--- /dev/null
+#
+# Copyright (C) 2010-2013 OpenWrt.org
+#
+
+rootpartuuid() {
+ local cmdline=$(cat /proc/cmdline)
+ local bootpart=${cmdline##*root=}
+ bootpart=${bootpart%% *}
+ local uuid=${bootpart#PARTUUID=}
+ echo ${uuid%-02}
+}
+
+bootdev_from_uuid() {
+ blkid | grep "PTUUID=\"$(rootpartuuid)\"" | cut -d : -f1
+}
+
+bootpart_from_uuid() {
+ blkid | grep $(rootpartuuid)-01 | cut -d : -f1
+}
+
+rootpart_from_uuid() {
+ blkid | grep $(rootpartuuid)-02 | cut -d : -f1
+}
+
+imx_sdcard_mount_boot() {
+ mkdir -p /boot
+ [ -f /boot/uImage ] || {
+ mount -o rw,noatime $(bootpart_from_uuid) /boot > /dev/null
+ }
+}
+
+imx_sdcard_copy_config() {
+ imx_sdcard_mount_boot
+ cp -af "$UPGRADE_BACKUP" "/boot/$BACKUP_FILE"
+ sync
+ umount /boot
+}
+
+imx_sdcard_do_upgrade() {
+ local board_dir="$(tar tf "${1}" | grep -m 1 '^sysupgrade-.*/$')"
+ board_dir="${board_dir%/}"
+
+ imx_sdcard_mount_boot
+ get_image "$1" | tar Oxf - ${board_dir}/kernel > /boot/uImage
+ get_image "$1" | tar Oxf - ${board_dir}/root > $(rootpart_from_uuid)
+ sync
+ umount /boot
+}
+
+imx_sdcard_pre_upgrade() {
+ [ -z "$UPGRADE_BACKUP" ] && {
+ jffs2reset -y
+ umount /overlay
+ }
+}
+
+imx_sdcard_move_config() {
+ if [ -b $(bootpart_from_uuid) ]; then
+ imx_sdcard_mount_boot
+ [ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" /
+ umount /boot
+ fi
+}
+++ /dev/null
-#
-# Copyright (C) 2010-2013 OpenWrt.org
-#
-
-rootpartuuid() {
- local cmdline=$(cat /proc/cmdline)
- local bootpart=${cmdline##*root=}
- bootpart=${bootpart%% *}
- local uuid=${bootpart#PARTUUID=}
- echo ${uuid%-02}
-}
-
-bootdev_from_uuid() {
- blkid | grep "PTUUID=\"$(rootpartuuid)\"" | cut -d : -f1
-}
-
-bootpart_from_uuid() {
- blkid | grep $(rootpartuuid)-01 | cut -d : -f1
-}
-
-rootpart_from_uuid() {
- blkid | grep $(rootpartuuid)-02 | cut -d : -f1
-}
-
-apalis_mount_boot() {
- mkdir -p /boot
- [ -f /boot/uImage ] || {
- mount -o rw,noatime $(bootpart_from_uuid) /boot > /dev/null
- }
-}
toradex,apalis_imx6q-eval|\
toradex,apalis_imx6q-ixora|\
toradex,apalis_imx6q-ixora-v1.1)
- if [ -b $(bootpart_from_uuid) ]; then
- apalis_mount_boot
- [ -f "/boot/$BACKUP_FILE" ] && mv -f "/boot/$BACKUP_FILE" /
- umount /boot
- fi
+ imx_sdcard_move_config
;;
esac
}
}
enable_image_metadata_check
-apalis_copy_config() {
- apalis_mount_boot
- cp -af "$UPGRADE_BACKUP" "/boot/$BACKUP_FILE"
- sync
- umount /boot
-}
-
-apalis_do_upgrade() {
- apalis_mount_boot
- get_image "$1" | tar Oxf - sysupgrade-apalis/kernel > /boot/uImage
- get_image "$1" | tar Oxf - sysupgrade-apalis/root > $(rootpart_from_uuid)
- sync
- umount /boot
-}
-
platform_check_image() {
local board=$(board_name)
toradex,apalis_imx6q-eval|\
toradex,apalis_imx6q-ixora|\
toradex,apalis_imx6q-ixora-v1.1)
- apalis_do_upgrade "$1"
+ imx_sdcard_do_upgrade "$1"
;;
esac
}
toradex,apalis_imx6q-eval|\
toradex,apalis_imx6q-ixora|\
toradex,apalis_imx6q-ixora-v1.1)
- apalis_copy_config
+ imx_sdcard_copy_config
;;
esac
}
toradex,apalis_imx6q-eval|\
toradex,apalis_imx6q-ixora|\
toradex,apalis_imx6q-ixora-v1.1)
- [ -z "$UPGRADE_BACKUP" ] && {
- jffs2reset -y
- umount /overlay
- }
+ imx_sdcard_pre_upgrade
;;
esac
}