[RFC PATCH 1/5] ath79: put some 8/32MB devices to tiny subtarget

Adrian Schmutzler mail at adrianschmutzler.de
Sun Dec 6 07:49:32 EST 2020


> --- a/target/linux/ath79/image/common-tp-link.mk
> +++ b/target/linux/ath79/image/common-tp-link.mk
> @@ -40,6 +40,7 @@ define Device/tplink-4m
>    $(Device/tplink-nolzma)
>    TPLINK_FLASHLAYOUT := 4M
>    IMAGE_SIZE := 3904k
> +  FEATURES := small_flash

Features are a target property, defining them per-device is wrong and won't work as expected.

Best

Adrian

>    DEFAULT := n
>  endef
> 
> @@ -47,6 +48,7 @@ define Device/tplink-4mlzma
>    $(Device/tplink-v1)
>    TPLINK_FLASHLAYOUT := 4Mlzma
>    IMAGE_SIZE := 3904k
> +  FEATURES := small_flash
>    DEFAULT := n
>  endef
> 
> diff --git a/target/linux/ath79/image/tiny-tp-link.mk
> b/target/linux/ath79/image/tiny-tp-link.mk
> index c918c6baa6..d5b36de577 100644
> --- a/target/linux/ath79/image/tiny-tp-link.mk
> +++ b/target/linux/ath79/image/tiny-tp-link.mk
> @@ -223,6 +223,17 @@ define Device/tplink_tl-wa901nd-v5  endef
> TARGET_DEVICES += tplink_tl-wa901nd-v5
> 
> +define Device/tplink_tl-wr1043nd-v1
> +  $(Device/tplink-8m)
> +  SOC := ar9132
> +  DEVICE_MODEL := TL-WR1043N/ND
> +  DEVICE_VARIANT := v1
> +  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
> +  TPLINK_HWID := 0x10430001
> +  SUPPORTED_DEVICES += tl-wr1043nd
> +endef
> +TARGET_DEVICES += tplink_tl-wr1043nd-v1
> +
>  define Device/tplink_tl-wr703n
>    $(Device/tplink-4mlzma)
>    SOC := ar9331
> @@ -243,6 +254,29 @@ define Device/tplink_tl-wr740n-v1  endef
> TARGET_DEVICES += tplink_tl-wr740n-v1
> 
> +define Device/tplink_tl-wr710n-v1
> +  $(Device/tplink-8mlzma)
> +  SOC := ar9331
> +  DEVICE_MODEL := TL-WR710N
> +  DEVICE_VARIANT := v1
> +  DEVICE_PACKAGES := kmod-usb-chipidea2 kmod-usb-ledtrig-usbport
> +  TPLINK_HWID := 0x07100001
> +  SUPPORTED_DEVICES += tl-wr710n
> +endef
> +TARGET_DEVICES += tplink_tl-wr710n-v1
> +
> +define Device/tplink_tl-wr710n-v2.1
> +  $(Device/tplink-8mlzma)
> +  SOC := ar9331
> +  DEVICE_MODEL := TL-WR710N
> +  DEVICE_VARIANT := v2.1
> +  DEVICE_PACKAGES := kmod-usb-chipidea2 kmod-usb-ledtrig-usbport
> +  TPLINK_HWID := 0x07100002
> +  TPLINK_HWREV := 0x2
> +  SUPPORTED_DEVICES += tl-wr710n
> +endef
> +TARGET_DEVICES += tplink_tl-wr710n-v2.1
> +
>  define Device/tplink_tl-wr740n-v3
>    $(Device/tplink-4m)
>    SOC := ar7240
> @@ -327,6 +361,16 @@ define Device/tplink_tl-wr802n-v2  endef
> TARGET_DEVICES += tplink_tl-wr802n-v2
> 
> +define Device/tplink_tl-wr810n-v2
> +  $(Device/tplink-8mlzma)
> +  SOC := qca9533
> +  DEVICE_MODEL := TL-WR810N
> +  DEVICE_VARIANT := v2
> +  TPLINK_HWID := 0x8100002
> +  SUPPORTED_DEVICES += tl-wr810n-v2
> +endef
> +TARGET_DEVICES += tplink_tl-wr810n-v2
> +
>  define Device/tplink_tl-wr841-v5
>    $(Device/tplink-4m)
>    SOC := ar7240
> @@ -403,6 +447,28 @@ define Device/tplink_tl-wr841-v12  endef
> TARGET_DEVICES += tplink_tl-wr841-v12
> 
> +define Device/tplink_tl-wr842n-v1
> +  $(Device/tplink-8m)
> +  SOC := ar7241
> +  DEVICE_MODEL := TL-WR842N/ND
> +  DEVICE_VARIANT := v1
> +  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
> +  TPLINK_HWID := 0x8420001
> +  SUPPORTED_DEVICES += tl-mr3420
> +endef
> +TARGET_DEVICES += tplink_tl-wr842n-v1
> +
> +define Device/tplink_tl-wr842n-v2
> +  $(Device/tplink-8mlzma)
> +  SOC := ar9341
> +  DEVICE_MODEL := TL-WR842N/ND
> +  DEVICE_VARIANT := v2
> +  DEVICE_PACKAGES := kmod-usb2 kmod-usb-ledtrig-usbport
> +  TPLINK_HWID := 0x8420002
> +  SUPPORTED_DEVICES += tl-wr842n-v2
> +endef
> +TARGET_DEVICES += tplink_tl-wr842n-v2
> +
>  define Device/tplink_tl-wr940n-v3
>    $(Device/tplink-4mlzma)
>    SOC := tp9343
> diff --git a/target/linux/ath79/image/tiny-ubnt.mk
> b/target/linux/ath79/image/tiny-ubnt.mk
> new file mode 100644
> index 0000000000..a8c5a2cf68
> --- /dev/null
> +++ b/target/linux/ath79/image/tiny-ubnt.mk
> @@ -0,0 +1,132 @@
> +DEVICE_VARS += UBNT_BOARD UBNT_CHIP UBNT_TYPE UBNT_VERSION
> +UBNT_REVISION
> +
> +# On M (XW) devices the U-Boot as of version 1.1.4-s1039 doesn't like #
> +VERSION_DIST being on the place of major(?) version number, so we need
> +to # use some number.
> +UBNT_REVISION := $(VERSION_DIST)-$(REVISION)
> +
> +# mkubntimage is using the kernel image direct # routerboard creates
> +partitions out of the ubnt header define Build/mkubntimage
> +	-$(STAGING_DIR_HOST)/bin/mkfwimage -B $(UBNT_BOARD) \
> +		-v $(UBNT_TYPE).$(UBNT_CHIP).v6.0.0-$(VERSION_DIST)-
> $(REVISION) \
> +		-k $(IMAGE_KERNEL) -r $@ -o $@
> +endef
> +
> +# all UBNT XM/WA devices expect the kernel image to have 1024k while
> +flash, when # booting the image, the size doesn't matter.
> +define Build/mkubntimage-split
> +	-[ -f $@ ] && ( \
> +	dd if=$@ of=$@.old1 bs=1024k count=1; \
> +	dd if=$@ of=$@.old2 bs=1024k skip=1; \
> +	$(STAGING_DIR_HOST)/bin/mkfwimage -B $(UBNT_BOARD) \
> +		-v $(UBNT_TYPE).$(UBNT_CHIP).v$(UBNT_VERSION)-
> $(UBNT_REVISION) \
> +		-k $@.old1 -r $@.old2 -o $@; \
> +	rm $@.old1 $@.old2 )
> +endef
> +
> +# UBNT_BOARD e.g. one of (XS2, XS5, RS, XM) # UBNT_TYPE e.g. one of
> +(BZ, XM, XW) # UBNT_CHIP e.g. one of (ar7240, ar933x, ar934x) #
> +UBNT_VERSION e.g. one of (6.0.0, 8.5.3) define Device/ubnt
> +  DEVICE_VENDOR := Ubiquiti
> +  DEVICE_PACKAGES := kmod-usb2
> +  IMAGES += factory.bin
> +  IMAGE/factory.bin := append-kernel | pad-to $$$$(BLOCKSIZE) | \
> +	append-rootfs | pad-rootfs | check-size | mkubntimage-split endef
> +
> +define Device/ubnt-xm
> +  $(Device/ubnt)
> +  DEVICE_VARIANT := XM
> +  DEVICE_PACKAGES += kmod-usb-ohci
> +  IMAGE_SIZE := 7448k
> +  UBNT_BOARD := XM
> +  UBNT_CHIP := ar7240
> +  UBNT_TYPE := XM
> +  UBNT_VERSION := 6.0.0
> +  KERNEL := kernel-bin | append-dtb | relocate-kernel | lzma | uImage
> +lzma endef
> +
> +define Device/ubnt_airrouter
> +  $(Device/ubnt-xm)
> +  SOC := ar7241
> +  DEVICE_MODEL := AirRouter
> +  SUPPORTED_DEVICES += airrouter
> +endef
> +TARGET_DEVICES += ubnt_airrouter
> +
> +define Device/ubnt_bullet-m-ar7240
> +  $(Device/ubnt-xm)
> +  SOC := ar7240
> +  DEVICE_MODEL := Bullet M
> +  DEVICE_VARIANT := XM (AR7240)
> +  DEVICE_PACKAGES += rssileds
> +  SUPPORTED_DEVICES += bullet-m
> +endef
> +TARGET_DEVICES += ubnt_bullet-m-ar7240
> +
> +define Device/ubnt_bullet-m-ar7241
> +  $(Device/ubnt-xm)
> +  SOC := ar7241
> +  DEVICE_MODEL := Bullet M
> +  DEVICE_VARIANT := XM (AR7241)
> +  DEVICE_PACKAGES += rssileds
> +  SUPPORTED_DEVICES += bullet-m ubnt,bullet-m endef TARGET_DEVICES
> +=
> +ubnt_bullet-m-ar7241
> +
> +define Device/ubnt_nanobridge-m
> +  $(Device/ubnt-xm)
> +  SOC := ar7241
> +  DEVICE_MODEL := NanoBridge M
> +  DEVICE_PACKAGES += rssileds
> +  SUPPORTED_DEVICES += bullet-m
> +endef
> +TARGET_DEVICES += ubnt_nanobridge-m
> +
> +define Device/ubnt_nanostation-loco-m
> +  $(Device/ubnt-xm)
> +  SOC := ar7241
> +  DEVICE_MODEL := Nanostation Loco M
> +  DEVICE_PACKAGES += rssileds
> +  SUPPORTED_DEVICES += bullet-m
> +endef
> +TARGET_DEVICES += ubnt_nanostation-loco-m
> +
> +define Device/ubnt_nanostation-m
> +  $(Device/ubnt-xm)
> +  SOC := ar7241
> +  DEVICE_MODEL := Nanostation M
> +  DEVICE_PACKAGES += rssileds
> +  SUPPORTED_DEVICES += nanostation-m
> +endef
> +TARGET_DEVICES += ubnt_nanostation-m
> +
> +define Device/ubnt_picostation-m
> +  $(Device/ubnt-xm)
> +  SOC := ar7241
> +  DEVICE_MODEL := Picostation M
> +  DEVICE_PACKAGES += rssileds
> +  SUPPORTED_DEVICES += bullet-m
> +endef
> +TARGET_DEVICES += ubnt_picostation-m
> +
> +define Device/ubnt_powerbridge-m
> +  $(Device/ubnt-xm)
> +  SOC := ar7241
> +  DEVICE_MODEL := PowerBridge M
> +  DEVICE_PACKAGES += rssileds
> +  SUPPORTED_DEVICES += bullet-m
> +endef
> +TARGET_DEVICES += ubnt_powerbridge-m
> +
> +define Device/ubnt_rocket-m
> +  $(Device/ubnt-xm)
> +  SOC := ar7241
> +  DEVICE_MODEL := Rocket M
> +  DEVICE_PACKAGES += rssileds
> +  SUPPORTED_DEVICES += rocket-m
> +endef
> +TARGET_DEVICES += ubnt_rocket-m
> 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..95aeeba7c9 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
> @@ -86,6 +86,13 @@ tplink,tl-wa850re-v2)
>  	ucidef_set_led_rssi "rssimediumhigh" "RSSIMEDIUMHIGH"
> "blue:signal4" "wlan0" "60" "100"
>  	ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "blue:signal5" "wlan0" "80"
> "100"
>  	;;
> +tplink,tl-wr842n-v2)
> +	ucidef_set_led_netdev "wan" "WAN" "green:wan" "eth1"
> +	ucidef_set_led_switch "lan1" "LAN1" "green:lan1" "switch0" "0x04"
> +	ucidef_set_led_switch "lan2" "LAN2" "green:lan2" "switch0" "0x08"
> +	ucidef_set_led_switch "lan3" "LAN3" "green:lan3" "switch0" "0x10"
> +	ucidef_set_led_switch "lan4" "LAN4" "green:lan4" "switch0" "0x02"
> +	;;
>  tplink,tl-wr940n-v3|\
>  tplink,tl-wr940n-v4|\
>  tplink,tl-wr941nd-v6)
> 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..45a4a7b589 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
> @@ -59,6 +59,7 @@ ath79_setup_interfaces()
>  	tplink,tl-wr841-v10|\
>  	tplink,tl-wr841-v11|\
>  	tplink,tl-wr841-v12|\
> +	tplink,tl-wr842n-v1|\
>  	tplink,tl-wr940n-v3|\
>  	tplink,tl-wr940n-v4|\
>  	tplink,tl-wr940n-v6|\
> @@ -71,11 +72,16 @@ ath79_setup_interfaces()
>  	tplink,tl-wr740n-v4|\
>  	tplink,tl-wr740n-v5|\
>  	tplink,tl-wr741nd-v4|\
> -	tplink,tl-wr841-v8)
> +	tplink,tl-wr841-v8|\
> +	tplink,tl-wr842n-v2)
>  		ucidef_set_interface_wan "eth1"
>  		ucidef_add_switch "switch0" \
>  			"0 at eth0" "1:lan:4" "2:lan:1" "3:lan:2" "4:lan:3"
>  		;;
> +	tplink,tl-wr1043nd-v1)
> +		ucidef_add_switch "switch0" \
> +			"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "5 at eth0"
> +		;;
>  	tplink,tl-wr941-v2)
>  		ucidef_set_interfaces_lan_wan "lan1 lan2 lan3 lan4" "wan"
>  		;;
> @@ -83,6 +89,9 @@ ath79_setup_interfaces()
>  		ucidef_add_switch "switch0" \
>  			"0 at eth0" "2:lan:1" "3:lan:2" "4:lan:3" "5:lan:4"
> "1:wan"
>  		;;
> +	ubnt,nanostation-m)
> +		ucidef_set_interfaces_lan_wan "eth1" "eth0"
> +		;;
>  	*)
>  		ucidef_set_interfaces_lan_wan "eth0" "eth1"
>  		;;
> diff --git a/target/linux/ath79/tiny/base-files/etc/board.d/03_gpio_switches
> b/target/linux/ath79/tiny/base-files/etc/board.d/03_gpio_switches
> new file mode 100755
> index 0000000000..91eeee7937
> --- /dev/null
> +++ b/target/linux/ath79/tiny/base-files/etc/board.d/03_gpio_switches
> @@ -0,0 +1,20 @@
> +#!/bin/sh
> +#
> +# Copyright (C) 2018 OpenWrt.org
> +#
> +
> +. /lib/functions/uci-defaults.sh
> +
> +board_config_update
> +
> +board=$(board_name)
> +
> +case "$board" in
> +ubnt,nanostation-m)
> +	ucidef_add_gpio_switch "poe_passthrough" "PoE Passthrough" "8"
> +	;;
> +esac
> +
> +board_config_flush
> +
> +exit 0
> 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..8ebff61332 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
> @@ -33,7 +33,12 @@ case "$FIRMWARE" in
>  	tplink,tl-wr740n-v3|\
>  	tplink,tl-wr741-v1|\
>  	tplink,tl-wr743nd-v1|\
> -	tplink,tl-wr841-v7)
> +	tplink,tl-wr841-v7|\
> +	tplink,tl-wr842n-v1|\
> +	ubnt,nanostation-m|\
> +	ubnt,picostation-m|\
> +	ubnt,powerbridge-m|\
> +	ubnt,rocket-m)
>  		caldata_extract "art" 0x1000 0x1000
>  		;;
>  	pqi,air-pen)
> diff --git a/target/linux/ath79/tiny/target.mk
> b/target/linux/ath79/tiny/target.mk
> index 91f135b56e..79623bd889 100644
> --- a/target/linux/ath79/tiny/target.mk
> +++ b/target/linux/ath79/tiny/target.mk
> @@ -1,5 +1,5 @@
> -BOARDNAME:=Devices with small flash
> -FEATURES += small_flash
> +BOARDNAME:=Devices with small flash / low ram FEATURES +=
> 
>  DEFAULT_PACKAGES += wpad-basic-wolfssl
> 
> --
> 2.20.1
> 
> 
> _______________________________________________
> openwrt-devel mailing list
> openwrt-devel at lists.openwrt.org
> https://lists.openwrt.org/mailman/listinfo/openwrt-devel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: openpgp-digital-signature.asc
Type: application/pgp-signature
Size: 834 bytes
Desc: not available
URL: <http://lists.openwrt.org/pipermail/openwrt-devel/attachments/20201206/61ba4809/attachment.sig>


More information about the openwrt-devel mailing list