platform.sh 1004 B

123456789101112131415161718192021222324252627282930313233
  1. USE_REFRESH=1
  2. platform_check_image() {
  3. [ "$ARGC" -gt 1 ] && return 1
  4. case "$(get_magic_word "$1")" in
  5. eb48) return 0;;
  6. *)
  7. echo "Invalid image type"
  8. return 1
  9. ;;
  10. esac
  11. }
  12. platform_do_upgrade() {
  13. local ROOTFS
  14. sync
  15. grep -q -e "jffs2" -e "squashfs" /proc/cmdline \
  16. && ROOTFS="$(awk 'BEGIN { RS=" "; FS="="; } ($1 == "block2mtd.block2mtd") { print substr($2,1,index($2, ",")-1) }' < /proc/cmdline)" \
  17. || ROOTFS="$(awk 'BEGIN { RS=" "; FS="="; } ($1 == "root") { print $2 }' < /proc/cmdline)"
  18. [ -b ${ROOTFS%[0-9]} ] && get_image "$1" > ${ROOTFS%[0-9]}
  19. }
  20. x86_prepare_ext2() {
  21. # if we're running from ext2, we need to make sure that we have a mtd
  22. # partition that points to the active rootfs partition.
  23. # however this only matters if we actually need to preserve the config files
  24. [ "$SAVE_CONFIG" -eq 1 ] || return 0
  25. grep rootfs /proc/mtd >/dev/null || {
  26. echo /dev/hda2,65536,rootfs > /sys/module/block2mtd/parameters/block2mtd
  27. }
  28. }
  29. append sysupgrade_pre_upgrade x86_prepare_ext2