Skip to content

Commit bbcc0d0

Browse files
committed
Put manufacturer distinction into ipxe script
1 parent 97e2d6f commit bbcc0d0

File tree

3 files changed

+8
-13
lines changed

3 files changed

+8
-13
lines changed

pixiecore/boot.ipxe

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,14 @@ echo metal-stack pixie
2323

2424
echo Manufacturer: ${manufacturer}
2525

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+
2634
# Try to get a filename from ProxyDHCP, retrying a couple of times if
2735
# we fail.
2836
:loop

pixiecore/http.go

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -196,10 +196,6 @@ 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("set console ttyS1\n")
200-
b.WriteString("set sp:hex 20 && set sp ${sp:string}\n")
201-
b.WriteString("iseq ${manufacturer} Dell${sp}Inc. && set console ttyS0 ||\n")
202-
b.WriteString("iseq ${manufacturer} Giga${sp}Computing && set console ttyS0 ||\n")
203199
u := fmt.Sprintf(urlTemplate, url.QueryEscape(string(spec.Kernel)), "kernel", url.QueryEscape(mach.MAC.String()))
204200
fmt.Fprintf(&b, "kernel --name kernel %s\n", u)
205201
for i, initrd := range spec.Initrd {
@@ -218,7 +214,6 @@ func ipxeScript(mach Machine, spec *Spec, serverHost string) ([]byte, error) {
218214
f := func(id string) string {
219215
return fmt.Sprintf("http://%s/_/file?name=%s", serverHost, url.QueryEscape(id))
220216
}
221-
222217
cmdline, err := expandCmdline(spec.Cmdline, template.FuncMap{"ID": f})
223218
if err != nil {
224219
return nil, fmt.Errorf("expanding cmdline %q: %w", spec.Cmdline, err)

pixiecore/http_test.go

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -66,10 +66,6 @@ func TestIpxe(t *testing.T) {
6666
}
6767

6868
expected := `#!ipxe
69-
set console ttyS1
70-
set sp:hex 20 && set sp ${sp:string}
71-
iseq ${manufacturer} Dell${sp}Inc. && set console ttyS0 ||
72-
iseq ${manufacturer} Giga${sp}Computing && set console ttyS0 ||
7369
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
7470
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
7571
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
@@ -95,10 +91,6 @@ boot kernel initrd=initrd0 initrd=initrd1 console=${console},115200n8 thing=http
9591
}
9692

9793
expected = `#!ipxe
98-
set console ttyS1
99-
set sp:hex 20 && set sp ${sp:string}
100-
iseq ${manufacturer} Dell${sp}Inc. && set console ttyS0 ||
101-
iseq ${manufacturer} Giga${sp}Computing && set console ttyS0 ||
10294
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
10395
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
10496
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

0 commit comments

Comments
 (0)