Here is a copy of the rc.rofileysys as it is on my zaurus, and then copied to a CF so that I can copy/paste it to here:
#!/bin/bash
#export PATH=$PATH:/usr/sbin.rom:/usr/bin.rom
LINUXFMT=ext2
#LINUXFMT=ext3
MKE2FSOPT=
if [ "$LINUXFMT" = "ext3" ]; then
MKE2FSOPT=-j
fi
#
# get device pcmcia_slot
# format: get_dev_pcmcia_slot [slot number]
# slot number: 0, 1
# output: device name (hda or hdc)
#
get_dev_pcmcia()
{
while read SOCKET CLASS DRIVER INSTANCE DEVS MAJOR MINOR;
do
echo $DEVS
done
}
get_dev_pcmcia_slot()
{
grep "^$1" /var/lib/pcmcia/stab | get_dev_pcmcia
}
RW_MTD_LINE=`cat /proc/mtd | grep "home" | tail -n 1`
if [ "$RW_MTD_LINE" = "" ]; then
RW_MTD_LINE=`cat /proc/mtd | grep "\<NAND\>.*\<2\>" | tail -n 1`
fi
RW_MTD_NO=`echo $RW_MTD_LINE | cut -d: -f1 | cut -dd -f2`
RW_MTD_SIZE_HEX=`echo $RW_MTD_LINE | cut -d" " -f2`
RW_MTD=/dev/mtd$RW_MTD_NO
RW_MTDBLK=/dev/mtdblock$RW_MTD_NO
RW_MTD_SIZE=`dc 0x$RW_MTD_SIZE_HEX 1024 /`
initlog -s $"found $RW_MTD ${RW_MTD_SIZE}\"Kbyte\""
#echo "ZAURUS_RESET=$ZAURUS_RESET RW_MTD_NO=$RW_MTD_NO RW_MTD_SIZE_HEX=$RW_MTD_SIZE_HEX"
#ZAURUS_RESET=HARD
if [ "$ZAURUS_RESET" = "HARD" ]; then
STRING=$"Starting filesystem: "
msg -n $STRING
# mount /home
/sbin/eraseall $RW_MTD 2> /dev/null > /dev/null
mount -t jffs2 -o rw,noatime $RW_MTDBLK /home
cd /
tar xf /root/.home_default.tar
# mount /dev
dd if=/dev/zero of=/dev/ram1 bs=1024 count=64 2> /dev/null > /dev/null
mkfs.minix -i 512 /dev/ram1 64 2> /dev/null > /dev/null
mount -t minix /dev/ram1 /dev
(cd /home ; tar cf - dev | (cd / ; tar xf -))
# mount /tmp
mount -t tmpfs -o size=1m none /dev/shm
mkdir /dev/shm/tmp
chmod 4777 /dev/shm/tmp
mkdir /dev/shm/run
touch /dev/shm/run/utmp
mkdir /dev/shm/run/usb
/etc/ledmode reset
# mount HDD
/etc/rc.d/init.d/pcmcia start
while [ "$IDE1" = "" ]; do
IDE1=`get_dev_pcmcia_slot 1`
done
if [ "$HDDCLEAR" = "YES" ]; then
dd if=/dev/zero of=/dev/${IDE1}2 > /dev/null 2> /dev/null
fi
mke2fs $MKE2FSOPT /dev/${IDE1}2 2> /dev/null > /dev/null
e2fsck -p /dev/${IDE1}2 > /dev/null
if [ "$HDDCLEAR" = "YES" ]; then
dd if=/dev/zero of=/dev/${IDE1}3 > /dev/null 2> /dev/null
fi
##mkfs.vfat -F 32 /dev/${IDE1}3 2> /dev/null > /dev/null
mount -t $LINUXFMT -o ro,noatime /dev/${IDE1}1 /hdd1
rc=$?
if [ "$rc" != "0" ]; then
echo -n "HDD1 Error!! "
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ "$DUMMY" = "" ]; do
sleep 1
done
fi
mount -t $LINUXFMT -o noatime /dev/${IDE1}2 /hdd2
rc=$?
if [ "$rc" != "0" ]; then
echo -n "HDD2 Error!! "
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ "$DUMMY" = "" ]; do
sleep 1
done
fi
##mount -t vfat -o noatime,quiet,umask=000,iocharset=utf8 /dev/${IDE1}3 /hdd3
rc=$?
if [ "$rc" != "0" ]; then
echo -n "HDD3 Error!! "
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ "$DUMMY" = "" ]; do
sleep 1
done
fi
if [ ! -f /hdd1/.sys/hdimage2.tgz ]; then
echo "Error!! HDD is not initialized!"
fi
cd /
gzip -dc /hdd1/.sys/hdimage2.tgz | tar xf -
sltime -clear
rc=$?
if [ "$rc" = "0" ]; then
success "$STRING"
else
failure "$STRING"
fi
msg
else
### SW Reset !
#STRING=$"Checking filesystem: "
# mount /home
mount -t jffs2 -o rw,noatime $RW_MTDBLK /home
# mount /dev
dd if=/dev/zero of=/dev/ram1 bs=1024 count=64 2> /dev/null > /dev/null
mkfs.minix -i 512 /dev/ram1 64 2> /dev/null > /dev/null
mount -t minix /dev/ram1 /dev
(cd /home ; tar cf - dev | (cd / ; tar xf -))
if [ -f /home/etc/restorepc ]; then
RESTORE_CONNECTION=`cat /home/etc/restorepc`
else
RESTORE_CONNECTION=""
fi
if [ "$RESTORE_CONNECTION" != "" ]; then
cp /home/etc/restoreip /dev/restoreip 2> /dev/null > /dev/null
cp /home/zaurus/Settings/Security.conf /dev/Security.conf 2> /dev/null > /dev/null
umount $RW_MTDBLK
/sbin/eraseall $RW_MTD 2> /dev/null > /dev/null
mount -t jffs2 -o rw,noatime $RW_MTDBLK /home
mount -t tmpfs -o size=1m none /dev/shm
mkdir /dev/shm/tmp
chmod 4777 /dev/shm/tmp
mkdir /dev/shm/run
touch /dev/shm/run/utmp
mkdir /dev/shm/run/usb
cd /
tar xf /root/.home_default.tar
rm -rf /home/zaurus/Applications/Contents/
/etc/ledmode reset
# mount HDD
/etc/rc.d/init.d/pcmcia start
while [ "$IDE1" = "" ]; do
IDE1=`get_dev_pcmcia_slot 1`
done
mount -t $LINUXFMT -o ro,noatime /dev/${IDE1}1 /hdd1
rc=$?
if [ "$rc" != "0" ]; then
echo -n "HDD1 Error!! "
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ "$DUMMY" = "" ]; do
sleep 1
done
fi
mke2fs $MKE2FSOPT /dev/${IDE1}2 2> /dev/null > /dev/null
e2fsck -p /dev/${IDE1}2 > /dev/null
mount -t $LINUXFMT -o noatime /dev/${IDE1}2 /hdd2
rc=$?
if [ "$rc" != "0" ]; then
echo -n "HDD2 Error!! "
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ "$DUMMY" = "" ]; do
sleep 1
done
fi
cd /
# Documents files are discarded...
gzip -dc /hdd1/.sys/hdimage2.tgz | tar xf -
## mount -t vfat -o noatime,quiet,umask=000,iocharset=utf8 /dev/${IDE1}3 /hdd3
rc=$?
if [ "$rc" != "0" ]; then
echo -n "HDD3 Error!! "
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ "$DUMMY" = "" ]; do
sleep 1
done
fi
if [ ! -f /hdd1/.sys/hdimage2.tgz ]; then
echo -n "Error!! HDD is not initialized!"
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ "$DUMMY" = "" ]; do
sleep 1
done
fi
rm /home/zaurus/Settings/route.conf 2>/dev/null >/dev/null
echo -n $RESTORE_CONNECTION > /home/zaurus/Settings/route.conf
touch /home/etc/restorepc
mv /dev/restoreip /etc/hotplug/usbdnet.conf 2> /dev/null > /dev/null
mv /dev/Security.conf /home/zaurus/Settings/Security.conf 2> /dev/null > /dev/null
else
# mount /tmp
mount -t tmpfs -o size=1m none /dev/shm
mkdir /dev/shm/tmp
chmod 4777 /dev/shm/tmp
mkdir /dev/shm/run
touch /dev/shm/run/utmp
mkdir /dev/shm/run/usb
/etc/ledmode reset
# mount HDD
/etc/rc.d/init.d/pcmcia start
while [ "$IDE1" = "" ]; do
IDE1=`get_dev_pcmcia_slot 1`
done
mount -t $LINUXFMT -o ro,noatime /dev/${IDE1}1 /hdd1
rc=$?
if [ "$rc" != "0" ]; then
echo -n "HDD1 Error!! "
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ "$DUMMY" = "" ]; do
sleep 1
done
fi
mount -t $LINUXFMT -o noatime /dev/${IDE1}2 /hdd2
rc=$?
if [ "$rc" != "0" ]; then
echo -n "HDD2 Error!! "
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ "$DUMMY" = "" ]; do
sleep 1
done
fi
## mount -t vfat -o noatime,quiet,umask=000,iocharset=utf8 /dev/${IDE1}3 /hdd3
rc=$?
if [ "$rc" != "0" ]; then
echo -n "HDD3 Error!! "
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ "$DUMMY" = "" ]; do
sleep 1
done
fi
if [ ! -f /hdd1/.sys/hdimage2.tgz ]; then
echo -n "Error!! HDD is not initialized!"
/bin/ledctl ledmode 0
/bin/ledctl alarm 1
while [ "$DUMMY" = "" ]; do
sleep 1
done
fi
fi
fi
echo $LAUNCH > /home/sharp/etc/launch.default