about summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorAtemu <atemu.main@gmail.com>2023-12-24 11:53:33 +0100
committerGitHub <noreply@github.com>2023-12-24 11:53:33 +0100
commitd7b70652ef5ab26f4abb37b9dc4d619c9e0ae1c6 (patch)
tree7869f7509a42f3d2d9953b9369aa249aa01bc749 /pkgs/build-support
parent5308b9992601a7bf3781d52457074883d2f507e2 (diff)
parent4084ee0cd55e41b6d78ea578f03ef3471a261731 (diff)
downloadnixlib-d7b70652ef5ab26f4abb37b9dc4d619c9e0ae1c6.tar
nixlib-d7b70652ef5ab26f4abb37b9dc4d619c9e0ae1c6.tar.gz
nixlib-d7b70652ef5ab26f4abb37b9dc4d619c9e0ae1c6.tar.bz2
nixlib-d7b70652ef5ab26f4abb37b9dc4d619c9e0ae1c6.tar.lz
nixlib-d7b70652ef5ab26f4abb37b9dc4d619c9e0ae1c6.tar.xz
nixlib-d7b70652ef5ab26f4abb37b9dc4d619c9e0ae1c6.tar.zst
nixlib-d7b70652ef5ab26f4abb37b9dc4d619c9e0ae1c6.zip
Merge pull request #272125 from yaxitech/reproducible-initrd
make-initrd-ng: fix reproducibility problems
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/kernel/make-initrd-ng.nix8
1 files changed, 4 insertions, 4 deletions
diff --git a/pkgs/build-support/kernel/make-initrd-ng.nix b/pkgs/build-support/kernel/make-initrd-ng.nix
index f2f7aaa6d1b6..65e143cb7349 100644
--- a/pkgs/build-support/kernel/make-initrd-ng.nix
+++ b/pkgs/build-support/kernel/make-initrd-ng.nix
@@ -8,7 +8,7 @@ let
   # compression type and filename extension.
   compressorName = fullCommand: builtins.elemAt (builtins.match "([^ ]*/)?([^ ]+).*" fullCommand) 1;
 in
-{ stdenvNoCC, perl, cpio, ubootTools, lib, pkgsBuildHost, makeInitrdNGTool, binutils, runCommand
+{ stdenvNoCC, libarchive, ubootTools, lib, pkgsBuildHost, makeInitrdNGTool, binutils, runCommand
 # Name of the derivation (not of the resulting file!)
 , name ? "initrd"
 
@@ -74,18 +74,18 @@ in
   passAsFile = ["contents"];
   contents = lib.concatMapStringsSep "\n" ({ object, symlink, ... }: "${object}\n${lib.optionalString (symlink != null) symlink}") contents + "\n";
 
-  nativeBuildInputs = [makeInitrdNGTool cpio] ++ lib.optional makeUInitrd ubootTools ++ lib.optional strip binutils;
+  nativeBuildInputs = [makeInitrdNGTool libarchive] ++ lib.optional makeUInitrd ubootTools ++ lib.optional strip binutils;
 
   STRIP = if strip then "${pkgsBuildHost.binutils.targetPrefix}strip" else null;
 }) ''
   mkdir -p ./root/var/empty
   make-initrd-ng "$contentsPath" ./root
   mkdir "$out"
-  (cd root && find * .[^.*] -exec touch -h -d '@1' '{}' +)
+  (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")
+  (cd root && find . -print0 | sort -z | bsdtar --uid 0 --gid 0 -cnf - -T - | bsdtar --null -cf - --format=newc @- | eval -- $compress >> "$out/initrd")
 
   if [ -n "$makeUInitrd" ]; then
       mkimage -A "$uInitrdArch" -O linux -T ramdisk -C "$uInitrdCompression" -d "$out/initrd" $out/initrd.img