summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorJanne Heß <janne@hess.ooo>2022-04-16 22:02:26 +0200
committerGitHub <noreply@github.com>2022-04-16 22:02:26 +0200
commit031b95e587f75da4796c95e8ee232383310389c5 (patch)
tree8c9f2208fe3357bbcb2660e66676636d48ea87dc /pkgs/build-support
parentbb5678ef5f62a75ef60fc1031c9cde1e3e9f0028 (diff)
parentb9bf28fd70ae179f703b6bd99f7b0620473b183f (diff)
downloadnixpkgs-031b95e587f75da4796c95e8ee232383310389c5.tar
nixpkgs-031b95e587f75da4796c95e8ee232383310389c5.tar.gz
nixpkgs-031b95e587f75da4796c95e8ee232383310389c5.tar.bz2
nixpkgs-031b95e587f75da4796c95e8ee232383310389c5.tar.lz
nixpkgs-031b95e587f75da4796c95e8ee232383310389c5.tar.xz
nixpkgs-031b95e587f75da4796c95e8ee232383310389c5.tar.zst
nixpkgs-031b95e587f75da4796c95e8ee232383310389c5.zip
Merge pull request #168814 from helsinki-systems/feat/systemd-stage-1-pass-vars
nixos/systemd-stage-1: Pass more vars to the builder
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/kernel/make-initrd-ng.nix16
1 files changed, 15 insertions, 1 deletions
diff --git a/pkgs/build-support/kernel/make-initrd-ng.nix b/pkgs/build-support/kernel/make-initrd-ng.nix
index 9fd202c4484..1890bbcd173 100644
--- a/pkgs/build-support/kernel/make-initrd-ng.nix
+++ b/pkgs/build-support/kernel/make-initrd-ng.nix
@@ -66,14 +66,28 @@ in
     compressorArgs = _compressorArgsReal;
   };
 
+  inherit extension makeUInitrd uInitrdArch prepend;
+  ${if makeUInitrd then "uInitrdCompression" else null} = uInitrdCompression;
+
   passAsFile = ["contents"];
   contents = lib.concatMapStringsSep "\n" ({ object, symlink, ... }: "${object}\n${if symlink == null then "" else symlink}") contents + "\n";
 
-  nativeBuildInputs = [makeInitrdNGTool patchelf glibc cpio];
+  nativeBuildInputs = [makeInitrdNGTool patchelf glibc cpio] ++ lib.optional makeUInitrd ubootTools;
 } ''
   mkdir ./root
   make-initrd-ng "$contentsPath" ./root
   mkdir "$out"
   (cd root && find * .[^.*] -exec touch -h -d '@1' '{}' +)
+  for PREP in $prepend; do
+    cat $PREP >> $out/initrd
+  done
   (cd root && find * .[^.*] -print0 | sort -z | cpio -o -H newc -R +0:+0 --reproducible --null | eval -- $compress >> "$out/initrd")
+
+  if [ -n "$makeUInitrd" ]; then
+      mkimage -A "$uInitrdArch" -O linux -T ramdisk -C "$uInitrdCompression" -d "$out/initrd" $out/initrd.img
+      # Compatibility symlink
+      ln -sf "initrd.img" "$out/initrd"
+  else
+      ln -s "initrd" "$out/initrd$extension"
+  fi
 ''