devfsd for Debian
=================

Mounting devfs
==============

To actually use devfsd, devfs needs to be mounted. In general devfs
should be mounted as early as possible, in order for various init
scripts etc that manipulate in /dev (mounting devpts, LVM) to work
and for their changes to be preserved.

There are several option to achieve this, recommended first:

- Using the "devfs=mount" kernel option
    This works with all kernels that have devfs compiled in. Add it
    in your lilo.conf (or whatever boot loader you happen to use).

- Compiling your kernel with CONFIG_DEVFS_MOUNT=y
    This is currently not the default for Debian kernel-image-*
    packages.

- Using the MOUNT variable in /etc/default/devfsd [disencouraged]
    When you use this, make damn sure that the devfsd init script
    is called before anything fiddles around in /dev! One step
    towards that goal would be to do:

    update-rc.d -f devfsd remove
    update-rc.d devfsd start 01 S 0 1 2 3 4 5 6 .


Configuring devfsd in maintainer scripts/packages
=================================================

The /etc/init.d/devfs script creates extra devices from the
configuration files in /etc/devfs, it does this by calling the
/sbin/devfsd_make_links script.

The purpose of this is to support devices which are not created
automatically by the drivers as yet.

Also in the Debian version, the configuration file is moved into
/etc/devfs/devfsd.conf instead of /etc/devfsd.conf, and includes a
file /etc/devfs/perms which as installed contains the standard
permissions equivalent to that used by /sbin/MAKEDEV.

New packages which need to create devices and/or directories may place
files in the same formats as /etc/devfs/devices under /etc/devfs/devices.d .

New packages which need to create new devfsd configuration directives may place
files in the same format as /etc/devfs/devfsd.conf under /etc/devfs/conf.d .
This is also used for symlinks.

/etc/devfs/symlinks.d and /etc/devfs/symlinks are deprecated and will be
removed in a future version.  /etc/devfs/conf.d files can do every type of
sym-link creation you could desire.


The mailing list for discussing devfs is devfs@oss.sgi.com.


To illustrate an aspect of Debian packages using devfs:
From: Ludovic Rousseau <ludovic.rousseau@free.fr>
To: russell@coker.com.au

Hi,

I am Debian packaging a smart card reader driver (libgempc410). The
driver accesses the serial ports through /dev/pcsc/1 to /dev/pcsc/4 (and
not /dev/ttyS?). This scheme is used to always use /dev/pcsc/1 in the
driver instead of a different name for each kernel (Linux, BSD, Solaris,
etc.)

So my problem is to create the symlinks.

I created a file /etc/devfs/devices.d/libgempc410 that contains:

pcsc/            d       ""      ""      root    root    0755
pcsc/1           c       4       64      root    dialout 0660
pcsc/2           c       4       65      root    dialout 0660
pcsc/3           c       4       66      root    dialout 0660
pcsc/4           c       4       67      root    dialout 0660


My Answer:
From: Russell Coker <russell@coker.com.au>
To: Ludovic Rousseau <ludovic.rousseau@free.fr>
Reply to: Russell Coker <russell@coker.com.au>

In /etc/devfs/conf.d/libgempc410 have the following:
REGISTER        ^tts/0$          CFUNCTION GLOBAL symlink $devname pcsc/1
UNREGISTER      ^tts/0$          CFUNCTION GLOBAL unlink pcsc/1

Also have similar entries for tts/1 etc (actually advanced regular expressions
could make this easier - it's in the man page).

In /etc/devfs/devices.d/libgempc410 have the following:
pcsc           d       ""      ""      root    root    0755

Then have the following in your postinst:
if [ -x /usr/sbin/update-devfsd ]; then
  /usr/sbin/update-devfsd -f
fi

    -- Arthur Korn <arthur@debian.org>  Wed,  1 Sep 2004 12:36:44 +0200
