diff mbox series

[4/5] ath79: netgear: trim down uImage customisations

Message ID 20201104092117.86343-5-sander@svanheule.net
State Accepted
Headers show
Series Make Build/uImage more flexible | expand

Commit Message

Sander Vanheule Nov. 4, 2020, 9:21 a.m. UTC
Replace NETGEAR_KERNEL_MAGIC by UIMAGE_MAGIC to better match the
variable's purpose. This allows to drop UIMAGE_MAGIC where it equals the
default for uImages, and remove the custom Build/netgear-uImage.

Signed-off-by: Sander Vanheule <sander@svanheule.net>
---
Build tested for Netgear WNDR3700v2 and EX6400.

 target/linux/ath79/image/common-netgear.mk | 14 +++++---------
 target/linux/ath79/image/generic.mk        | 15 +++++++--------
 target/linux/ath79/image/nand.mk           | 18 +++++++-----------
 target/linux/ath79/image/tiny-netgear.mk   |  8 ++++----
 4 files changed, 23 insertions(+), 32 deletions(-)
diff mbox series

Patch

diff --git a/target/linux/ath79/image/common-netgear.mk b/target/linux/ath79/image/common-netgear.mk
index b41650c6e9..d4f43bbaca 100644
--- a/target/linux/ath79/image/common-netgear.mk
+++ b/target/linux/ath79/image/common-netgear.mk
@@ -1,9 +1,9 @@ 
-DEVICE_VARS += NETGEAR_KERNEL_MAGIC NETGEAR_BOARD_ID NETGEAR_HW_ID
+DEVICE_VARS += NETGEAR_BOARD_ID NETGEAR_HW_ID
 
 define Build/netgear-rootfs
 	mkimage \
 		-A mips -O linux -T filesystem -C none \
-		-M $(NETGEAR_KERNEL_MAGIC) \
+		$(if $(UIMAGE_MAGIC),-M $(UIMAGE_MAGIC)) \
 		-n '$(VERSION_DIST) filesystem' \
 		-d $(IMAGE_ROOTFS) $@.fs
 	cat $@.fs >> $@
@@ -22,21 +22,17 @@  define Build/netgear-squashfs
 	dd if=/dev/zero bs=1k count=1 >> $@.squashfs
 	mkimage \
 		-A mips -O linux -T filesystem -C none \
-		-M $(NETGEAR_KERNEL_MAGIC) \
+		$(if $(UIMAGE_MAGIC),-M $(UIMAGE_MAGIC)) \
 		-a 0xbf070000 -e 0xbf070000 \
 		-n 'MIPS $(VERSION_DIST) Linux-$(LINUX_VERSION)' \
 		-d $@.squashfs $@
 	rm -rf $@.squashfs $@.fs
 endef
 
-define Build/netgear-uImage
-	$(call Build/uImage,$(1) -M $(NETGEAR_KERNEL_MAGIC))
-endef
-
 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
+  KERNEL := kernel-bin | append-dtb | lzma -d20 | uImage lzma
+  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | uImage lzma
   IMAGES += factory.img
   IMAGE/default := append-kernel | pad-to $$$$(BLOCKSIZE) | netgear-squashfs | \
 	append-rootfs | pad-rootfs
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index b6ec366eb0..df0ee4e835 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -1205,7 +1205,6 @@  TARGET_DEVICES += nec_wg800hp
 define Device/netgear_ex6400_ex7300
   $(Device/netgear_generic)
   SOC := qca9558
-  NETGEAR_KERNEL_MAGIC := 0x27051956
   NETGEAR_BOARD_ID := EX7300series
   NETGEAR_HW_ID := 29765104+16+0+128
   IMAGE_SIZE := 15552k
@@ -1241,7 +1240,7 @@  define Device/netgear_wndr3700
   $(Device/netgear_wndr3x00)
   DEVICE_MODEL := WNDR3700
   DEVICE_VARIANT := v1
-  NETGEAR_KERNEL_MAGIC := 0x33373030
+  UIMAGE_MAGIC := 0x33373030
   NETGEAR_BOARD_ID := WNDR3700
   IMAGE_SIZE := 7680k
   IMAGES += factory-NA.img
@@ -1255,7 +1254,7 @@  define Device/netgear_wndr3700-v2
   $(Device/netgear_wndr3x00)
   DEVICE_MODEL := WNDR3700
   DEVICE_VARIANT := v2
-  NETGEAR_KERNEL_MAGIC := 0x33373031
+  UIMAGE_MAGIC := 0x33373031
   NETGEAR_BOARD_ID := WNDR3700v2
   NETGEAR_HW_ID := 29763654+16+64
   IMAGE_SIZE := 15872k
@@ -1266,7 +1265,7 @@  TARGET_DEVICES += netgear_wndr3700-v2
 define Device/netgear_wndr3800
   $(Device/netgear_wndr3x00)
   DEVICE_MODEL := WNDR3800
-  NETGEAR_KERNEL_MAGIC := 0x33373031
+  UIMAGE_MAGIC := 0x33373031
   NETGEAR_BOARD_ID := WNDR3800
   NETGEAR_HW_ID := 29763654+16+128
   IMAGE_SIZE := 15872k
@@ -1277,7 +1276,7 @@  TARGET_DEVICES += netgear_wndr3800
 define Device/netgear_wndr3800ch
   $(Device/netgear_wndr3x00)
   DEVICE_MODEL := WNDR3800CH
-  NETGEAR_KERNEL_MAGIC := 0x33373031
+  UIMAGE_MAGIC := 0x33373031
   NETGEAR_BOARD_ID := WNDR3800CH
   NETGEAR_HW_ID := 29763654+16+128
   IMAGE_SIZE := 15872k
@@ -1289,7 +1288,7 @@  define Device/netgear_wndrmac-v1
   $(Device/netgear_wndr3x00)
   DEVICE_MODEL := WNDRMAC
   DEVICE_VARIANT := v1
-  NETGEAR_KERNEL_MAGIC := 0x33373031
+  UIMAGE_MAGIC := 0x33373031
   NETGEAR_BOARD_ID := WNDRMAC
   NETGEAR_HW_ID := 29763654+16+64
   IMAGE_SIZE := 15872k
@@ -1301,7 +1300,7 @@  define Device/netgear_wndrmac-v2
   $(Device/netgear_wndr3x00)
   DEVICE_MODEL := WNDRMAC
   DEVICE_VARIANT := v2
-  NETGEAR_KERNEL_MAGIC := 0x33373031
+  UIMAGE_MAGIC := 0x33373031
   NETGEAR_BOARD_ID := WNDRMACv2
   NETGEAR_HW_ID := 29763654+16+128
   IMAGE_SIZE := 15872k
@@ -1314,7 +1313,7 @@  define Device/netgear_wnr2200_common
   SOC := ar7241
   DEVICE_MODEL := WNR2200
   DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
-  NETGEAR_KERNEL_MAGIC := 0x32323030
+  UIMAGE_MAGIC := 0x32323030
   NETGEAR_BOARD_ID := wnr2200
 endef
 
diff --git a/target/linux/ath79/image/nand.mk b/target/linux/ath79/image/nand.mk
index c7f96eb6d4..5badaeddaa 100644
--- a/target/linux/ath79/image/nand.mk
+++ b/target/linux/ath79/image/nand.mk
@@ -1,5 +1,3 @@ 
-include ./common-netgear.mk	# for netgear-uImage
-
 DEVICE_VARS += RAS_ROOTFS_SIZE RAS_BOARD RAS_VERSION
 
 # attention: only zlib compression is allowed for the boot fs
@@ -163,10 +161,10 @@  define Device/netgear_ath79_nand
   PAGESIZE := 2048
   IMAGE_SIZE := 25600k
   KERNEL := kernel-bin | append-dtb | lzma -d20 | \
-	pad-offset $$(KERNEL_SIZE) 129 | netgear-uImage lzma | \
+	pad-offset $$(KERNEL_SIZE) 129 | uImage lzma | \
 	append-string -e '\xff' | \
-	append-uImage-fakehdr filesystem $$(NETGEAR_KERNEL_MAGIC)
-  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | netgear-uImage lzma
+	append-uImage-fakehdr filesystem $$(UIMAGE_MAGIC)
+  KERNEL_INITRAMFS := kernel-bin | append-dtb | lzma -d20 | uImage lzma
   IMAGES := sysupgrade.bin factory.img
   IMAGE/factory.img := append-kernel | append-ubi | netgear-dni | \
 	check-size
@@ -179,7 +177,7 @@  define Device/netgear_wndr3700-v4
   SOC := ar9344
   DEVICE_MODEL := WNDR3700
   DEVICE_VARIANT := v4
-  NETGEAR_KERNEL_MAGIC := 0x33373033
+  UIMAGE_MAGIC := 0x33373033
   NETGEAR_BOARD_ID := WNDR3700v4
   NETGEAR_HW_ID := 29763948+128+128
   $(Device/netgear_ath79_nand)
@@ -189,7 +187,7 @@  TARGET_DEVICES += netgear_wndr3700-v4
 define Device/netgear_wndr4300
   SOC := ar9344
   DEVICE_MODEL := WNDR4300
-  NETGEAR_KERNEL_MAGIC := 0x33373033
+  UIMAGE_MAGIC := 0x33373033
   NETGEAR_BOARD_ID := WNDR4300
   NETGEAR_HW_ID := 29763948+0+128+128+2x2+3x3
   $(Device/netgear_ath79_nand)
@@ -199,7 +197,7 @@  TARGET_DEVICES += netgear_wndr4300
 define Device/netgear_wndr4300sw
   SOC := ar9344
   DEVICE_MODEL := WNDR4300SW
-  NETGEAR_KERNEL_MAGIC := 0x33373033
+  UIMAGE_MAGIC := 0x33373033
   NETGEAR_BOARD_ID := WNDR4300SW
   NETGEAR_HW_ID := 29763948+0+128+128+2x2+3x3
   $(Device/netgear_ath79_nand)
@@ -209,7 +207,7 @@  TARGET_DEVICES += netgear_wndr4300sw
 define Device/netgear_wndr4300tn
   SOC := ar9344
   DEVICE_MODEL := WNDR4300TN
-  NETGEAR_KERNEL_MAGIC := 0x33373033
+  UIMAGE_MAGIC := 0x33373033
   NETGEAR_BOARD_ID := WNDR4300TN
   NETGEAR_HW_ID := 29763948+0+128+128+2x2+3x3
   $(Device/netgear_ath79_nand)
@@ -220,7 +218,6 @@  define Device/netgear_wndr4300-v2
   SOC := qca9563
   DEVICE_MODEL := WNDR4300
   DEVICE_VARIANT := v2
-  NETGEAR_KERNEL_MAGIC := 0x27051956
   NETGEAR_BOARD_ID := WNDR4500series
   NETGEAR_HW_ID := 29764821+2+128+128+3x3+3x3+5508012175
   $(Device/netgear_ath79_nand)
@@ -231,7 +228,6 @@  define Device/netgear_wndr4500-v3
   SOC := qca9563
   DEVICE_MODEL := WNDR4500
   DEVICE_VARIANT := v3
-  NETGEAR_KERNEL_MAGIC := 0x27051956
   NETGEAR_BOARD_ID := WNDR4500series
   NETGEAR_HW_ID := 29764821+2+128+128+3x3+3x3+5508012173
   $(Device/netgear_ath79_nand)
diff --git a/target/linux/ath79/image/tiny-netgear.mk b/target/linux/ath79/image/tiny-netgear.mk
index 8561f91ab8..080827c08d 100644
--- a/target/linux/ath79/image/tiny-netgear.mk
+++ b/target/linux/ath79/image/tiny-netgear.mk
@@ -6,7 +6,7 @@  define Device/netgear_wnr612-v2
   DEVICE_MODEL := WNR612
   DEVICE_VARIANT := v2
   DEVICE_DTS := ar7240_netgear_wnr612-v2
-  NETGEAR_KERNEL_MAGIC := 0x32303631
+  UIMAGE_MAGIC := 0x32303631
   NETGEAR_BOARD_ID := REALWNR612V2
   IMAGE_SIZE := 3712k
   SUPPORTED_DEVICES += wnr612-v2
@@ -19,7 +19,7 @@  define Device/on_n150r
   SOC := ar7240
   DEVICE_VENDOR := On Networks
   DEVICE_MODEL := N150R
-  NETGEAR_KERNEL_MAGIC := 0x32303631
+  UIMAGE_MAGIC := 0x32303631
   NETGEAR_BOARD_ID := N150R
   IMAGE_SIZE := 3712k
   SUPPORTED_DEVICES += n150r
@@ -32,7 +32,7 @@  define Device/netgear_wnr1000-v2
   SOC := ar7240
   DEVICE_MODEL := WNR1000
   DEVICE_VARIANT := v2
-  NETGEAR_KERNEL_MAGIC := 0x31303031
+  UIMAGE_MAGIC := 0x31303031
   NETGEAR_BOARD_ID := WNR1000V2
   NETGEAR_HW_ID := 29763331+4+32
   IMAGE_SIZE := 3712k
@@ -46,7 +46,7 @@  define Device/netgear_wnr2000-v3
   SOC := ar7241
   DEVICE_MODEL := WNR2000
   DEVICE_VARIANT := v3
-  NETGEAR_KERNEL_MAGIC := 0x32303033
+  UIMAGE_MAGIC := 0x32303033
   NETGEAR_BOARD_ID := WNR2000V3
   NETGEAR_HW_ID := 29763551+04+32
   IMAGE_SIZE := 3712k