[PATCH] ramips: add common definition netgear_sercomm_nor

Adrian Schmutzler freifunk at adrianschmutzler.de
Mon Aug 3 13:28:22 EDT 2020


Like NAND-based devices, SPI-NOR based Netgear devices also share
a common setup for their images. This creates a common defition
for them in image/Makefile, so it can be reused across subtargets.

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 target/linux/ramips/image/Makefile  | 14 +++++++++++++-
 target/linux/ramips/image/mt7621.mk | 16 +++++-----------
 target/linux/ramips/image/mt76x8.mk | 21 ++++++---------------
 3 files changed, 24 insertions(+), 27 deletions(-)

diff --git a/target/linux/ramips/image/Makefile b/target/linux/ramips/image/Makefile
index d72d937ab8..c0890e6bb3 100644
--- a/target/linux/ramips/image/Makefile
+++ b/target/linux/ramips/image/Makefile
@@ -12,7 +12,7 @@ DEVICE_VARS += 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_HWNAME SERCOMM_HWID SERCOMM_HWVER SERCOMM_SWVER
-DEVICE_VARS += JCG_MAXSIZE
+DEVICE_VARS += SERCOMM_PAD JCG_MAXSIZE
 
 loadaddr-y := 0x80000000
 loadaddr-$(CONFIG_TARGET_ramips_rt288x) := 0x88000000
@@ -176,6 +176,18 @@ define Device/Default
   IMAGE/sysupgrade.bin := append-kernel | append-rootfs | pad-rootfs | append-metadata | check-size
 endef
 
+define Device/netgear_sercomm_nor
+  BLOCKSIZE := 64k
+  DEVICE_VENDOR := NETGEAR
+  IMAGES += factory.img
+  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
+	pad-rootfs
+  IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size
+  IMAGE/factory.img := pad-extra $$$$(SERCOMM_PAD) | $$(IMAGE/default) | \
+	pad-to $$$$(BLOCKSIZE) | sercom-footer | pad-to 128 | \
+	zip $$$$(SERCOMM_HWNAME).bin | sercom-seal
+endef
+
 define Device/seama
   SEAMA_MTDBLOCK := 2
   IMAGES += factory.bin
diff --git a/target/linux/ramips/image/mt7621.mk b/target/linux/ramips/image/mt7621.mk
index f13be3d3bc..d296e389a4 100644
--- a/target/linux/ramips/image/mt7621.mk
+++ b/target/linux/ramips/image/mt7621.mk
@@ -827,22 +827,16 @@ endef
 TARGET_DEVICES += netgear_wac124
 
 define Device/netgear_wndr3700-v5
+  $(Device/netgear_sercomm_nor)
   $(Device/uimage-lzma-loader)
-  BLOCKSIZE := 64k
   IMAGE_SIZE := 15232k
+  DEVICE_MODEL := WNDR3700
+  DEVICE_VARIANT := v5
+  SERCOMM_HWNAME := WNDR3700v5
   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/factory.img := pad-extra 320k | $$(IMAGE/default) | \
-	pad-to $$$$(BLOCKSIZE) | sercom-footer | pad-to 128 | zip WNDR3700v5.bin | \
-	sercom-seal
-  DEVICE_VENDOR := NETGEAR
-  DEVICE_MODEL := WNDR3700
-  DEVICE_VARIANT := v5
+  SERCOMM_PAD := 320k
   DEVICE_PACKAGES := kmod-mt7603 kmod-mt76x2 kmod-usb3 \
 	kmod-usb-ledtrig-usbport wpad-basic
   SUPPORTED_DEVICES += wndr3700v5
diff --git a/target/linux/ramips/image/mt76x8.mk b/target/linux/ramips/image/mt76x8.mk
index 00c8fbe43e..b08951f37b 100644
--- a/target/linux/ramips/image/mt76x8.mk
+++ b/target/linux/ramips/image/mt76x8.mk
@@ -216,20 +216,8 @@ define Device/mercury_mac1200r-v2
 endef
 TARGET_DEVICES += mercury_mac1200r-v2
 
-define Device/netgear_r6xxx
-  BLOCKSIZE := 64k
-  DEVICE_VENDOR := NETGEAR
-  IMAGES += factory.img
-  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | \
-	pad-rootfs
-  IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | check-size
-  IMAGE/factory.img := pad-extra 576k | $$(IMAGE/default) | \
-	pad-to $$$$(BLOCKSIZE) | sercom-footer | pad-to 128 | \
-	zip $$$$(SERCOMM_HWNAME).bin | sercom-seal
-endef
-
 define Device/netgear_r6020
-  $(Device/netgear_r6xxx)
+  $(Device/netgear_sercomm_nor)
   IMAGE_SIZE := 7104k
   DEVICE_MODEL := R6020
   DEVICE_PACKAGES := kmod-mt76x2
@@ -237,11 +225,12 @@ define Device/netgear_r6020
   SERCOMM_HWID := CFR
   SERCOMM_HWVER := A001
   SERCOMM_SWVER := 0x0040
+  SERCOMM_PAD := 576k
 endef
 TARGET_DEVICES += netgear_r6020
 
 define Device/netgear_r6080
-  $(Device/netgear_r6xxx)
+  $(Device/netgear_sercomm_nor)
   IMAGE_SIZE := 7552k
   DEVICE_MODEL := R6080
   DEVICE_PACKAGES := kmod-mt76x2
@@ -249,11 +238,12 @@ define Device/netgear_r6080
   SERCOMM_HWID := CFR
   SERCOMM_HWVER := A001
   SERCOMM_SWVER := 0x0040
+  SERCOMM_PAD := 576k
 endef
 TARGET_DEVICES += netgear_r6080
 
 define Device/netgear_r6120
-  $(Device/netgear_r6xxx)
+  $(Device/netgear_sercomm_nor)
   IMAGE_SIZE := 15744k
   DEVICE_MODEL := R6120
   DEVICE_PACKAGES := kmod-mt76x2 kmod-usb2 kmod-usb-ohci
@@ -261,6 +251,7 @@ define Device/netgear_r6120
   SERCOMM_HWID := CGQ
   SERCOMM_HWVER := A001
   SERCOMM_SWVER := 0x0040
+  SERCOMM_PAD := 576k
 endef
 TARGET_DEVICES += netgear_r6120
 
-- 
2.20.1




More information about the openwrt-devel mailing list