[PATCH 1/4] ath79: reorganize common image definitions for Netgear

Adrian Schmutzler freifunk at adrianschmutzler.de
Sat Jul 25 14:29:12 EDT 2020


Netgear currently has a special definition for tiny devices, which
is only used by two devices. Despite, it sets ups the IMAGE/default
definition individually for all devices, although there is actually
only one exception.

This merges the common parts into a single netgear_generic definition
(in contrast to netgear_ath79_nand), and adjusts the individual
defitions accordingly.

Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 target/linux/ath79/image/common-netgear.mk |  5 +++-
 target/linux/ath79/image/generic.mk        | 14 +++++------
 target/linux/ath79/image/tiny-netgear.mk   | 28 ++++++++--------------
 3 files changed, 21 insertions(+), 26 deletions(-)

diff --git a/target/linux/ath79/image/common-netgear.mk b/target/linux/ath79/image/common-netgear.mk
index 51808069e3..b41650c6e9 100644
--- a/target/linux/ath79/image/common-netgear.mk
+++ b/target/linux/ath79/image/common-netgear.mk
@@ -33,10 +33,13 @@ define Build/netgear-uImage
 	$(call Build/uImage,$(1) -M $(NETGEAR_KERNEL_MAGIC))
 endef
 
-define Device/netgear_ath79
+define Device/netgear_generic
   DEVICE_VENDOR := NETGEAR
   KERNEL := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma
+  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma
   IMAGES += factory.img
+  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | \
+	append-rootfs | pad-rootfs
   IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \
 	check-size
   IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | \
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 8dc16983e1..64e9410519 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -1030,6 +1030,7 @@ endef
 TARGET_DEVICES += nec_wg800hp
 
 define Device/netgear_ex6400_ex7300
+  $(Device/netgear_generic)
   SOC := qca9558
   NETGEAR_KERNEL_MAGIC := 0x27051956
   NETGEAR_BOARD_ID := EX7300series
@@ -1037,8 +1038,11 @@ define Device/netgear_ex6400_ex7300
   IMAGE_SIZE := 15552k
   IMAGE/default := append-kernel | pad-offset $$$$(BLOCKSIZE) 64 | \
 	netgear-rootfs | pad-rootfs
+  IMAGE/sysupgrade.bin := $$(IMAGE/default) | append-metadata | \
+	check-size
+  IMAGE/factory.img := $$(IMAGE/default) | netgear-dni | \
+	check-size
   DEVICE_PACKAGES := kmod-ath10k-ct ath10k-firmware-qca99x0-ct
-  $(Device/netgear_ath79)
 endef
 
 define Device/netgear_ex6400
@@ -1054,12 +1058,10 @@ endef
 TARGET_DEVICES += netgear_ex7300
 
 define Device/netgear_wndr3x00
+  $(Device/netgear_generic)
   SOC := ar7161
-  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | \
-	append-rootfs | pad-rootfs
   DEVICE_PACKAGES := kmod-usb-ohci kmod-usb2 kmod-usb-ledtrig-usbport \
 	kmod-leds-reset kmod-owl-loader
-  $(Device/netgear_ath79)
 endef
 
 define Device/netgear_wndr3700
@@ -1135,14 +1137,12 @@ endef
 TARGET_DEVICES += netgear_wndrmac-v2
 
 define Device/netgear_wnr2200_common
+  $(Device/netgear_generic)
   SOC := ar7241
   DEVICE_MODEL := WNR2200
   DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
   NETGEAR_KERNEL_MAGIC := 0x32323030
   NETGEAR_BOARD_ID := wnr2200
-  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | \
-	append-rootfs | pad-rootfs
-  $(Device/netgear_ath79)
 endef
 
 define Device/netgear_wnr2200-8m
diff --git a/target/linux/ath79/image/tiny-netgear.mk b/target/linux/ath79/image/tiny-netgear.mk
index 5c83a10e01..0127e5bd97 100644
--- a/target/linux/ath79/image/tiny-netgear.mk
+++ b/target/linux/ath79/image/tiny-netgear.mk
@@ -1,35 +1,32 @@
 include ./common-netgear.mk
 
-define Device/netgear_ar7240
-  SOC := ar7240
-  NETGEAR_KERNEL_MAGIC := 0x32303631
-  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma
-  IMAGE_SIZE := 3712k
-  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | \
-	append-rootfs | pad-rootfs
-  $(Device/netgear_ath79)
-endef
-
 define Device/netgear_wnr612-v2
-  $(Device/netgear_ar7240)
+  $(Device/netgear_generic)
+  SOC := ar7240
   DEVICE_MODEL := WNR612
   DEVICE_VARIANT := v2
   DEVICE_DTS := ar7240_netgear_wnr612-v2
+  NETGEAR_KERNEL_MAGIC := 0x32303631
   NETGEAR_BOARD_ID := REALWNR612V2
+  IMAGE_SIZE := 3712k
   SUPPORTED_DEVICES += wnr612-v2
 endef
 TARGET_DEVICES += netgear_wnr612-v2
 
 define Device/on_n150r
-  $(Device/netgear_ar7240)
+  $(Device/netgear_generic)
+  SOC := ar7240
   DEVICE_VENDOR := On Networks
   DEVICE_MODEL := N150R
+  NETGEAR_KERNEL_MAGIC := 0x32303631
   NETGEAR_BOARD_ID := N150R
+  IMAGE_SIZE := 3712k
   SUPPORTED_DEVICES += n150r
 endef
 TARGET_DEVICES += on_n150r
 
 define Device/netgear_wnr1000-v2
+  $(Device/netgear_generic)
   SOC := ar7240
   DEVICE_MODEL := WNR1000
   DEVICE_VARIANT := v2
@@ -37,14 +34,12 @@ define Device/netgear_wnr1000-v2
   NETGEAR_BOARD_ID := WNR1000V2
   NETGEAR_HW_ID := 29763331+4+32
   IMAGE_SIZE := 3712k
-  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | \
-	append-rootfs | pad-rootfs
   SUPPORTED_DEVICES += wnr1000-v2
-  $(Device/netgear_ath79)
 endef
 TARGET_DEVICES += netgear_wnr1000-v2
 
 define Device/netgear_wnr2000-v3
+  $(Device/netgear_generic)
   SOC := ar7241
   DEVICE_MODEL := WNR2000
   DEVICE_VARIANT := v3
@@ -52,12 +47,9 @@ define Device/netgear_wnr2000-v3
   NETGEAR_BOARD_ID := WNR2000V3
   NETGEAR_HW_ID := 29763551+04+32
   IMAGE_SIZE := 3712k
-  IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | \
-	append-rootfs | pad-rootfs
   IMAGES += factory-NA.img
   IMAGE/factory-NA.img := $$(IMAGE/default) | netgear-dni NA | \
 	check-size
   SUPPORTED_DEVICES += wnr2000-v3
-  $(Device/netgear_ath79)
 endef
 TARGET_DEVICES += netgear_wnr2000-v3
-- 
2.20.1




More information about the openwrt-devel mailing list