[Nix-dev] NixOS external kernelmodules + hotplugging + webcam support

Armijn Hemel armijn at uulug.nl
Sun Jan 8 02:28:48 CET 2006


hi all,

the last few days I've been working on loading external kernel modules in
NixOS. As a testcase I used the ov511 webcam driver for my Philips PCVC
720K/00 webcam.

It is a driver that builds relatively clean, as in, you can build it for
other kernels than just the current one. To make everything work well I
had to do a few things:

- make the ov511 kernel compile with the sources supplied by our
installed kernel. The difficulty here was not to let the ov511 driver
install the drivers it made in the kernel directory. After all, the Nix
store is immutable. I chose to use
/nix/store/abcd...ov511.../lib/modules/2.6.11.12-efgh.../ to install
everything in. So, the ov511 module is installed under its own path,
but inside it is a directory with the version of the kernel (with a
Nix hash embedded). Loading the drivers that are built this way works
very well.

- make a script that "merges" the kernel tree and the external module and
presents it as one tree. This is needed for tools like depmod and modprobe.
I built a script that takes all inputs, rebuilds the whole directory tree
as it is in the store and makes symlinks to the actual kernel modules.
I do this for a few reasons, one of them is that I don't want depmod to
write its information in the store. The scripts are not foolproof and very
hackish. Expect more work on that...

- to make the modules load automatically when the webcam is inserted I had
to hack a lot on the hotplug package. It contains many references to tools
it expects to be in the PATH. I cleaned up a lot of it, but there is still
much work to do to make this package clean. This works now, at least, as
far as I have tested it. Also, udev needs work so it automatically creates
devices.

- also added xawtv, to test if the webcam actually works. There are still
a few minor errors in this package which need cleaning up, but that's
rather trivial. One thing is that it needs the new X libraries, so maybe
it's time for a switch to that...

I just did a successful test with the webcam, the modules were loaded
automatically, a device node was created, xawtv launched fine and I got a
picture with it. So, I can proudly say we have webcam support in NixOS :D

armijn

-- 
 ---------------------------------------------------------------------------
  armijn at uulug.nl | http://www.uulug.nl/ | UULug: Utrecht Linux Users Group
 ---------------------------------------------------------------------------



More information about the nix-dev mailing list