Merge pull request #165892 from tpwrules/fix-initrd-dirlinks

make-initrd: fix reproducibility problems

authored by

Artturi and committed by
GitHub
98ff3e40 d9309f43

+5 -5
+2 -2
nixos/modules/system/boot/stage-1.nix
··· 420 ${lib.optionalString (config.boot.initrd.secrets == {}) 421 "exit 0"} 422 423 - export PATH=${pkgs.coreutils}/bin:${pkgs.cpio}/bin:${pkgs.gzip}/bin:${pkgs.findutils}/bin 424 425 function cleanup { 426 if [ -n "$tmp" -a -d "$tmp" ]; then ··· 440 ) config.boot.initrd.secrets) 441 } 442 443 - (cd "$tmp" && find . -print0 | sort -z | cpio --quiet -o -H newc -R +0:+0 --reproducible --null) | \ 444 ${compressorExe} ${lib.escapeShellArgs initialRamdisk.compressorArgs} >> "$1" 445 ''; 446
··· 420 ${lib.optionalString (config.boot.initrd.secrets == {}) 421 "exit 0"} 422 423 + export PATH=${pkgs.coreutils}/bin:${pkgs.libarchive}/bin:${pkgs.gzip}/bin:${pkgs.findutils}/bin 424 425 function cleanup { 426 if [ -n "$tmp" -a -d "$tmp" ]; then ··· 440 ) config.boot.initrd.secrets) 441 } 442 443 + (cd "$tmp" && find . -print0 | sort -z | bsdtar --uid 0 --gid 0 -cnf - -T - | bsdtar --null -cf - --format=newc @-) | \ 444 ${compressorExe} ${lib.escapeShellArgs initialRamdisk.compressorArgs} >> "$1" 445 ''; 446
+2 -2
pkgs/build-support/kernel/make-initrd.nix
··· 18 # compression type and filename extension. 19 compressorName = fullCommand: builtins.elemAt (builtins.match "([^ ]*/)?([^ ]+).*" fullCommand) 1; 20 in 21 - { stdenvNoCC, perl, cpio, ubootTools, lib, pkgsBuildHost 22 # Name of the derivation (not of the resulting file!) 23 , name ? "initrd" 24 ··· 82 83 builder = ./make-initrd.sh; 84 85 - nativeBuildInputs = [ perl cpio ] 86 ++ lib.optional makeUInitrd ubootTools; 87 88 compress = "${_compressorExecutable} ${lib.escapeShellArgs _compressorArgsReal}";
··· 18 # compression type and filename extension. 19 compressorName = fullCommand: builtins.elemAt (builtins.match "([^ ]*/)?([^ ]+).*" fullCommand) 1; 20 in 21 + { stdenvNoCC, perl, libarchive, ubootTools, lib, pkgsBuildHost 22 # Name of the derivation (not of the resulting file!) 23 , name ? "initrd" 24 ··· 82 83 builder = ./make-initrd.sh; 84 85 + nativeBuildInputs = [ perl libarchive ] 86 ++ lib.optional makeUInitrd ubootTools; 87 88 compress = "${_compressorExecutable} ${lib.escapeShellArgs _compressorArgsReal}";
+1 -1
pkgs/build-support/kernel/make-initrd.sh
··· 40 cat $PREP >> $out/initrd 41 done 42 (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") 44 45 if [ -n "$makeUInitrd" ]; then 46 mkimage -A "$uInitrdArch" -O linux -T ramdisk -C "$uInitrdCompression" -d "$out/initrd" $out/initrd.img
··· 40 cat $PREP >> $out/initrd 41 done 42 (cd root && find * .[^.*] -exec touch -h -d '@1' '{}' +) 43 + (cd root && find * .[^.*] -print0 | sort -z | bsdtar --uid 0 --gid 0 -cnf - -T - | bsdtar --null -cf - --format=newc @- | eval -- $compress >> "$out/initrd") 44 45 if [ -n "$makeUInitrd" ]; then 46 mkimage -A "$uInitrdArch" -O linux -T ramdisk -C "$uInitrdCompression" -d "$out/initrd" $out/initrd.img