[klibc] Weird early-boot sequence, can't find a way to adapt to ramfs

Joshua Hudson joshudson at gmail.com
Fri Apr 7 15:34:16 PDT 2006

This is most exceedingly weird boot/shutdown sequence that I used
once, and can't find
a way to adapt to initramfs. Since you guys are trying to adapt all
mechanisms that use
initrd to using initramfs, this should interest you.

initrd has (all binaries static):

 init halt mount poweroff pivot_root reboot sh umount
 fstab haltrc
 null zero tty tty0 tty1 console->tty0 hda1 loop0 ram0

contents of fstab:
/proc /proc proc defaults 0 0
/dev/hda1 /host ntfs umask=077 0 0
/host/linux/root.img ext2 ro 0 0

contents of /linuxrc:
# This part normal
mount /host
mount /root
cd /root
pivot_root /root /root/initrd

# This part unusual
exec /initrd/bin/init

end of systems /etc/rc.d/rc.0 (rc.6 -> rc.0):
halt -w
umount -a
# Because /initrd is not in host's /etc/mtab, it's still there
cd /initrd
pivot_root /initrd /initrd/root
exec /bin/sh /etc/haltrc $RUNLEVEL < dev/console > dev/console 2>&1

contents of /etc/haltrc:
umount -a
case $RUNLEVEL in
 0) poweroff -f ;;
 6) reboot -f ;;

More information about the klibc mailing list