0
0
Fork 0
mirror of https://github.com/NixOS/nixpkgs.git synced 2025-07-13 21:50:33 +03:00

nixos/stage-1: create initramfs /lib at build time

Modules built in to the kernel can attempt to load firmware before
init is started.  To guarantee the firmware is accessible to them
where they expect, /lib has to exist in the initramfs — it can't be
created later by init, because by that point the module may already
have tried and given up.
This commit is contained in:
Alyssa Ross 2023-10-30 08:57:17 +01:00
parent e55c73a6f4
commit d9105c28c8
2 changed files with 4 additions and 4 deletions

View file

@ -253,9 +253,6 @@ done
@setHostId@ @setHostId@
# Load the required kernel modules. # Load the required kernel modules.
mkdir -p /lib
ln -s @modulesClosure@/lib/modules /lib/modules
ln -s @modulesClosure@/lib/firmware /lib/firmware
echo @extraUtils@/bin/modprobe > /proc/sys/kernel/modprobe echo @extraUtils@/bin/modprobe > /proc/sys/kernel/modprobe
for i in @kernelModules@; do for i in @kernelModules@; do
info "loading module $(basename $i)..." info "loading module $(basename $i)..."

View file

@ -307,7 +307,7 @@ let
${pkgs.buildPackages.busybox}/bin/ash -n $target ${pkgs.buildPackages.busybox}/bin/ash -n $target
''; '';
inherit linkUnits udevRules extraUtils modulesClosure; inherit linkUnits udevRules extraUtils;
inherit (config.boot) resumeDevice; inherit (config.boot) resumeDevice;
@ -349,6 +349,9 @@ let
[ { object = bootStage1; [ { object = bootStage1;
symlink = "/init"; symlink = "/init";
} }
{ object = "${modulesClosure}/lib";
symlink = "/lib";
}
{ object = pkgs.runCommand "initrd-kmod-blacklist-ubuntu" { { object = pkgs.runCommand "initrd-kmod-blacklist-ubuntu" {
src = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf"; src = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf";
preferLocalBuild = true; preferLocalBuild = true;