Subject: mdev problem with BB 1.4.2

From: Mike Cashwell <[email-masked]>
Date: Wed, 18 Apr 2007 11:39:11 -0400

Greetings all,

I'm bringing up a completely new toolchain (gcc 4.1.1; glibc 2.5;  
linux 2.6.20.4; BB 1.4.2) on an ARM v4tle board. (Whew!)

I'm having trouble getting mdev to fully populate /dev. Specifically,  
I'm not getting entries for my 3 physical serial ports. I've scoured  
the mailing list archives and found a few near-misses, but nothing  
specific.

My hunch is that my sysfs is putting in symlinks in such a way that  
mdev is having trouble. I've included what I think is the relevant  
info below.

Anyone have any ideas? Maybe there's some BB config setting I don't  
have set? My confusion is why mdev is getting the block devices right  
but not the character ones.

Thanks for any assistance!
-Mike

------ /dev and /sys info -----

dm17:/dev $ ls -la
drwxrwxrwt    4 root     root          640 Jan  1 00:01 .
drwxrwxr-x   15 500      500          4096 Apr 18  2007 ..
crw-------    1 root     root       5,   1 Jan  1 04:58 console
srw-rw-rw-    1 root     root            0 Jan  1 00:01 log
brw-rw----    1 root     root       7,   0 Jan  1 00:01 loop0
brw-rw----    1 root     root       7,   1 Jan  1 00:01 loop1
brw-rw----    1 root     root       7,   2 Jan  1 00:01 loop2
brw-rw----    1 root     root       7,   3 Jan  1 00:01 loop3
brw-rw----    1 root     root       7,   4 Jan  1 00:01 loop4
brw-rw----    1 root     root       7,   5 Jan  1 00:01 loop5
brw-rw----    1 root     root       7,   6 Jan  1 00:01 loop6
brw-rw----    1 root     root       7,   7 Jan  1 00:01 loop7
crw-r--r--    1 root     root       1,   3 Jan  1 00:00 null
drwxr-xr-x    2 root     root           40 Jan  1 00:00 pts
brw-rw----    1 root     root       1,   0 Jan  1 00:01 ram0
brw-rw----    1 root     root       1,   1 Jan  1 00:01 ram1
brw-rw----    1 root     root       1,  10 Jan  1 00:01 ram10
brw-rw----    1 root     root       1,  11 Jan  1 00:01 ram11
brw-rw----    1 root     root       1,  12 Jan  1 00:01 ram12
brw-rw----    1 root     root       1,  13 Jan  1 00:01 ram13
brw-rw----    1 root     root       1,  14 Jan  1 00:01 ram14
brw-rw----    1 root     root       1,  15 Jan  1 00:01 ram15
brw-rw----    1 root     root       1,   2 Jan  1 00:01 ram2
brw-rw----    1 root     root       1,   3 Jan  1 00:01 ram3
brw-rw----    1 root     root       1,   4 Jan  1 00:01 ram4
brw-rw----    1 root     root       1,   5 Jan  1 00:01 ram5
brw-rw----    1 root     root       1,   6 Jan  1 00:01 ram6
brw-rw----    1 root     root       1,   7 Jan  1 00:01 ram7
brw-rw----    1 root     root       1,   8 Jan  1 00:01 ram8
brw-rw----    1 root     root       1,   9 Jan  1 00:01 ram9
crw-rw----    1 root     root     254,   0 Jan  1 00:01 rtc0
drwxr-xr-x    2 root     root           40 Jan  1 00:00 shm
dm17:/dev $ cd /sys
dm17:/sys $ ls
block     class     firmware  kernel    power
bus       devices   fs        module
dm17:/sys $ cd class/
dm17:/sys/class $ ls -la
drwxr-xr-x    9 root     root            0 Jan  1  1970 .
drwxr-xr-x   11 root     root            0 Jan  1  1970 ..
drwxr-xr-x    2 root     root            0 Jan  1 00:01 mem
drwxr-xr-x    2 root     root            0 Jan  1 00:01 misc
drwxr-xr-x    2 root     root            0 Jan  1  1970 mtd
drwxr-xr-x    4 root     root            0 Jan  1  1970 net
drwxr-xr-x    3 root     root            0 Jan  1  1970 rtc
drwxr-xr-x    3 root     root            0 Jan  1  1970 rtc-dev
drwxr-xr-x    2 root     root            0 Jan  1 00:01 tty
dm17:/sys/class $ cd tty/
dm17:/sys/class/tty $ ls -la
drwxr-xr-x    2 root     root            0 Jan  1 00:01 .
drwxr-xr-x    9 root     root            0 Jan  1  1970 ..
lrwxrwxrwx    1 root     root            0 Jan  1 00:01 console - 
 > ../../devices/virtual/tty/console
lrwxrwxrwx    1 root     root            0 Jan  1 00:01 ptmx -> ../../ 
devices/virtual/tty/ptmx
lrwxrwxrwx    1 root     root            0 Jan  1 00:01 tty -> ../../ 
devices/virtual/tty/tty
lrwxrwxrwx    1 root     root            0 Jan  1 00:01 ttyS0 - 
 > ../../devices/platform/serial8250.0/ttyS0
lrwxrwxrwx    1 root     root            0 Jan  1 00:01 ttyS1 - 
 > ../../devices/platform/serial8250.0/ttyS1
lrwxrwxrwx    1 root     root            0 Jan  1 00:01 ttyS2 - 
 > ../../devices/platform/serial8250.0/ttyS2
dm17:/sys/class/tty $ cat ttyS0/dev
4:64
dm17:/sys/class/tty $ cat /proc/devices
Character devices:
   1 mem
   4 ttyS
   5 /dev/tty
   5 /dev/console
   5 /dev/ptmx
10 misc
90 mtd
128 ptm
136 pts
254 rtc

Block devices:
   1 ramdisk
   7 loop
31 mtdblock

_______________________________________________
busybox mailing list
[email-masked]
http://busybox.net/cgi-bin/mailman/listinfo/busybox

---

From: Thomas Mathys <[email-masked]>
Date: Wed, 18 Apr 2007 19:29:56 +0200

Hello,

I had this problem too when I upgraded to a recent kernel, where sysfs 
heavily changed. The problem is, that  mdev does never follow symlinks 
(probably to keep mdev simple - sysfs is full of cycles caused by symlinks).

I did find a fix (forgive me for not sending it as a patch - I don't 
have access to that code right now):
Inside mdev.c is a function that recursively traverses sysfs. It 
descends only into entries that are NOT symlinks. I changed mdev.c, so 
that it does not descend into symlinks, UNLESS they're called subsystem.

Explanation:
- I observed that all the missing device nodes can be reached by 
following a symlink called subsystem
- And I observed that cycles in sysfs are never caused by the subsystem 
symlinks

Cheers
Thomas Mathys