b4ec2ca563b526ac3c32f7ccda8eae15ea3ee172
[openwrt/svn-archive/archive.git] / openwrt / package / base-files / default / sbin / mount_root
1 #!/bin/sh
2 if [ "$1" != "failsafe" ]; then
3 mount | grep jffs2 >&-
4 if [ $? = 0 ] ; then
5 if [ $(cat /proc/mtd | wc -l) = 6 ]; then
6 echo 5 > /proc/sys/diag
7 mtd unlock linux
8 mtd erase OpenWrt
9 jffs2root --move
10 else
11 mtd unlock rootfs
12 mount -o remount,rw /dev/root /
13 fi
14 else
15 mtd unlock OpenWrt
16 mount -t jffs2 /dev/mtdblock/4 /jffs
17 pivot_root /jffs /jffs/rom
18 mount none /proc -t proc
19 mount none /dev -t devfs
20 umount /rom/proc rom/dev >&-
21 fi
22 fi
23 mount none /tmp -t tmpfs -o nosuid,nodev,mode=1777,size=50%
24 mkdir -p /dev/pts
25 mount none /dev/pts -t devpts