makeModulesClosure: support firmware
Link it in stage 1.
This commit is contained in:
parent
0be2746fc2
commit
56e0943b08
@ -167,6 +167,7 @@ done
|
||||
# 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
|
||||
echo "loading module $(basename $i)..."
|
||||
|
@ -13,12 +13,14 @@ let
|
||||
|
||||
kernelPackages = config.boot.kernelPackages;
|
||||
modulesTree = config.system.modulesTree;
|
||||
firmware = config.hardware.firmware;
|
||||
|
||||
|
||||
# Determine the set of modules that we need to mount the root FS.
|
||||
modulesClosure = pkgs.makeModulesClosure {
|
||||
rootModules = config.boot.initrd.availableKernelModules ++ config.boot.initrd.kernelModules;
|
||||
kernel = modulesTree;
|
||||
firmware = firmware;
|
||||
allowMissing = true;
|
||||
};
|
||||
|
||||
|
@ -3,13 +3,13 @@
|
||||
# the modules identified by `rootModules', plus their dependencies.
|
||||
# Also generate an appropriate modules.dep.
|
||||
|
||||
{ stdenvNoCC, kernel, nukeReferences, rootModules
|
||||
{ stdenvNoCC, kernel, firmware, nukeReferences, rootModules
|
||||
, kmod, allowMissing ? false }:
|
||||
|
||||
stdenvNoCC.mkDerivation {
|
||||
name = kernel.name + "-shrunk";
|
||||
builder = ./modules-closure.sh;
|
||||
buildInputs = [ nukeReferences kmod ];
|
||||
inherit kernel rootModules allowMissing;
|
||||
inherit kernel firmware rootModules allowMissing;
|
||||
allowedReferences = ["out"];
|
||||
}
|
||||
|
@ -33,4 +33,13 @@ for module in $closure; do
|
||||
echo $target >> $out/insmod-list
|
||||
done
|
||||
|
||||
mkdir -p $out/lib/firmware
|
||||
for module in $closure; do
|
||||
for i in $(modinfo -F firmware $module); do
|
||||
mkdir -p "$out/lib/firmware/$(dirname "$i")"
|
||||
echo "firmware for $module: $i"
|
||||
cp "$firmware/lib/firmware/$i" "$out/lib/firmware/$i" 2>/dev/null || if test -z "$allowMissing"; then exit 1; fi
|
||||
done
|
||||
done
|
||||
|
||||
depmod -b $out -a $version
|
||||
|
@ -26,6 +26,7 @@ rec {
|
||||
|
||||
modulesClosure = makeModulesClosure {
|
||||
inherit kernel rootModules;
|
||||
firmware = kernel;
|
||||
};
|
||||
|
||||
|
||||
|
@ -320,9 +320,9 @@ with pkgs;
|
||||
makeWrapper = makeSetupHook { deps = [ dieHook ]; }
|
||||
../build-support/setup-hooks/make-wrapper.sh;
|
||||
|
||||
makeModulesClosure = { kernel, rootModules, allowMissing ? false }:
|
||||
makeModulesClosure = { kernel, firmware, rootModules, allowMissing ? false }:
|
||||
callPackage ../build-support/kernel/modules-closure.nix {
|
||||
inherit kernel rootModules allowMissing;
|
||||
inherit kernel firmware rootModules allowMissing;
|
||||
};
|
||||
|
||||
mkShell = callPackage ../build-support/mkshell { };
|
||||
|
Loading…
Reference in New Issue
Block a user