Where/when is /dev populated? - Embedded

This is a discussion on Where/when is /dev populated? - Embedded ; I have an openwrt dist with kernel 2.6.21 and busybox 1.4.2. I don't get the permissions I want on some device nodes in /dev. Although I can change those in an rc script, it would be nice to get the ...

+ Reply to Thread
Results 1 to 7 of 7

Thread: Where/when is /dev populated?

  1. Where/when is /dev populated?


    I have an openwrt dist with kernel 2.6.21 and busybox 1.4.2. I don't
    get the permissions I want on some device nodes in /dev. Although I
    can change those in an rc script, it would be nice to get the
    permissions right from the start.

    However, I cannot figure out where the device nodes are created... How
    can I find that out?

  2. Re: Where/when is /dev populated?

    Le 10/04/08 16:51, dans
    , «*John*»
    a écrit*:

    > However, I cannot figure out where the device nodes are created... How
    > can I find that out?


    A driver can use devfs_mk_cdev() function to create the dev entry and set
    initial mode permissions.

    --
    Éric Lévénez --
    Unix is not only an OS, it's a way of life.


  3. Re: Where/when is /dev populated?

    John wrote:
    > I have an openwrt dist with kernel 2.6.21 and busybox 1.4.2. I don't
    > get the permissions I want on some device nodes in /dev. Although I
    > can change those in an rc script, it would be nice to get the
    > permissions right from the start.
    >
    > However, I cannot figure out where the device nodes are created... How
    > can I find that out?


    I'm only figuring this out myself, but I do know, the configurable
    part of it, in 2.6 kernels, is run by udev, and configured by rule
    files in /etc/udev/rules.d/*.rules

    Good luck, Mel.

  4. Re: Where/when is /dev populated?

    Mel wrote:
    > John wrote:
    >> I have an openwrt dist with kernel 2.6.21 and busybox 1.4.2. I don't
    >> get the permissions I want on some device nodes in /dev. Although I
    >> can change those in an rc script, it would be nice to get the
    >> permissions right from the start.
    >>
    >> However, I cannot figure out where the device nodes are created... How
    >> can I find that out?

    >
    > I'm only figuring this out myself, but I do know, the configurable
    > part of it, in 2.6 kernels, is run by udev, and configured by rule
    > files in /etc/udev/rules.d/*.rules


    Its very simple. For tty the udev rule could look like this:

    KERNEL=="tty", MODE="0666", GROUP="users"

    Do you need special things for the serial devices? Add:

    KERNEL=="ttyS0*", MODE="0640", GROUP="special"
    KERNEL=="ttyS[1-9]*", MODE="0666", GROUP="users"

    (first match wins. So ttyS0 gets other settings than all other ttyS devices)

    And it works for all kind of devices.

    JB

  5. Re: Where/when is /dev populated?

    In further news, we're trying to nail a particular device down to a
    particular USB socket. For whatever reason, udev was coming up with
    different KERNEL names on different boots. After a productive day
    yesterday, we have a rule like

    SUBSYSTEM=="usb", KERNELS=="2-1:1.0", DRIVERS=="ftdi_sio",
    NAME="ourown/tty"

    The application opens a connection to /dev/ourown/tty , and gets the
    device consistently.

    We had been dealing with the permissions thing by putting our user
    into the dialout group which is automatically assigned. It's
    inflexible, but it works as long as we don't need actual ttys on the
    system. Good to know about GROUP= .

    Also the commands udevinfo, which provides the magic names and values
    to use in rules, and udevtest which lets you test rule files without
    booting.

    Mel.

  6. Re: Where/when is /dev populated?

    Mel wrote:

    > In further news, we're trying to nail a particular device down to a
    > particular USB socket. For whatever reason, udev was coming up with
    > different KERNEL names on different boots. After a productive day
    > yesterday, we have a rule like
    >
    > SUBSYSTEM=="usb", KERNELS=="2-1:1.0", DRIVERS=="ftdi_sio",
    > NAME="ourown/tty"


    Why not using this?

    KERNEL=="ttyUSB[0-9]*", ATTRS{idVendor}=="0403", ATTRS{idProduct}=="6001", SYMLINK+="ourown/tty"

    $ ls -la /dev/ourown/tty
    lrwxrwxrwx 1 root root 10 Apr 11 14:00 /dev/ourown/tty -> ../ttyUSB0

    $ ls -la /dev/ttyUSB0
    crw-rw---- 1 root root 188, 0 Apr 11 14:00 /dev/ttyUSB0

    Its my FTDI245 based device.

    JB

  7. Re: Where/when is /dev populated?

    On Apr 11, 3:00*am, Mel wrote:
    > John wrote:
    > > However, I cannot figure out where the device nodes are created... How
    > > can I find that out?

    >
    > I'm only figuring this out myself, but I do know, the configurable
    > part of it, in 2.6 kernels, is run by udev, and configured by rule
    > files in /etc/udev/rules.d/*.rules


    I don't have /etc/udev... However, I found out that the permissions
    can be specified in /etc/hotplug2-init.rules. Moreover, something
    happens in /sbin/mount_root (a file with OpenWrt copyright): It is
    concluded I have no devfs entry in /proc/filesystems, a tmpfs
    filesystem is mounted and the hotplug2 daemon is started.

    Don't know it that will ever help anyone

+ Reply to Thread