Skip to contentSkip to conversation

mdev problem in 2011.08 ?

Buildroot Pierre Ficheux 2 participants 4 messages Sep 18, 2011

lore
Share & tools
lore
#0 lore raw

Hi all,

May be I'm wrong but it seems there is a problem when using mdev for /dev management:

/dev management (Dynamic using mdev)

The /dev/null device is needed by /etc/inittab when mounting /proc and /sys. As it does not exist because S10mdev is started later, /sys is not mounted and mdev -s does not work.

# Startup the system
null::sysinit:/bin/mount -t proc proc /proc null::sysinit:/bin/mount -o remount,rw / # REMOUNT_ROOTFS_RW null::sysinit:/bin/mkdir -p /dev/pts null::sysinit:/bin/mkdir -p /dev/shm null::sysinit:/bin/mount -a null::sysinit:/bin/hostname -F /etc/hostname

# now run any rc scripts
::sysinit:/etc/init.d/rcS

I fixed it for my test by adding the following line to /etc/inittab

::sysinit:/bin/mknod /dev/null c 1 3

regards

Signature · 4 lines
Pierre FICHEUX -/- CTO OW/OWI, France -\- pierre.ficheux at openwide.fr
                                         http://ingenierie.openwide.fr
                                         http://www.ficheux.org
I would love to change the world, but they won't give me the source code
#1 lore raw

Hello Pierre,

Le Sun, 18 Sep 2011 15:01:51 +0200,
Pierre Ficheux <[email protected]> a ?crit :

Quoted 2 lines

May be I'm wrong but it seems there is a problem when using mdev for /dev management:

For our mdev and udev support, we assume that the kernel is compiled with CONFIG_DEVTMPFS and CONFIG_DEVTMPFS_MOUNT. For kernels built by Buildroot, this is ensured by :

        $(if $(BR2_ROOTFS_DEVICE_CREATION_STATIC),,
                $(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS,$(@D)/.config)
                $(call KCONFIG_ENABLE_OPT,CONFIG_DEVTMPFS_MOUNT,$(@D)/.config))

in linux/linux.mk.

For kernels built outside of Buildroot, it's up to the user to enable those options. In your case, I guess your kernel lacks devtmpfs support and/or the option to have devtmpfs mounted automatically at boot time, and this explains why the /dev/null device is missing.

Regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com
#2 lore raw

Le 18/09/11 16:28, Thomas Petazzoni a ?crit :

Quoted 10 lines

Hello Pierre,

Le Sun, 18 Sep 2011 15:01:51 +0200,
Pierre Ficheux <[email protected]> a ?crit :

Quoted 2 lines

May be I'm wrong but it seems there is a problem when using mdev for /dev management:

For our mdev and udev support, we assume that the kernel is compiled with CONFIG_DEVTMPFS and CONFIG_DEVTMPFS_MOUNT.

Kernel config looks fine:

$ grep DEVTMPFS output/build/linux-2.6.34.5/.config
CONFIG_DEVTMPFS=y
CONFIG_DEVTMPFS_MOUNT=y

But I still have:

Freeing unused kernel memory: 328k freed can't open /dev/null: No such file or directory can't open /dev/null: No such file or directory can't open /dev/null: No such file or directory can't open /dev/null: No such file or directory can't open /dev/null: No such file or directory can't open /dev/null: No such file or directory Starting logging: OK
Starting mdev...
mdev: /sys/class: No such file or directory

I test with QEMU + rootfs.cpio, does it matter?

Signature · 4 lines
Pierre FICHEUX -/- CTO OW/OWI, France -\- pierre.ficheux at openwide.fr
                                         http://ingenierie.openwide.fr
                                         http://www.ficheux.org
I would love to change the world, but they won't give me the source code
#3 lore raw

Le Sun, 18 Sep 2011 18:44:59 +0200,
Pierre Ficheux <[email protected]> a ?crit :

Quoted 1 line

I test with QEMU + rootfs.cpio, does it matter?

So you're using the rootfs.cpio as an initrd/initramfs ?

If yes, then yes, it matters. The thing is that the kernel does not automount the devtmpfs filesystem when an initramfs is present. So, in Buildroot, we have an "init" wrapper script in fs/initramfs/init which mounts devtmpfs and does some other things before starting the real init process. However, this script is only used when you generate an initramfs bundled into a kernel image generated by Buildroot. If you generate a .cpio filesystem, this trick is not applied.

However, Arnout Vandecappelle has recently contributed 2 patches that fix this by refactoring the initramfs and cpio support in Buildroot. See:

From: "Arnout Vandecappelle (Essensium/Mind)" <[email protected]>
To: buildroot at busybox.net
Subject: [Buildroot] [PATCH 1/2] cpio: fix boot with dynamic /dev
Date: Tue, 6 Sep 2011 23:16:08 +0200

From: "Arnout Vandecappelle (Essensium/Mind)" <[email protected]>
To: buildroot at busybox.net
Subject: [Buildroot] [PATCH 2/2] fs/initramfs: refactor with fs/cpio
Date: Tue, 6 Sep 2011 23:16:09 +0200

The PATCH 1/2 should fix your problem, but on the long term, I think PATCH 2/2 is the way to go. If you have the time to test and Ack those patches, it would be nice!

Regards,

Thomas

Signature · 4 lines
Thomas Petazzoni, Free Electrons
Kernel, drivers, real-time and embedded Linux
development, consulting, training and support.
http://free-electrons.com