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

How the kernel firmware loader works

Gated from my blog.

(#104) How the kernel firmware loader works

fEnIo[0] learnt an important lesson about the kernel firmware loader:
it (usually) does not work as expected for non-modular drivers.

The reason is that the request_firmware()[1] interface is synchronous.
Since it's usually called in the initialisation section of drivers, the
userspace firmware loader is not available yet if the calling driver is
built-in in the kernel. The request_firmware_nowait()[2] asynchronous
interface was designed to replace it, but most drivers have not been
ported yet.

When a driver calls request_firmware(), a uevent[3] is sent by the
kernel to udev over a netlink(7) socket, requesting that a specific
file is uploaded. udevd runs /lib/udev/firmware.agent, a simple shell
script which will look for the $FIRMWARE file in a few directories and
then copy it to the designated place in the driver $DEVPATH in sysfs.

If the driver is initialised before userspace is started then the
loader will not be available, and the request will fail. A possible
solution is to run udev in the early userspace environment (initramfs),
but just compiling the driver as a module is usually simpler.

[0] http://jabba.uaznia.net/fEnIo/id/8689
[1] http://lxr.linux.no/ident?i=request_firmware
[2] http://lxr.linux.no/ident?i=request_firmware_nowait
[3] http://lxr.linux.no/ident?i=kobject_uevent

Posted at 23:57:34. [http://blog.bofh.it/id_104]


Reply to: