add bios too

This commit is contained in:
2026-01-27 21:50:16 +00:00
parent fb287d812a
commit 096817182a
2 changed files with 40 additions and 7 deletions

View File

@@ -32,8 +32,9 @@ Borg
netboot
-------
efi:
qemu-system-x86_64 \
-nographic \
-enable-kvm \
-cpu host \
-m 1024 \
@@ -41,3 +42,13 @@ qemu-system-x86_64 \
-device e1000,netdev=net0 \
-boot order=n \
-bios $(nix build .#nixosConfigurations.mtworx.pkgs.OVMF.fd --no-link --print-out-paths)/FV/OVMF.fd
bios:
qemu-system-x86_64 \
-enable-kvm \
-cpu host \
-m 8192 \
-netdev tap,id=net0,ifname=tap0,script=no,downscript=no \
-device e1000,netdev=net0 \
-boot order=n

View File

@@ -28,24 +28,30 @@ let
boot
:netbootxyz
chain http://10.14.143.1/boot/netboot.xyz.efi
isset ''${platform} && iseq ''${platform} pcbios && chain --autofree https://boot.netboot.xyz/ipxe/netboot.xyz.kpxe ||
chain --autofree https://boot.netboot.xyz/ipxe/netboot.xyz.efi
:shell
shell
'';
# Custom iPXE with embedded menu
customIpxe = pkgs.ipxe.override {
# Custom iPXE with embedded menu (UEFI)
customIpxeEfi = pkgs.ipxe.override {
embedScript = ipxeMenu;
};
# Custom iPXE with embedded menu (BIOS)
customIpxeBios = pkgs.ipxe.override {
embedScript = ipxeMenu;
};
# TFTP root directory with all boot files
tftp-root = pkgs.runCommand "tftp-root" { } ''
mkdir -p $out/mrescue
cp ${customIpxe}/ipxe.efi $out/boot.efi
cp ${customIpxeEfi}/ipxe.efi $out/boot.efi
cp ${customIpxeBios}/undionly.kpxe $out/boot.kpxe
cp ${pkgs.mrescue}/kernel $out/mrescue/kernel
cp ${pkgs.mrescue}/initrd $out/mrescue/initrd
cp ${pkgs.netbootxyz-efi} $out/netboot.xyz.efi
'';
in
{
@@ -262,7 +268,23 @@ in
dhcp-option = "66,\"0.0.0.0\"";
enable-tftp = true;
tftp-root = "${tftp-root}";
dhcp-boot = "boot.efi";
# Detect client architecture and serve appropriate bootloader
# DHCP option 93 = Client System Architecture Type
dhcp-match = [
"set:efi-x86_64,option:client-arch,7" # EFI BC (x86-64)
"set:efi-x86_64,option:client-arch,9" # EFI x86-64
"set:efi-x86,option:client-arch,6" # EFI IA32
"set:bios,option:client-arch,0" # BIOS x86
];
# Serve appropriate boot file based on architecture
dhcp-boot = [
"tag:efi-x86_64,boot.efi" # UEFI x86-64 clients
"tag:efi-x86,boot.efi" # UEFI IA32 clients
"tag:bios,boot.kpxe" # BIOS clients
"boot.efi" # Default to UEFI if undetected
];
};
};
};