From 08b8bc24cb818d78971f6cb941b7991e54c6971b Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Fri, 14 Apr 2017 17:59:54 -0400 Subject: [PATCH] Netboot: Add aarch64 --- nixos/modules/installer/netboot/netboot.nix | 19 +++++--- nixos/release.nix | 49 ++++++++++++++------- 2 files changed, 44 insertions(+), 24 deletions(-) diff --git a/nixos/modules/installer/netboot/netboot.nix b/nixos/modules/installer/netboot/netboot.nix index 0f6046339b37..52239b619126 100644 --- a/nixos/modules/installer/netboot/netboot.nix +++ b/nixos/modules/installer/netboot/netboot.nix @@ -18,17 +18,17 @@ with lib; }; - config = { - - boot.loader.grub.version = 2; - + config = rec { # Don't build the GRUB menu builder script, since we don't need it # here and it causes a cyclic dependency. boot.loader.grub.enable = false; # !!! Hack - attributes expected by other modules. - system.boot.loader.kernelFile = "bzImage"; - environment.systemPackages = [ pkgs.grub2 pkgs.grub2_efi pkgs.syslinux ]; + environment.systemPackages = [ pkgs.grub2_efi ] + ++ (if pkgs.stdenv.system == "aarch64-linux" + then [] + else [ pkgs.grub2 pkgs.syslinux ]); + system.boot.loader.kernelFile = pkgs.stdenv.platform.kernelTarget; fileSystems."/" = { fsType = "tmpfs"; @@ -84,7 +84,12 @@ with lib; ]; }; - system.build.netbootIpxeScript = pkgs.writeTextDir "netboot.ipxe" "#!ipxe\nkernel bzImage init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams}\ninitrd initrd\nboot"; + system.build.netbootIpxeScript = pkgs.writeTextDir "netboot.ipxe" '' + #!ipxe + kernel ${pkgs.stdenv.platform.kernelTarget} init=${config.system.build.toplevel}/init ${toString config.boot.kernelParams} + initrd initrd + boot + ''; boot.loader.timeout = 10; diff --git a/nixos/release.nix b/nixos/release.nix index 84e39cd91dc4..426a5eef34ae 100644 --- a/nixos/release.nix +++ b/nixos/release.nix @@ -1,6 +1,6 @@ { nixpkgs ? { outPath = ./..; revCount = 56789; shortRev = "gfedcba"; } , stableBranch ? false -, supportedSystems ? [ "x86_64-linux" ] +, supportedSystems ? [ "x86_64-linux" "aarch64-linux" ] }: with import ../lib; @@ -89,6 +89,27 @@ let }); }).config)); + makeNetboot = config: + let + config_evaled = import lib/eval-config.nix config; + build = config_evaled.config.system.build; + kernelTarget = config_evaled.pkgs.stdenv.platform.kernelTarget; + in + pkgs.symlinkJoin { + name="netboot"; + paths=[ + build.netbootRamdisk + build.kernel + build.netbootIpxeScript + ]; + postBuild = '' + mkdir -p $out/nix-support + echo "file ${kernelTarget} $out/${kernelTarget}" >> $out/nix-support/hydra-build-products + echo "file initrd $out/initrd" >> $out/nix-support/hydra-build-products + echo "file ipxe $out/netboot.ipxe" >> $out/nix-support/hydra-build-products + ''; + }; + in rec { @@ -103,28 +124,22 @@ in rec { # Build the initial ramdisk so Hydra can keep track of its size over time. initialRamdisk = buildFromConfig ({ pkgs, ... }: { }) (config: config.system.build.initialRamdisk); - netboot.x86_64-linux = let build = (import lib/eval-config.nix { + netboot = { + x86_64-linux = makeNetboot { system = "x86_64-linux"; modules = [ ./modules/installer/netboot/netboot-minimal.nix versionModule ]; - }).config.system.build; - in - pkgs.symlinkJoin { - name="netboot"; - paths=[ - build.netbootRamdisk - build.kernel - build.netbootIpxeScript - ]; - postBuild = '' - mkdir -p $out/nix-support - echo "file bzImage $out/bzImage" >> $out/nix-support/hydra-build-products - echo "file initrd $out/initrd" >> $out/nix-support/hydra-build-products - echo "file ipxe $out/netboot.ipxe" >> $out/nix-support/hydra-build-products - ''; }; + } // (optionalAttrs (elem "aarch64-linux" supportedSystems) { + aarch64-linux = makeNetboot { + system = "aarch64-linux"; + modules = [ + ./modules/installer/netboot/netboot-minimal.nix + versionModule + ]; + };}); iso_minimal = forAllSystems (system: makeIso { module = ./modules/installer/cd-dvd/installation-cd-minimal.nix;