From d9105c28c8ca979fc1e55ba2f30511cbc36efa5a Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Mon, 30 Oct 2023 08:57:17 +0100 Subject: nixos/stage-1: create initramfs /lib at build time MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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. --- nixos/modules/system/boot/stage-1-init.sh | 3 --- nixos/modules/system/boot/stage-1.nix | 5 ++++- 2 files changed, 4 insertions(+), 4 deletions(-) (limited to 'nixos/modules') 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; -- cgit v1.2.3