[openwrt/openwrt] ath79: move small-flash Engenius boards to tiny

LEDE Commits lede-commits at lists.infradead.org
Thu Jan 7 13:52:19 EST 2021


adrian pushed a commit to openwrt/openwrt.git, branch master:
https://git.openwrt.org/0070650df45da29a55a89922544dba6859c18f2b

commit 0070650df45da29a55a89922544dba6859c18f2b
Author: Michael Pratt <mcpratt at pm.me>
AuthorDate: Fri Jan 1 16:48:52 2021 -0500

    ath79: move small-flash Engenius boards to tiny
    
    This moves some of the Engenius boards from generic to tiny:
    
     - EAP350 v1
     - ECB350 v1
     - ENH202 v1
    
    For these, factory.bin builds are already failing on master
    branch because of the unique situation for these boards:
    
     - 8 MB flash
     - an extra "failsafe" image for recovery
     - TFTP does not work (barely possible with 600 MTU)
     - bootloader loads image from a longer flash offset
     - 1 eraseblock each needed for OKLI kernel loader and fake rootfs
     - using mtd-concat to make use of remaining space...
    
    The manual alternative would be removing the failsafe partition.
    However this comes with the risk of extremely difficult recovery
    if a flash ever fails because TFTP on the bootloader is bugged.
    Signed-off-by: Michael Pratt <mcpratt at pm.me>
    [improve commit message]
    Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
 .../ath79/generic/base-files/etc/board.d/01_leds   |  8 ---
 .../generic/base-files/etc/board.d/02_network      | 32 ++++------
 .../etc/hotplug.d/firmware/10-ath9k-eeprom         |  5 +-
 target/linux/ath79/image/common-engenius.mk        | 33 ++++++++++
 target/linux/ath79/image/generic.mk                | 70 +---------------------
 target/linux/ath79/image/tiny.mk                   | 35 +++++++++++
 .../ath79/tiny/base-files/etc/board.d/01_leds      |  8 +++
 .../ath79/tiny/base-files/etc/board.d/02_network   | 10 ++++
 .../etc/hotplug.d/firmware/10-ath9k-eeprom         |  3 +
 9 files changed, 104 insertions(+), 100 deletions(-)

diff --git a/target/linux/ath79/generic/base-files/etc/board.d/01_leds b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
index b961e7d3e8..079c8d4e47 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds
@@ -182,14 +182,6 @@ dlink,dap-1365-a1)
 dlink,dir-859-a1)
 	ucidef_set_led_switch "internet" "WAN" "green:internet" "switch0" "0x20"
 	;;
-engenius,enh202-v1)
-	ucidef_set_led_switch "lan" "LAN" "amber:lan" "switch0" "0x10"
-	ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0"
-	ucidef_set_rssimon "wlan0" "200000" "1"
-	ucidef_set_led_rssi "rssilow" "RSSILOW" "red:rssilow" "wlan0" "1"  "100"
-	ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "amber:rssimedium" "wlan0" "33" "100"
-	ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "green:rssihigh" "wlan0" "67" "100"
-	;;
 engenius,ens202ext-v1|\
 engenius,enstationac-v1)
 	ucidef_set_rssimon "wlan0" "200000" "1"
diff --git a/target/linux/ath79/generic/base-files/etc/board.d/02_network b/target/linux/ath79/generic/base-files/etc/board.d/02_network
index c79286d45d..c08f374d3a 100755
--- a/target/linux/ath79/generic/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network
@@ -33,11 +33,9 @@ ath79_setup_interfaces()
 	dlink,dap-3320-a1|\
 	dlink,dir-505|\
 	engenius,eap300-v2|\
-	engenius,eap350-v1|\
 	engenius,eap600|\
 	engenius,ecb1200|\
 	engenius,ecb1750|\
-	engenius,ecb350-v1|\
 	engenius,ecb600|\
 	enterasys,ws-ap3705i|\
 	glinet,gl-ar300m-lite|\
@@ -227,11 +225,6 @@ ath79_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0 at eth0" "1:wan" "2:lan:3" "3:lan:2"
 		;;
-	engenius,enh202-v1)
-		ucidef_set_interface_wan "eth0"
-		ucidef_add_switch "switch0" \
-			"0 at eth1" "4:lan:1"
-		;;
 	engenius,ens202ext-v1)
 		ucidef_set_interface_wan "eth1"
 		ucidef_add_switch "switch0" \
@@ -530,19 +523,6 @@ ath79_setup_macs()
 		lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
 		label_mac=$lan_mac
 		;;
-	engenius,enh202-v1|\
-	ubnt,airrouter|\
-	ubnt,bullet-m-ar7240|\
-	ubnt,bullet-m-ar7241|\
-	ubnt,nanobridge-m|\
-	ubnt,nanostation-loco-m|\
-	ubnt,nanostation-m|\
-	ubnt,picostation-m|\
-	ubnt,powerbridge-m|\
-	ubnt,rocket-m|\
-	ubnt,unifi)
-		label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
-		;;
 	engenius,epg5000)
 		lan_mac=$(mtd_get_mac_ascii u-boot-env ethaddr)
 		wan_mac=$(mtd_get_mac_ascii u-boot-env wanaddr)
@@ -623,6 +603,18 @@ ath79_setup_macs()
 		wan_mac=$(mtd_get_mac_text mac 0x18)
 		label_mac=$wan_mac
 		;;
+	ubnt,airrouter|\
+	ubnt,bullet-m-ar7240|\
+	ubnt,bullet-m-ar7241|\
+	ubnt,nanobridge-m|\
+	ubnt,nanostation-loco-m|\
+	ubnt,nanostation-m|\
+	ubnt,picostation-m|\
+	ubnt,powerbridge-m|\
+	ubnt,rocket-m|\
+	ubnt,unifi)
+		label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
+		;;
 	ubnt,litebeam-ac-gen2|\
 	ubnt,nanobeam-ac-gen2|\
 	ubnt,powerbeam-5ac-500|\
diff --git a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 28ac38e1d4..95ad2a57ef 100644
--- a/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ath79/generic/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -74,10 +74,7 @@ case "$FIRMWARE" in
 	avm,fritz300e)
 		caldata_extract_reverse "urloader" 0x1541 0x440
 		;;
-	buffalo,wzr-hp-g302h-a1a0|\
-	engenius,eap350-v1|\
-	engenius,ecb350-v1|\
-	engenius,enh202-v1)
+	buffalo,wzr-hp-g302h-a1a0)
 		caldata_extract "art" 0x1000 0xeb8
 		;;
 	buffalo,wzr-hp-g450h|\
diff --git a/target/linux/ath79/image/common-engenius.mk b/target/linux/ath79/image/common-engenius.mk
new file mode 100644
index 0000000000..56e8f8cf67
--- /dev/null
+++ b/target/linux/ath79/image/common-engenius.mk
@@ -0,0 +1,33 @@
+DEVICE_VARS += ENGENIUS_IMGNAME
+
+# This needs to make /tmp/_sys/sysupgrade.tgz an empty file prior to
+# sysupgrade, as otherwise it will implant the old configuration from
+# OEM firmware when writing rootfs from factory.bin
+define Build/engenius-tar-gz
+	-[ -f "$@" ] && \
+	mkdir -p $@.tmp && \
+	touch $@.tmp/failsafe.bin && \
+	echo '#!/bin/sh' > $@.tmp/before-upgrade.sh && \
+	echo ': > /tmp/_sys/sysupgrade.tgz' >> $@.tmp/before-upgrade.sh && \
+	$(CP) $(KDIR)/loader-$(DEVICE_NAME).uImage \
+		$@.tmp/openwrt-$(word 1,$(1))-uImage-lzma.bin && \
+	$(CP) $@ $@.tmp/openwrt-$(word 1,$(1))-root.squashfs && \
+	$(TAR) -cp --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name \
+		$(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
+		-C $@.tmp . | gzip -9n > $@ && \
+	rm -rf $@.tmp
+endef
+
+define Device/engenius_loader_okli
+  DEVICE_VENDOR := EnGenius
+  KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49
+  LOADER_TYPE := bin
+  COMPILE := loader-$(1).bin loader-$(1).uImage
+  COMPILE/loader-$(1).bin := loader-okli-compile
+  COMPILE/loader-$(1).uImage := append-loader-okli $(1) | pad-to 64k | lzma | \
+	uImage lzma
+  IMAGES += factory.bin
+  IMAGE/factory.bin := append-squashfs-fakeroot-be | pad-to $$$$(BLOCKSIZE) | \
+	append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \
+	check-size | engenius-tar-gz $$$$(ENGENIUS_IMGNAME)
+endef
diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk
index 190f477b7e..ccc9ff2ac2 100644
--- a/target/linux/ath79/image/generic.mk
+++ b/target/linux/ath79/image/generic.mk
@@ -1,12 +1,12 @@
 include ./common-buffalo.mk
+include ./common-engenius.mk
 include ./common-netgear.mk
 include ./common-tp-link.mk
 include ./common-yuncore.mk
 
 DEVICE_VARS += ADDPATTERN_ID ADDPATTERN_VERSION
 DEVICE_VARS += SEAMA_SIGNATURE SEAMA_MTDBLOCK
-DEVICE_VARS += KERNEL_INITRAMFS_PREFIX
-DEVICE_VARS += DAP_SIGNATURE ENGENIUS_IMGNAME
+DEVICE_VARS += KERNEL_INITRAMFS_PREFIX DAP_SIGNATURE
 DEVICE_VARS += EDIMAX_HEADER_MAGIC EDIMAX_HEADER_MODEL
 
 define Build/add-elecom-factory-initramfs
@@ -69,24 +69,6 @@ define Build/edimax-headers
 	rm -rf $@.uImage $@.rootfs
 endef
 
-# This needs to make /tmp/_sys/sysupgrade.tgz an empty file prior to
-# sysupgrade, as otherwise it will implant the old configuration from
-# OEM firmware when writing rootfs from factory.bin
-define Build/engenius-tar-gz
-	-[ -f "$@" ] && \
-	mkdir -p $@.tmp && \
-	touch $@.tmp/failsafe.bin && \
-	echo '#!/bin/sh' > $@.tmp/before-upgrade.sh && \
-	echo ': > /tmp/_sys/sysupgrade.tgz' >> $@.tmp/before-upgrade.sh && \
-	$(CP) $(KDIR)/loader-$(DEVICE_NAME).uImage \
-		$@.tmp/openwrt-$(word 1,$(1))-uImage-lzma.bin && \
-	$(CP) $@ $@.tmp/openwrt-$(word 1,$(1))-root.squashfs && \
-	$(TAR) -cp --numeric-owner --owner=0 --group=0 --mode=a-s --sort=name \
-		$(if $(SOURCE_DATE_EPOCH),--mtime="@$(SOURCE_DATE_EPOCH)") \
-		-C $@.tmp . | gzip -9n > $@ && \
-	rm -rf $@.tmp
-endef
-
 define Build/mkdapimg2
 	$(STAGING_DIR_HOST)/bin/mkdapimg2 \
 		-i $@ -o $@.new \
@@ -974,20 +956,6 @@ define Device/embeddedwireless_dorin
 endef
 TARGET_DEVICES += embeddedwireless_dorin
 
-define Device/engenius_loader_okli
-  DEVICE_VENDOR := EnGenius
-  KERNEL := kernel-bin | append-dtb | lzma | uImage lzma -M 0x4f4b4c49
-  LOADER_TYPE := bin
-  COMPILE := loader-$(1).bin loader-$(1).uImage
-  COMPILE/loader-$(1).bin := loader-okli-compile
-  COMPILE/loader-$(1).uImage := append-loader-okli $(1) | pad-to 64k | lzma | \
-	uImage lzma
-  IMAGES += factory.bin
-  IMAGE/factory.bin := append-squashfs-fakeroot-be | pad-to $$$$(BLOCKSIZE) | \
-	append-kernel | pad-to $$$$(BLOCKSIZE) | append-rootfs | pad-rootfs | \
-	check-size | engenius-tar-gz $$$$(ENGENIUS_IMGNAME)
-endef
-
 define Device/engenius_eap300-v2
   $(Device/engenius_loader_okli)
   SOC := ar9341
@@ -999,17 +967,6 @@ define Device/engenius_eap300-v2
 endef
 TARGET_DEVICES += engenius_eap300-v2
 
-define Device/engenius_eap350-v1
-  $(Device/engenius_loader_okli)
-  SOC := ar7242
-  DEVICE_MODEL := EAP350
-  DEVICE_VARIANT := v1
-  IMAGE_SIZE := 4864k
-  LOADER_FLASH_OFFS := 0x1b0000
-  ENGENIUS_IMGNAME := senao-eap350
-endef
-TARGET_DEVICES += engenius_eap350-v1
-
 define Device/engenius_eap600
   $(Device/engenius_loader_okli)
   SOC := ar9344
@@ -1046,17 +1003,6 @@ define Device/engenius_ecb1750
 endef
 TARGET_DEVICES += engenius_ecb1750
 
-define Device/engenius_ecb350-v1
-  $(Device/engenius_loader_okli)
-  SOC := ar7242
-  DEVICE_MODEL := ECB350
-  DEVICE_VARIANT := v1
-  IMAGE_SIZE := 4864k
-  LOADER_FLASH_OFFS := 0x1b0000
-  ENGENIUS_IMGNAME := senao-ecb350
-endef
-TARGET_DEVICES += engenius_ecb350-v1
-
 define Device/engenius_ecb600
   $(Device/engenius_loader_okli)
   SOC := ar9344
@@ -1067,18 +1013,6 @@ define Device/engenius_ecb600
 endef
 TARGET_DEVICES += engenius_ecb600
 
-define Device/engenius_enh202-v1
-  $(Device/engenius_loader_okli)
-  SOC := ar7240
-  DEVICE_MODEL := ENH202
-  DEVICE_VARIANT := v1
-  DEVICE_PACKAGES := rssileds
-  IMAGE_SIZE := 4864k
-  LOADER_FLASH_OFFS := 0x1b0000
-  ENGENIUS_IMGNAME := senao-enh202
-endef
-TARGET_DEVICES += engenius_enh202-v1
-
 define Device/engenius_ens202ext-v1
   $(Device/engenius_loader_okli)
   SOC := ar9341
diff --git a/target/linux/ath79/image/tiny.mk b/target/linux/ath79/image/tiny.mk
index 83c34d718b..36d2818ad5 100644
--- a/target/linux/ath79/image/tiny.mk
+++ b/target/linux/ath79/image/tiny.mk
@@ -1,4 +1,5 @@
 include ./common-buffalo.mk
+include ./common-engenius.mk
 
 define Device/buffalo_whr-g301n
   $(Device/buffalo_common)
@@ -30,6 +31,40 @@ define Device/dlink_dir-615-e4
 endef
 TARGET_DEVICES += dlink_dir-615-e4
 
+define Device/engenius_eap350-v1
+  $(Device/engenius_loader_okli)
+  SOC := ar7242
+  DEVICE_MODEL := EAP350
+  DEVICE_VARIANT := v1
+  IMAGE_SIZE := 4864k
+  LOADER_FLASH_OFFS := 0x1b0000
+  ENGENIUS_IMGNAME := senao-eap350
+endef
+TARGET_DEVICES += engenius_eap350-v1
+
+define Device/engenius_ecb350-v1
+  $(Device/engenius_loader_okli)
+  SOC := ar7242
+  DEVICE_MODEL := ECB350
+  DEVICE_VARIANT := v1
+  IMAGE_SIZE := 4864k
+  LOADER_FLASH_OFFS := 0x1b0000
+  ENGENIUS_IMGNAME := senao-ecb350
+endef
+TARGET_DEVICES += engenius_ecb350-v1
+
+define Device/engenius_enh202-v1
+  $(Device/engenius_loader_okli)
+  SOC := ar7240
+  DEVICE_MODEL := ENH202
+  DEVICE_VARIANT := v1
+  DEVICE_PACKAGES := rssileds
+  IMAGE_SIZE := 4864k
+  LOADER_FLASH_OFFS := 0x1b0000
+  ENGENIUS_IMGNAME := senao-enh202
+endef
+TARGET_DEVICES += engenius_enh202-v1
+
 define Device/pqi_air-pen
   SOC := ar9330
   DEVICE_VENDOR := PQI
diff --git a/target/linux/ath79/tiny/base-files/etc/board.d/01_leds b/target/linux/ath79/tiny/base-files/etc/board.d/01_leds
index 26926b6f64..f0b4acf066 100755
--- a/target/linux/ath79/tiny/base-files/etc/board.d/01_leds
+++ b/target/linux/ath79/tiny/base-files/etc/board.d/01_leds
@@ -21,6 +21,14 @@ tplink,tl-wr941-v4)
 	ucidef_set_led_switch "lan3" "LAN3" "green:lan3" "switch0" "0x08"
 	ucidef_set_led_switch "lan4" "LAN4" "green:lan4" "switch0" "0x10"
 	;;
+engenius,enh202-v1)
+	ucidef_set_led_switch "lan" "LAN" "amber:lan" "switch0" "0x10"
+	ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth0"
+	ucidef_set_rssimon "wlan0" "200000" "1"
+	ucidef_set_led_rssi "rssilow" "RSSILOW" "red:rssilow" "wlan0" "1"  "100"
+	ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "amber:rssimedium" "wlan0" "33" "100"
+	ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "green:rssihigh" "wlan0" "67" "100"
+	;;
 netgear,wnr1000-v2|\
 netgear,wnr2000-v3)
 	ucidef_set_led_netdev "wan-amber" "WAN (amber)" "amber:wan" "eth0"
diff --git a/target/linux/ath79/tiny/base-files/etc/board.d/02_network b/target/linux/ath79/tiny/base-files/etc/board.d/02_network
index cbcdbe9a89..ce95bf7037 100755
--- a/target/linux/ath79/tiny/base-files/etc/board.d/02_network
+++ b/target/linux/ath79/tiny/base-files/etc/board.d/02_network
@@ -28,6 +28,8 @@ ath79_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0 at eth1" "1:lan" "2:lan" "3:lan" "4:lan"
 		;;
+	engenius,eap350-v1|\
+	engenius,ecb350-v1|\
 	pqi,air-pen|\
 	tplink,tl-mr10u|\
 	tplink,tl-mr3020-v1|\
@@ -51,6 +53,11 @@ ath79_setup_interfaces()
 	tplink,tl-wr802n-v2)
 		ucidef_set_interface_lan "eth0"
 		;;
+	engenius,enh202-v1)
+		ucidef_set_interface_wan "eth0"
+		ucidef_add_switch "switch0" \
+			"0 at eth1" "4:lan:1"
+		;;
 	tplink,tl-mr3220-v1|\
 	tplink,tl-mr3420-v1|\
 	tplink,tl-mr3420-v3|\
@@ -99,6 +106,9 @@ ath79_setup_macs()
 		wan_mac=$(mtd_get_mac_ascii "nvram" "wan_mac")
 		label_mac=$wan_mac
 		;;
+	engenius,enh202-v1)
+		label_mac=$(cat /sys/class/ieee80211/phy0/macaddress)
+		;;
 	tplink,tl-wr941-v2|\
 	tplink,tl-wr941n-v7-cn)
 		base_mac=$(mtd_get_mac_binary u-boot 0x1fc00)
diff --git a/target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom b/target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
index 6ae2dc5f94..ffbc46afd0 100644
--- a/target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
+++ b/target/linux/ath79/tiny/base-files/etc/hotplug.d/firmware/10-ath9k-eeprom
@@ -10,6 +10,9 @@ case "$FIRMWARE" in
 "ath9k-eeprom-pci-0000:00:00.0.bin")
 	case $board in
 	buffalo,whr-g301n|\
+	engenius,eap350-v1|\
+	engenius,ecb350-v1|\
+	engenius,enh202-v1|\
 	tplink,tl-wa701nd-v1|\
 	tplink,tl-wa730re-v1|\
 	tplink,tl-wa801nd-v1|\



More information about the lede-commits mailing list