how to reboot but leave same kernel (tell pid 1 to run /linuxrc again)?
Luciano Rocha
strange at nsk.no-ip.org
Wed Nov 21 15:36:10 UTC 2007
On Wed, Nov 21, 2007 at 10:46:11AM +0100, Frantisek Dufka wrote:
> Hello,
>
> I did google search and poked around in busybox init/* sources but still
> don't know how/if this is possible.
>
> I'd like to implement quicker reboot on Nokia 770 tablet without doing
> real reboot that goes through bootloader and kernel. For this I think I
> need to tell init to exec my script (as pid 1). How?
>
> 770 boot process is like
> - bootloader loads kernel (from /dev/mtdblock2)
> -kernel runs /linuxrc in /dev/mtdblock3 (uclibc system with busybox 1.00).
> - linuxrc does some stuff, mounts real root and then switches to it via
> pivot_root like this:
>
> cd /mnt/new_root
> pivot_root . mnt/initfs
> exec /usr/sbin/chroot . /sbin/init $def_runlevel <dev/console
> >dev/console 2>&1
>
> Real root filesystem has busybox 1.4.1 and glibc, /sbin/init is busybox
> init.
>
> what I'd like to do is put genie back to bottle, shutdown everything,
> pivot_root back to /dev/mtdblock3 (mounted to /mnt/initfs) and run
> /linuxrc as pid 1 again.
>
> First I implemented it as new runlevel an basically it works except when
> being back in /linuxrc I am not pid 1 and still have original init as
> pid 1 keeping old root busy and preventing me to boot different root
> again via same pivot_root trick and running different /sbin/init.
> Obviously init cannot be killed so it needs to be replaced.
>
> init/init.c has "static void exec_signal(int sig ATTRIBUTE_UNUSED)"
> which looks like code I need but I don't know how to invoke it with my
> script or binary.
In inittab, add something like:
::restart:/sbin/init
Then kill init with signal QUIT:
kill -QUIT 1
Then init will execute the program at /sbin/init, that can be a symlink
to /linuxrc in your mtdblock3, or change the inittab directoy.
--
lfr
0/0
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://lists.busybox.net/pipermail/busybox/attachments/20071121/84550e6b/attachment-0002.pgp
More information about the busybox
mailing list