diff options
author | Joachim Fasting <joachifm@fastmail.fm> | 2016-12-20 10:27:13 +0100 |
---|---|---|
committer | Joachim F <joachifm@users.noreply.github.com> | 2016-12-20 14:00:04 +0100 |
commit | 5a8147479e794d5932273d01790c3602b8abeedc (patch) | |
tree | b42232071a36e63f3fc6f685dfc60d643c77ba9c /pkgs/build-support/kernel/make-initrd.nix | |
parent | 49e3190efa3e307f48d3d3ebfefb421bc5956a6b (diff) |
make-initrd: create reproducible initrds
To achieve reproducible results, `cpio` archive members are added in sorted order and inodes renumbered. The `cpio-clean.pl` script is made obsolete by setting mtimes via `touch` & using `cpio --reproducible`. Suggested by @dezgeg in https://github.com/NixOS/nixpkgs/pull/21273#issuecomment-268116605. Note that using `--reproducible` means that initial ramdisk creation now requires at least `cpio` version 2.12 (released in 2015).
Diffstat (limited to 'pkgs/build-support/kernel/make-initrd.nix')
-rw-r--r-- | pkgs/build-support/kernel/make-initrd.nix | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/pkgs/build-support/kernel/make-initrd.nix b/pkgs/build-support/kernel/make-initrd.nix index 895160616b796..092ab4586b38f 100644 --- a/pkgs/build-support/kernel/make-initrd.nix +++ b/pkgs/build-support/kernel/make-initrd.nix @@ -12,10 +12,10 @@ # `contents = {object = ...; symlink = /init;}' is a typical # argument. -{ stdenv, perl, perlArchiveCpio, cpio, contents, ubootChooser, compressor, prepend }: +{ stdenv, perl, cpio, contents, ubootChooser, compressor, prepend }: let - inputsFun = ubootName : [perl cpio perlArchiveCpio ] + inputsFun = ubootName : [ perl cpio ] ++ stdenv.lib.optional (ubootName != null) [ (ubootChooser ubootName) ]; makeUInitrdFun = ubootName : (ubootName != null); in @@ -30,12 +30,11 @@ stdenv.mkDerivation { objects = map (x: x.object) contents; symlinks = map (x: x.symlink) contents; suffices = map (x: if x ? suffix then x.suffix else "none") contents; - + # For obtaining the closure of `contents'. exportReferencesGraph = map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents; pathsFromGraph = ./paths-from-graph.pl; - cpioClean = ./cpio-clean.pl; crossAttrs = { nativeBuildInputs = inputsFun stdenv.cross.platform.uboot; |