Skip to content

Commit b3cc139

Browse files
authored
Merge branch 'main' into oci-puller
2 parents 27a64e8 + 4e2f3b1 commit b3cc139

File tree

3 files changed

+16
-2
lines changed

3 files changed

+16
-2
lines changed

pixiecore/boot.ipxe

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,16 @@ set user-class pixiecore
2121

2222
echo metal-stack pixie
2323

24+
echo Manufacturer: ${manufacturer}
25+
26+
# Detect serial console based on manufacturer.
27+
# Implicitly ttyS1 is used as console for Supermicro.
28+
29+
set console ttyS1
30+
set sp:hex 20 && set sp ${sp:string}
31+
iseq ${manufacturer} Dell${sp}Inc. && set console ttyS0 ||
32+
iseq ${manufacturer} Giga${sp}Computing && set console ttyS0 ||
33+
2434
# Try to get a filename from ProxyDHCP, retrying a couple of times if
2535
# we fail.
2636
:loop

pixiecore/http.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,7 @@ func ipxeScript(mach Machine, spec *Spec, serverHost string) ([]byte, error) {
196196
urlTemplate := fmt.Sprintf("http://%s/_/file?name=%%s&type=%%s&mac=%%s", serverHost)
197197
var b bytes.Buffer
198198
b.WriteString("#!ipxe\n")
199+
b.WriteString("isset ${console} || set console ttyS1\n")
199200
u := fmt.Sprintf(urlTemplate, url.QueryEscape(string(spec.Kernel)), "kernel", url.QueryEscape(mach.MAC.String()))
200201
fmt.Fprintf(&b, "kernel --name kernel %s\n", u)
201202
for i, initrd := range spec.Initrd {
@@ -218,6 +219,7 @@ func ipxeScript(mach Machine, spec *Spec, serverHost string) ([]byte, error) {
218219
if err != nil {
219220
return nil, fmt.Errorf("expanding cmdline %q: %w", spec.Cmdline, err)
220221
}
222+
b.WriteString("console=${console},115200n8 ")
221223
b.WriteString(cmdline)
222224
b.WriteByte('\n')
223225

pixiecore/http_test.go

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,12 +66,13 @@ func TestIpxe(t *testing.T) {
6666
}
6767

6868
expected := `#!ipxe
69+
isset ${console} || set console ttyS1
6970
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
7071
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
7172
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
7273
imgfetch --name ready http://localhost:1234/_/booting?mac=01%3A02%3A03%3A04%3A05%3A06 ||
7374
imgfree ready ||
74-
boot kernel initrd=initrd0 initrd=initrd1 thing=http://localhost:1234/_/file?name=f-01%3A02%3A03%3A04%3A05%3A06-0 foo=bar
75+
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
7576
`
7677
if rr.Body.String() != expected {
7778
t.Fatalf("Wrong iPXE script\nwant: %s\ngot: %s", expected, rr.Body.String())
@@ -91,12 +92,13 @@ boot kernel initrd=initrd0 initrd=initrd1 thing=http://localhost:1234/_/file?nam
9192
}
9293

9394
expected = `#!ipxe
95+
isset ${console} || set console ttyS1
9496
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
9597
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
9698
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
9799
imgfetch --name ready http://localhost:1234/_/booting?mac=fe%3Afe%3Afe%3Afe%3Afe%3Afe ||
98100
imgfree ready ||
99-
boot kernel initrd=initrd0 initrd=initrd1 thing=http://localhost:1234/_/file?name=f-fe%3Afe%3Afe%3Afe%3Afe%3Afe-1 foo=bar
101+
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
100102
`
101103
if rr.Body.String() != expected {
102104
t.Fatalf("Wrong iPXE script\nwant: %s\ngot: %s", expected, rr.Body.String())

0 commit comments

Comments
 (0)