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