Modifying init to create /dev/console ?

Denis Vlasenko vda.linux at googlemail.com
Fri Mar 2 16:54:32 PST 2007


On Thursday 01 March 2007 07:49, Terry Barnaby wrote:
> > kernel booted with: init=/somewhere/fix_dev.sh
> > 
> > fix_dev.sh:
> > 
> > #!/bin/sh
> > mknod ... /dev/....
> > exec /sbin/init "$@"
> > 
> > No hacking in init! :)
> > 
> > Do you see any problems with this approach?
> 
> No problems I can see with this approach apart from the kernel boot line 
> needing changing in all places

Nope. Just rename /sbin/init to /sbin/init.binary,
place above script in /sbin/init, and exec /sbin/init.binary "$@"

> and I'm not sure if it will work across a
> switch_root. But, I do prefer getting init to do the work. Using init, I
> believe, is cleaner, simpler

I think that programming in C is not simpler than four-line shell script.
It's not easier and not faster to debug or to tailor for special cases
like yours.

> and more in keeping with what init is supposed to do

I still don't know what init is supposed to do. For some reason which
I still fail to understand, init has to handle this:

::shutdown:/how/to/shutdown...

but not this:

::network_config:/how/to/set/up/network...
::send_mail:/how/to/send/mail...
::pizza:/how/to/order/food...

Why? Why TERM/pause/KILL/pause/umount/shutdown sequence gets this
special treatment in init?
--
vda


More information about the busybox mailing list