[BusyBox] busybox init/linuxrc and 2.4.x kernel

Andreas Neuhaus andy at fasta.fh-dortmund.de
Thu Mar 15 02:06:33 UTC 2001


dear all,

i recently have some problems with busybox' init on 2.4 kernels. as far as i
read from busybox/init.c, busybox may be called as init if pid==1 or as
linuxrc if called as /linuxrc (suppose Config.h is set properly). now, the
kernel 2.4.2 Documentation/initrd.txt tells me about the "new way" to change
the root dir, called pivot_root:

linuxrc does never exit, instead it pivot_root the new root and execs
/sbin/init. here's exactly what i'm trying:

my initrd contains a romfs filesystem with uClibc in /lib and busybox in
/bin. my /linuxrc is a binary (no shell script) which does:
- load some modules (works)
- create a ramfs on /newroot: mount("/dev/rd/1", "/newroot", "ramfs", 0,
NULL); (works)
- copy all files from / to /newroot (works)
- change root to /newroot (works):
   chdir("/newroot");
   pivot_root(".", "initrd");
   chroot(".");
- create busybox links (works)
- execl("/sbin/init", "/sbin/init", NULL); (FAILS!)

because it's linuxrc starting init, the current pid is not 1 (7 in my case)
and busybox init does not run (shows usage()). if i change my execl call to
execl("/sbin/init", "/linuxrc", NULL); it makes busybox think it was called
as linuxrc and it displays an error: linuxrc: applet not found. (yes,
Config.h is ok and linuxrc support is compiled in).

did i misunderstand the new 2.4.x initrd concept or is it true that init is
now not longer forced to be at pid 1? does busybox not work as init for
2.4.x kernels or is it just me misunderstanding something?

regards,
andreas neuhaus
--
Life could be so much easier if we could just look at the source code...
  .~.
  /V\    Andreas Neuhaus, FaStA Informatik FH-Dortmund
 // \\    Sonnenstr. 96, D-44139 Dortmund, Tel 0231/9112-734
/(   )\    System-Administration FaStA FH-Dortmund
^^-^^
 LINUX - Don't fear the penguin






More information about the busybox mailing list