makeInitrd: Support prepending other initrds

Changed files
+17 -6
nixos
modules
system
pkgs
build-support
top-level
+9 -1
nixos/modules/system/boot/stage-1.nix
···
# The closure of the init script of boot stage 1 is what we put in
# the initial RAM disk.
initialRamdisk = pkgs.makeInitrd {
-
inherit (config.boot.initrd) compressor;
contents =
[ { object = bootStage1;
···
Specify here the device where the file resides.
You should also use <varname>boot.kernelParams</varname> to specify
<literal><replaceable>resume_offset</replaceable></literal>.
'';
};
···
# The closure of the init script of boot stage 1 is what we put in
# the initial RAM disk.
initialRamdisk = pkgs.makeInitrd {
+
inherit (config.boot.initrd) compressor prepend;
contents =
[ { object = bootStage1;
···
Specify here the device where the file resides.
You should also use <varname>boot.kernelParams</varname> to specify
<literal><replaceable>resume_offset</replaceable></literal>.
+
'';
+
};
+
+
boot.initrd.prepend = mkOption {
+
default = [ ];
+
type = types.listOf types.str;
+
description = ''
+
Other initrd files to prepend to the final initrd we are building.
'';
};
+2 -2
pkgs/build-support/kernel/make-initrd.nix
···
# `contents = {object = ...; symlink = /init;}' is a typical
# argument.
-
{stdenv, perl, perlArchiveCpio, cpio, contents, ubootChooser, compressor}:
let
inputsFun = ubootName : [perl cpio perlArchiveCpio ]
···
nativeBuildInputs = inputsFun stdenv.cross.platform.uboot;
makeUInitrd = makeUInitrdFun stdenv.cross.platform.uboot;
};
-
inherit compressor;
}
···
# `contents = {object = ...; symlink = /init;}' is a typical
# argument.
+
{ stdenv, perl, perlArchiveCpio, cpio, contents, ubootChooser, compressor, prepend }:
let
inputsFun = ubootName : [perl cpio perlArchiveCpio ]
···
nativeBuildInputs = inputsFun stdenv.cross.platform.uboot;
makeUInitrd = makeUInitrdFun stdenv.cross.platform.uboot;
};
+
inherit compressor prepend;
}
+4 -1
pkgs/build-support/kernel/make-initrd.sh
···
# Put the closure in a gzipped cpio archive.
mkdir -p $out
-
(cd root && find * -print0 | cpio -o -H newc --null | perl $cpioClean | $compressor > $out/initrd)
if [ -n "$makeUInitrd" ]; then
mv $out/initrd $out/initrd.gz
···
# Put the closure in a gzipped cpio archive.
mkdir -p $out
+
for PREP in $prepend; do
+
cat $PREP >> $out/initrd
+
done
+
(cd root && find * -print0 | cpio -o -H newc --null | perl $cpioClean | $compressor >> $out/initrd)
if [ -n "$makeUInitrd" ]; then
mv $out/initrd $out/initrd.gz
+2 -2
pkgs/top-level/all-packages.nix
···
inherit lib;
};
-
makeInitrd = {contents, compressor ? "gzip -9n"}:
import ../build-support/kernel/make-initrd.nix {
-
inherit stdenv perl perlArchiveCpio cpio contents ubootChooser compressor;
};
makeWrapper = makeSetupHook { } ../build-support/setup-hooks/make-wrapper.sh;
···
inherit lib;
};
+
makeInitrd = { contents, compressor ? "gzip -9n", prepend }:
import ../build-support/kernel/make-initrd.nix {
+
inherit stdenv perl perlArchiveCpio cpio contents ubootChooser compressor prepend;
};
makeWrapper = makeSetupHook { } ../build-support/setup-hooks/make-wrapper.sh;