Skip to content

Commit

Permalink
Merge pull request #32031 from NixOS/unstable-aarch64
Browse files Browse the repository at this point in the history
Aarch64 Netboot
  • Loading branch information
grahamc committed Dec 12, 2017
2 parents 04d3d19 + 08b8bc2 commit 3cad1ab
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 24 deletions.
19 changes: 12 additions & 7 deletions nixos/modules/installer/netboot/netboot.nix
Expand Up @@ -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";
Expand Down Expand Up @@ -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;

Expand Down
49 changes: 32 additions & 17 deletions 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;
Expand Down Expand Up @@ -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 {

Expand All @@ -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;
Expand Down

0 comments on commit 3cad1ab

Please sign in to comment.