diff options
Diffstat (limited to 'target')
-rw-r--r-- | target/linux/ath79/base-files/lib/upgrade/platform.sh | 25 | ||||
-rw-r--r-- | target/linux/ath79/image/generic-ubnt.mk | 3 |
2 files changed, 23 insertions, 5 deletions
diff --git a/target/linux/ath79/base-files/lib/upgrade/platform.sh b/target/linux/ath79/base-files/lib/upgrade/platform.sh index a7cb455b8e..bc19149d5c 100644 --- a/target/linux/ath79/base-files/lib/upgrade/platform.sh +++ b/target/linux/ath79/base-files/lib/upgrade/platform.sh @@ -7,11 +7,28 @@ REQUIRE_IMAGE_METADATA=1 routerstation_do_upgrade() { local append - local kern_length=0x$(dd if="$1" bs=2 skip=1 count=4 2>/dev/null) + local sysup_file="$1" + local magic=$(get_magic_word "$sysup_file") - [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j $CONF_TAR" - dd if="$1" bs=64k skip=1 2>/dev/null | \ - mtd -r $append -Fkernel:$kern_length:0x80060000,rootfs write - kernel:rootfs + if [ "$magic" = "4349" ]; then + local kern_length=0x$(dd if="$sysup_file" bs=2 skip=1 count=4 2>/dev/null) + + [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j $CONF_TAR" + dd if="$sysup_file" bs=64k skip=1 2>/dev/null | \ + mtd -r $append -Fkernel:$kern_length:0x80060000,rootfs write - kernel:rootfs + + elif [ "$magic" = "7379" ]; then + local board_dir=$(tar tf $sysup_file | grep -m 1 '^sysupgrade-.*/$') + local kern_length=$(tar xf $sysup_file ${board_dir}kernel -O | wc -c) + + [ -f "$CONF_TAR" -a "$SAVE_CONFIG" -eq 1 ] && append="-j $CONF_TAR" + tar xf $sysup_file ${board_dir}kernel ${board_dir}root -O | \ + mtd -r $append -Fkernel:$kern_length:0x80060000,rootfs write - kernel:rootfs + + else + echo "Unknown image, aborting!" + return 1 + fi } platform_check_image() { diff --git a/target/linux/ath79/image/generic-ubnt.mk b/target/linux/ath79/image/generic-ubnt.mk index 4f0a6a500d..89b9f6746d 100644 --- a/target/linux/ath79/image/generic-ubnt.mk +++ b/target/linux/ath79/image/generic-ubnt.mk @@ -195,7 +195,8 @@ define Device/ubnt_routerstation_common IMAGE_SIZE := 16128k IMAGES += factory.bin IMAGE/factory.bin := append-rootfs | pad-rootfs | mkubntimage | check-size $$$$(IMAGE_SIZE) - IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE) | append-metadata + IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | combined-image | check-size $$$$(IMAGE_SIZE) +# IMAGE/sysupgrade.bin := append-rootfs | pad-rootfs | check-size $$$$(IMAGE_SIZE) | sysupgrade-tar rootfs=$$$$@ | append-metadata KERNEL := kernel-bin | append-dtb | lzma | pad-to $$(BLOCKSIZE) KERNEL_INITRAMFS := kernel-bin | append-dtb endef |