build initramfs into kernel

this doesn't matter for qemu, but there's no other way of
getting a hardware device to find it if the bootloader
won't co-operate
This commit is contained in:
Daniel Barlow 2023-04-10 20:35:06 +01:00
parent 633a4f8003
commit 4638092d3d

View file

@ -17,6 +17,7 @@ in
}; };
config = mkIf config.boot.initramfs.enable { config = mkIf config.boot.initramfs.enable {
kernel.config.BLK_DEV_INITRD = "y"; kernel.config.BLK_DEV_INITRD = "y";
kernel.config.INITRAMFS_SOURCE = builtins.toJSON "${config.outputs.initramfs}";
outputs = { outputs = {
initramfs = initramfs =
@ -57,7 +58,7 @@ in
''; '';
refs = pkgs.writeReferencesToFile bb; refs = pkgs.writeReferencesToFile bb;
gen_init_cpio = pkgs.pkgsBuildBuild.gen_init_cpio; gen_init_cpio = pkgs.pkgsBuildBuild.gen_init_cpio;
in runCommand "initramfs" {} '' in runCommand "initramfs.cpio" {} ''
cat << SPECIALS | ${gen_init_cpio}/bin/gen_init_cpio /dev/stdin > $out cat << SPECIALS | ${gen_init_cpio}/bin/gen_init_cpio /dev/stdin > $out
dir /proc 0755 0 0 dir /proc 0755 0 0
dir /dev 0755 0 0 dir /dev 0755 0 0