summaryrefslogtreecommitdiffstats
path: root/nixos/modules
diff options
context:
space:
mode:
authorAlyssa Ross <hi@alyssa.is>2023-10-30 08:57:17 +0100
committerAlyssa Ross <hi@alyssa.is>2023-11-06 14:35:34 +0100
commitd9105c28c8ca979fc1e55ba2f30511cbc36efa5a (patch)
tree57cb17f6c9a2964b4ca379160a6f41405d75b402 /nixos/modules
parente55c73a6f4d024086144b61ce6da4aa42dbeaa61 (diff)
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.
Diffstat (limited to 'nixos/modules')
-rw-r--r--nixos/modules/system/boot/stage-1-init.sh3
-rw-r--r--nixos/modules/system/boot/stage-1.nix5
2 files changed, 4 insertions, 4 deletions
diff --git a/nixos/modules/system/boot/stage-1-init.sh b/nixos/modules/system/boot/stage-1-init.sh
index bc2fc7f7b108..bac354b4724b 100644
--- a/nixos/modules/system/boot/stage-1-init.sh
+++ b/nixos/modules/system/boot/stage-1-init.sh
@@ -253,9 +253,6 @@ done
@setHostId@
# 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
for i in @kernelModules@; do
info "loading module $(basename $i)..."
diff --git a/nixos/modules/system/boot/stage-1.nix b/nixos/modules/system/boot/stage-1.nix
index a3551f68dbe8..f139902cdc85 100644
--- a/nixos/modules/system/boot/stage-1.nix
+++ b/nixos/modules/system/boot/stage-1.nix
@@ -307,7 +307,7 @@ let
${pkgs.buildPackages.busybox}/bin/ash -n $target
'';
- inherit linkUnits udevRules extraUtils modulesClosure;
+ inherit linkUnits udevRules extraUtils;
inherit (config.boot) resumeDevice;
@@ -349,6 +349,9 @@ let
[ { object = bootStage1;
symlink = "/init";
}
+ { object = "${modulesClosure}/lib";
+ symlink = "/lib";
+ }
{ object = pkgs.runCommand "initrd-kmod-blacklist-ubuntu" {
src = "${pkgs.kmod-blacklist-ubuntu}/modprobe.conf";
preferLocalBuild = true;