git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #165892 from tpwrules/fix-initrd-dirlinks

make-initrd: fix reproducibility problems

commit98ff3e401c67a92ef3bb0df7d9e4f0e07dfaffe9 authorArtturi <Artturin@artturin.com> dateThu 21 Apr 2022, 20:51 (5 years ago) parentd9309f47fd6cea
3 files changed+5−5
nixos/modules/system/boot/stage-1.nix+2−2 pkgs/build-support/kernel/make-initrd.nix+2−2 pkgs/build-support/kernel/make-initrd.sh+1−1
nixos/modules/system/boot/stage-1.nix+2−2
@@ -420,7 +420,7 @@ let
420420 ${lib.optionalString (config.boot.initrd.secrets == {})
421421 "exit 0"}
422422
423− export PATH=${pkgs.coreutils}/bin:${pkgs.cpio}/bin:${pkgs.gzip}/bin:${pkgs.findutils}/bin
423+ export PATH=${pkgs.coreutils}/bin:${pkgs.libarchive}/bin:${pkgs.gzip}/bin:${pkgs.findutils}/bin
424424
425425 function cleanup {
426426 if [ -n "$tmp" -a -d "$tmp" ]; then
@@ -440,7 +440,7 @@ let
440440 ) config.boot.initrd.secrets)
441441 }
442442
443− (cd "$tmp" && find . -print0 | sort -z | cpio --quiet -o -H newc -R +0:+0 --reproducible --null) | \
443+ (cd "$tmp" && find . -print0 | sort -z | bsdtar --uid 0 --gid 0 -cnf - -T - | bsdtar --null -cf - --format=newc @-) | \
444444 ${compressorExe} ${lib.escapeShellArgs initialRamdisk.compressorArgs} >> "$1"
445445 '';
446446
pkgs/build-support/kernel/make-initrd.nix+2−2
@@ -18,7 +18,7 @@ let
1818 # compression type and filename extension.
1919 compressorName = fullCommand: builtins.elemAt (builtins.match "([^ ]*/)?([^ ]+).*" fullCommand) 1;
2020in
21−{ stdenvNoCC, perl, cpio, ubootTools, lib, pkgsBuildHost
21+{ stdenvNoCC, perl, libarchive, ubootTools, lib, pkgsBuildHost
2222# Name of the derivation (not of the resulting file!)
2323, name ? "initrd"
2424
@@ -82,7 +82,7 @@ in stdenvNoCC.mkDerivation rec {
8282
8383 builder = ./make-initrd.sh;
8484
85− nativeBuildInputs = [ perl cpio ]
85+ nativeBuildInputs = [ perl libarchive ]
8686 ++ lib.optional makeUInitrd ubootTools;
8787
8888 compress = "${_compressorExecutable} ${lib.escapeShellArgs _compressorArgsReal}";
pkgs/build-support/kernel/make-initrd.sh+1−1
@@ -40,7 +40,7 @@ for PREP in $prepend; do
4040 cat $PREP >> $out/initrd
4141done
4242(cd root && find * .[^.*] -exec touch -h -d '@1' '{}' +)
43−(cd root && find * .[^.*] -print0 | sort -z | cpio -o -H newc -R +0:+0 --reproducible --null | eval -- $compress >> "$out/initrd")
43+(cd root && find * .[^.*] -print0 | sort -z | bsdtar --uid 0 --gid 0 -cnf - -T - | bsdtar --null -cf - --format=newc @- | eval -- $compress >> "$out/initrd")
4444
4545if [ -n "$makeUInitrd" ]; then
4646 mkimage -A "$uInitrdArch" -O linux -T ramdisk -C "$uInitrdCompression" -d "$out/initrd" $out/initrd.img