add oleg's fix for jffs2 mounting
[openwrt.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                 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 size=50%
24 mkdir -p /dev/pts
25 mount none /dev/pts -t devpts