shutdown busybox and start another PID1 process

Harald Becker ralda at gmx.de
Tue Aug 12 06:57:34 UTC 2014


Hi James !

 > This is very close to what I'm doing now.  The two changes are:
>
>    1) I boot into Debian so I switch_root into their /sbin/init
>       and I use "telinit u" to get back pid 1.

If that work, fine.  Not much difference, just use the init you like, 
the only question is how to shut down pid 1 in a resource saving way.

>    2) I copy busybox et al. into the new root before switching
>       so I don't need to unpack.

Nearly same if copying from your file system or from an archiv. Depends 
on your needs. I prefer to have a quick and simple unpack from a single 
file to get a working environment. Other info is then copied with a 
second cpio -p.

> BTW: I wrote a space invaders game in busybox-shell, although I
> cheated a little and wrote a tiny C program called getch that
> gives me non-blocking input.  Maybe there is already a way to
> do that built in.  If not, a getch applet might be very handy.

There are some neat stty/dd tricks and in addition the shell read has a 
timeout and a length option (never used the later). For the stty trick 
see the raw, min N and time N settings.

> It is a small thing but it is all that is needed to write
> truly interactive scripts with just busybox.  IMO it would
> open the door to some really neat things.

Sure, some carefully designed interactive tools would open up whole new 
worlds of interactive programming with nothing more than a single binary 
and a few configuration files. That is, why I add in some own 
functionality on my self build BB versions :) ... depending on what I 
need, but those applets are not "upstream" compatible, so there 
inclusion into main stream BB tend to get blocked. Not my decision.

--
Harald



More information about the busybox mailing list