forked from mirrors/nixpkgs
Make initrd and the kernel builds repeatable.
This commit is contained in:
parent
c69eb7c2c1
commit
f67015cae4
20
pkgs/build-support/kernel/cpio-clean.pl
Normal file
20
pkgs/build-support/kernel/cpio-clean.pl
Normal file
|
@ -0,0 +1,20 @@
|
||||||
|
use strict;
|
||||||
|
|
||||||
|
# Make inode number, link info and mtime consistent in order to get a consistent hash.
|
||||||
|
#
|
||||||
|
# Author: Alexander Kjeldaas <ak@formalprivacy.com>
|
||||||
|
|
||||||
|
use Archive::Cpio;
|
||||||
|
|
||||||
|
my $cpio = Archive::Cpio->new;
|
||||||
|
my $IN = \*STDIN;
|
||||||
|
my $ino = 1;
|
||||||
|
$cpio->read_with_handler($IN, sub {
|
||||||
|
my ($e) = @_;
|
||||||
|
$e->{inode} = $ino;
|
||||||
|
$ino++;
|
||||||
|
$e->{nlink} = 1;
|
||||||
|
$e->{mtime} = 1;
|
||||||
|
$cpio->write_one(\*STDOUT, $e);
|
||||||
|
});
|
||||||
|
$cpio->write_trailer(\*STDOUT);
|
|
@ -12,10 +12,10 @@
|
||||||
# `contents = {object = ...; symlink = /init;}' is a typical
|
# `contents = {object = ...; symlink = /init;}' is a typical
|
||||||
# argument.
|
# argument.
|
||||||
|
|
||||||
{stdenv, perl, cpio, contents, ubootChooser, compressor}:
|
{stdenv, perl, perlArchiveCpio, cpio, contents, ubootChooser, compressor}:
|
||||||
|
|
||||||
let
|
let
|
||||||
inputsFun = ubootName : [perl cpio]
|
inputsFun = ubootName : [perl cpio perlArchiveCpio ]
|
||||||
++ stdenv.lib.optional (ubootName != null) [ (ubootChooser ubootName) ];
|
++ stdenv.lib.optional (ubootName != null) [ (ubootChooser ubootName) ];
|
||||||
makeUInitrdFun = ubootName : (ubootName != null);
|
makeUInitrdFun = ubootName : (ubootName != null);
|
||||||
in
|
in
|
||||||
|
@ -35,6 +35,7 @@ stdenv.mkDerivation {
|
||||||
exportReferencesGraph =
|
exportReferencesGraph =
|
||||||
map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents;
|
map (x: [("closure-" + baseNameOf x.symlink) x.object]) contents;
|
||||||
pathsFromGraph = ./paths-from-graph.pl;
|
pathsFromGraph = ./paths-from-graph.pl;
|
||||||
|
cpioClean = ./cpio-clean.pl;
|
||||||
|
|
||||||
crossAttrs = {
|
crossAttrs = {
|
||||||
nativeBuildInputs = inputsFun stdenv.cross.platform.uboot;
|
nativeBuildInputs = inputsFun stdenv.cross.platform.uboot;
|
||||||
|
|
|
@ -36,7 +36,7 @@ storePaths=$(perl $pathsFromGraph closure-*)
|
||||||
|
|
||||||
# Put the closure in a gzipped cpio archive.
|
# Put the closure in a gzipped cpio archive.
|
||||||
mkdir -p $out
|
mkdir -p $out
|
||||||
(cd root && find * -print0 | cpio -o -H newc --null | $compressor > $out/initrd)
|
(cd root && find * -print0 | cpio -o -H newc --null | perl $cpioClean | $compressor > $out/initrd)
|
||||||
|
|
||||||
if [ -n "$makeUInitrd" ]; then
|
if [ -n "$makeUInitrd" ]; then
|
||||||
mv $out/initrd $out/initrd.gz
|
mv $out/initrd $out/initrd.gz
|
||||||
|
|
|
@ -354,7 +354,7 @@ let
|
||||||
|
|
||||||
makeInitrd = {contents, compressor ? "gzip -9"}:
|
makeInitrd = {contents, compressor ? "gzip -9"}:
|
||||||
import ../build-support/kernel/make-initrd.nix {
|
import ../build-support/kernel/make-initrd.nix {
|
||||||
inherit stdenv perl cpio contents ubootChooser compressor;
|
inherit stdenv perl perlArchiveCpio cpio contents ubootChooser compressor;
|
||||||
};
|
};
|
||||||
|
|
||||||
makeWrapper = makeSetupHook { } ../build-support/setup-hooks/make-wrapper.sh;
|
makeWrapper = makeSetupHook { } ../build-support/setup-hooks/make-wrapper.sh;
|
||||||
|
@ -6179,6 +6179,8 @@ let
|
||||||
|
|
||||||
ack = perlPackages.ack;
|
ack = perlPackages.ack;
|
||||||
|
|
||||||
|
perlArchiveCpio = perlPackages.ArchiveCpio;
|
||||||
|
|
||||||
perlcritic = perlPackages.PerlCritic;
|
perlcritic = perlPackages.PerlCritic;
|
||||||
|
|
||||||
planetary_annihilation = callPackage ../games/planetaryannihilation { };
|
planetary_annihilation = callPackage ../games/planetaryannihilation { };
|
||||||
|
|
|
@ -200,6 +200,14 @@ let self = _self // overrides; _self = with self; {
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
|
ArchiveCpio = buildPerlPackage {
|
||||||
|
name = "Archive-Cpio-0.09";
|
||||||
|
src = fetchurl {
|
||||||
|
url = mirror://cpan/authors/id/P/PI/PIXEL/Archive-Cpio-0.09.tar.gz;
|
||||||
|
sha256 = "1cf8k5zjykdbc1mn8lixlkij6jklwn6divzyq2grycj3rpd36g5c";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
ArchiveZip = buildPerlPackage {
|
ArchiveZip = buildPerlPackage {
|
||||||
name = "Archive-Zip-1.16";
|
name = "Archive-Zip-1.16";
|
||||||
src = fetchurl {
|
src = fetchurl {
|
||||||
|
|
Loading…
Reference in a new issue