replace some hardcoded /dev/mtdblock/* references with calls to find_mtd_part()
[openwrt.git] / target / linux / brcm-2.4 / base-files / default / sbin / mount_root
1 #!/bin/sh
2 # Copyright (C) 2006 OpenWrt.org
3 . /etc/functions.sh
4
5 is_dirty() {
6 mtdpart="$(find_mtd_part linux)"
7 grep Broadcom /proc/cpuinfo >&- || return 1
8 OFFSET="$(($(hexdump -v $mtdpart -s 20 -n 2 -e '"%d"')-1))"
9 return $(hexdump -v $mtdpart -s $OFFSET -n 1 -e '"%d"')
10 }
11
12 if [ "$1" != "failsafe" ]; then
13 mtd unlock linux
14 mount | grep jffs2 >&-
15 if [ $? = 0 ] ; then
16 mount -o remount,rw /dev/root /
17 else
18 . /bin/firstboot
19 is_dirty
20 [ $? != 0 ] && {
21 echo "switching to jffs2"
22 mount $(find_mtd_part OpenWrt) /jffs -t jffs2
23 fopivot /jffs /rom
24 } || {
25 echo "jffs2 not ready yet; using ramdisk"
26 ramoverlay
27 }
28 fi
29 fi
30
31 mkdir -p /dev/pts
32 mount none /dev/pts -t devpts 2>&-
33 grep sysfs /proc/filesystems >/dev/null && mount -t sysfs none /sys 2>&-
This page took 0.063267 seconds and 5 git commands to generate.