3 # **** DO NOT EVEN THINK OF EDITING OR REMOVING THIS FILE ****
4 # **** UNLESS YOU REALLY KNOW *EXACTLY* WHAT YOU ARE DOING. ****
7 # Determine the desired rootfs based on user flag files.
9 if [ -f /.sda1root ] ; then
10 /bin/echo "Preferred root device is /dev/sda1 (disk 1)"
13 elif [ -f /.sda2root ] ; then
14 /bin/echo "Preferred root device is /dev/sda2 (disk 1)"
17 elif [ -f /.sdb1root ] ; then
18 /bin/echo "Preferred root device is /dev/sdb1 (disk 2)"
21 elif [ -f /.sdb2root ] ; then
22 /bin/echo "Preferred root device is /dev/sdb2 (disk 2)"
25 elif [ -f /.nfsroot ] ; then
26 /bin/echo "Preferred root device is NFS"
30 /bin/echo "Preferred root device is jffs2"
36 # Perform prepatory tasks, and determine whether the desired rootfs is viable.
38 /bin/mount -t proc proc /proc
40 if [ $prefroot = "sda1" -o $prefroot = "sda2" -o $prefroot = "sdb1" -o $prefroot = "sdb2" ] ; then
41 /bin/echo "Sleeping while waiting for disk..."
43 while [ $cnt -gt 0 ] ; do
46 [ $prefroot = "sda1" ] && [ -f /proc/hd_conn ] && cnt=0
47 [ $prefroot = "sda2" ] && [ -f /proc/hd_conn ] && cnt=0
48 [ $prefroot = "sdb1" ] && [ -f /proc/hd2_conn ] && cnt=0
49 [ $prefroot = "sdb2" ] && [ -f /proc/hd2_conn ] && cnt=0
53 /bin/mount -rt ext3 /dev/$prefroot /mnt
54 if [ -L /mnt/sbin/init -o -x /mnt/sbin/init -o \
55 -L /mnt/bin/init -o -x /mnt/bin/init ] ; then
56 /bin/echo "Root filesystem will be mounted from /dev/$prefroot ..."
59 /bin/echo "Can't find valid rootfs on /dev/$prefroot, using jffs2 ..."
65 if [ $prefroot = "nfsroot" ] ; then
67 sysconflen=`/bin/dd if=/dev/mtd1 bs=4 count=1 2>/dev/null | /usr/bin/hexdump -n 6 -e '"%02d"'`
68 ipaddr=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 2>/dev/null | grep ip_addr | sed -e s/ip_addr=//`
69 netmask=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 2>/dev/null | grep netmask | sed -e s/netmask=//`
70 gateway=`/bin/dd if=/dev/mtd1 bs=1 count=$sysconflen skip=4 2>/dev/null | grep gateway | sed -e s/gateway=//`
73 /sbin/insmod ixp425_eth
74 /sbin/ifconfig ixp0 up $ipaddr netmask $netmask
75 /sbin/route add default gw $gateway
77 /sbin/ifconfig lo up 127.0.0.1
79 # The nfsrootloc and nfsrootopts vars can be overridden here.
82 /bin/mount $nfsrootopts $nfsrootloc /mnt
84 if [ -L /mnt/sbin/init -o -x /mnt/sbin/init -o \
85 -L /mnt/bin/init -o -x /mnt/bin/init ] ; then
86 /bin/echo "Root filesystem will be mounted from an NFS root ..."
90 /bin/echo "Can't find valid NFS rootfs, using jffs2 ..."
96 if [ $prefroot = "jffs2" ] ; then
97 /bin/echo "Root filesystem will be mounted from /dev/mtdblock4 ..."
104 # Pivot to the desired rootfs and run the initial executable.
106 if [ -n "$mounted" ] ; then
110 if [ -x ./sbin/init -o -L ./sbin/init ] ; then
112 elif [ -x ./bin/init -o -L ./bin/init ] ; then
118 /sbin/pivot_root . initrd
120 exec /usr/sbin/chroot . $runboot < /dev/console 1> /dev/console 2> /dev/console
128 /bin/echo "Can't chroot to $prefroot, using jffs2 ..."
131 # Last-resort fall-back - this should never be reached.