Only boot with ipxe.pxe if we're chainloading from another iPXE. #63

undionly.kpxe doesn't work if you chainload from a native iPXE, but it's
required for physical machines with NICs that iPXE doesn't natively
support.

In my previous attempt to handle Virtualbox's crippled iPXE, I switched
all BIOS-based boots to use ipxe.pxe. This was a bad idea, so now instead
we specifically recognize third-party iPXE builds, and only chainload
*those* with ipxe.pxe, and stick with undionly.kpxe for the rest.
This commit is contained in:
David Anderson 2018-02-04 14:37:49 -08:00
parent a44cef6d7b
commit b7411f3ed3
5 changed files with 20 additions and 8 deletions

View File

@ -21,9 +21,10 @@ import (
)
func main() {
cli.Ipxe[pixiecore.FirmwareX86PC] = ipxe.MustAsset("ipxe.pxe")
cli.Ipxe[pixiecore.FirmwareX86PC] = ipxe.MustAsset("undionly.kpxe")
cli.Ipxe[pixiecore.FirmwareEFI32] = ipxe.MustAsset("ipxe-i386.efi")
cli.Ipxe[pixiecore.FirmwareEFI64] = ipxe.MustAsset("ipxe-x86_64.efi")
cli.Ipxe[pixiecore.FirmwareEFIBC] = ipxe.MustAsset("ipxe-x86_64.efi")
cli.Ipxe[pixiecore.FirmwareX86Ipxe] = ipxe.MustAsset("ipxe.pxe")
cli.CLI()
}

View File

@ -168,6 +168,11 @@ func (s *Server) offerDHCP(pkt *dhcp4.Packet, mach Machine, serverIP net.IP, cli
resp.BootServerName = serverIP.String()
resp.BootFilename = fmt.Sprintf("%s/%d", mach.MAC, fwtype)
case clientSoftwareIPXE:
// TODO: this selection logic is getting increasingly messy,
// it needs a refactor.
if fwtype == FirmwareX86PC {
fwtype = FirmwareX86Ipxe
}
resp.BootFilename = fmt.Sprintf("tftp://%s/%s/%d", serverIP, mach.MAC, fwtype)
case clientSoftwarePixiecoreIPXE:
resp.BootFilename = fmt.Sprintf("http://%s:%d/_/ipxe?arch=%d&mac=%s", serverIP, s.HTTPPort, mach.Arch, mach.MAC)

View File

@ -148,6 +148,10 @@ const (
FirmwareEFI32 = 6 // 32-bit x86 processor running EFI
FirmwareEFI64 = 7 // 64-bit x86 processor running EFI
FirmwareEFIBC = 9 // 64-bit x86 processor running EFI
// This is a "fictional" firmware, representing an x86 BIOS
// running iPXE, which does not have UNDI available.
FirmwareX86Ipxe = 42
)
var fwToArch = map[Firmware]Architecture{
@ -155,6 +159,8 @@ var fwToArch = map[Firmware]Architecture{
FirmwareEFI32: ArchIA32,
FirmwareEFI64: ArchX64,
FirmwareEFIBC: ArchX64,
FirmwareX86Ipxe: ArchIA32,
}
// A Server boots machines using a Booter.

View File

@ -5,11 +5,11 @@ ipxe:
git clone git://git.ipxe.org/ipxe.git
(cd ipxe && git rev-parse HEAD >COMMIT-ID)
rm -rf ipxe/.git
(cd ipxe/src && make bin/ipxe.pxe EMBED=../../../pixiecore/boot.ipxe)
(cd ipxe/src && make bin-x86_64-efi/ipxe.efi EMBED=../../../pixiecore/boot.ipxe)
(cd ipxe/src && make bin-i386-efi/ipxe.efi EMBED=../../../pixiecore/boot.ipxe)
(cd ipxe/src &&\
make bin/ipxe.pxe bin/undionly.kpxe bin-x86_64-efi/ipxe.efi bin-i386-efi/ipxe.efi EMBED=../../../pixiecore/boot.ipxe)
(cd ipxe && rm -rf bin && mkdir bin)
mv -f ipxe/src/bin/ipxe.pxe ipxe/bin/ipxe.pxe
mv -f ipxe/src/bin/undionly.kpxe ipxe/bin/undionly.kpxe
mv -f ipxe/src/bin-x86_64-efi/ipxe.efi ipxe/bin/ipxe-x86_64.efi
mv -f ipxe/src/bin-i386-efi/ipxe.efi ipxe/bin/ipxe-i386.efi
go-bindata -o ipxe/ipxe-bin.go -pkg ipxe -nometadata -nomemcopy -prefix ipxe/bin/ ipxe/bin

File diff suppressed because one or more lines are too long