mount_root 554 B

12345678910111213141516171819202122232425
  1. #!/bin/sh
  2. # Copyright (C) 2006 OpenWrt.org
  3. . /etc/functions.sh
  4. jffs2_ready () {
  5. mtdpart="$(find_mtd_part rootfs_data)"
  6. magic=$(hexdump $mtdpart -n 4 -e '4/1 "%02x"')
  7. [ "$magic" != "deadc0de" ]
  8. }
  9. grep rootfs_data /proc/mtd >/dev/null 2>/dev/null && {
  10. . /sbin/firstboot
  11. mtd unlock rootfs_data
  12. jffs2_ready && {
  13. echo "switching to jffs2"
  14. mount "$(find_mtd_part rootfs_data)" /jffs -t jffs2 && \
  15. fopivot /jffs /rom
  16. } || {
  17. echo "jffs2 not ready yet; using ramdisk"
  18. ramoverlay
  19. }
  20. } || {
  21. mtd unlock rootfs
  22. mount -o remount,rw /dev/root /
  23. }