FS#34255 - [mkinitcpio] should warn if modinfo has firmware that doesn't exist

Attached to Project: Arch Linux
Opened by Zack Buhman (buhman) - Monday, 11 March 2013, 10:12 GMT
Last edited by Dave Reisner (falconindy) - Thursday, 02 May 2013, 03:39 GMT
Task Type Feature Request
Category Packages: Core
Status Closed
Assigned To Dave Reisner (falconindy)
Architecture All
Severity Low
Priority Normal
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:

As a specific example/use-case: I have a diskless PXE setup with all sorts of packages, including arch-install-scripts, installed that I use to do pretty much everything/anything, such as doing arbitrary archlinux installations.

I have aur/aic94xx-firmware[1] installed on the NFS root, so said disk controller would initializes properly without any fiddling (so I wouldn't be instantly conscious that the disk controller requires firmware not present in core/linux-firmware). But the firmware would not be copied to the target root filesystem without manually installing said package.

Mkinitcpio would then include aic94xx module in the initramfs as expected, but completely not mention the part where aic94xx requires aic94xx-seq.fw, but that isn't in the target /lib/firmware

It would be nice, for slow people like me, if mkinitcpio would mention that the generated initramfs is probably broken because firmware for an included module was not present.

Additional info:
* package version(s)

mkinitcpio 0.13.0-1

[1] https://aur.archlinux.org/packages/aic94xx-firmware/
This task depends upon

Closed by  Dave Reisner (falconindy)
Thursday, 02 May 2013, 03:39 GMT
Reason for closing:  Fixed
Additional comments about closing:  mkinitcpio-0.14.0
Comment by Zack Buhman (buhman) - Monday, 11 March 2013, 11:33 GMT
patch
Comment by Zack Buhman (buhman) - Monday, 11 March 2013, 11:34 GMT
Let's try this again, only without the truncation. Ignore previous patch.
Comment by Dave Reisner (falconindy) - Monday, 11 March 2013, 12:23 GMT
Seems wrong. The initial if should just be removed, add_file will throw an error, and the build will eventually fail.
Comment by Dave Reisner (falconindy) - Monday, 11 March 2013, 14:32 GMT
Firmware adding is actually even more broken than just this, because mkinitcpio doesn't honor updates in /usr/lib/firmware/updates/$fwpath. That should be the soft fail, with the fallback on /usr/lib/firmware/$fwpath being a hard fail.
Comment by Zack Buhman (buhman) - Monday, 11 March 2013, 15:03 GMT
This, you mean? Works for me.
Comment by Dave Reisner (falconindy) - Thursday, 14 March 2013, 19:25 GMT Comment by Dave Reisner (falconindy) - Sunday, 21 April 2013, 15:18 GMT
So in further testing, this sucks. Modules like this exist:

$ modinfo -k 3.8.8-1-ARCH bfa
filename: /lib/modules/3.8.8-1-ARCH/kernel/drivers/scsi/bfa/bfa.ko.gz
version: 3.1.2.1
author: Brocade Communications Systems, Inc.
description: Brocade Fibre Channel HBA Driver fcpim
license: GPL
firmware: ct2fw-3.1.0.0.bin
firmware: ctfw-3.1.0.0.bin
firmware: cbfw-3.1.0.0.bin
srcversion: 0E58B18DCDDBAFD81911FBD
alias: pci:v00001657d00000022sv*sd*bc0Csc04i00*
alias: pci:v00001657d00000021sv*sd*bc0Csc04i00*
alias: pci:v00001657d00000014sv*sd*bc0Csc04i00*
alias: pci:v00001657d00000017sv*sd*bc*sc*i*
alias: pci:v00001657d00000013sv*sd*bc*sc*i*
depends: scsi_mod,scsi_transport_fc
intree: Y
vermagic: 3.8.8-1-ARCH SMP preempt mod_unload modversions

The firmware file 'cbfw-3.1.0.0.bin' is nowhere to be found so mkinitcpio complains about it. Of course, there's other firmware files so it's possible that everything works out fine.

I suppose what needs to happen is for mkinitcpio to complain only if *no* firmware was found for the module, but then there's potentially problems for modules which might require multiple firmware files.

edit: nevermind. NONE of the firmware files exist for this module in the generic linux-firmware package. Everyone creating a fallback image with the block hook is going to run into this... blahhhhhhh
Comment by Dave Reisner (falconindy) - Sunday, 21 April 2013, 15:40 GMT
And I'm starting to feel even worse about this...

$ find /lib/modules/3.8.8-1-ARCH/kernel/ -name '*.ko.gz' -exec modinfo -F firmware {} + | while read fw; do [[ -f /lib/firmware/$fw ]] || echo $fw; done | wc -l
268
$ find /lib/modules/3.8.8-1-ARCH/kernel/ -name '*.ko.gz' -exec modinfo -F firmware {} + | while read fw; do [[ -f /lib/firmware/$fw ]] && echo $fw; done | wc -l
371

So in other words, 40% of the firmware referenced by mainline kernel modules isn't shipped by the kernel. I realize there's packages like alsa-firmware and bluez-firmware which drop the count of missing files down to about 170, but that's still 26% meaning our strike rate isn't so hot.

Loading...