Re-Exec init after pivot_root

Zoban Gubich zobangub at gmail.com
Tue Mar 20 14:01:22 PDT 2007


On 3/19/07, Denis Vlasenko <vda.linux at googlemail.com> wrote:
>
> Hi Mark,
>
> On Monday 19 March 2007 03:12, Mark Hinds wrote:
> > I'm using pivot_root to switch from a JFFS2 rootfs to tempfs rootfs
> > to do SW updates on the abobe JFFS2 rootfs. It was very handy to
> > restart init via re-exec'ing in a signal handler so I added a new signal
> > handler to busybox's init_main
> >
> > #ifdef CONFIG_FEATURE_INIT_REXEC
> >          signal(SIGINT, rexec_signal);
> > #endif
> >
> > rexec_signal does much of what shutdown does, except
> > when its done it exec's /sbin/init, and boom - we're
> > running in fresh init in the new pivot'd rootfs and can
> > do as I please to the JFFS2 rootfs.
> >
> > Questions:
> > 1. Does this make sense?
>
> Don't know, because I didn't fully understand what exactly
> are you trying to achieve. You pivot-rooted to tmpfs, and
> then... you want to send SIGINT to init in order to re-exec it?
> why? I obviously miss something here...


I tried doing the shutdown stuff external to init, but in the end
/mnt/oldroot/bin/busybox is still what init is running from.
This means I can't umount /mnt/oldroot, which intern means
I can't/shouldn't flash_eraseall /dev/mtd1 so I can do a rootfs
update.

Perhaps I should further clarify that my system boots to a read-only jffs2
rootfs.
This seems clean and simple to me, but does necessitate the
pivot_root/re-exec init
thing so I can re-write the jffs rootfs for major SW updates.

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://busybox.net/lists/busybox/attachments/20070320/32156404/attachment.htm 


More information about the busybox mailing list