add mount_root script to mount root fs (called from /etc/preinit)
[openwrt/svn-archive/archive.git] / openwrt / target / default / target_skeleton / sbin / mount_root
1 #!/bin/sh
2 if [ "$1" != "failsafe" ]; then
3 mount | grep jffs2 >&-
4 if [ $? = 0 ] ; then
5 mtd unlock rootfs
6 [ $(cat /proc/mtd | wc -l) = 6 ] && {
7 echo 5 > /proc/sys/diag
8 mtd unlock OpenWrt
9 mtd erase OpenWrt
10 jffs2root --move
11 }
12 mount -o remount,rw /dev/root /
13 else
14 mtd unlock mtd4
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