#!/bin/sh ###DEFAULTS### # Splash screens (if available) NFS_SPLASH="/etc/intimate/pics/IntimateSplashNFS.pnm" HDD_SPLASH="/etc/intimate/pics/IntimateSplashudrive.pnm" SPLASHER="/bin/pnmtofb" # Modules needed before cardmgr is run GENERIC_MODULES="h3600_generic_sleeve pcmcia_core ds h3600_ts" #IDE_CS_MODULES="" # not needed? # Where intimate lives, if it is on microdrive. (For nfsroot leave this as /dev/hda1) ROOTDEV="/dev/hda1" ROOTFS="auto" # Mono ipaqs will like this - swapon early, swapon often. ;) #SWAPDEV="" # Not needed for boot, most times # Some of us (ok, maybe just me) have to suspend before wvlan works. This prompts and pauses 5s. SUSPEND_PAUSE="N" # SUBROUTINES runfor() { limit=$1; shift echo RUNFOR ( $* #$* > /tmp/.limit.$$.out 2> /tmp/.limit.$$.err echo $? > /tmp/.limit.$$.res ) & sub=$! count=0 while [ $count -lt $limit ]; do sleep 1 count=$(($count+1)) [ -s /tmp/.limit.$$.res ] && count=$limit echo -n . done if [ -f /tmp/.limit.$$.res ]; then result=`cat /tmp/.limit.$$.res` else echo TIMEOUT echo TIMEOUT > /dev/vc/0 result=-1 kill $sub > /dev/null 2>&1 fi exit $result } getkey() { dd if=/dev/touchscreen/key bs=1 count=2 2>/dev/null | \ /usr/bin/tr \\001-\\017 A-X|/usr/bin/tr \\201-\\230 a-x } # START INTIMATE startintimate_usebinds() { echo "Starting INTIMATE using the BIND method" echo -n "Binding." echo "Starting INTIMATE using the BIND method" > /dev/vc/0 echo -n "Binding." > /dev/vc/0 for dir in bin etc home lib root sbin usr var; do mkdir -p /orig/$dir mount --bind /$dir /orig/$dir mount --bind /mnt/hda1/$dir /$dir echo -n "." done echo "Executing /sbin/init..." echo "Executing /sbin/init..." > /dev/vc/0 exec /sbin/init || { echo FAILED - REBOOTING; echo FAILED - REBOOTING > /dev/vc/0 ; sleep 15; reboot; } } startintimate_usepivot() { mount -n -t devfs none /mnt/hda1/dev pivot_root /mnt/hda1 /mnt/hda1/boot cd / if [ -f "$HDD_SPLASH" -a -x $SPLASHER ]; then # ln -s /dev/fb/0 /dev/fb0 $SPLASHER /$HDD_SPLASH else echo "Executing /sbin/init..." > /dev/vc/0 fi echo "Setting up pm off flash" echo "Setting up pm off flash" > /dev/vc/0 # pm_setup echo "Executing /sbin/init..." echo "Executing /sbin/init..." > /dev/vc/0 exec /sbin/init || { echo FAILED - REBOOTING; sleep 15; reboot; } } startintimate_ramfspivot() { set -x echo "Starting INTIMATE using RAMFS and PIVOT_ROOT" echo "Starting INTIMATE using RAMFS and PIVOT_ROOT" > /dev/vc/0 umount /mnt/hda1 mkdir -p /mnt/ramroot mount -n -t ramfs ramroot /mnt/ramroot mkdir -p /mnt/ramroot/.HDA1 mkdir -p /mnt/ramroot/boot mkdir -p /mnt/ramroot/dev mkdir -p /mnt/ramroot/flash mkdir -p /mnt/ramroot/proc mkdir -p /mnt/ramroot/tmp mount -n -t devfs devfs /mnt/ramroot/dev mount -n -t proc proc /mnt/ramroot/proc mount -n -t tmpfs tmpfs /mnt/ramroot/tmp mount -n $ROOTDEV /mnt/ramroot/.HDA1 echo -n "Binding." echo -n "Binding." > /dev/vc/0 for dir in bin boot etc home lib root sbin usr var; do mkdir -p /mnt/ramroot/$dir mount --bind /mnt/ramroot/.HDA1/$dir /mnt/ramroot/$dir echo -n " $dir" echo -n " $dir" > /dev/vc/0 done mkdir -p /mnt/ramroot/.oldroot pivot_root /mnt/ramroot /mnt/ramroot/.oldroot if ([ $? = "0" ]); then umount /.oldroot/dev umount /.oldroot/proc umount /.oldroot/mnt/* umount /.oldroot echo "Executing /sbin/init..." echo "Executing /sbin/init..." > /dev/vc/0 exec /sbin/init else echo FAILED - REBOOTING echo FAILED - REBOOTING > /dev/vc/0 sleep 15 reboot fi } pm_setup() { mount /flash 2> /dev/null echo /flash/sbin/pm_helper_i > /proc/sys/pm/helper echo /flash/sbin/hotplug_i > /proc/sys/kernel/hotplug } PATH=/bin:/sbin export GENERIC_MODULES IDE_CS_MODULES ROOTDEV ROOTFS SWAPDEV SYSPEND_PAUSE PATH ###END DEFAULTS### if [ -f /.intimateboot ]; then . /.intimateboot fi echo "Mounting /proc" #echo "Mounting /proc" > /dev/vc/0 mount -n /proc mount /mnt/ramfs mkdir /mnt/ramfs/tmp chmod +t /mnt/ramfs/tmp mkdir -p /mnt/ramfs/var/log/ksymoops mkdir /mnt/ramfs/var/run mkdir -p /mnt/ramfs/var/lib/pcmcia touch /var/run/pcmcia-scheme #KERNEL_VERSION=`uname -r` depmod -a modprobe pcmcia_core setup_delay=50 vcc_settle=100 modprobe sa1100_cs setup_delay=50 vcc_settle=100 if [ ".$GENERIC_MODULES" != "." ]; then for i in $GENERIC_MODULES; do modprobe $i done fi if [ ".$IDE_CS_MODULES" != "." ]; then for i in $IDE_CS_MODULES; do modprobe $i done fi if [ ".$SUSPEND_PAUSE" = ".Y" ]; then echo "Last chance to suspend and fix pcmcia..." echo "Last chance to suspend and fix pcmcia..." > /dev/vc/0 sleep 5 fi cardmgr -q -o -c /etc/pcmcia until [ "$action" != "" ]; do echo -- "-----------------------------------------------" echo "----------------------------------------" > /dev/vc/0 echo "What would you like to do?" echo "What would you like to do?" > /dev/vc/0 echo "CAL = INTIMATE (normal)" echo "CAL = INTIMATE (normal)" > /dev/vc/0 echo "TEL = FAMILIAR" echo "TEL = FAMILIAR" > /dev/vc/0 echo " Q = INTIMATE using the BIND method" echo " Q = INTIMATE using the BIND method" > /dev/vc/0 echo "--> = REBOOT" echo "--> = REBOOT" > /dev/vc/0 key=`getkey` [ "$key" = "Bb" ] && action="intimate" [ "$key" = "Cc" ] && action="familiar" [ "$key" = "Dd" ] && { action="intimate"; bind="yes"; } [ "$key" = "Ee" ] && action="reboot" [ "$key" = "Jj" ] && exec /bin/sh [ "$key" = "Ff" ] && { action="intimate"; bind="ram"; } [ "$action" = "intimate" -o "$action" = "intimatebind" ] && { cardmgr -q -o -c /etc/pcmcia if [ ! -b $ROOTDEV ]; then echo; echo "Can\'t find $ROOTDEV" echo "Can\'t find $ROOTDEV" > /dev/vc/0 echo "You could try re-seating the sleeve or the card/drive" echo "You could try re-seating the sleeve or the card/drive" /dev/vc/0 action="" fi } #action="intimate" done echo echo $action echo $action > /dev/vc/0 echo [ "$action" = "reboot" ] && exec /sbin/reboot if [ "$action" = "intimate" -a -b $ROOTDEV ] then # insmod -f /root/blkmtd-arm.o device=/dev/hda # mount -n -t jffs2 /dev/mtdblock/4 /mnt/hda1 mount -o noatime -n -t $ROOTFS $ROOTDEV /mnt/hda1 if [ $? -eq 0 -a -x /mnt/hda1/sbin/init ] then echo "Booting intimate from microdrive..." if [ "$bind" = "yes" ]; then startintimate_usebinds elif [ "$bind" = "ram" ]; then startintimate_ramfspivot else startintimate_usepivot fi else umount /mnt/hda1 >/dev/null 2>&1 fi else echo "Searching for intimate distribution over ethernet..." # echo "Searching for intimate distribution over ethernet..." > /dev/vc/0 if [ "."$NFSPATH = "." ]; then mount /mnt/nfs else mount -t nfs -o nolock,soft $NFSPATH /mnt/nfs fi if [ $? -eq 0 -a -x /mnt/nfs/sbin/init ] then mount -n -t devfs none /mnt/nfs/dev echo "Booting intimate from nfs..." # echo "Booting intimate from nfs..." > /dev/vc/0 pivot_root /mnt/nfs /mnt/nfs/boot cd / if [ -f "/$NFS_SPLASH" ]; then # ln -s /dev/fb/0 /dev/fb0 $SPLASHER /$NFS_SPLASH else echo "Executing /sbin/init..." > /dev/vc/0 fi # killall-by-pid function here killall -9 pump # This lets you unmount /boot and /ramfs - a Good Thing. -9 keeps it from # going weird and dropping the interface echo "Executing /sbin/init..." echo "Executing /sbin/init..." > /dev/vc/0 exec /sbin/init fi fi ###use the killall-by-pid func from init scripts killall pump # ..and add a remove-modules var? rmmod nfs >/dev/null 2>&1 rmmod pcnet_cs >/dev/null 2>&1 rmmod lockd >/dev/null 2>&1 rmmod 8390 >/dev/null 2>&1 rmmod ds >/dev/null 2>&1 rmmod sa1100_cs >/dev/null 2>&1 rmmod pcmcia_core >/dev/null 2>&1 echo ' ___ _ ___ ' echo ' / _/__ ___ _ (_) (_)__ _____' echo ' / _/ _ `/ ` \/ / / / _ `/ __/' echo '/_/ \_,_/_/_/_/_/_/_/\_,_/_/ ' echo ' ___ _ ___ ' > /dev/vc/0 echo ' / _/__ ___ _ (_) (_)__ _____' > /dev/vc/0 echo ' / _/ _ `/ ` \/ / / / _ `/ __/' > /dev/vc/0 echo '/_/ \_,_/_/_/_/_/_/_/\_,_/_/ ' > /dev/vc/0 echo "Loading floating point emulator..." echo "Loading floating point emulator..." > /dev/vc/0 /sbin/insmod nwfpe echo "Loading Unix socket support" echo "Loading Unix socket support" > /dev/vc/0 /sbin/insmod unix echo "Setting up RAMFS, please wait... " echo "Setting up RAMFS, please wait... " > /dev/vc/0 tar xfpz .ramfs.tar.gz -C /mnt/ramfs > /dev/null 2>&1 if [ ! -s /etc/inittab ] then echo "You are attemping to boot an incomplete system, starting a shell..." echo "You are attemping to boot an incomplete system, starting a shell..." > /dev/vc/0 mkdir /mnt/ramfs/tmp cd /tmp exec /bin/sh fi echo "Setting Date/Time from previous settings" echo "Setting Date/Time from previous settings" > /dev/vc/0 /bin/date -s "`/bin/cat /etc/lastdate`" echo "Setting up some links... houm" grep ln /linuxrc.familiar | sh echo "Executing /sbin/init..." echo "Executing /sbin/init..." > /dev/vc/0 exec /sbin/init