summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAP <debian@inml.grue.cc>2020-04-28 04:11:10 +0100
committerBen Hutchings <ben@decadent.org.uk>2020-04-28 04:55:32 +0100
commit857042c99134cc2aa5d2959def37d0ae28cd555e (patch)
tree33822531be88c344cf890e63e308d30c57959b01
parentf6133e19a8e264a81820078e7fb3f99d6d9f6020 (diff)
hook-functions: Search for firmware under /lib/firmware/updates
I like to keep up with the official kernel releases. As a result the firmware they wind up requiring is newer than what is available in firmware packages. I placed the firmware from the git repo in /lib/firmware/updates/ which the kernel searches before /lib/firmware. Kernel can find them but update-initramfs cannot. I have attached an initial patch that solves this. I am currently using the resultng code and it is working fine for me. The one thing the patch does not do is allow for a custom location that can be provided to the kernel to search first. This is because that's a little more complicated and requires a decision wrt where to specify this location (ie the config file?). [bwh: Text above is from AP's bug report with minor edits; I added the subject line.] Closes: #956663 Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
-rw-r--r--hook-functions29
1 files changed, 18 insertions, 11 deletions
diff --git a/hook-functions b/hook-functions
index 97a3407..188966e 100644
--- a/hook-functions
+++ b/hook-functions
@@ -53,7 +53,7 @@ add_modules_from_file()
# Add dependent modules + eventual firmware
manual_add_modules()
{
- local prefix kmod options firmware
+ local prefix kmod options firmware fwloc
if [ $# -eq 0 ]; then
return
@@ -76,15 +76,19 @@ manual_add_modules()
# Add required firmware
for firmware in $(modinfo -k "${version}" -F firmware "${kmod}"); do
- if [ -e "${DESTDIR}/lib/firmware/${firmware}" ] \
- || [ -e "${DESTDIR}/lib/firmware/${version}/${firmware}" ]; then
+ if [ -e "${DESTDIR}/lib/firmware/updates/${version}/${firmware}" ] \
+ || [ -e "${DESTDIR}/lib/firmware/updates/${firmware}" ] \
+ || [ -e "${DESTDIR}/lib/firmware/${version}/${firmware}" ] \
+ || [ -e "${DESTDIR}/lib/firmware/${firmware}" ]; then
continue
fi
# Only print warning for missing fw of loaded module
# or forced loaded module
- if [ ! -e "/lib/firmware/${firmware}" ] \
- && [ ! -e "/lib/firmware/${version}/${firmware}" ] ; then
+ if [ ! -e "/lib/firmware/updates/${version}/${firmware}" ] \
+ && [ ! -e "/lib/firmware/updates/${firmware}" ] \
+ && [ ! -e "/lib/firmware/${version}/${firmware}" ] \
+ && [ ! -e "/lib/firmware/${firmware}" ]; then
# Only warn about missing firmware if
# /proc/modules exists
if [ ! -e /proc/modules ] ; then
@@ -99,12 +103,15 @@ manual_add_modules()
continue
fi
- if [ -e "/lib/firmware/${version}/${firmware}" ]; then
- copy_file firmware \
- "/lib/firmware/${version}/${firmware}"
- else
- copy_file firmware "/lib/firmware/${firmware}"
- fi
+ for fwloc in "/lib/firmware/updates/${version}/${firmware}" \
+ "/lib/firmware/updates/${firmware}" \
+ "/lib/firmware/${version}/${firmware}" \
+ "/lib/firmware/${firmware}"; do
+ if [ -e "$fwloc" ]; then
+ copy_file firmware "$fwloc"
+ break
+ fi
+ done
done
done
}