409fe38fdd3a4bb99da26b34e797fb5657c820be
[openwrt-10.03/.git] / target / default / target_skeleton / sbin / mount_root
1 #!/bin/sh
2 if [ "$1" != "failsafe" ]; then 
3         mount | grep jffs2 >&-
4         if [ $? = 0 ] ; then
5                 [ $(cat /proc/mtd | wc -l) = 6 ] && {
6                         echo 5 > /proc/sys/diag
7                         mtd unlock linux
8                         mtd erase OpenWrt
9                         jffs2root --move
10                 } &
11                 mtd unlock rootfs
12                 mount -o remount,rw /dev/root /
13         else
14                 mtd unlock OpenWrt
15                 mount -t jffs2 /dev/mtdblock/4 /jffs
16                 pivot_root /jffs /jffs/rom
17                 mount none /proc -t proc
18                 mount none /dev -t devfs
19                 umount rom/proc rom/dev
20         fi
21 fi
22 mount none /tmp -t ramfs
23 mkdir -p /dev/pts
24 mount none /dev/pts -t devpts