cmd: Append the kernel command line args when booting on Packet
The iPXE needs the hard coded value of 'kernel-params' but
we should append the kernel command line from the YAML in case
it sets other parameters.
@@ -5,6 +5,7 @@ import (
"encoding/json"
"flag"
"fmt"
+ "io/ioutil"
"net"
"net/http"
"os"
@@ -89,12 +90,22 @@ func runPacket(args []string) {
osType := "custom_ipxe"
billing := "hourly"
+ // Read kernel command line
+ var cmdline string
+ if c, err := ioutil.ReadFile(prefix + "-cmdline"); err != nil {
+ log.Fatalf("Cannot open cmdline file: %v", err)
+ } else {
+ cmdline = string(c)
+ }
+
// Build the iPXE script
- // TODO(rn): Extract the kernel commandline from the file generated by moby build
+ // Note, we *append* the <prefix>-cmdline. iXPE booting will
+ // need the first set of "kernel-params" and we don't want to
+ // require these to be added to every YAML file.
userData := "#!ipxe\n\n"
userData += "dhcp\n"
userData += fmt.Sprintf("set base-url %s\n", url)
- userData += "set kernel-params ip=dhcp nomodeset ro serial console=ttyS1,115200\n"
+ userData += fmt.Sprintf("set kernel-params ip=dhcp nomodeset ro serial console=ttyS1,115200 %s\n", cmdline)
userData += fmt.Sprintf("kernel ${base-url}/%s-kernel ${kernel-params}\n", name)
userData += fmt.Sprintf("initrd ${base-url}/%s-initrd.img\n", name)
userData += "boot"
