[OpenWrt-Devel] [PATCH 5/6] layerscape: ls10121frdm: add sysupgrade

Tomasz Maciej Nowak tomek_n at o2.pl
Tue Feb 25 14:07:40 EST 2020


Instead of dangerous rewriting full chip with firmware.bin image to
update OpenWrt, add sysupgrade image. This image will be used to update
kernel and rootfs, leaving bootloader intact and making recovery
possible, without resorting to external hardware tools.

Signed-off-by: Tomasz Maciej Nowak <tomek_n at o2.pl>
---
 target/linux/layerscape/base-files/lib/upgrade/platform.sh | 7 +++++++
 target/linux/layerscape/image/armv8_64b.mk                 | 4 ++++
 2 files changed, 11 insertions(+)

diff --git a/target/linux/layerscape/base-files/lib/upgrade/platform.sh b/target/linux/layerscape/base-files/lib/upgrade/platform.sh
index c7b9b06cfe..a2ee81cf3a 100644
--- a/target/linux/layerscape/base-files/lib/upgrade/platform.sh
+++ b/target/linux/layerscape/base-files/lib/upgrade/platform.sh
@@ -32,6 +32,9 @@ platform_check_image() {
 		nand_do_platform_check "traverse-ls1043" $1
 		return $?
 		;;
+	fsl,ls1012a-frdm)
+		return 0
+		;;
 	*)
 		echo "Sysupgrade is not currently supported on $board"
 		;;
@@ -51,6 +54,10 @@ platform_do_upgrade() {
 	traverse,ls1043s)
 		platform_do_upgrade_traverse_nandubi "$1"
 		;;
+	fsl,ls1012a-frdm)
+		PART_NAME=firmware
+		default_do_upgrade "$1"
+		;;
 	*)
 		echo "Sysupgrade is not currently supported on $board"
 		;;
diff --git a/target/linux/layerscape/image/armv8_64b.mk b/target/linux/layerscape/image/armv8_64b.mk
index 3a7b28c416..bd7055b3ee 100644
--- a/target/linux/layerscape/image/armv8_64b.mk
+++ b/target/linux/layerscape/image/armv8_64b.mk
@@ -25,6 +25,7 @@ define Device/ls1012afrdm
   DEVICE_DTS := freescale/fsl-ls1012a-frdm
   BLOCKSIZE := 256KiB
   FILESYSTEMS := squashfs
+  IMAGES += sysupgrade.bin
   IMAGE/firmware.bin := \
     ls-clean | \
     ls-append $(1)-bl2.pbl | pad-to 1M | \
@@ -34,8 +35,11 @@ define Device/ls1012afrdm
     ls-append-dtb $$(DEVICE_DTS) | pad-to 16M | \
     append-kernel | pad-to $$(BLOCKSIZE) | \
     append-rootfs | pad-rootfs | check-size 67108865
+  IMAGE/sysupgrade.bin := append-kernel | pad-to $$(BLOCKSIZE) | \
+	append-rootfs | pad-rootfs | check-size 50331648 | append-metadata
   KERNEL := kernel-bin | gzip | fit gzip $$(DTS_DIR)/$$(DEVICE_DTS).dtb
   KERNEL_INITRAMFS := kernel-bin | fit none $$(DTS_DIR)/$$(DEVICE_DTS).dtb
+  SUPPORTED_DEVICES := fsl,ls1012a-frdm
 endef
 TARGET_DEVICES += ls1012afrdm
 
-- 
2.25.1


_______________________________________________
openwrt-devel mailing list
openwrt-devel at lists.openwrt.org
https://lists.openwrt.org/mailman/listinfo/openwrt-devel



More information about the openwrt-devel mailing list