makeModulesClosure: support firmware

Link it in stage 1.
This commit is contained in:
Nikolay Amiantov
2018-02-16 00:11:07 +02:00
committed by Tuomas Tynkkynen
parent 0be2746fc2
commit 56e0943b08
6 changed files with 17 additions and 4 deletions
@@ -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