diff --git a/pixiecore/boot.ipxe b/pixiecore/boot.ipxe index 4b1efca..ac33df2 100644 --- a/pixiecore/boot.ipxe +++ b/pixiecore/boot.ipxe @@ -21,6 +21,16 @@ set user-class pixiecore echo metal-stack pixie +echo Manufacturer: ${manufacturer} + +# Detect serial console based on manufacturer. +# Implicitly ttyS1 is used as console for Supermicro. + +set console ttyS1 +set sp:hex 20 && set sp ${sp:string} +iseq ${manufacturer} Dell${sp}Inc. && set console ttyS0 || +iseq ${manufacturer} Giga${sp}Computing && set console ttyS0 || + # Try to get a filename from ProxyDHCP, retrying a couple of times if # we fail. :loop diff --git a/pixiecore/http.go b/pixiecore/http.go index f809fc2..47ab8bc 100644 --- a/pixiecore/http.go +++ b/pixiecore/http.go @@ -218,6 +218,7 @@ func ipxeScript(mach Machine, spec *Spec, serverHost string) ([]byte, error) { if err != nil { return nil, fmt.Errorf("expanding cmdline %q: %w", spec.Cmdline, err) } + b.WriteString("console=${console},115200n8 ") b.WriteString(cmdline) b.WriteByte('\n') diff --git a/pixiecore/http_test.go b/pixiecore/http_test.go index bb23788..e8bbfb1 100644 --- a/pixiecore/http_test.go +++ b/pixiecore/http_test.go @@ -71,7 +71,7 @@ initrd --name initrd0 http://localhost:1234/_/file?name=i1-01%3A02%3A03%3A04%3A0 initrd --name initrd1 http://localhost:1234/_/file?name=i2-01%3A02%3A03%3A04%3A05%3A06-0&type=initrd&mac=01%3A02%3A03%3A04%3A05%3A06 imgfetch --name ready http://localhost:1234/_/booting?mac=01%3A02%3A03%3A04%3A05%3A06 || imgfree ready || -boot kernel initrd=initrd0 initrd=initrd1 thing=http://localhost:1234/_/file?name=f-01%3A02%3A03%3A04%3A05%3A06-0 foo=bar +boot kernel initrd=initrd0 initrd=initrd1 console=${console},115200n8 thing=http://localhost:1234/_/file?name=f-01%3A02%3A03%3A04%3A05%3A06-0 foo=bar ` if rr.Body.String() != expected { t.Fatalf("Wrong iPXE script\nwant: %s\ngot: %s", expected, rr.Body.String()) @@ -96,7 +96,7 @@ initrd --name initrd0 http://localhost:1234/_/file?name=i1-fe%3Afe%3Afe%3Afe%3Af initrd --name initrd1 http://localhost:1234/_/file?name=i2-fe%3Afe%3Afe%3Afe%3Afe%3Afe-1&type=initrd&mac=fe%3Afe%3Afe%3Afe%3Afe%3Afe imgfetch --name ready http://localhost:1234/_/booting?mac=fe%3Afe%3Afe%3Afe%3Afe%3Afe || imgfree ready || -boot kernel initrd=initrd0 initrd=initrd1 thing=http://localhost:1234/_/file?name=f-fe%3Afe%3Afe%3Afe%3Afe%3Afe-1 foo=bar +boot kernel initrd=initrd0 initrd=initrd1 console=${console},115200n8 thing=http://localhost:1234/_/file?name=f-fe%3Afe%3Afe%3Afe%3Afe%3Afe-1 foo=bar ` if rr.Body.String() != expected { t.Fatalf("Wrong iPXE script\nwant: %s\ngot: %s", expected, rr.Body.String())