Skip to contentSkip to conversation

no /dev/console; /dev/null when booting with initrd of type 'ext2'

Buildroot Thierry Bultel 5 participants 10 messages Oct 16, 2012 – Oct 17, 2012

lore
Share & tools
lore
#0 lore raw

Hi,

When booting with an initrd of type "ext2", as it is the case when using a generated ISO image,
the kernel (a 3.2.21 in my case) does not automagically create the "/dev/null" and "dev/console" entries,
whereas it does when using a cpio.

Would the solution be to always have these inodes created in 'device_table.txt' ?
(Works in my case, I do not plan to use the static table)

Or change the ISO generation for using cpio instead of ext2 ?

Thanks
Thierry

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20121016/175bc41e/attachment.html>

#1 lore raw
Quoted 3 lines · Thierry Bultel

Would the solution be to always have these inodes created in 'device_table.txt' ?
(Works in my case, I do not plan to use the static table)

The devtmpfs "file system" is usually a better approach.

Signature · 1 line
Richard Braun
#7 lore raw
In reply to Thierry Bultel
Quoted 1 line · Thierry Bultel

When booting with an initrd of type "ext2", as it is the case when using a generated ISO image,

ISO?

Quoted 2 lines

the kernel (a 3.2.21 in my case) does not automagically create the "/dev/null" and "dev/console" entries, whereas it does when using a cpio.

The kernel doesn't, but buildroot does. We copy fs/cpio/init to /init
for cpio (and initramfs) archives, because those are the ones that are normally used for initrd.

You can copy fs/cpio/init to /init in your post-build script, if you like.

Quoted 2 lines

Would the solution be to always have these inodes created in 'device_table.txt' ? (Works in my case, I do not plan to use the static table)

Not really: the kernel doesn't automount devtmps for initrd.

Quoted 1 line

Or change the ISO generation for using cpio instead of ext2 ?

There's no point in using ext2 for initrd, it just adds overhead.
So yes, switch to cpio.

Oh, now I see your point with the iso image: fs/iso9660 uses an ext2
initrd... Hm, that seems like a bad idea. Someone should rewrite that.

Regards,
Arnout

Signature · 6 lines
Arnout Vandecappelle                               arnout at mind be
Senior Embedded Software Architect                 +32-16-286540
Essensium/Mind                                     http://www.mind.be
G.Geenslaan 9, 3001 Leuven, Belgium                BE 872 984 063 RPR Leuven
LinkedIn profile: http://www.linkedin.com/in/arnoutvandecappelle
GPG fingerprint:  7CB5 E4CC 6C2E EFD4 6E3D A754 F963 ECAB 2450 2F1F
#2 lore raw
In reply to Richard Braun

Le 16/10/2012 16:23, Richard Braun a ?crit :

Quoted 6 lines · Thierry Bultel
Quoted 3 lines

Would the solution be to always have these inodes created in 'device_table.txt' ?
(Works in my case, I do not plan to use the static table)

The devtmpfs "file system" is usually a better approach.

I have CONFIG_TMPFS and , and CONFIG_DEVTMPFS_MOUNT, and it works with everything but initrd of type "ext2"

I am thus asking 2 questions to myself
1) Why does the ISO image imply an ext2 initrd , instead of a cpio ?
2) Why does ext2 not work with devtmpfs (the answer is likely somewhere in the kernel sources and I will take a look as well) ?

Regards
Thierry
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.busybox.net/pipermail/buildroot/attachments/20121016/e479d661/attachment.html>

#3 lore raw
Quoted 2 lines · Thierry Bultel

2) Why does ext2 not work with devtmpfs (the answer is likely somewhere in the kernel sources and I will take a look as well) ?

A common mistake is forgetting to select the "mount devtmpfs at boot time" option (CONFIG_DEVTMPFS_MOUNT).

Signature · 1 line
Richard Braun
#4 lore raw

Dear Richard Braun,

Quoted 6 lines · Richard Braun
Quoted 2 lines · Thierry Bultel

2) Why does ext2 not work with devtmpfs (the answer is likely somewhere in the kernel sources and I will take a look as well) ?

A common mistake is forgetting to select the "mount devtmpfs at boot time" option (CONFIG_DEVTMPFS_MOUNT).

Yes, but Thierry explicitly said he enabled this option, re-read the e-mail you're replying to :)

Maybe the devtmpfs mounting done by CONFIG_DEVTMPFS_MOUNT does not take place when an initrd is used? I honestly don't know, I don't use initrd personally.

Thomas

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

Yes, but Thierry explicitly said he enabled this option, re-read the e-mail you're replying to :)

Woah, right sorry, time to sleep. Good luck.

Signature · 1 line
Richard Braun
#6 lore raw
In reply to Thomas Petazzoni
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line

"Thomas" == Thomas Petazzoni <[email protected]> writes:

Hi,

Thomas> Maybe the devtmpfs mounting done by CONFIG_DEVTMPFS_MOUNT does Thomas> not take place when an initrd is used? I honestly don't know, I Thomas> don't use initrd personally.

I also don't use initrd's, but it's atleast not done for initramfs (which is why we have the pre-init script in fs/cpio/init).

Signature · 1 line
Bye, Peter Korsgaard
#8 lore raw
In reply to Arnout Vandecappelle

Le 16/10/2012 18:09, Arnout Vandecappelle a ?crit :

Quoted 24 lines · Thierry Bultel
Quoted 2 lines

When booting with an initrd of type "ext2", as it is the case when using a generated ISO image,

ISO?

Quoted 3 lines

the kernel (a 3.2.21 in my case) does not automagically create the "/dev/null" and "dev/console" entries,
whereas it does when using a cpio.

The kernel doesn't, but buildroot does. We copy fs/cpio/init to /init
for cpio (and initramfs) archives, because those are the ones that are normally used for initrd.

You can copy fs/cpio/init to /init in your post-build script, if you
like.

Quoted 3 lines

Would the solution be to always have these inodes created in 'device_table.txt' ?
(Works in my case, I do not plan to use the static table)

Not really: the kernel doesn't automount devtmps for initrd.

Quoted 7 lines
Quoted 1 line

Or change the ISO generation for using cpio instead of ext2 ?

There's no point in using ext2 for initrd, it just adds overhead.
So yes, switch to cpio.

Oh, now I see your point with the iso image: fs/iso9660 uses an ext2
initrd... Hm, that seems like a bad idea. Someone should rewrite that.

FYI, I have hacked into "iso9660.mk"

diff -r1.1.1.1 iso9660.mk
18c18
< $(BINARIES_DIR)/rootfs.iso9660: host-cdrkit host-fakeroot linux rootfs-ext2 grub
---

Quoted 1 line

$(BINARIES_DIR)/rootfs.iso9660: host-cdrkit host-fakeroot linux

rootfs-cpio grub
22a23

25c26
< cp $(BINARIES_DIR)/rootfs.ext2 $(ISO9660_TARGET_DIR)/initrd
---

Quoted 1 line
    cp $(BINARIES_DIR)/rootfs.cpio $(ISO9660_TARGET_DIR)/initrd

and it works perfectly without having to use the "device_table_dev.txt"

The other thing that is missing here is that the iso9660 build does not support the grub splashscreen.

Quoted 3 lines

Regards,
Arnout

#9 lore raw

Dear Thierry Bultel,

Quoted 11 lines · Thierry Bultel

FYI, I have hacked into "iso9660.mk"

diff -r1.1.1.1 iso9660.mk
18c18
< $(BINARIES_DIR)/rootfs.iso9660: host-cdrkit host-fakeroot linux rootfs-ext2 grub
---

Quoted 1 line

$(BINARIES_DIR)/rootfs.iso9660: host-cdrkit host-fakeroot linux

rootfs-cpio grub
22a23

Quoted 7 lines

25c26
< cp $(BINARIES_DIR)/rootfs.ext2 $(ISO9660_TARGET_DIR)/initrd
---

Quoted 1 line
    cp $(BINARIES_DIR)/rootfs.cpio $(ISO9660_TARGET_DIR)/initrd

and it works perfectly without having to use the
"device_table_dev.txt"

Could you send a proper Git patch for that? See
http://elinux.org/Buildroot_how_to_contribute.

Thomas

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