[openwrt/openwrt] kirkwood: use the generic board detect

LEDE Commits lede-commits at lists.infradead.org
Tue Jan 9 13:10:14 PST 2018


mkresin pushed a commit to openwrt/openwrt.git, branch master:
https://git.lede-project.org/c9e2c35f46346fc460a78b8f13b70d538c47cb27

commit c9e2c35f46346fc460a78b8f13b70d538c47cb27
Author: Mathias Kresin <dev at kresin.me>
AuthorDate: Thu Dec 28 10:18:48 2017 +0100

    kirkwood: use the generic board detect
    
    Drop the target specific detection function in favour of the generic
    one provided by base-files.
    
    Signed-off-by: Mathias Kresin <dev at kresin.me>
---
 package/boot/uboot-envtools/files/kirkwood         | 14 ++---
 .../linux/kirkwood/base-files/etc/board.d/01_leds  | 18 +++---
 .../kirkwood/base-files/etc/board.d/02_network     | 20 +++---
 target/linux/kirkwood/base-files/etc/diag.sh       | 16 ++---
 .../base-files/etc/init.d/linksys_recovery         |  2 +-
 .../base-files/etc/init.d/nsa310_fancontrol        |  2 +-
 target/linux/kirkwood/base-files/lib/kirkwood.sh   | 72 ----------------------
 .../kirkwood/base-files/lib/preinit/01_sysinfo     |  9 ---
 .../kirkwood/base-files/lib/upgrade/platform.sh    |  4 +-
 target/linux/kirkwood/image/Makefile               | 11 ++++
 10 files changed, 49 insertions(+), 119 deletions(-)

diff --git a/package/boot/uboot-envtools/files/kirkwood b/package/boot/uboot-envtools/files/kirkwood
index cfd3550..516b52e 100644
--- a/package/boot/uboot-envtools/files/kirkwood
+++ b/package/boot/uboot-envtools/files/kirkwood
@@ -13,15 +13,15 @@ touch /etc/config/ubootenv
 board=$(board_name)
 
 case "$board" in
-dockstar|\
-ib62x0|\
-linksys-viper|\
-nsa310b|\
-nsa325|\
-pogo_e02)
+seagate,dockstar|\
+raidsonic,ib-nas62x0|\
+linksys,viper|\
+zyxel,nsa310b|\
+zyxel,nsa325|\
+cloudengines,pogoe02)
 	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
 	;;
-linksys-audi)
+linksys,audi)
 	ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x4000" "0x4000"
 	;;
 esac
diff --git a/target/linux/kirkwood/base-files/etc/board.d/01_leds b/target/linux/kirkwood/base-files/etc/board.d/01_leds
index a0b4eca..b8a9b47 100755
--- a/target/linux/kirkwood/base-files/etc/board.d/01_leds
+++ b/target/linux/kirkwood/base-files/etc/board.d/01_leds
@@ -10,37 +10,37 @@ board_config_update
 board=$(board_name)
 
 case "$board" in
-"dockstar")
+"seagate,dockstar")
 	ucidef_set_led_default "health" "health" "status:green:health" "1"
 	ucidef_set_led_default "fault" "fault" "status:orange:fault" "1"
 	;;
-"linksys-audi")
+"linksys,audi")
 	ucidef_set_led_default "power" "power" "audi:green:power" "1"
 	;;
-"linksys-viper")
+"linksys,viper")
 	ucidef_set_led_default "health" "health" "viper:white:health" "1"
 	ucidef_set_led_default "pulse" "pulse" "viper:white:pulse" "1"
 	;;
-"goflexhome" | \
-"goflexnet")
+"seagate,goflexhome" | \
+"seagate,goflexnet")
 	ucidef_set_led_default "health" "health" "status:green:health" "1"
 	ucidef_set_led_default "fault" "fault" "status:orange:fault" "0"
 	;;
-"ib62x0")
+"raidsonic,ib-nas62x0")
 	ucidef_set_led_default "health" "health" "ib62x0:green:os" "1"
 	ucidef_set_led_default "fault" "fault" "ib62x0:red:os" "1"
 	;;
-"pogo_e02")
+"cloudengines,pogoe02")
 	ucidef_set_led_default "health" "health" "pogo_e02:green:health" "1"
 	ucidef_set_led_default "fault" "fault" "pogo_e02:orange:fault" "1"
 	;;
-"nsa310b")
+"zyxel,nsa310b")
 	ucidef_set_led_default "health" "health" "nsa310:green:sys" "1"
 	ucidef_set_led_usbhost "usb" "USB" "nsa310:green:usb"
 	ucidef_set_led_ataport "hdd" "HDD" "nsa310:green:hdd" "1"
 	ucidef_set_led_ataport "esata" "eSata" "nsa310:green:esata" "2"
 	;;
-"nsa325")
+"zyxel,nsa325")
 	ucidef_set_led_default "health" "health" "nsa325:green:sys" "1"
 	ucidef_set_led_usbhost "usb" "USB" "nsa325:green:usb"
 	ucidef_set_led_ataport "hdd1" "HDD1" "nsa325:green:sata1" "1"
diff --git a/target/linux/kirkwood/base-files/etc/board.d/02_network b/target/linux/kirkwood/base-files/etc/board.d/02_network
index 549d232..b83d0d2 100755
--- a/target/linux/kirkwood/base-files/etc/board.d/02_network
+++ b/target/linux/kirkwood/base-files/etc/board.d/02_network
@@ -11,24 +11,24 @@ board_config_update
 board=$(board_name)
 
 case "$board" in
-"dockstar"|\
-"goflexhome"|\
-"goflexnet"|\
-"ib62x0"|\
-"iconnect"|\
-"pogo_e02")
+"seagate,dockstar"|\
+"seagate,goflexhome"|\
+"seagate,goflexnet"|\
+"raidsonic,ib-nas62x0"|\
+"iom,iconnect-1.1"|\
+"cloudengines,pogoe02")
 	ucidef_set_interface_lan "eth0" "dhcp"
 	;;
-"linksys-audi"|\
-"linksys-viper")
+"linksys,audi"|\
+"linksys,viper")
 	ucidef_add_switch "switch0" \
 		"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5 at eth0" "6 at eth1"
 	;;
-"nsa310b"|"nsa325")
+"zyxel,nsa310b"|"zyxel,nsa325")
 	ucidef_set_interface_lan "eth0" "dhcp"
 	ucidef_set_interface_macaddr "lan" $( mtd_get_mac_ascii uboot_env ethaddr )
 	;;
-"on100")
+"cisco,on100")
 	ucidef_set_interface_lan "eth0 eth1"
 	;;
 *)
diff --git a/target/linux/kirkwood/base-files/etc/diag.sh b/target/linux/kirkwood/base-files/etc/diag.sh
index 71a1639..0ff2ccb 100755
--- a/target/linux/kirkwood/base-files/etc/diag.sh
+++ b/target/linux/kirkwood/base-files/etc/diag.sh
@@ -6,24 +6,24 @@
 
 get_status_led() {
 	case $(board_name) in
-	dockstar|\
-	goflexhome|\
-	goflexnet)
+	seagate,dockstar|\
+	seagate,goflexhome|\
+	seagate,goflexnet)
 		status_led="status:orange:fault"
 		;;
-	pogo_e02)
+	cloudengines,pogoe02)
 		status_led="pogo_e02:orange:fault"
 		;;
-	linksys-audi)
+	linksys,audi)
 		status_led="audi:green:power"
 		;;
-	linksys-viper)
+	linksys,viper)
 		status_led="viper:white:health"
 		;;
-	nsa310b)
+	zyxel,nsa310b)
 		status_led="nsa310:green:sys"
 		;;
-	on100)
+	cisco,on100)
 		status_led="on100:green:health"
 		;;
 	esac
diff --git a/target/linux/kirkwood/base-files/etc/init.d/linksys_recovery b/target/linux/kirkwood/base-files/etc/init.d/linksys_recovery
index ba7e4bb..8fd2f38 100755
--- a/target/linux/kirkwood/base-files/etc/init.d/linksys_recovery
+++ b/target/linux/kirkwood/base-files/etc/init.d/linksys_recovery
@@ -6,7 +6,7 @@ boot() {
 . /lib/functions.sh
 
 case $(board_name) in
-	linksys-audi|linksys-viper)
+	linksys,audi|linksys,viper)
 		# make sure auto_recovery in uboot is always on
 		AUTO_RECOVERY_ENA="`fw_printenv -n auto_recovery`"
 		if [ "$AUTO_RECOVERY_ENA" != "yes" ] ; then
diff --git a/target/linux/kirkwood/base-files/etc/init.d/nsa310_fancontrol b/target/linux/kirkwood/base-files/etc/init.d/nsa310_fancontrol
index 4073c2d..10eb5aa 100755
--- a/target/linux/kirkwood/base-files/etc/init.d/nsa310_fancontrol
+++ b/target/linux/kirkwood/base-files/etc/init.d/nsa310_fancontrol
@@ -10,7 +10,7 @@ boot() {
 path_to_hwmon='/sys/devices/platform/ocp at f1000000/f1011000.i2c/i2c-0/0-002e/hwmon/hwmon0'
 
 case $(board_name) in
-	nsa310b)
+	zyxel,nsa310b)
 	echo 2 > "$path_to_hwmon/pwm1_enable" # fan is on pwm1
 	echo 1 > "$path_to_hwmon/pwm1_auto_channels" # temp1 is the only one that changes
 	echo 23000 > "$path_to_hwmon/temp1_auto_temp_min"
diff --git a/target/linux/kirkwood/base-files/lib/kirkwood.sh b/target/linux/kirkwood/base-files/lib/kirkwood.sh
deleted file mode 100644
index 6474b06..0000000
--- a/target/linux/kirkwood/base-files/lib/kirkwood.sh
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/bin/sh
-#
-# Copyright (C) 2014 OpenWrt.org
-#
-
-KIRKWOOD_BOARD_NAME=
-KIRKWOOD_MODEL=
-
-kirkwood_board_detect() {
-	local machine
-	local name
-
-	machine=$(cat /proc/device-tree/model)
-
-	case "$machine" in
-	"Seagate FreeAgent Dockstar")
-		name="dockstar"
-		;;
-
-        "Seagate GoFlex Home")
-                name="goflexhome"
-                ;;
-
-	"Seagate GoFlex Net")
-		name="goflexnet"
-		;;
-
-	"Iomega Iconnect")
-		name="iconnect"
-		;;
-
-	"RaidSonic ICY BOX IB-NAS62x0 (Rev B)")
-		name="ib62x0"
-		;;
-
-	"Cisco Systems ON100")
-		name="on100"
-		;;
-
-	"Cloud Engines Pogoplug E02")
-		name="pogo_e02"
-		;;
-
-	"Linksys Audi (EA3500)")
-		name="linksys-audi"
-		;;
-
-	"Linksys Viper (E4200v2 / EA4500)")
-		name="linksys-viper"
-		;;
-
-	"ZyXEL NSA310b")
-		name="nsa310b"
-		;;
-
-	"ZyXEL NSA325")
-		name="nsa325"
-		;;
-
-	*)
-		name="generic"
-		;;
-	esac
-
-	[ -z "$KIRKWOOD_BOARD_NAME" ] && KIRKWOOD_BOARD_NAME="$name"
-	[ -z "$KIRKWOOD_MODEL" ] && KIRKWOOD_MODEL="$machine"
-
-	[ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
-
-	echo "$KIRKWOOD_BOARD_NAME" > /tmp/sysinfo/board_name
-	echo "$KIRKWOOD_MODEL" > /tmp/sysinfo/model
-}
diff --git a/target/linux/kirkwood/base-files/lib/preinit/01_sysinfo b/target/linux/kirkwood/base-files/lib/preinit/01_sysinfo
deleted file mode 100644
index d45fc92..0000000
--- a/target/linux/kirkwood/base-files/lib/preinit/01_sysinfo
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-
-do_sysinfo_kirkwood() {
-	. /lib/kirkwood.sh
-
-	kirkwood_board_detect
-}
-
-boot_hook_add preinit_main do_sysinfo_kirkwood
diff --git a/target/linux/kirkwood/base-files/lib/upgrade/platform.sh b/target/linux/kirkwood/base-files/lib/upgrade/platform.sh
index dd06aa7..27012bd 100644
--- a/target/linux/kirkwood/base-files/lib/upgrade/platform.sh
+++ b/target/linux/kirkwood/base-files/lib/upgrade/platform.sh
@@ -11,8 +11,8 @@ platform_do_upgrade() {
 	local board="$(board_name)"
 
 	case "$board" in
-	"linksys-audi"|\
-	"linksys-viper")
+	"linksys,audi"|\
+	"linksys,viper")
 		platform_do_upgrade_linksys "$ARGV"
 		;;
 	*)
diff --git a/target/linux/kirkwood/image/Makefile b/target/linux/kirkwood/image/Makefile
index b75ef9f..20b368f 100644
--- a/target/linux/kirkwood/image/Makefile
+++ b/target/linux/kirkwood/image/Makefile
@@ -30,18 +30,21 @@ endef
 define Device/dockstar
   DEVICE_DTS := kirkwood-dockstar
   DEVICE_TITLE := Seagate FreeAgent Dockstar
+  SUPPORTED_DEVICES += seagate,dockstar
 endef
 TARGET_DEVICES += dockstar
 
 define Device/goflexnet
   DEVICE_TITLE := Seagate GoFlexNet
   DEVICE_DTS := kirkwood-goflexnet
+  SUPPORTED_DEVICES += seagate,goflexnet
 endef
 TARGET_DEVICES += goflexnet
 
 define Device/goflexhome
   DEVICE_TITLE := Seagate GoFlexHome
   DEVICE_DTS := kirkwood-goflexhome
+  SUPPORTED_DEVICES += seagate,goflexhome
 endef
 TARGET_DEVICES += goflexhome
 
@@ -53,6 +56,7 @@ define Device/linksys-audi
   KERNEL_IN_UBI := 0
   UBINIZE_OPTS := -E 5
   IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
+  SUPPORTED_DEVICES += linksys,audi
 endef
 TARGET_DEVICES += linksys-audi
 
@@ -64,12 +68,14 @@ define Device/linksys-viper
   KERNEL_IN_UBI := 0
   UBINIZE_OPTS := -E 5
   IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
+  SUPPORTED_DEVICES += linksys,viper
 endef
 TARGET_DEVICES += linksys-viper
 
 define Device/iconnect
   DEVICE_TITLE := Iomega Iconnect
   DEVICE_DTS := kirkwood-iconnect
+  SUPPORTED_DEVICES += iom,iconnect-1.1
 endef
 TARGET_DEVICES += iconnect
 
@@ -77,6 +83,7 @@ define Device/nsa310b
   DEVICE_TITLE := ZyXEL NSA310b
   DEVICE_DTS := kirkwood-nsa310b
   DEVICE_PACKAGES := kmod-r8169 kmod-gpio-button-hotplug kmod-hwmon-lm85
+  SUPPORTED_DEVICES += zyxel,nsa310b
 endef
 TARGET_DEVICES += nsa310b
 
@@ -84,6 +91,7 @@ define Device/nsa325
   DEVICE_TITLE := ZyXEL NSA325 (v1 and v2)
   DEVICE_DTS := kirkwood-nsa325
   DEVICE_PACKAGES := kmod-gpio-button-hotplug kmod-rtc-pcf8563 kmod-usb3
+  SUPPORTED_DEVICES += zyxel,nsa325
 endef
 TARGET_DEVICES += nsa325
 
@@ -95,18 +103,21 @@ define Device/on100
   KERNEL_IN_UBI := 0
   UBINIZE_OPTS := -E 5
   IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
+  SUPPORTED_DEVICES := cisco,on100
 endef
 TARGET_DEVICES += on100
 
 define Device/pogo_e02
   DEVICE_TITLE := Cloud Engines Pogoplug E02
   DEVICE_DTS := kirkwood-pogo_e02
+  SUPPORTED_DEVICES += cloudengines,pogoe02
 endef
 TARGET_DEVICES += pogo_e02
 
 define Device/ib62x0
   DEVICE_TITLE := RaidSonic ICY BOX IB-NAS62x0
   DEVICE_DTS := kirkwood-ib62x0
+  SUPPORTED_DEVICES += raidsonic,ib-nas62x0
 endef
 TARGET_DEVICES += ib62x0
 



More information about the lede-commits mailing list