Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions pixiecore/boot.ipxe
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 2 additions & 0 deletions pixiecore/http.go
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,7 @@ func ipxeScript(mach Machine, spec *Spec, serverHost string) ([]byte, error) {
urlTemplate := fmt.Sprintf("http://%s/_/file?name=%%s&type=%%s&mac=%%s", serverHost)
var b bytes.Buffer
b.WriteString("#!ipxe\n")
b.WriteString("isset ${console} || set console ttyS1\n")
u := fmt.Sprintf(urlTemplate, url.QueryEscape(string(spec.Kernel)), "kernel", url.QueryEscape(mach.MAC.String()))
fmt.Fprintf(&b, "kernel --name kernel %s\n", u)
for i, initrd := range spec.Initrd {
Expand All @@ -218,6 +219,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 ")
Copy link
Contributor Author

@majst01 majst01 Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should only add this console line if ${console} is not empty string.

But i don't now how this is possible with ipxe scripting

Copy link
Contributor Author

@majst01 majst01 Jan 20, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eventually with:

b.WriteString("isset ${console} && console=${console},115200n8 ||")

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We set the console parameter in the boot.ipxe script by default to ttyS1. The variable should be passed down, where we construct the ipxe script. So I assume it should not be an empty string.

However, we could add something like this upfront:

...
b.WriteString("isset ${console} || set console ttyS1")
b.WriteString("console=${console},115200n8 ")
...

b.WriteString(cmdline)
b.WriteByte('\n')

Expand Down
6 changes: 4 additions & 2 deletions pixiecore/http_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,13 @@ func TestIpxe(t *testing.T) {
}

expected := `#!ipxe
isset ${console} || set console ttyS1
kernel --name kernel http://localhost:1234/_/file?name=k-01%3A02%3A03%3A04%3A05%3A06-0&type=kernel&mac=01%3A02%3A03%3A04%3A05%3A06
initrd --name initrd0 http://localhost:1234/_/file?name=i1-01%3A02%3A03%3A04%3A05%3A06-0&type=initrd&mac=01%3A02%3A03%3A04%3A05%3A06
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())
Expand All @@ -91,12 +92,13 @@ boot kernel initrd=initrd0 initrd=initrd1 thing=http://localhost:1234/_/file?nam
}

expected = `#!ipxe
isset ${console} || set console ttyS1
kernel --name kernel http://localhost:1234/_/file?name=k-fe%3Afe%3Afe%3Afe%3Afe%3Afe-1&type=kernel&mac=fe%3Afe%3Afe%3Afe%3Afe%3Afe
initrd --name initrd0 http://localhost:1234/_/file?name=i1-fe%3Afe%3Afe%3Afe%3Afe%3Afe-1&type=initrd&mac=fe%3Afe%3Afe%3Afe%3Afe%3Afe
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())
Expand Down