[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Is there a way to load/unload a firmware manually?



I think I finally solved this. 

Basically not all files from /lib/firmware/ are copied to the initrd image, 
which means that there's some mechanism, which decides what to add (and I 
have no idea what that is). Looking for info, I came across some 
suggestions that only the drivers compiled as kernel modules are subjected 
to this behavior. So basically when you've built a driver into the kernel, 
you have to take care of everything manually. So in my case, I have every 
single module built into my kernel, so there's two ways to handle this. 
I can use the CONFIG_EXTRA_FIRMWARE_DIR= and CONFIG_EXTRA_FIRMWARE= kernel 
options, or I can add a hook to initramfs config (under 
/etc/initramfs-tools/hooks/), which would look like the one following:

============================================================
#!/bin/sh -e

# Copy missing firmware files

PREREQ=""

prereqs () { echo "${PREREQ}"; }

case "${1}" in prereqs) prereqs; exit 0 ;; esac ;

. /usr/share/initramfs-tools/hook-functions

echo -n "Copying missing firmware files... "

[ ! -d "${DESTDIR}/lib/firmware/" ] && mkdir -p ${DESTDIR}/lib/firmware/
[ ! -d "${DESTDIR}/lib/firmware/brcm/" ] && mkdir -p ${DESTDIR}/lib/firmware/brcm/

cp /lib/firmware/iwlwifi-6000g2a-6.ucode ${DESTDIR}/lib/firmware/
cp /lib/firmware/brcm/BCM20702A1-0a5c-21e6.hcd ${DESTDIR}/lib/firmware/brcm/

echo "done."

exit 0
============================================================

And then the firmware files would finally get into the initrd image:

# lsinitramfs /boot/initrd.img-5.5.8-amd64 | grep -i firm
usr/lib/firmware
usr/lib/firmware/brcm
usr/lib/firmware/brcm/BCM20702A1-0a5c-21e6.hcd
usr/lib/firmware/iwlwifi-6000g2a-6.ucode
usr/lib/udev/rules.d/50-firmware.rules

which I think solves the issue for good. :]

Attachment: signature.asc
Description: OpenPGP digital signature


Reply to: