feat(pxe-infra): stage iPXE EFI + boot.ipxe — completes the boot chain
Wires the missing piece between the L3 services and the L4 VM:
the firmware does DHCP+TFTP-fetch of an iPXE binary, then iPXE
fetches a static boot.ipxe script over HTTP, which sanboots the
alpine-worker raw image. Without this, the VM has a DHCP lease
but no filename to TFTP-fetch, so the chain stops at the
firmware.
- modules/options.nix: new options.pxe-infra.bootloader
- enable: master switch (default true)
- ipxeBinary: filename under tftpboot/ (default "ipxe.efi",
the universal UEFI binary from pkgs.ipxe; "snp.efi" is a
smaller virtio-net-only alternative)
- modules/pxe-infra/ipxe.nix: new file.
- environment.etc drops pkgs.ipxe's binary under
/etc/static/pxe-infra/tftpboot/<ipxeBinary>, plus a static
boot.ipxe script under /etc/static/pxe-infra/http/.
- The script uses iPXE's own ${boot-url} variable substitution
(escaped with Nix's ''${...}'' so it survives into the
output verbatim) to sanboot http://<bridge.address>/latest/
alpine-worker.raw, with a 5s retry on failure.
- modules/pxe-infra/dhcp.nix: when both pxe-infra.tftp.enable
and pxe-infra.bootloader.enable are on, dnsmasq settings now
include `dhcp-boot=<ipxeBinary>`. The MAC filter (tag:!known)
still drops requests from unknown MACs before they can use the
filename.
- modules/pxe-infra/default.nix: imports ipxe.nix and adds two
`L+` tmpfiles rules that symlink the iPXE binary and the
boot.ipxe script from /etc/static/pxe-infra/... into the
served TFTP/HTTP roots. `L+` (instead of plain `L`) means
systemd-tmpfiles will update the symlink target on every
boot, so pkgs.ipxe upgrades via nixos-rebuild take effect
without redeploying anything.
Refs: docs/ARCHITECTURE.md §L3, §L4.
This commit is contained in:
1 parent
5973aa74fd
commit
d7e46a4e89
4 files changed
+95
-1
No files matched your search
@@ -334,5 +334,33 @@
|
||||
'';
|
||||
};
|
||||
};
|
||||
|
||||
# iPXE bootloader staging. Bridges the UEFI firmware (which
|
||||
# speaks TFTP only) to the L3 HTTP server (which serves the
|
||||
# actual image). Without this, the L4 VM gets a DHCP lease
|
||||
# but has no filename to TFTP-fetch, so the chain stops there.
|
||||
bootloader = {
|
||||
enable = lib.mkOption {
|
||||
type = lib.types.bool;
|
||||
default = true;
|
||||
description = ''
|
||||
Whether to stage the iPXE EFI binary into the TFTP root
|
||||
and write the static boot.ipxe script into the HTTP
|
||||
root. Off disables the entire L4 boot chain.
|
||||
'';
|
||||
};
|
||||
ipxeBinary = lib.mkOption {
|
||||
type = lib.types.str;
|
||||
default = "ipxe.efi";
|
||||
description = ''
|
||||
Filename of the iPXE EFI binary under the TFTP root.
|
||||
The actual binary is taken from `pkgs.ipxe`; this only
|
||||
controls the served filename and the `filename` DHCP
|
||||
option handed to UEFI firmware. Defaults to the
|
||||
universal UEFI binary; `snp.efi` is a smaller variant
|
||||
that works on virtio-net only.
|
||||
'';
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
||||
Reference in new issue
Block a user