[Buildroot] [PATCH] initramfs/init: make sure that 0, 1, 2 fds are available

Peter Korsgaard jacmet at uclibc.org
Thu Aug 4 19:52:43 UTC 2011


>>>>> "Thomas" == Thomas Petazzoni <thomas.petazzoni at free-electrons.com> writes:

 Thomas> As the kernel doesn't automatically mount devtmpfs when an initramfs
 Thomas> is used, commit 424888e47431db738f5f9b3c6392435bfce7a842 has
 Thomas> introduced a small wrapper script that mounts devtmpfs before starting
 Thomas> the real init.

 Thomas> Unfortunately, the problem is that in this case, the init process runs
 Thomas> without any 0, 1 and 2 file descriptors, so none of the
 Thomas> messages/errors printed by the various initialization scripts can be
 Thomas> seen. This is due to the fact the init process relies on 0, 1 and 2
 Thomas> being opened by the kernel before init is started. However, as
 Thomas> /dev/console isn't present on the filesystem at the time the kernel
 Thomas> tries to open the console to create the 0, 1 and 2 file descriptors,
 Thomas> the kernel fails on this and prints the famous "Warning: unable to
 Thomas> open an initial console".

 Thomas> The proposed workaround is to actually open 0, 1 and 2 to /dev/console
 Thomas> in the wrapper script, right after mounting the devtmpfs filesystem,
 Thomas> and before starting the real init. The "Warning" from the kernel is
 Thomas> still shown, but at least the messages from the init scripts are
 Thomas> visible.

Committed, thanks.

-- 
Bye, Peter Korsgaard



More information about the buildroot mailing list