From: Steve Kenton <skenton@ou.edu>
To: buildroot@busybox.net
Subject: [Buildroot] Where is /dev/console created when using devtmpfs?
Date: Fri, 27 Mar 2015 18:35:47 -0500 [thread overview]
Message-ID: <5515E953.2010207@ou.edu> (raw)
In-Reply-To: <5515D638.9090502@mind.be>
On 03/27/2015 05:14 PM, Arnout Vandecappelle wrote:
> On 27/03/15 05:14, Steve Kenton wrote:
>> On 03/26/2015 02:51 PM, Rob Landley wrote:
>>> On Wed, Mar 25, 2015 at 12:44 PM, Steve Kenton <skenton@ou.edu> wrote:
> [snip]
>>>> so I spent some time looking at my device usage and for the life of me
>>>> I can't find where /dev/console gets created during the build process.
>>>
>>> The console PID 1 inherits at process launch is the /dev/console in
>>> initramfs. When you don't have initramfs, the init/noinitramfs.c code
>>> literally does:
>> Yes, this is my configuration - initramfs not linked into kernel by buildroot
>> # BR2_TARGET_ROOTFS_INITRAMFS is not set
>
> Just to be clear "initramfs not linked into kernel" is BR2_TARGET_ROOTFS_CPIO,
> "initramfs linked into the kernel" is BR2_TARGET_ROOTFS_INITRAMFS. But for the
> purpose of the contents of the rootfs, that doesn't make a difference.
>
> But so in your case, Steve, I believe you _do_ have an initramfs, i.e. you have
> selected BR2_TARGET_ROOTFS_CPIO. Otherwise /dev/console wouldn't have been
> created :-).
I've been known to be confused once or twice :-)
Yes, BR2_TARGET_ROOTFS_CPIO was still explicitly set in my config from previous testing
and experimentation with initramfs even though BR2_TARGET_ROOTFS_INITRAMFS was not set.
Since BR2_TARGET_ROOTFS_INITRAMFS selects BR2_TARGET_ROOTFS_CPIO I must have been confused :-(
So even though I am currently using the tar version of the rootfs there is indeed
also a cpio version getting created and that process is where /dev/console comes from in
my on-disk rootfs. It should disappear when I clear the unneeded BR2_TARGET_ROOTFS_CPIO.
.../buildroot-2015.02/output/images$ ls -l
total 548980
-rw-rw-r-- 1 steve steve 5896640 Mar 26 22:44 bzImage
-rw-rw-r-- 1 steve steve 139560 Mar 22 19:59 grub.img
-rw-rw-r-- 1 steve steve 183162368 Mar 26 22:44 rootfs.cpio
-rw-rw-r-- 1 steve steve 213949440 Mar 26 22:44 rootfs.ext2
lrwxrwxrwx 1 steve steve 11 Mar 26 22:44 rootfs.ext4 -> rootfs.ext2
-rw-rw-r-- 1 steve steve 185610240 Mar 26 22:44 rootfs.tar
drwxr-xr-x 2 steve steve 4096 Mar 22 20:01 syslinux
Oops!
.../dev$ ls -l
total 4
crw--w--w- 1 root root 5, 1 Mar 25 22:54 console
lrwxrwxrwx 1 root root 10 Mar 1 15:26 log -> ../tmp/log
drwxrwxr-x 2 root root 4096 Mar 1 15:26 pts
And it makes sense now.
>
>>
>>>
>>> err = sys_mkdir((const char __user __force *) "/dev", 0755);
>>> if (err < 0)
>>> goto out;
>>>
>>> err = sys_mknod((const char __user __force *) "/dev/console",
>>> S_IFCHR | S_IRUSR | S_IWUSR,
>>> new_encode_dev(MKDEV(5, 1)));
>
> Note again that this stuff is only done when there is no initramfs. In other
> words, when there is an initramfs, this initramfs must contain /dev/console or
> you have no console.
>
> That's why buildroot adds it explicitly in fs/cpio/cpio.mk:
>
> PACKAGES_PERMISSIONS_TABLE += /dev/console c 622 0 0 5 1 - - -$(sep)
Ahhh! and that answers my original question of where the on-disk /dev/console come from.
Thanks everyone for the information.
Rob, my 2 cents worth says that todo item of yours is a good idea.
Steve
[snip]
next prev parent reply other threads:[~2015-03-27 23:35 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-03-25 17:44 [Buildroot] Where is /dev/console created when using devtmpfs? Steve Kenton
2015-03-26 19:51 ` Rob Landley
2015-03-27 4:14 ` Steve Kenton
2015-03-27 22:14 ` Arnout Vandecappelle
2015-03-27 23:35 ` Steve Kenton [this message]
2015-03-28 20:17 ` [Buildroot] Something odd about /dev/console creation Steve Kenton
2015-03-28 23:04 ` [Buildroot] Where is /dev/console created when using devtmpfs? Rob Landley
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=5515E953.2010207@ou.edu \
--to=skenton@ou.edu \
--cc=buildroot@busybox.net \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.