Md at debian.org

tales of a debian maintainer

How the kernel firmware loader works

fEnIo 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() 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() asynchronous interface was designed to replace it, but most drivers have not been ported yet.

When a driver calls request_firmware(), a uevent 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.

About

This is the blog of Marco d'Itri.

S M T W T F S
  1 2 3 4 5 6
7 8 9 10 11 12 13
14 15 16 17 18 19 20
21 22 23 24 25 26 27
28 29 30        

See also:

My blogroll:


W3C HTML 4.01
W3C CSS 2.0     

Powered by Bryar.pm.