From de42466528b4e5748d18af9396a4226b0c1cd0fa Mon Sep 17 00:00:00 2001
From: Mathias Kresin <dev@kresin.me>
Date: Sat, 29 Dec 2018 19:40:56 +0100
Subject: [PATCH] ar71xx: sync seama image build code with ramips

Use the same syntax as used in the ramips target, to use common seama
recipes.

Signed-off-by: Mathias Kresin <dev@kresin.me>
---
 target/linux/ar71xx/image/generic.mk | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/target/linux/ar71xx/image/generic.mk b/target/linux/ar71xx/image/generic.mk
index 45c6d75399..9f5e755cfe 100644
--- a/target/linux/ar71xx/image/generic.mk
+++ b/target/linux/ar71xx/image/generic.mk
@@ -1,4 +1,5 @@
-DEVICE_VARS += DAP_SIGNATURE NETGEAR_BOARD_ID NETGEAR_HW_ID NETGEAR_KERNEL_MAGIC ROOTFS_SIZE SEAMA_SIGNATURE
+DEVICE_VARS += DAP_SIGNATURE NETGEAR_BOARD_ID NETGEAR_HW_ID NETGEAR_KERNEL_MAGIC ROOTFS_SIZE
+DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK
 
 define Build/alfa-network-rootfs-header
 	mkimage \
@@ -67,12 +68,14 @@ define Build/relocate-kernel
 endef
 
 define Build/seama
-	$(STAGING_DIR_HOST)/bin/seama -i $@ $(if $(1),$(1),-m "dev=/dev/mtdblock/1" -m "type=firmware")
+	$(STAGING_DIR_HOST)/bin/seama -i $@ \
+		-m "dev=/dev/mtdblock/$(SEAMA_MTDBLOCK)" -m "type=firmware"
 	mv $@.seama $@
 endef
 
 define Build/seama-seal
-	$(call Build/seama,-s $@.seama $(1))
+	$(STAGING_DIR_HOST)/bin/seama -i $@ -s $@.seama \
+		-m "signature=$(SEAMA_SIGNATURE)"
 endef
 
 define Build/teltonika-fw-fake-checksum
@@ -1138,6 +1141,7 @@ define Device/seama
   KERNEL := kernel-bin | patch-cmdline | relocate-kernel | lzma
   KERNEL_INITRAMFS := kernel-bin | patch-cmdline | lzma | seama
   KERNEL_INITRAMFS_SUFFIX = $$(KERNEL_SUFFIX).seama
+  SEAMA_MTDBLOCK := 1
   IMAGES := sysupgrade.bin factory.bin
 
   # 64 bytes offset:
@@ -1149,8 +1153,7 @@ define Device/seama
 	check-size $$$$(IMAGE_SIZE)
   IMAGE/factory.bin := \
 	$$(IMAGE/default) | seama | pad-rootfs | \
-	seama-seal -m "signature=$$$$(SEAMA_SIGNATURE)" | \
-	check-size $$$$(IMAGE_SIZE)
+	seama-seal | check-size $$$$(IMAGE_SIZE)
   SEAMA_SIGNATURE :=
 endef
 
-- 
2.30.2