Modifying init to create /dev/console ?

Terry Barnaby terry1 at beam.ltd.uk
Wed Feb 28 21:29:45 UTC 2007


David Daney wrote:
> Terry Barnaby wrote:
>> Mike Frysinger wrote:
>>> On Tuesday 27 February 2007, Terry Barnaby wrote:
>>>> However, init and other programs obviously require /dev/console (and
>>>> other /dev entries).
>>> they dont require /dev/console
>>>
>>>> I was wondering about adding an option to init where it would create a
>>>> tmpfs file system, mount it on /dev and create a /dev/console node 
>>>> if no
>>>> /dev/console was found. I guess it could do a bit more and function as
>>>> udev as well.
>>> it wouldnt work ... the kernel opens up /dev/console before executing 
>>> init, so even if /sbin/init created the device node, it wouldnt matter
>>>
>>> also, this is what init scripts are for ... such / policy handling 
>>> does not belong hardcoded in the C code
>>> -mike
>>
>> No, they don't require /dev/console just to operate, but if you want 
>> debug printout they do :)
>>
>> Init could easily reopen its controlling terminal to the created 
>> /dev/console and continue ...
>>
>> The reason I was looking at getting init to create /dev/console was so 
>> that I could debug my init scripts that are not working when 
>> /dev/console does not exist ...
>>
> 
> Why do you think what Make says is false?  All your posts on this 
> subject are premised on that false belief.
> 
> I think it is time that you change your assumption that you can boot a 
> system that does not contain /dev/console in its root file system.  You 
> cannot do it with a standard Linux kernel.
> 
> As I see it you have two choices:
> 
> 1) Put /dev/console in your root filesystem.
> 2) Hack up your kernel so that /dev/console is not needed.
> 
> David Daney

Hi,

Because, you can !
You can boot a system without /dev/console and get init to create the 
basic /dev/console and continue. At least with the 2.6.19 kernel. My 
patch to the Busybox init later in this thread does this and with an 
un-modified kernel (in fact a standard Fedora 6 binary kernel).

I can now boot my system without any /dev nodes in sight. Init mounts a 
tmpfs file system on /dev and creates the two necessary nodes 
/dev/console and /dev/null and the rcS init script creates the rest.
However, being new to Busybox I'm not sure that this is the best 
approach ...

Cheers

Terry



More information about the busybox mailing list