From 7c6be9e35b29828735c2b9ddbdc1b1dc6a323283 Mon Sep 17 00:00:00 2001 From: Devon Bautista Date: Mon, 25 Nov 2024 13:30:34 -0700 Subject: [PATCH 1/2] fix: correct iPXE client architecture to bootloader mapping OpenCHAMI uses https://github.com/OpenCHAMI/ipxe-binaries/ for iPXE binaries now. This commit sets the boot file paths to correspond with the names of these generated files based on the DHCP client architecture presented. Also, the undionly.kpxe file was being presented erroneously to EFI 32-bit x86 hosts, so this commit corrects that to from EFI_IA32 to INTEL_X86PC. --- internal/ipxe/ipxe.go | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/internal/ipxe/ipxe.go b/internal/ipxe/ipxe.go index d61b300..ffe731a 100644 --- a/internal/ipxe/ipxe.go +++ b/internal/ipxe/ipxe.go @@ -15,13 +15,25 @@ func ServeIPXEBootloader(l *logrus.Entry, req, resp *dhcpv4.DHCPv4) (*dhcpv4.DHC l.Debugf("client architecture of %s is %v (%q)", req.ClientHWAddr, carchBytes, string(carchBytes)) carch = iana.Arch(binary.BigEndian.Uint16(carchBytes)) switch carch { - case iana.EFI_IA32: + case iana.INTEL_X86PC: // iPXE legacy 32-bit x86 bootloader resp.Options.Update(dhcpv4.OptBootFileName("undionly.kpxe")) return resp, true + case iana.EFI_IA32: + // iPXE EFI 32-bit bootloader + resp.Options.Update(dhcpv4.OptBootFileName("ipxe-i386.efi")) + return resp, true case iana.EFI_X86_64: // iPXE 64-bit x86 bootloader - resp.Options.Update(dhcpv4.OptBootFileName("ipxe.efi")) + resp.Options.Update(dhcpv4.OptBootFileName("ipxe-x86_64.efi")) + return resp, true + case iana.EFI_ARM32: + // iPXE EFI 32-bit ARM bootloader + resp.Options.Update(dhcpv4.OptBootFileName("ipxe-arm32.efi")) + return resp, true + case iana.EFI_ARM64: + // iPXE EFI 64-bit ARM bootloader + resp.Options.Update(dhcpv4.OptBootFileName("ipxe-arm64.efi")) return resp, true default: l.Errorf("no iPXE bootloader available for unknown architecture: %d (%s)", carch, carch.String()) From a9760e5734fc3fade200009f3bed1528900879a0 Mon Sep 17 00:00:00 2001 From: Devon Bautista Date: Mon, 25 Nov 2024 14:42:39 -0700 Subject: [PATCH 2/2] fix: set DHCP option 17 (root path) to satisfy iPXE init script --- coresmd/main.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/coresmd/main.go b/coresmd/main.go index 4431e72..32a3b97 100644 --- a/coresmd/main.go +++ b/coresmd/main.go @@ -134,6 +134,9 @@ func Handler4(req, resp *dhcpv4.DHCPv4) (*dhcpv4.DHCPv4, bool) { resp.Options.Update(dhcpv4.OptHostName(fmt.Sprintf("nid%03d", ifaceInfo.CompNID))) } + // Set root path to this server's IP + resp.Options.Update(dhcpv4.OptRootPath(resp.ServerIPAddr.String())) + // STEP 2: Send boot config if cinfo := req.Options.Get(dhcpv4.OptionUserClassInformation); string(cinfo) != "iPXE" { // BOOT STAGE 1: Send iPXE bootloader over TFTP