From 1557027e33708c09de3e90c6a931b3db92baca72 Mon Sep 17 00:00:00 2001 From: Alyssa Ross Date: Sun, 29 Oct 2023 00:23:49 +0200 Subject: [PATCH] makeModulesClosure: handle firmware glob patterns A handful of kernel modules use glob patterns to express their firmware dependencies. (`git grep 'MODULE_FIRMWARE.*\*'`) Previously, we weren't handling these patterns. Now, we are. --- pkgs/build-support/kernel/modules-closure.sh | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/pkgs/build-support/kernel/modules-closure.sh b/pkgs/build-support/kernel/modules-closure.sh index 74bc490eb15c..5f61bac751af 100644 --- a/pkgs/build-support/kernel/modules-closure.sh +++ b/pkgs/build-support/kernel/modules-closure.sh @@ -66,8 +66,8 @@ for module in $rootModules; do fi done -mkdir -p $out/lib/firmware -for module in $(cat closure); do +cd "$firmware" +for module in $(< ~-/closure); do # for builtin modules, modinfo will reply with a wrong output looking like: # $ modinfo -F firmware unix # name: unix @@ -78,16 +78,15 @@ for module in $(cat closure); do # # For now, the workaround is just to filter out the extraneous lines out # of its output. - for i in $(modinfo -b $kernel --set-version "$version" -F firmware $module | grep -v '^name:'); do - mkdir -p "$out/lib/firmware/$(dirname "$i")" + modinfo -b $kernel --set-version "$version" -F firmware $module | grep -v '^name:' | while read -r i; do echo "firmware for $module: $i" for name in "$i" "$i.xz" ""; do [ -z "$name" ] && echo "WARNING: missing firmware $i for module $module" - if cp "$firmware/lib/firmware/$name" "$out/lib/firmware/$name" 2>/dev/null; then + if cp -v --parents --no-preserve=mode lib/firmware/$name "$out" 2>/dev/null; then break fi done - done + done || : done # copy module ordering hints for depmod