X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/05adaa9794e41d02870a74a1ed7ba58cc59b9286..aa196b361191e3498cd8b96f0669722a4742cca2:/package/base-files/files/sbin/mount_root?ds=sidebyside diff --git a/package/base-files/files/sbin/mount_root b/package/base-files/files/sbin/mount_root index 81660f006..86d4ef95f 100755 --- a/package/base-files/files/sbin/mount_root +++ b/package/base-files/files/sbin/mount_root @@ -1,10 +1,25 @@ #!/bin/sh # Copyright (C) 2006 OpenWrt.org +. /etc/functions.sh -mount none /proc -t proc -size=$(awk '/Mem:/ {l=5242880;print((s=$2/2)&- -mount -o remount,rw /dev/root / +jffs2_ready () { + mtdpart="$(find_mtd_part rootfs_data)" + magic=$(hexdump $mtdpart -n 4 -e '4/1 "%02x"') + [ "$magic" != "deadc0de" ] +} + +grep rootfs_data /proc/mtd >/dev/null 2>/dev/null && { + . /sbin/firstboot + mtd unlock rootfs_data + jffs2_ready && { + echo "switching to jffs2" + mount "$(find_mtd_part rootfs_data)" /jffs -t jffs2 && \ + fopivot /jffs /rom + } || { + echo "jffs2 not ready yet; using ramdisk" + ramoverlay + } +} || { + mtd unlock rootfs + mount -o remount,rw /dev/root / +}