Merge pull request #124415 from misuzu/aarch64-boot-test

nixos/boot: test on aarch64

authored by Guillaume Girol and committed by GitHub 5a4320c4 86bb1290

+48 -21
+6 -1
nixos/lib/test-driver/test-driver.py
··· 292 292 net_frontend += "," + args["netFrontendArgs"] 293 293 294 294 start_command = ( 295 - "qemu-kvm -m 384 " + net_backend + " " + net_frontend + " $QEMU_OPTS " 295 + args.get("qemuBinary", "qemu-kvm") 296 + + " -m 384 " 297 + + net_backend 298 + + " " 299 + + net_frontend 300 + + " $QEMU_OPTS " 296 301 ) 297 302 298 303 if "hda" in args:
+1 -1
nixos/tests/all-tests.nix
··· 43 43 bitcoind = handleTest ./bitcoind.nix {}; 44 44 bittorrent = handleTest ./bittorrent.nix {}; 45 45 blockbook-frontend = handleTest ./blockbook-frontend.nix {}; 46 - boot = handleTestOn ["x86_64-linux"] ./boot.nix {}; # syslinux is unsupported on aarch64 46 + boot = handleTestOn ["x86_64-linux" "aarch64-linux"] ./boot.nix {}; 47 47 boot-stage1 = handleTest ./boot-stage1.nix {}; 48 48 borgbackup = handleTest ./borgbackup.nix {}; 49 49 botamusique = handleTest ./botamusique.nix {};
+22 -14
nixos/tests/boot.nix
··· 4 4 }: 5 5 6 6 with import ../lib/testing-python.nix { inherit system pkgs; }; 7 + with import ../lib/qemu-flags.nix { inherit pkgs; }; 7 8 with pkgs.lib; 8 9 9 10 let ··· 21 22 22 23 makeBootTest = name: extraConfig: 23 24 let 24 - machineConfig = pythonDict ({ qemuFlags = "-m 768"; } // extraConfig); 25 + machineConfig = pythonDict ({ 26 + qemuBinary = qemuBinary pkgs.qemu_test; 27 + qemuFlags = "-m 768"; 28 + } // extraConfig); 25 29 in 26 30 makeTest { 27 31 inherit iso; ··· 61 65 ]; 62 66 }; 63 67 machineConfig = pythonDict ({ 68 + qemuBinary = qemuBinary pkgs.qemu_test; 64 69 qemuFlags = "-boot order=n -m 2000"; 65 70 netBackendArgs = "tftp=${ipxeBootDir},bootfile=netboot.ipxe"; 66 71 } // extraConfig); ··· 75 80 machine.shutdown() 76 81 ''; 77 82 }; 83 + uefiBinary = { 84 + x86_64-linux = "${pkgs.OVMF.fd}/FV/OVMF.fd"; 85 + aarch64-linux = "${pkgs.OVMF.fd}/FV/QEMU_EFI.fd"; 86 + }.${pkgs.stdenv.hostPlatform.system}; 78 87 in { 79 - 80 - biosCdrom = makeBootTest "bios-cdrom" { 88 + uefiCdrom = makeBootTest "uefi-cdrom" { 81 89 cdrom = "${iso}/iso/${iso.isoName}"; 90 + bios = uefiBinary; 82 91 }; 83 92 84 - biosUsb = makeBootTest "bios-usb" { 93 + uefiUsb = makeBootTest "uefi-usb" { 85 94 usb = "${iso}/iso/${iso.isoName}"; 95 + bios = uefiBinary; 86 96 }; 87 97 88 - uefiCdrom = makeBootTest "uefi-cdrom" { 98 + uefiNetboot = makeNetbootTest "uefi" { 99 + bios = uefiBinary; 100 + # Custom ROM is needed for EFI PXE boot. I failed to understand exactly why, because QEMU should still use iPXE for EFI. 101 + netFrontendArgs = "romfile=${pkgs.ipxe}/ipxe.efirom"; 102 + }; 103 + } // optionalAttrs (pkgs.stdenv.hostPlatform.system == "x86_64-linux") { 104 + biosCdrom = makeBootTest "bios-cdrom" { 89 105 cdrom = "${iso}/iso/${iso.isoName}"; 90 - bios = "${pkgs.OVMF.fd}/FV/OVMF.fd"; 91 106 }; 92 107 93 - uefiUsb = makeBootTest "uefi-usb" { 108 + biosUsb = makeBootTest "bios-usb" { 94 109 usb = "${iso}/iso/${iso.isoName}"; 95 - bios = "${pkgs.OVMF.fd}/FV/OVMF.fd"; 96 110 }; 97 111 98 112 biosNetboot = makeNetbootTest "bios" {}; 99 - 100 - uefiNetboot = makeNetbootTest "uefi" { 101 - bios = "${pkgs.OVMF.fd}/FV/OVMF.fd"; 102 - # Custom ROM is needed for EFI PXE boot. I failed to understand exactly why, because QEMU should still use iPXE for EFI. 103 - netFrontendArgs = "romfile=${pkgs.ipxe}/ipxe.efirom"; 104 - }; 105 113 }
+19 -5
pkgs/tools/misc/ipxe/default.nix
··· 1 - { stdenv, lib, fetchFromGitHub, perl, cdrkit, syslinux, xz, openssl, gnu-efi, mtools 1 + { stdenv, lib, fetchFromGitHub, perl, cdrkit, xz, openssl, gnu-efi, mtools 2 + , syslinux ? null 2 3 , embedScript ? null 3 4 , additionalTargets ? {} 4 5 }: ··· 8 9 "bin-x86_64-efi/ipxe.efi" = null; 9 10 "bin-x86_64-efi/ipxe.efirom" = null; 10 11 "bin-x86_64-efi/ipxe.usb" = "ipxe-efi.usb"; 11 - } // { 12 + } // lib.optionalAttrs (stdenv.isi686 || stdenv.isx86_64) { 12 13 "bin/ipxe.dsk" = null; 13 14 "bin/ipxe.usb" = null; 14 15 "bin/ipxe.iso" = null; 15 16 "bin/ipxe.lkrn" = null; 16 17 "bin/undionly.kpxe" = null; 18 + } // lib.optionalAttrs stdenv.isAarch32 { 19 + "bin-arm32-efi/ipxe.efi" = null; 20 + "bin-arm32-efi/ipxe.efirom" = null; 21 + "bin-arm32-efi/ipxe.usb" = "ipxe-efi.usb"; 22 + } // lib.optionalAttrs stdenv.isAarch64 { 23 + "bin-arm64-efi/ipxe.efi" = null; 24 + "bin-arm64-efi/ipxe.efirom" = null; 25 + "bin-arm64-efi/ipxe.usb" = "ipxe-efi.usb"; 17 26 }; 18 27 in 19 28 ··· 21 30 pname = "ipxe"; 22 31 version = "1.21.1"; 23 32 24 - nativeBuildInputs = [ perl cdrkit syslinux xz openssl gnu-efi mtools ]; 33 + nativeBuildInputs = [ perl cdrkit xz openssl gnu-efi mtools ] ++ lib.optional (stdenv.isi686 || stdenv.isx86_64) syslinux; 25 34 26 35 src = fetchFromGitHub { 27 36 owner = "ipxe"; ··· 37 46 38 47 makeFlags = 39 48 [ "ECHO_E_BIN_ECHO=echo" "ECHO_E_BIN_ECHO_E=echo" # No /bin/echo here. 49 + ] ++ lib.optionals (stdenv.isi686 || stdenv.isx86_64) [ 40 50 "ISOLINUX_BIN_LIST=${syslinux}/share/syslinux/isolinux.bin" 41 51 "LDLINUX_C32=${syslinux}/share/syslinux/ldlinux.c32" 42 52 ] ++ lib.optional (embedScript != null) "EMBED=${embedScript}"; ··· 62 72 buildFlags = lib.attrNames targets; 63 73 64 74 installPhase = '' 75 + runHook preInstall 76 + 65 77 mkdir -p $out 66 78 ${lib.concatStringsSep "\n" (lib.mapAttrsToList (from: to: 67 79 if to == null ··· 71 83 # Some PXE constellations especially with dnsmasq are looking for the file with .0 ending 72 84 # let's provide it as a symlink to be compatible in this case. 73 85 ln -s undionly.kpxe $out/undionly.kpxe.0 86 + 87 + runHook postInstall 74 88 ''; 75 89 76 90 enableParallelBuilding = true; ··· 78 92 meta = with lib; 79 93 { description = "Network boot firmware"; 80 94 homepage = "https://ipxe.org/"; 81 - license = licenses.gpl2; 95 + license = licenses.gpl2Only; 82 96 maintainers = with maintainers; [ ehmry ]; 83 - platforms = [ "x86_64-linux" "i686-linux" ]; 97 + platforms = platforms.linux; 84 98 }; 85 99 }