#!/bin/sh ## Lars Kellogg-Stedman ## $Id: linuxrc,v 1.6 2001/11/28 21:05:25 lars Exp lars $ ## ## This is the linuxrc script I use to boot up my root-on-LVM ## system. If you pass the 'rescue' parameter on the kernel ## command line, you will get a shell prompt before continuing ## with the normal (post-initrd) boot process. ROOTDEV=/dev/vg00/root MODDIR=/lib/modules MODULES="scsi_mod sd_mod aic7xxx md xor raid5 lvm-mod" RCSID='$Id: linuxrc,v 1.6 2001/11/28 21:05:25 lars Exp lars $' PATH=/bin:/sbin; export PATH STARTSHELL=0 ## We need to mount /proc before running busybox --install. busybox mount -t proc none /proc busybox echo "** Setting up busybox links..." busybox --install -s || { echo "## BUSYBOX install failed!" >&2 exec /bin/sh } cat < ** $RCSID ** EOF ## check for the 'rescue' parameter on the kernel command line. grep rescue /proc/cmdline > /dev/null 2>&1 && STARTSHELL=1 echo "** Loading modules..." for m in $MODULES; do echo " $m module..." insmod ${MODDIR}/${m}.o done echo echo "** Activating RAID and LVM..." raidstart -a && vgscan && vgchange -a y echo "** Mounting root filesystem..." mount -o ro -t xfs $ROOTDEV /sysroot || STARTSHELL=1 if [ $STARTSHELL -eq 1 ]; then ## Start a rescue shell. We mount a tmpfs filesystem ## on /tmp as a place for command output, etc., since ## the ramdisk may be mostly full. mount -t tmpfs none /tmp echo "** Starting shell (exit to continue)..." /bin/sh umount /tmp fi echo echo "** Booting..." echo ## This comes straight from the RedHat initrd. This tells the kernel ## that the ramdisk (device major == 1, minor == 0) is the root filesystem. ## What we're reallying doing is tricking the kernel into not trying to ## mount root on its own, since with the pivot_root command, below, ## we replace the ramdisk root with our real root filesystem. echo 0x0100 > /proc/sys/kernel/real-root-dev umount /proc cd /sysroot pivot_root . initrd