[source] ramips: dont replace the board name

LEDE Commits lede-commits at lists.infradead.org
Thu Apr 20 22:53:02 PDT 2017


mkresin pushed a commit to source.git, branch master:
https://git.lede-project.org/18618695aedf8cf593ca5bb5a5a0b4c97e53dd2f

commit 18618695aedf8cf593ca5bb5a5a0b4c97e53dd2f
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Sat Apr 8 00:34:48 2017 +0200

    ramips: dont replace the board name
    
    Use fixed led names and add each board variant instead of manipulating
    the board name.
    
    It makes the ramips board name function less different to the one used
    in other targets and allows to merge them with a common function.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 package/boot/uboot-envtools/files/ramips           |  3 +-
 target/linux/ramips/base-files/etc/board.d/01_leds | 42 ++++++++++++----------
 .../linux/ramips/base-files/etc/board.d/02_network | 24 ++++++++-----
 target/linux/ramips/base-files/etc/diag.sh         | 32 +++++++++++++----
 target/linux/ramips/base-files/lib/ramips.sh       |  2 +-
 .../ramips/base-files/lib/upgrade/platform.sh      | 30 ++++++++++------
 6 files changed, 88 insertions(+), 45 deletions(-)

diff --git a/package/boot/uboot-envtools/files/ramips b/package/boot/uboot-envtools/files/ramips
index 3216b30..9ce8c30 100644
--- a/package/boot/uboot-envtools/files/ramips
+++ b/package/boot/uboot-envtools/files/ramips
@@ -15,7 +15,8 @@ board=$(ramips_board_name)
 
 case "$board" in
 all0239-3g|\
-all0256n|\
+all0256n-4M|\
+all0256n-8M|\
 all5002)
 	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x10000" "0x10000"
 	;;
diff --git a/target/linux/ramips/base-files/etc/board.d/01_leds b/target/linux/ramips/base-files/etc/board.d/01_leds
index 3ca390f..213f2ed 100755
--- a/target/linux/ramips/base-files/etc/board.d/01_leds
+++ b/target/linux/ramips/base-files/etc/board.d/01_leds
@@ -56,11 +56,12 @@ air3gii)
 	set_wifi_led "$board:green:wlan"
 	set_usb_led "$board:green:mobile"
 	;;
-all0256n)
+all0256n-4M|\
+all0256n-8M)
 	ucidef_set_rssimon "wlan0" "200000" "1"
-	ucidef_set_led_rssi "rssilow" "RSSILOW" "$board:green:rssilow" "wlan0" "1" "40" "0" "6"
-	ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "$board:green:rssimed" "wlan0" "30" "80" "-29" "5"
-	ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "$board:green:rssihigh" "wlan0" "70" "100" "-69" "8"
+	ucidef_set_led_rssi "rssilow" "RSSILOW" "all0256n:green:rssilow" "wlan0" "1" "40" "0" "6"
+	ucidef_set_led_rssi "rssimedium" "RSSIMEDIUM" "all0256n:green:rssimed" "wlan0" "30" "80" "-29" "5"
+	ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "all0256n:green:rssihigh" "wlan0" "70" "100" "-69" "8"
 	set_wifi_led "rt2800pci-phy0::radio"
 	;;
 ar670w|\
@@ -68,11 +69,12 @@ ar725w|\
 awapn2403)
 	set_wifi_led "rt2800soc-phy0::radio"
 	;;
-asl26555)
-	ucidef_set_led_default "power" "POWER" "$board:green:power" "1"
-	ucidef_set_led_netdev "eth" "ETH" "$board:green:eth" "eth0"
-	set_wifi_led "$board:green:wlan"
-	set_usb_led "$board:green:3g"
+asl26555-8M|\
+asl26555-16M)
+	ucidef_set_led_default "power" "POWER" "asl26555:green:power" "1"
+	ucidef_set_led_netdev "eth" "ETH" "asl26555:green:eth" "eth0"
+	set_wifi_led "asl26555:green:wlan"
+	set_usb_led "asl26555:green:3g"
 	;;
 bc2)
 	set_usb_led "$board:blue:usb"
@@ -139,7 +141,8 @@ hlk-rm04|\
 sl-r7205|\
 v11st-fe|\
 w306r-v20|\
-wt1520)
+wt1520-4M|\
+wt1520-8M)
 	set_wifi_led "rt2800pci-phy0::radio"
 	;;
 dir-615-d|\
@@ -292,9 +295,10 @@ psg1218b)
 	ucidef_set_led_netdev "Network" "Network" "$board:blue:status" "eth0"
 	ucidef_set_led_default "status" "STATUS" "$board:yellow:status" "0"
 	;;
-px-4885)
-	set_wifi_led "$board:orange:wifi"
-	set_usb_led "$board:blue:storage"
+px-4885-4M|\
+px-4885-8M)
+	set_wifi_led "px-4885:orange:wifi"
+	set_usb_led "px-4885:blue:storage"
 	;;
 r6220)
 	ucidef_set_led_netdev "wan" "wan" "$board:green:wan" eth0.2
@@ -324,9 +328,10 @@ tiny-ac)
 	set_wifi_led "$board:orange:wifi"
 	set_usb_led "$board:green:usb"
 	;;
-vocore)
-	ucidef_set_led_netdev "eth" "ETH" "$board:orange:eth" "eth0"
-	set_wifi_led "$board:green:status"
+vocore-8M|\
+vocore-16M)
+	ucidef_set_led_netdev "eth" "ETH" "vocore:orange:eth" "eth0"
+	set_wifi_led "vocore:green:status"
 	;;
 vocore2)
 	set_wifi_led "$board:fuchsia:status"
@@ -357,8 +362,9 @@ wrh-300cr)
 wndr3700v5)
 	ucidef_set_led_default "power" "POWER" "$board:green:power" "0"
 	;;
-wt3020)
-	ucidef_set_led_default "power" "power" "$board:blue:power" "0"
+wt3020-4M|\
+wt3020-8M)
+	ucidef_set_led_default "power" "power" "wt3020:blue:power" "0"
 	;;
 y1)
 	set_usb_led "$board:blue:usb"
diff --git a/target/linux/ramips/base-files/etc/board.d/02_network b/target/linux/ramips/base-files/etc/board.d/02_network
index a4da5ee..99c3ad6 100755
--- a/target/linux/ramips/base-files/etc/board.d/02_network
+++ b/target/linux/ramips/base-files/etc/board.d/02_network
@@ -41,7 +41,8 @@ ramips_setup_interfaces()
 	3g150b|\
 	3g300m|\
 	a5-v11|\
-	all0256n|\
+	all0256n-4M|\
+	all0256n-8M|\
 	all5002|\
 	all5003|\
 	broadway|\
@@ -91,7 +92,8 @@ ramips_setup_interfaces()
 	mt7628|\
 	mzk-750dhp|\
 	mzk-w300nh2|\
-	nixcore|\
+	nixcore-x1-8M|\
+	nixcore-x1-16M|\
 	oy-0001|\
 	pbr-m1|\
 	psg1208|\
@@ -104,7 +106,8 @@ ramips_setup_interfaces()
 	witi|\
 	wl-wn575a3|\
 	wndr3700v5|\
-	wt1520|\
+	wt1520-4M|\
+	wt1520-8M|\
 	y1|\
 	youku-yk1|\
 	zbt-ape522ii|\
@@ -133,13 +136,15 @@ ramips_setup_interfaces()
 		ucidef_add_switch "switch0" \
 			"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5 at eth0"
 		;;
-	asl26555|\
+	asl26555-8M|\
+	asl26555-16M|\
 	rp-n53)
 		ucidef_add_switch "switch0" \
 			"1:lan" "2:lan" "3:lan" "4:lan" "6t at eth0"
 		;;
 	atp-52b|\
-	awm002-evb|\
+	awm002-evb-4M|\
+	awm002-evb-8M|\
 	awm003-evb|\
 	c20i|\
 	c50|\
@@ -161,7 +166,8 @@ ramips_setup_interfaces()
 	wrtnode|\
 	wrtnode2p | \
 	wrtnode2r | \
-	wt3020|\
+	wt3020-4M|\
+	wt3020-8M|\
 	zbt-wa05)
 		ucidef_add_switch "switch0" \
 			"1:lan" "2:lan" "3:lan" "4:lan" "0:wan" "6 at eth0"
@@ -241,7 +247,8 @@ ramips_setup_interfaces()
 		ucidef_set_interface_wan "usb0"
 		;;
 	mzk-dp150n|\
-	vocore)
+	vocore-8M|\
+	vocore-16M)
 		ucidef_add_switch "switch0" \
 			"0:lan" "4:lan" "6t at eth0"
 		;;
@@ -382,7 +389,8 @@ ramips_setup_macs()
 		lan_mac=$(macaddr_setbit_la "$wan_mac")
 		;;
 	m3|\
-	m4|\
+	m4-4M|\
+	m4-8M|\
 	x5|\
 	x8)
 		lan_mac=$(cat /sys/class/net/eth0/address)
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index 3624efd..e5b4b59 100644
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -16,7 +16,6 @@ get_status_led() {
 	3g-6200n|\
 	ar670w|\
 	ar725w|\
-	asl26555|\
 	br-6425|\
 	br-6475nd|\
 	c50|\
@@ -79,7 +78,6 @@ get_status_led() {
 	mofi3500-3gn|\
 	rut5xx|\
 	v11st-fe|\
-	vocore|\
 	wmr-300|\
 	zbt-wg2626|\
 	zbt-wg3526)
@@ -89,6 +87,10 @@ get_status_led() {
 	ht-tm02)
 		status_led="$board:blue:wlan"
 		;;
+	asl26555-8M|\
+	asl26555-16M)
+		status_led="asl26555:green:power"
+		;;
 	atp-52b|\
 	ew1200|\
 	ip2202)
@@ -123,7 +125,6 @@ get_status_led() {
 	wl-330n|\
 	wl-330n3g|\
 	wli-tx4-ag300n|\
-	wt3020|\
 	y1|\
 	y1s)
 		status_led="$board:blue:power"
@@ -162,10 +163,13 @@ get_status_led() {
 		status_led="$board:blue:wifi"
 		;;
 	m3|\
-	m4|\
 	miwifi-nano)
 		status_led="$board:blue:status"
 		;;
+	m4-4M|\
+	m4-8M)
+		status_led="m4:blue:status"
+		;;
 	miwifi-mini|\
 	zte-q7)
 		status_led="$board:red:status"
@@ -194,7 +198,10 @@ get_status_led() {
 	psr-680w)
 		status_led="$board:red:wan"
 		;;
-	px-4885|\
+	px-4885-4M|\
+	px-4885-8M)
+		status_led="px-4885:orange:wifi"
+		;;
 	re6500|\
 	whr-1166d|\
 	whr-600d|\
@@ -207,8 +214,7 @@ get_status_led() {
 	tew-692gr|\
 	ur-326n4g|\
 	ur-336un|\
-	wf-2881|\
-	wr512-3gn)
+	wf-2881)
 		status_led="$board:green:wps"
 		;;
 	rb750gr3)
@@ -220,6 +226,10 @@ get_status_led() {
 	v22rw-2x2)
 		status_led="$board:green:security"
 		;;
+	vocore-8M|\
+	vocore-16M)
+		status_led="vocore:green:status"
+		;;
 	vocore2)
 		status_led="$board:fuchsia:status"
 		;;
@@ -249,11 +259,19 @@ get_status_led() {
 	wizfi630a)
 		status_led="$board::run"
 		;;
+	wr512-3gn-4M|\
+	wr512-3gn-8M)
+		status_led="wr512-3gn:green:wps"
+		;;
 	wrtnode2r | \
 	wrtnode2p | \
 	wrtnode)
 		status_led="wrtnode:blue:indicator"
 		;;
+	wt3020-4M|\
+	wt3020-8M)
+		status_led="wt3020:blue:power"
+		;;
 	zbt-cpe102)
 		status_led="$board:green:4g-0"
 		;;
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index 7630166..eec9612 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -696,5 +696,5 @@ ramips_board_name() {
 	[ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
 	[ -z "$name" ] && name="unknown"
 
-	echo "${name%-[0-9]*M}"
+	echo "${name}"
 }
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index d0dd28e..036e19a 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -21,13 +21,16 @@ platform_check_image() {
 	ai-br100|\
 	air3gii|\
 	all0239-3g|\
-	all0256n|\
+	all0256n-4M|\
+	all0256n-8M|\
 	all5002|\
 	all5003|\
 	ar725w|\
-	asl26555|\
+	asl26555-8M|\
+	asl26555-16M|\
 	awapn2403|\
-	awm002-evb|\
+	awm002-evb-4M|\
+	awm002-evb-8M|\
 	awm003-evb|\
 	bc2|\
 	broadway|\
@@ -81,7 +84,8 @@ platform_check_image() {
 	linkits7688d|\
 	m2m|\
 	m3|\
-	m4|\
+	m4-4M|\
+	m4-8M|\
 	mac1200rv2|\
 	microwrt|\
 	miniembplug|\
@@ -104,7 +108,8 @@ platform_check_image() {
 	nbg-419n|\
 	nbg-419n2|\
 	newifi-d1|\
-	nixcore|\
+	nixcore-x1-8M|\
+	nixcore-x1-16M|\
 	nw718|\
 	omega2|\
 	omega2p|\
@@ -115,7 +120,8 @@ platform_check_image() {
 	psg1218a|\
 	psg1218b|\
 	psr-680w|\
-	px-4885|\
+	px-4885-4M|\
+	px-4885-8M|\
 	rb750gr3|\
 	re6500|\
 	rp-n53|\
@@ -139,7 +145,8 @@ platform_check_image() {
 	ur-326n4g|\
 	ur-336un|\
 	v22rw-2x2|\
-	vocore|\
+	vocore-8M|\
+	vocore-16M|\
 	vocore2|\
 	vr500|\
 	w150m|\
@@ -165,15 +172,18 @@ platform_check_image() {
 	wn3000rpv3|\
 	wnce2001|\
 	wndr3700v5|\
-	wr512-3gn|\
+	wr512-3gn-4M|\
+	wr512-3gn-8M|\
 	wr6202|\
 	wrh-300cr|\
 	wrtnode|\
 	wrtnode2r |\
 	wrtnode2p |\
 	wsr-600|\
-	wt1520|\
-	wt3020|\
+	wt1520-4M|\
+	wt1520-8M|\
+	wt3020-4M|\
+	wt3020-8M|\
 	wzr-agl300nh|\
 	x5|\
 	x8|\



More information about the lede-commits mailing list