summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorArtturi <Artturin@artturin.com>2022-04-21 20:51:35 +0300
committerGitHub <noreply@github.com>2022-04-21 20:51:35 +0300
commit98ff3e401c67a92ef3bb0df7d9e4f0e07dfaffe9 (patch)
treed3989f56acb4152ef2371fcce1ed6c2c16d7e2a8 /pkgs/build-support
parentd9309f43b3f1c038140662e6a80bfb190547c7b4 (diff)
parent7fd6cea253a27d3c0660a4c21774c9697a655661 (diff)
downloadnixpkgs-98ff3e401c67a92ef3bb0df7d9e4f0e07dfaffe9.tar
nixpkgs-98ff3e401c67a92ef3bb0df7d9e4f0e07dfaffe9.tar.gz
nixpkgs-98ff3e401c67a92ef3bb0df7d9e4f0e07dfaffe9.tar.bz2
nixpkgs-98ff3e401c67a92ef3bb0df7d9e4f0e07dfaffe9.tar.lz
nixpkgs-98ff3e401c67a92ef3bb0df7d9e4f0e07dfaffe9.tar.xz
nixpkgs-98ff3e401c67a92ef3bb0df7d9e4f0e07dfaffe9.tar.zst
nixpkgs-98ff3e401c67a92ef3bb0df7d9e4f0e07dfaffe9.zip
Merge pull request #165892 from tpwrules/fix-initrd-dirlinks
make-initrd: fix reproducibility problems
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/kernel/make-initrd.nix4
-rw-r--r--pkgs/build-support/kernel/make-initrd.sh2
2 files changed, 3 insertions, 3 deletions
diff --git a/pkgs/build-support/kernel/make-initrd.nix b/pkgs/build-support/kernel/make-initrd.nix
index 23ce992f0d5..9c27a142f4b 100644
--- a/pkgs/build-support/kernel/make-initrd.nix
+++ b/pkgs/build-support/kernel/make-initrd.nix
@@ -18,7 +18,7 @@ let
   # compression type and filename extension.
   compressorName = fullCommand: builtins.elemAt (builtins.match "([^ ]*/)?([^ ]+).*" fullCommand) 1;
 in
-{ stdenvNoCC, perl, cpio, ubootTools, lib, pkgsBuildHost
+{ stdenvNoCC, perl, libarchive, ubootTools, lib, pkgsBuildHost
 # Name of the derivation (not of the resulting file!)
 , name ? "initrd"
 
@@ -82,7 +82,7 @@ in stdenvNoCC.mkDerivation rec {
 
   builder = ./make-initrd.sh;
 
-  nativeBuildInputs = [ perl cpio ]
+  nativeBuildInputs = [ perl libarchive ]
     ++ lib.optional makeUInitrd ubootTools;
 
   compress = "${_compressorExecutable} ${lib.escapeShellArgs _compressorArgsReal}";
diff --git a/pkgs/build-support/kernel/make-initrd.sh b/pkgs/build-support/kernel/make-initrd.sh
index 0a87d643546..8f64114d54c 100644
--- a/pkgs/build-support/kernel/make-initrd.sh
+++ b/pkgs/build-support/kernel/make-initrd.sh
@@ -40,7 +40,7 @@ for PREP in $prepend; do
   cat $PREP >> $out/initrd
 done
 (cd root && find * .[^.*] -exec touch -h -d '@1' '{}' +)
-(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