[From nobody Thu Jun 25 05:55:11 2020
Received: from srv4.3e8.eu ([2001:67c:12a0:200::2])
 by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux))
 id 1hQzIm-0005tE-Ee
 for openwrt-devel@lists.openwrt.org; Wed, 15 May 2019 19:10:59 +0000
Received: from localhost.localdomain
 (p200300C6CF1098A0852C1B8B6B504594.dip0.t-ipconnect.de
 [IPv6:2003:c6:cf10:98a0:852c:1b8b:6b50:4594])
 (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits))
 (No client certificate requested)
 by srv4.3e8.eu (Postfix) with ESMTPSA id 475D36002C;
 Wed, 15 May 2019 21:10:43 +0200 (CEST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=3e8.eu;
 s=mail20170724; t=1557947443;
 bh=O8+UBpoORx/Yfl0vLQYB24WpA7/NgUtvzcZheFmSxcM=;
 h=From:To:Cc:Subject:Date:From;
 b=QMzveRS/qINpSD6+E5jkysxeoSw3u4zu53hr+k3oN81herpoJR8H2CvSpWN/J6RZD
 g6WgrBUI0bSX/F4SPVoPHp9fYtnC0K4hFQ4uZewmss4qZWdoWr9CQ8ytpTE+SMgZ2Q
 kBtvtwohdmh2ze7hzfVJwHrD8MV2MiHC0ASEEKVtrOIrpQkpGJE7PGSuPbKJ3kwNrF
 BT7DhcT8m9Da7nYraiTREjeifiV2Tszf7tEUzaFQAejcM5Z4/QARb9JFfo/Jq/QVt4
 SDSxncWzb9Ursq0tVl6xVQSCGE46GULUcJeJ5+EHtniLuQoLy8ey7eeV2vu+7Ilxeb
 W2aSPFPELA3FQ==
From: Jan Hoffmann &lt;jan@3e8.eu&gt;
To: openwrt-devel@lists.openwrt.org
Cc: Jan Hoffmann &lt;jan@3e8.eu&gt;
Subject: [PATCH] ramips: add factory image for WNDR3700v5
Date: Wed, 15 May 2019 21:10:21 +0200
Message-Id: &lt;20190515191021.4871-1-jan@3e8.eu&gt;
X-Mailer: git-send-email 2.17.1
X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 
X-CRM114-CacheID: sfid-20190515_121056_930685_0BD63962 
X-CRM114-Status: UNSURE (   8.58  )
X-CRM114-Notice: Please train this message.
X-Spam-Score: -0.2 (/)
X-Spam-Report: SpamAssassin version 3.4.2 on bombadil.infradead.org summary:
 Content analysis details:   (-0.2 points)
 pts rule name              description
 ---- ---------------------- --------------------------------------------------
 -0.0 SPF_HELO_PASS          SPF: HELO matches SPF record
 -0.0 SPF_PASS               SPF: sender matches SPF record
 -0.1 DKIM_VALID_EF          Message has a valid DKIM or DK signature from
 envelope-from domain
 -0.1 DKIM_VALID_AU          Message has a valid DKIM or DK signature from
 author's domain
 0.1 DKIM_SIGNED            Message has a DKIM or DK signature, not necessarily
 valid
 -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature

This uses the existing rules for Sercomm factory images and moves them
to the ramips image Makefile, so they can be used in all subtargets.

The new factory image for WNDR3700v5 can be flashed using nmrpflash.

Signed-off-by: Jan Hoffmann &lt;jan@3e8.eu&gt;
---
 target/linux/ramips/image/Makefile  | 14 ++++++++++++++
 target/linux/ramips/image/mt7621.mk | 11 ++++++++++-
 target/linux/ramips/image/mt76x8.mk | 16 ----------------
 3 files changed, 24 insertions(+), 17 deletions(-)

diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
index 6eef596caf..145dbf4ec5 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -10,6 +10,7 @@ include $(INCLUDE_DIR)/image.mk
 DEVICE_VARS += DTS IMAGE_SIZE NETGEAR_BOARD_ID NETGEAR_HW_ID
 DEVICE_VARS += BUFFALO_TAG_PLATFORM BUFFALO_TAG_VERSION BUFFALO_TAG_MINOR
 DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK
+DEVICE_VARS += SERCOMM_HWID SERCOMM_HWVER SERCOMM_SWVER
 
 loadaddr-y := 0x80000000
 loadaddr-$(CONFIG_TARGET_ramips_rt288x) := 0x88000000
@@ -132,6 +133,19 @@ define Build/zyimage
 	$(STAGING_DIR_HOST)/bin/zyimage $(1) $@
 endef
 
+define Build/sercom-seal
+	$(STAGING_DIR_HOST)/bin/mksercommfw \
+		-i $@ \
+		-b $(SERCOMM_HWID) \
+		-r $(SERCOMM_HWVER) \
+		-v $(SERCOMM_SWVER) \
+		$(1)
+endef
+
+define Build/sercom-footer
+	$(call Build/sercom-seal,-f)
+endef
+
 ralink_default_fw_size_4M=3866624
 ralink_default_fw_size_8M=8060928
 ralink_default_fw_size_16M=16121856
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index 9e42404f64..671e7f378a 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -531,7 +531,16 @@ TARGET_DEVICES += mqmaker_witi-512m
 
 define Device/wndr3700v5
   DTS := WNDR3700V5
-  IMAGE_SIZE := $(ralink_default_fw_size_16M)
+  BLOCKSIZE := 64k
+  IMAGE_SIZE := 15232k
+  SERCOMM_HWID := AYB
+  SERCOMM_HWVER := A001
+  SERCOMM_SWVER := 0x1054
+  IMAGES += factory.img
+  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs
+  IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size $$$$(IMAGE_SIZE)
+  IMAGE/factory.img := pad-extra 320k | $$(IMAGE/default) | pad-to $$$$(BLOCKSIZE) | \
+	sercom-footer | pad-to 128 | zip WNDR3700v5.bin | sercom-seal
   DEVICE_TITLE := Netgear WNDR3700v5
   DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb3 wpad-basic
 endef
diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk
index ba3354a8a6..0f7d22c942 100644
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -2,22 +2,6 @@
 # MT76x8 Profiles
 #
 
-DEVICE_VARS += SERCOMM_HWID SERCOMM_HWVER SERCOMM_SWVER
-
-define Build/sercom-seal
-	$(STAGING_DIR_HOST)/bin/mksercommfw \
-		-i $@ \
-		-b $(SERCOMM_HWID) \
-		-r $(SERCOMM_HWVER) \
-		-v $(SERCOMM_SWVER) \
-		$(1)
-endef
-
-define Build/sercom-footer
-	$(call Build/sercom-seal,-f)
-endef
-
-
 define Device/tplink
   TPLINK_FLASHLAYOUT :=
   TPLINK_HWID :=
-- 
2.17.1


]