@@ -1,5 +1,17 @@
+PART_NAME=firmware
+
platform_check_image() {
local diskdev partdev diff
+ local firmware_mtd=$(find_mtd_part firmware)
+ local image_magic="$(get_magic_long "$1")"
+
+ if [ -n "$firmware_mtd" ] && [ "$image_magic" != "00000000" ]; then
+ REQUIRE_IMAGE_METADATA=1
+ if ! $(fwtool_check_image $@); then
+ return 1
+ fi
+ return 0
+ fi
export_bootdevice && export_partdevice diskdev -2 || {
echo "Unable to determine upgrade device"
@@ -35,7 +47,7 @@ platform_copy_config() {
fi
}
-platform_do_upgrade() {
+platform_do_upgrade_mmc() {
local diskdev partdev diff
export_bootdevice && export_partdevice diskdev -2 || {
@@ -87,3 +99,19 @@ platform_do_upgrade() {
echo "Writing new UUID to /dev/$diskdev..."
get_image "$@" | dd of="/dev/$diskdev" bs=1 skip=440 count=4 seek=440 conv=fsync
}
+
+platform_do_upgrade() {
+ local board=$(board_name)
+ local image_magic="$(get_magic_long "$1")"
+
+ if [ "$image_magic" != "00000000" ]; then
+ case "$board" in
+ pine64,pine64-lts)
+ default_do_upgrade "$ARGV"
+ ;;
+ esac
+ else
+ platform_do_upgrade_mmc "$ARGV"
+ fi
+
+}
Add support for updating SPI flash device firmware. U-boot has to be programmed to spi flash device /dev/mtd0 manually before switching from sdcard to SPI flash device. Running sysupgrade with sysupgrade.bin will write firmware partition and copy configuration files from sdcard. Signed-off-by: Oskari Lemmela <oskari@lemmela.net> --- .../sunxi/base-files/lib/upgrade/platform.sh | 30 ++++++++++++++++++- 1 file changed, 29 insertions(+), 1 deletion(-)