2.4 kernel style boot using pivot_root (RFC)

Michal Moskal malekith at pld.org.pl
Fri Mar 8 12:15:53 CET 2002


Hi,

Yesterday qboosh suggested me some additions to bsp to allow pivot_root
style boot using it. I thought it would be funny to have system booted up
this way, so I did it :)

There were some more or less severe problems during it.

  1) old root (initrd) has to be placed somewhere on real root, I suggest
     /var/lib/bsp/oldroot [RFC]
     
  2) we cannot unmount old root while bsp is running, I first thought we
     can unmount and freeramdisk old root in rc-scripts, however there is
     no standalone freeramdisk utility and even beside it, unmounting in
     rc-scripts seems messy, so I decided to use two stage bsp bootup.
     Bsp from initrd, at end of its life does exec /sbin/bsp (from real
     root filesystem, in the meantime we have to close /dev/console but
     this ain't problem), that unmounts oldroot, frees ramdisk and does
     exec /sbin/init. This works :) anyway RFC.
  
  3) there is problem with devfs. We can mount it in stage 1, unmount
     before trying to unmount oldroot, and mount it again in real root,
     so we don't have to have /dev/ram0 and /dev/console on root filesystem,
     but what then? leave it mounted? what about people not using it?
     and what if there is not devfs in kernel? RFC

  4) after boot:
     [malekith at roke ~]$ ls -l /dev/root
     lr-xr-xr-x    1 root     root            4 Jan  1  1970 /dev/root -> rd/0
     [malekith at roke ~]$ 

     I guess this is problem with devfsd.

  5) we have to use root=/dev/ram0 in lilo, and put bsp as /sbin/init on
     initrd. (otherwise kernel would never free up memory used for bootup).

  6) directory to put old root in, could be created automagicly by bsp,
     we would have to mount root read-write, create the directory,
     and in stage 2 remove it and mount root read-only. But I guess this
     isn't very bright idea (to mess with writing root before fsck
     has a chance to run).

Tests were done on 2.4.17-2, almost stock (rpm -bb kernel.spec), but compiled 
with gcc-3.0.4.

Any comments are welcome.

More detailed information can be found in cvs://bsp/README

-- 
: Michal Moskal :::::::: malekith/at/pld.org.pl :  GCS {C,UL}++++$ a? !tv
: PLD Linux ::::::: Wroclaw University, CS Dept :  {E-,w}-- {b++,e}>+++ h



More information about the pld-devel-en mailing list