FakeInit Applet

Alexander Surma surma at drebesium.org
Tue Nov 18 17:08:21 UTC 2008


Hi list,

I'm debugging my own little distribution (if you can call it that already)
- the initramfs to be specific.
My script for the creation of a initramfs uses busybox, and I want a add a
certain FakeInit (as I call it), which is nothing else as a mapping of the
init-call to the default shell, so that instead of running init you are
being dropped to a shell.

Since it is the smartest thing (regarding size and clarity) to implement
that in bb directly, I just added a APPLET_ODDNAME to (almost) achieve
what I was aiming for.

My question to you is: My implementation has ash hardcoded as jumpback.
That's not so bad since ash is almost all the time the shell of choice,
but I want this to work with every shell (preferebly the one that has been
chosen as default shell). How do I do that? Is there some macro-ism to do
that? Or is it cleaner to write a little c-function which just passes the
call onto the default shell? What would you rather see added to your
bb-code tree?

Sincerely,
Alexander Surma, GER

PS: I'm do not want this to get into the main tree, it's intended for
personal use, however, I want it fit in to the source tree.

== SNIP busybox-1.13.0-fakeinit.diff ==
diff -r ./busybox-1.13.0/include/applets.h
./busybox-1.13.0_ORIG/include/applets.h
24a25
>
78d78
< USE_ASH(APPLET_ODDNAME(init, ash, _BB_DIR_SBIN, _BB_SUID_ALWAYS, ash))
diff -r ./busybox-1.13.0/init/Config.in ./busybox-1.13.0_ORIG/init/Config.in
8,18d7
< config FAKE_INIT
<       bool "Spawn a shell instead of an actual init process"
<       default n
<       help
<         In some working environments, like a debug initramfs,
<         it might be useful to get to a shell directly instead
<         of going through all the init stages (since the bug
<         you want to fix may be hiding in there).
<         Usually, you should say N here, and go with the actual
<         init.
<
22d10
<       depends on !FAKE_INIT
== SNIP ==




More information about the busybox mailing list