Re: How the kernel firmware loader works

2006-01-09 Thread Bartosz Fenski aka fEnIo
On Sat, Jan 07, 2006 at 12:05:48AM +0100, Marco d'Itri wrote:
 (#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.

Yeah... thanks a lot for your explanation. I'm now a little smarter.
 
 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.

So I suppose that it shouldn't be possible to compile in such drivers, if
they work only as a module. At least since they aren't ported to new
interface.

Anyway, once again thanks for explanation, and now I'm glad that I posted
this question in blog, otherwise I would probably lost more time to figure
out what's going on.

regards
fEnIo

-- 
  ,''`.  Bartosz Fenski | mailto:[EMAIL PROTECTED] | pgp:0x13fefc40 | irc:fEnIo
 : :' :   32-050 Skawina - Glowackiego 3/15 - w. malopolskie - Poland
 `. `'   phone:+48602383548 | proud Debian maintainer and user
   `-  http://skawina.eu.org | jid:[EMAIL PROTECTED] | rlu:172001


signature.asc
Description: Digital signature


How the kernel firmware loader works

2006-01-06 Thread Marco d'Itri
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]
-

-- 
ciao,
Marco


-- 
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of unsubscribe. Trouble? Contact [EMAIL PROTECTED]