FS#14783 - [mkinitcpio] net hook of initcpio does not include firmware files

Attached to Project: Arch Linux
Opened by Matthias Dienstbier (fs4000) - Thursday, 21 May 2009, 13:30 GMT
Last edited by Tobias Powalowski (tpowa) - Sunday, 31 May 2009, 13:25 GMT
Task Type Bug Report
Category Packages: Core
Status Closed
Assigned To Tobias Powalowski (tpowa)
Aaron Griffin (phrakture)
Thomas Bächler (brain0)
Architecture All
Severity Medium
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

I installed a network bootable Arch Linux with this howto: http://wiki.archlinux.org/index.php/Diskless_network_boot_NFS_root

But on a machine that needs the e100 module the system will not boot because a necessary firmware file is missing.
I think the hook should read "modinfo $MODULE" and include the listed firmware files:

$ modinfo e100 | grep firmware
firmware: e100/d102e_ucode.bin
firmware: e100/d101s_ucode.bin
firmware: e100/d101m_ucode.bin
This task depends upon

Closed by  Tobias Powalowski (tpowa)
Sunday, 31 May 2009, 13:25 GMT
Reason for closing:  Fixed
Comment by Matthias Dienstbier (fs4000) - Saturday, 23 May 2009, 00:37 GMT
Don't know if it helps, but for now I'm using this code to include the firmware files:

for i in `modinfo $MODULES | grep firmware: | gawk '{ print $2 }'`; do
[ -f "/lib/firmware/$i" ] && add_file "/lib/firmware/$i"
done

I also don't know if modules with missing firmware should be removed from $MODULES again.
Comment by Thomas Bächler (brain0) - Saturday, 23 May 2009, 08:06 GMT
Okay, this sounds good, however, you need a -k option with modinfo (the kernel version you are running is not always the one you are building for). This should be included somewhere with the add_module function so that any module that needs firmware will have it included.

I hope to be able to work on mkinitcpio soon, there is so much to do here.
Comment by Matthias Dienstbier (fs4000) - Saturday, 23 May 2009, 12:34 GMT
At first I thought so, but I didn't know where I can get the target kernel version. As $MODULES contains the complete paths to the modules this should not be necessary, should it?
Comment by Tobias Powalowski (tpowa) - Saturday, 23 May 2009, 17:09 GMT
here my suggestion:
diff --git a/functions b/functions
index 38bf6bf..502d1d9 100644
--- a/functions
+++ b/functions
@@ -145,12 +145,17 @@ HAS_MODULES="n"
#modules are handled specially in order to enable autodetection
add_module ()
{
- local fil path mod deps
+ local fil path fw mod deps
#cleanup - remove .ko, replace - and _ with [-_] to match either
fil=$(basename "${1}" | sed -e "s|[-_]|\[-_\]|g" -e "s|\.ko$||g")

found=0
for path in $(find "${MODULEDIR}" -type f -name "${fil}.ko"); do
+ #get needed firmware files
+ for fw in $(/sbin/modinfo -F firmware "${path}"); do
+ [ -f "/lib/firmware/$fw" ] && add_file "/lib/firmware/$fw"
+ done
+ #get module depends
for mod in $(/sbin/modinfo -F depends "${path}" | tr ',' ' '); do
if [ -n "${mod}" ]; then
add_module "${mod}"
Comment by Tobias Powalowski (tpowa) - Saturday, 23 May 2009, 17:10 GMT
attached patch
Comment by Tobias Powalowski (tpowa) - Saturday, 23 May 2009, 17:12 GMT
One problem still exists:
ipw2200 and ipw2100 don't list firmware at all in module.
Don't know if more are affected.

Other point:
Are those listed firmware files the correct ones?
iwl packages provide more then one firmware file but only 1 is listed in modinfo.
Comment by Matthias Dienstbier (fs4000) - Saturday, 23 May 2009, 19:18 GMT
You're right, it seems that some modules don't list their firmware.
Well, for the e100 module your patch is working perfectly.
I'm not sure if anyone wants WLAN in initcpio. ;)
Comment by Thomas Bächler (brain0) - Sunday, 24 May 2009, 09:09 GMT
tpowa, that patch should work perfectly - I was wrong about needing -k, as we specify the full path to the module! Also, the -F firmware simplifies this considerably (much less parsing to do in bash scripts). Move it in.

About modules without firmware entries: There is simply nothing we can do - we act on the information we have. If there should be a firmware listed for a module but isn't, it's a kernel bug and should be reported as such.
Comment by Tobias Powalowski (tpowa) - Sunday, 24 May 2009, 09:34 GMT
implemented in mkinitcpio git

Loading...