#!/bin/sh # Netbook LX initial ramdisk boot script panic() { echo $1 *ABORTING* - Emergency shell exec /bin/sh exit } #linux 2.4 specific linux24_specific() { #add keyboard modules /sbin/modprobe i2c > /dev/null /sbin/modprobe i2ckbd > /dev/null #start pcmcia stuff /sbin/cardmgr -o -q } #linux 2.6 specific linux26_specific() { # temporary measure, anounce ourselves echo "Running Linux 2.6 System" echo "System is starting Kernel 2.6" > /dev/tty0 # we seem to need to run cardmgr twice? /sbin/cardmgr -o -q # /sbin/cardmgr -o -q } #mount and check # mount_n_check mount_n_check() { MOUNTOPTS=$1 shift DEVICE=$1 shift MOUNTPT=$1 shift # TODO: check ${MOUNTPT} isnt in use # if ( cat /proc/mounts | cut -d " " -f 2 | grep -q "^${MOUNTPT}\$" );then echo it is; fi # damm - pity we dont have grep mount ${MOUNTOPTS} ${DEVICE} ${MOUNTPT} MNTERR=$? if [ ${MNTERR} -eq 0 ]; then #ok it mounted, is there anything of interest here? for FILE in $*; do if [ ! -x "${MOUNTPT}/${FILE}" ]; then # no file? need to unmount and return umount ${MOUNTPT} return 1 fi done return 0 fi return ${MNTERR} } #proc filesystem mount proc /proc -t proc if [ $? -ne 0 ];then panic "Unable to mount proc filesystem system" fi # work out what sort of system we're running on LINUXVER=`uname -r | cut -d. -f1-2` if [ "${LINUXVER}" = "2.6" ]; then linux26_specific ${LINUXVER} else linux24_specific ${LINUXVER} fi # PsionLX release (2026): Psion's original ran /NBLXLoad.sh from the card's # first partition here, if present. That script is Psion's installer for the # internal NAND flash. Removed, so no file on a card can make this boot write # the NAND. # mount root filesystem # PsionLX release (2026): from the CF card ONLY. Psion's original tried the # internal NAND first and the card second; fuchs@gibson's March 2005 CF build # swapped them, card first and NAND as a fallback. This build never touches # the NAND at all: if the card's second partition will not mount, it stops at # the emergency shell instead. No /bin/sh check, as in fuchs's build -- an # absolute /sbin/init symlink resolves against this ramdisk, not the card. mount_n_check "-o ro" /dev/hda2 /rootfs if [ $? -ne 0 ]; then panic "Unable to mount the root filesystem from the CF card (/dev/hda2)" fi #start the real init if [ -d /rootfs/initrd ]; then echo Pivoting filesystem umount /proc cd /rootfs /sbin/pivot_root . initrd if [ $? -ne 0 ];then panic "Unable to pivot to root filesystem" fi exec /usr/sbin/chroot . /sbin/init dev/console 2>&1 panic "chroot failed" else panic "Initrd mount point missing in root filesystem" fi