Cross-compiling udev

By | October 23, 2009

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 2.6.23.17 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:

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:

Download udev-129.

Create a directory for installing it:

Set the following environment variables that will make our life easier:

Configure, compile and install it in $BUILDDIR

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.

One thought on “Cross-compiling udev

Leave a Reply

Your email address will not be published. Required fields are marked *