shutdown busybox and start another PID1 process

Rieker Flaik rieker_flaik at arcor.de
Sat Aug 9 11:02:28 UTC 2014


Greetings,

I want to use busybox as a "pre-OS" before my actual system starts up,
so that I can do backups and stuff.

Currently, I'm able to start busybox from an initramfs. I hacked a small
shellscript which serves as "/init" that finally execs a shell. 
 
There I can exec busybox its normal init "/sbin/init". This is what I
want to use in this pre-OS, having a nice init system to spawn all kinds
of programs like udhcp and dropbear to do the backup stuff.

After doing the backup stuff in this pre-OS, I want to go on in the
boot-process and actually start the normal Debian OS.

A normal initramfs would do:
 exec switch_root /mnt /sbin/init

But here I can't do that because /sbin/init has taken over PID 1 and
spawned processes. So I first have to shut this "pre-OS" down before
booting into the next.

Here is my question:

Is there a way to kill all processes and start a shellscript as PID 1
again? Maybe by tweaking /etc/inittab and its restart option? Or do I
need to hack the source in busybox-1.22.0/init/init.c?

Thanks
rik



More information about the busybox mailing list