[source] mvebu: use image metadata for firmware validation

LEDE Commits lede-commits at lists.infradead.org
Thu Nov 24 03:53:22 PST 2016


nbd pushed a commit to source.git, branch master:
https://git.lede-project.org/9fc0bcdd18688724494e3364ec986318372129a4

commit 9fc0bcdd18688724494e3364ec986318372129a4
Author: Felix Fietkau <nbd at nbd.name>
AuthorDate: Mon Nov 21 11:59:37 2016 +0100

    mvebu: use image metadata for firmware validation
    
    Signed-off-by: Felix Fietkau <nbd at nbd.name>
---
 .../linux/mvebu/base-files/lib/upgrade/platform.sh | 23 ++--------------------
 target/linux/mvebu/image/Makefile                  |  5 ++++-
 2 files changed, 6 insertions(+), 22 deletions(-)

diff --git a/target/linux/mvebu/base-files/lib/upgrade/platform.sh b/target/linux/mvebu/base-files/lib/upgrade/platform.sh
index a8ad602..77578e2 100755
--- a/target/linux/mvebu/base-files/lib/upgrade/platform.sh
+++ b/target/linux/mvebu/base-files/lib/upgrade/platform.sh
@@ -6,29 +6,10 @@
 . /lib/mvebu.sh
 
 RAMFS_COPY_DATA=/lib/mvebu.sh
+REQUIRE_IMAGE_METADATA=1
 
 platform_check_image() {
-	local board=$(mvebu_board_name)
-	local magic_long="$(get_magic_long "$1")"
-
-	[ "$#" -gt 1 ] && return 1
-
-	case "$board" in
-	armada-385-linksys-caiman|armada-385-linksys-cobra|armada-385-linksys-rango|armada-385-linksys-shelby|armada-xp-linksys-mamba)
-		[ "$magic_long" != "27051956" -a "$magic_long" != "73797375" ] && {
-			echo "Invalid image type."
-			return 1
-		}
-		return 0;
-		;;
-	armada-388-clearfog)
-		platform_check_image_clearfog "$ARGV"
-		return $?
-		;;
-	esac
-
-	echo "Sysupgrade is not yet supported on $board."
-	return 1
+	return 0
 }
 
 platform_do_upgrade() {
diff --git a/target/linux/mvebu/image/Makefile b/target/linux/mvebu/image/Makefile
index 73c533a..8b203a4 100644
--- a/target/linux/mvebu/image/Makefile
+++ b/target/linux/mvebu/image/Makefile
@@ -61,11 +61,12 @@ define Device/Default
   BOARD_NAME = $$(DEVICE_DTS)
   KERNEL_NAME := zImage
   KERNEL := kernel-bin | append-dtb | uImage none
+  SUPPORTED_DEVICES = $$(DEVICE_DTS)
 endef
 
 define Device/UBI
   IMAGES := sysupgrade.bin
-  IMAGE/sysupgrade.bin := sysupgrade-tar
+  IMAGE/sysupgrade.bin := sysupgrade-tar | append-metadata
 endef
 
 define Device/UBI-factory
@@ -146,6 +147,7 @@ TARGET_DEVICES += linksys-wrt1900ac
 define Device/openblocks-ax3
   $(Device/UBI-factory)
   DEVICE_DTS := armada-xp-openblocks-ax3-4
+  SUPPORTED_DEVCES := $(1)
   BLOCKSIZE := 128k
   PAGESIZE := 1
   IMAGE/factory.img := append-kernel | pad-to $$(BLOCKSIZE) | append-ubi
@@ -194,6 +196,7 @@ TARGET_DEVICES += armada-388-clearfog
 define Device/globalscale-mirabox
   $(Device/NAND-512K)
   DEVICE_DTS := armada-370-mirabox
+  SUPPORTED_DEVCES := mirabox
   DEVICE_TITLE := Globalscale Mirabox
 endef
 TARGET_DEVICES += globalscale-mirabox



More information about the lede-commits mailing list