From 8201e402c5485817eaf8838347b35e48f7086739 Mon Sep 17 00:00:00 2001 From: Shiji Yang Date: Tue, 19 Mar 2024 21:25:52 +0800 Subject: [PATCH] ath79: move D-Link DIR-859 and DIR-869 series to tiny sub-target These devices only have 64 MiB RAM and ath10k wireless driver will consume a lot of memory. Let's move them to the tiny sub-target to get extra 7 MiB of free space. In this way, we can extend their lifetime to receive support for the next OpenWrt LTS version. This patch also trims the USB package for the non-existent USB port. Signed-off-by: Shiji Yang --- .../generic/base-files/etc/board.d/01_leds | 6 ---- .../generic/base-files/etc/board.d/02_network | 12 ------- .../etc/uci-defaults/09_fix-checksum | 3 -- target/linux/ath79/image/generic.mk | 35 ------------------- target/linux/ath79/image/tiny.mk | 35 +++++++++++++++++++ .../ath79/tiny/base-files/etc/board.d/01_leds | 6 ++++ .../tiny/base-files/etc/board.d/02_network | 15 ++++++++ .../etc/uci-defaults/09_fix-checksum | 16 +++++++++ 8 files changed, 72 insertions(+), 56 deletions(-) create mode 100644 target/linux/ath79/tiny/base-files/etc/uci-defaults/09_fix-checksum 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 525224bec9..bfc383c0e5 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/generic/base-files/etc/board.d/01_leds @@ -249,12 +249,6 @@ dlink,dap-1720-a1) ucidef_set_led_rssi "rssimediumhigh" "RSSI MEDIUM-HIGH" "green:signal-2" "wlan0" "61" "100" ucidef_set_led_rssi "rssihigh" "RSSI HIGH" "green:signal-3" "wlan0" "81" "100" ;; -dlink,dir-859-a1) - ucidef_set_led_switch "internet" "WAN" "green:internet" "switch0" "0x20" - ;; -dlink,dir-859-a3) - ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x20" - ;; 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 6c1cb86235..de9bd6a300 100644 --- a/target/linux/ath79/generic/base-files/etc/board.d/02_network +++ b/target/linux/ath79/generic/base-files/etc/board.d/02_network @@ -318,9 +318,6 @@ ath79_setup_interfaces() dlink,dir-842-c1|\ dlink,dir-842-c2|\ dlink,dir-842-c3|\ - dlink,dir-859-a1|\ - dlink,dir-859-a3|\ - dlink,dir-869-a1|\ engenius,epg5000|\ engenius,esr1200|\ engenius,esr1750|\ @@ -699,15 +696,6 @@ ath79_setup_macs() wan_mac=$(mtd_get_mac_ascii devdata "wanmac") label_mac=$lan_mac ;; - dlink,dir-859-a1|\ - dlink,dir-869-a1) - lan_mac=$(mtd_get_mac_text "devdata" 0xc9) - wan_mac=$(mtd_get_mac_text "devdata" 0x79) - ;; - dlink,dir-859-a3) - lan_mac=$(get_mac_label) - wan_mac=$(macaddr_add "$lan_mac" 3) - ;; qihoo,c301|\ wd,mynet-n600|\ wd,mynet-n750) diff --git a/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum b/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum index 4ec8c13eb7..3f85fc12a0 100644 --- a/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum +++ b/target/linux/ath79/generic/base-files/etc/uci-defaults/09_fix-checksum @@ -23,9 +23,6 @@ dlink,dap-3662-a1) ;; dlink,dap-1720-a1|\ dlink,dir-629-a1|\ -dlink,dir-859-a1|\ -dlink,dir-859-a3|\ -dlink,dir-869-a1|\ qihoo,c301) fix_seama_header ;; diff --git a/target/linux/ath79/image/generic.mk b/target/linux/ath79/image/generic.mk index d56afcaac8..03a0472c12 100644 --- a/target/linux/ath79/image/generic.mk +++ b/target/linux/ath79/image/generic.mk @@ -1278,41 +1278,6 @@ define Device/dlink_dir-842-c3 endef TARGET_DEVICES += dlink_dir-842-c3 -define Device/dlink_dir-859-ax - $(Device/seama) - SOC := qca9563 - DEVICE_VENDOR := D-Link - DEVICE_MODEL := DIR-859 - IMAGE_SIZE := 15872k - DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct - SEAMA_SIGNATURE := wrgac37_dlink.2013gui_dir859 -endef - -define Device/dlink_dir-859-a1 - $(Device/dlink_dir-859-ax) - DEVICE_VARIANT := A1 -endef -TARGET_DEVICES += dlink_dir-859-a1 - -define Device/dlink_dir-859-a3 - $(Device/dlink_dir-859-ax) - DEVICE_VARIANT := A3 -endef -TARGET_DEVICES += dlink_dir-859-a3 - -define Device/dlink_dir-869-a1 - $(Device/seama) - SOC := qca9563 - DEVICE_VENDOR := D-Link - DEVICE_MODEL := DIR-869 - DEVICE_VARIANT := A1 - IMAGE_SIZE := 15872k - DEVICE_PACKAGES := kmod-usb2 kmod-ath10k-ct-smallbuffers ath10k-firmware-qca988x-ct - SEAMA_SIGNATURE := wrgac54_dlink.2015_dir869 - SUPPORTED_DEVICES += dir-869-a1 -endef -TARGET_DEVICES += dlink_dir-869-a1 - define Device/elecom_wab DEVICE_VENDOR := ELECOM IMAGE_SIZE := 14336k diff --git a/target/linux/ath79/image/tiny.mk b/target/linux/ath79/image/tiny.mk index 25ec95b574..13f105d202 100644 --- a/target/linux/ath79/image/tiny.mk +++ b/target/linux/ath79/image/tiny.mk @@ -30,6 +30,41 @@ define Device/dlink_dir-615-e4 endef TARGET_DEVICES += dlink_dir-615-e4 +define Device/dlink_dir-859-a + $(Device/seama) + SOC := qca9563 + DEVICE_VENDOR := D-Link + DEVICE_MODEL := DIR-859 + IMAGE_SIZE := 15872k + SEAMA_SIGNATURE := wrgac37_dlink.2013gui_dir859 + DEVICE_PACKAGES := ath10k-firmware-qca988x-ct kmod-ath10k-ct-smallbuffers +endef + +define Device/dlink_dir-859-a1 + $(Device/dlink_dir-859-a) + DEVICE_VARIANT := A1 +endef +TARGET_DEVICES += dlink_dir-859-a1 + +define Device/dlink_dir-859-a3 + $(Device/dlink_dir-859-a) + DEVICE_VARIANT := A3 +endef +TARGET_DEVICES += dlink_dir-859-a3 + +define Device/dlink_dir-869-a1 + $(Device/seama) + SOC := qca9563 + DEVICE_VENDOR := D-Link + DEVICE_MODEL := DIR-869 + DEVICE_VARIANT := A1 + IMAGE_SIZE := 15872k + SEAMA_SIGNATURE := wrgac54_dlink.2015_dir869 + DEVICE_PACKAGES := ath10k-firmware-qca988x-ct kmod-ath10k-ct-smallbuffers + SUPPORTED_DEVICES += dir-869-a1 +endef +TARGET_DEVICES += dlink_dir-869-a1 + define Device/engenius_eap350-v1 $(Device/senao_loader_okli) BLOCKSIZE := 4k 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 07e48ec49f..427eac8a06 100644 --- a/target/linux/ath79/tiny/base-files/etc/board.d/01_leds +++ b/target/linux/ath79/tiny/base-files/etc/board.d/01_leds @@ -20,6 +20,12 @@ tplink,tl-wr941-v4) ucidef_set_led_switch "lan3" "LAN3" "green:lan3" "switch0" "0x08" ucidef_set_led_switch "lan4" "LAN4" "green:lan4" "switch0" "0x10" ;; +dlink,dir-859-a1) + ucidef_set_led_switch "internet" "INTERNET" "green:internet" "switch0" "0x20" + ;; +dlink,dir-859-a3) + ucidef_set_led_switch "wan" "WAN" "green:wan" "switch0" "0x20" + ;; engenius,enh202-v1) ucidef_set_led_switch "lan" "LAN" "amber:lan" "switch0" "0x10" ucidef_set_led_netdev "wan" "WAN" "green: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 836d119867..60e640e0fb 100644 --- a/target/linux/ath79/tiny/base-files/etc/board.d/02_network +++ b/target/linux/ath79/tiny/base-files/etc/board.d/02_network @@ -27,6 +27,12 @@ ath79_setup_interfaces() ucidef_add_switch "switch0" \ "0@eth1" "1:lan" "2:lan" "3:lan" "4:lan" ;; + dlink,dir-859-a1|\ + dlink,dir-859-a3|\ + dlink,dir-869-a1) + ucidef_add_switch "switch0" \ + "0@eth0" "1:lan:4" "2:lan:3" "3:lan:2" "4:lan:1" "5:wan" + ;; engenius,eap350-v1|\ engenius,ecb350-v1|\ pqi,air-pen|\ @@ -126,6 +132,15 @@ ath79_setup_macs() wan_mac=$(mtd_get_mac_ascii "nvram" "wan_mac") label_mac=$wan_mac ;; + dlink,dir-859-a1|\ + dlink,dir-869-a1) + lan_mac=$(mtd_get_mac_text "devdata" 0xc9) + wan_mac=$(mtd_get_mac_text "devdata" 0x79) + ;; + dlink,dir-859-a3) + lan_mac=$(get_mac_label) + wan_mac=$(macaddr_add "$lan_mac" 3) + ;; engenius,enh202-v1|\ ubnt,airrouter|\ ubnt,bullet-m-ar7240|\ diff --git a/target/linux/ath79/tiny/base-files/etc/uci-defaults/09_fix-checksum b/target/linux/ath79/tiny/base-files/etc/uci-defaults/09_fix-checksum new file mode 100644 index 0000000000..4febde5335 --- /dev/null +++ b/target/linux/ath79/tiny/base-files/etc/uci-defaults/09_fix-checksum @@ -0,0 +1,16 @@ +. /lib/functions.sh + +fix_seama_header() { + local kernel_size=$(sed -n 's/mtd[0-9]*: \([0-9a-f]*\).*"kernel".*/\1/p' /proc/mtd) + [ "$kernel_size" ] && mtd -c 0x$kernel_size fixseama firmware +} + +board=$(board_name) + +case "$board" in +dlink,dir-859-a1|\ +dlink,dir-859-a3|\ +dlink,dir-869-a1) + fix_seama_header + ;; +esac -- 2.30.2