udev is the device manager for the Linux 2.6 kernel series. It takes care of handling all the devices in /dev, such as adding/removing devices, and loading firmware when a driver asks for it.
Compiling and installing udev is a straight-forward procedure, but you need to pay attention to it’s requirements. The README file inside the source code describes clearly these requirements.
One of these requirements in later versions of udev, such as udev-136 and on, specifies that you need to disable the CONFIG_SYSFS_DEPRECATED* option in the kernel configuration, but some drivers of embedded Linux distros such as STLinux2.3 that use a 126.96.36.199 kernel need this flag enabled, therefore, you have to
use a udev version that doesn’t have this constraint.
Although this requirement was introduced for a kernel 2.6.22 and the kernel of the STLinux2.3 distro is greater, udev has problems when uploading the firmware for a driver. In my case it fails when uploading it for a DVB-S2 tuner:
cx24116_firmware_ondemand: Waiting for firmware upload (dvb-fe-cx24116.fw)... kobject_add failed for i2c-1 with -EEXIST, don't try to register things with the same name in the same directory. Stack: (0x866fdde8 to 0x866fe000) (skipping stack dump) Call trace: [<841eba80>] kobject_get+0x0/0x20 [<8422713e>] device_add+0x9e/0x5c0 [<84226180>] get_device+0x0/0x20 [<841ec0ae>] kobject_init+0x2e/0x60 [<8422eef0>] _request_firmware+0xd0/0x3e0 [<841ef420>] strlcpy+0x0/0x80 [
] cx24116_cmd_execute+0x1bc/0x620 [cx24116] [ ] cx24116_cmd_execute+0x0/0x620 [cx24116] [<842cf432>] i2c_transfer+0x32/0x60 [ ] cx24116_writereg+0x58/0xc0 [cx24116] [ ] cx24116_cmd_execute+0x0/0x620 [cx24116] [ ] cx24116_writereg+0x0/0xc0 [cx24116] [ ] cx24116_initfe+0x60/0x140 [cx24116] [ ] cx24116_cmd_execute+0x0/0x620 [cx24116] [ ] cx24116_writereg+0x0/0xc0 [cx24116] [<84011776>] dequeue_entity+0x16/0xc0 [<84254880>] dvb_frontend_init+0x20/0xa0 [<84013140>] complete+0x0/0xa0 [<842574e0>] dvb_frontend_thread+0x0/0x5c0 [<84257534>] dvb_frontend_thread+0x54/0x5c0 [<842574e0>] dvb_frontend_thread+0x0/0x5c0 [<843ab2a6>] __switch_to_end+0x84/0x3fe [<8403112c>] kthread+0x2c/0x80 [<84031138>] kthread+0x38/0x80 [<84013140>] complete+0x0/0xa0 [<842574e0>] dvb_frontend_thread+0x0/0x5c0 [<840310c0>] kthread_should_stop+0x0/0x20 [<84003924>] kernel_thread_helper+0x4/0x20 [<84031100>] kthread+0x0/0x80 [<84003920>] kernel_thread_helper+0x0/0x20
Notice that I had this problem with STLinux2.3’s kernel an its drivers, this doesn’t mean that udev is buggy.
I used udev-129 for solving this problem. This udev version has only the following requirements:
- A 2.6.19 kernel
- The kernel must have sysfs, unix domain sockets (compiled inside the kernel, not as a module) and networking enabled.
- The proc and sysfs filesystems must be mounted in /proc and /sys
Since my system follows these requirements I had no problems for compiling and running it:
Create a directory for installing it:
$ mkdir -p /opt/build-129
Set the following environment variables that will make our life easier:
$ export BUILD=i386-linux $ export HOST=sh4-linux $ export PREFIX=/usr $ export BUILDDIR=/opt/build-129
Configure, compile and install it in $BUILDDIR
$ ./configure --build=$BUILD --host=$HOST --prefix=$PREFIX $ make $ make DESTDIR=$BUILDDIR install
Copy the $BUILDDIR directory to your target’s filesystem, you can leave aside the includes (/usr/include) and doc (/usr/share) directories that normally are not needed in the target.
Now you can start the fine-tuning of the rules and customize them as you need.