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.
|
# Load the required kernel modules.
|
||||||
mkdir -p /lib
|
mkdir -p /lib
|
||||||
ln -s @modulesClosure@/lib/modules /lib/modules
|
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
|
||||||
echo "loading module $(basename $i)..."
|
echo "loading module $(basename $i)..."
|
||||||
|
|
|
@ -13,12 +13,14 @@ let
|
||||||
|
|
||||||
kernelPackages = config.boot.kernelPackages;
|
kernelPackages = config.boot.kernelPackages;
|
||||||
modulesTree = config.system.modulesTree;
|
modulesTree = config.system.modulesTree;
|
||||||
|
firmware = config.hardware.firmware;
|
||||||
|
|
||||||
|
|
||||||
# Determine the set of modules that we need to mount the root FS.
|
# Determine the set of modules that we need to mount the root FS.
|
||||||
modulesClosure = pkgs.makeModulesClosure {
|
modulesClosure = pkgs.makeModulesClosure {
|
||||||
rootModules = config.boot.initrd.availableKernelModules ++ config.boot.initrd.kernelModules;
|
rootModules = config.boot.initrd.availableKernelModules ++ config.boot.initrd.kernelModules;
|
||||||
kernel = modulesTree;
|
kernel = modulesTree;
|
||||||
|
firmware = firmware;
|
||||||
allowMissing = true;
|
allowMissing = true;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -3,13 +3,13 @@
|
||||||
# the modules identified by `rootModules', plus their dependencies.
|
# the modules identified by `rootModules', plus their dependencies.
|
||||||
# Also generate an appropriate modules.dep.
|
# Also generate an appropriate modules.dep.
|
||||||
|
|
||||||
{ stdenvNoCC, kernel, nukeReferences, rootModules
|
{ stdenvNoCC, kernel, firmware, nukeReferences, rootModules
|
||||||
, kmod, allowMissing ? false }:
|
, kmod, allowMissing ? false }:
|
||||||
|
|
||||||
stdenvNoCC.mkDerivation {
|
stdenvNoCC.mkDerivation {
|
||||||
name = kernel.name + "-shrunk";
|
name = kernel.name + "-shrunk";
|
||||||
builder = ./modules-closure.sh;
|
builder = ./modules-closure.sh;
|
||||||
buildInputs = [ nukeReferences kmod ];
|
buildInputs = [ nukeReferences kmod ];
|
||||||
inherit kernel rootModules allowMissing;
|
inherit kernel firmware rootModules allowMissing;
|
||||||
allowedReferences = ["out"];
|
allowedReferences = ["out"];
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,4 +33,13 @@ for module in $closure; do
|
||||||
echo $target >> $out/insmod-list
|
echo $target >> $out/insmod-list
|
||||||
done
|
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
|
depmod -b $out -a $version
|
||||||
|
|
|
@ -26,6 +26,7 @@ rec {
|
||||||
|
|
||||||
modulesClosure = makeModulesClosure {
|
modulesClosure = makeModulesClosure {
|
||||||
inherit kernel rootModules;
|
inherit kernel rootModules;
|
||||||
|
firmware = kernel;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -320,9 +320,9 @@ with pkgs;
|
||||||
makeWrapper = makeSetupHook { deps = [ dieHook ]; }
|
makeWrapper = makeSetupHook { deps = [ dieHook ]; }
|
||||||
../build-support/setup-hooks/make-wrapper.sh;
|
../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 {
|
callPackage ../build-support/kernel/modules-closure.nix {
|
||||||
inherit kernel rootModules allowMissing;
|
inherit kernel firmware rootModules allowMissing;
|
||||||
};
|
};
|
||||||
|
|
||||||
mkShell = callPackage ../build-support/mkshell { };
|
mkShell = callPackage ../build-support/mkshell { };
|
||||||
|
|
Loading…
Reference in a new issue