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@kresin.me>
owl
Mathias Kresin 2017-12-28 10:18:48 +01:00
parent aa6f5f1787
commit c9e2c35f46
10 changed files with 49 additions and 119 deletions

View File

@ -13,15 +13,15 @@ touch /etc/config/ubootenv
board=$(board_name) board=$(board_name)
case "$board" in case "$board" in
dockstar|\ seagate,dockstar|\
ib62x0|\ raidsonic,ib-nas62x0|\
linksys-viper|\ linksys,viper|\
nsa310b|\ zyxel,nsa310b|\
nsa325|\ zyxel,nsa325|\
pogo_e02) cloudengines,pogoe02)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000" ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x20000" "0x20000"
;; ;;
linksys-audi) linksys,audi)
ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x4000" "0x4000" ubootenv_add_uci_config "/dev/mtd1" "0x0" "0x4000" "0x4000"
;; ;;
esac esac

View File

@ -10,37 +10,37 @@ board_config_update
board=$(board_name) board=$(board_name)
case "$board" in case "$board" in
"dockstar") "seagate,dockstar")
ucidef_set_led_default "health" "health" "status:green:health" "1" ucidef_set_led_default "health" "health" "status:green:health" "1"
ucidef_set_led_default "fault" "fault" "status:orange:fault" "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" 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 "health" "health" "viper:white:health" "1"
ucidef_set_led_default "pulse" "pulse" "viper:white:pulse" "1" ucidef_set_led_default "pulse" "pulse" "viper:white:pulse" "1"
;; ;;
"goflexhome" | \ "seagate,goflexhome" | \
"goflexnet") "seagate,goflexnet")
ucidef_set_led_default "health" "health" "status:green:health" "1" ucidef_set_led_default "health" "health" "status:green:health" "1"
ucidef_set_led_default "fault" "fault" "status:orange:fault" "0" 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 "health" "health" "ib62x0:green:os" "1"
ucidef_set_led_default "fault" "fault" "ib62x0:red: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 "health" "health" "pogo_e02:green:health" "1"
ucidef_set_led_default "fault" "fault" "pogo_e02:orange:fault" "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_default "health" "health" "nsa310:green:sys" "1"
ucidef_set_led_usbhost "usb" "USB" "nsa310:green:usb" ucidef_set_led_usbhost "usb" "USB" "nsa310:green:usb"
ucidef_set_led_ataport "hdd" "HDD" "nsa310:green:hdd" "1" ucidef_set_led_ataport "hdd" "HDD" "nsa310:green:hdd" "1"
ucidef_set_led_ataport "esata" "eSata" "nsa310:green:esata" "2" 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_default "health" "health" "nsa325:green:sys" "1"
ucidef_set_led_usbhost "usb" "USB" "nsa325:green:usb" ucidef_set_led_usbhost "usb" "USB" "nsa325:green:usb"
ucidef_set_led_ataport "hdd1" "HDD1" "nsa325:green:sata1" "1" ucidef_set_led_ataport "hdd1" "HDD1" "nsa325:green:sata1" "1"

View File

@ -11,24 +11,24 @@ board_config_update
board=$(board_name) board=$(board_name)
case "$board" in case "$board" in
"dockstar"|\ "seagate,dockstar"|\
"goflexhome"|\ "seagate,goflexhome"|\
"goflexnet"|\ "seagate,goflexnet"|\
"ib62x0"|\ "raidsonic,ib-nas62x0"|\
"iconnect"|\ "iom,iconnect-1.1"|\
"pogo_e02") "cloudengines,pogoe02")
ucidef_set_interface_lan "eth0" "dhcp" ucidef_set_interface_lan "eth0" "dhcp"
;; ;;
"linksys-audi"|\ "linksys,audi"|\
"linksys-viper") "linksys,viper")
ucidef_add_switch "switch0" \ ucidef_add_switch "switch0" \
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0" "6@eth1" "0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0" "6@eth1"
;; ;;
"nsa310b"|"nsa325") "zyxel,nsa310b"|"zyxel,nsa325")
ucidef_set_interface_lan "eth0" "dhcp" ucidef_set_interface_lan "eth0" "dhcp"
ucidef_set_interface_macaddr "lan" $( mtd_get_mac_ascii uboot_env ethaddr ) ucidef_set_interface_macaddr "lan" $( mtd_get_mac_ascii uboot_env ethaddr )
;; ;;
"on100") "cisco,on100")
ucidef_set_interface_lan "eth0 eth1" ucidef_set_interface_lan "eth0 eth1"
;; ;;
*) *)

View File

@ -6,24 +6,24 @@
get_status_led() { get_status_led() {
case $(board_name) in case $(board_name) in
dockstar|\ seagate,dockstar|\
goflexhome|\ seagate,goflexhome|\
goflexnet) seagate,goflexnet)
status_led="status:orange:fault" status_led="status:orange:fault"
;; ;;
pogo_e02) cloudengines,pogoe02)
status_led="pogo_e02:orange:fault" status_led="pogo_e02:orange:fault"
;; ;;
linksys-audi) linksys,audi)
status_led="audi:green:power" status_led="audi:green:power"
;; ;;
linksys-viper) linksys,viper)
status_led="viper:white:health" status_led="viper:white:health"
;; ;;
nsa310b) zyxel,nsa310b)
status_led="nsa310:green:sys" status_led="nsa310:green:sys"
;; ;;
on100) cisco,on100)
status_led="on100:green:health" status_led="on100:green:health"
;; ;;
esac esac

View File

@ -6,7 +6,7 @@ boot() {
. /lib/functions.sh . /lib/functions.sh
case $(board_name) in case $(board_name) in
linksys-audi|linksys-viper) linksys,audi|linksys,viper)
# make sure auto_recovery in uboot is always on # make sure auto_recovery in uboot is always on
AUTO_RECOVERY_ENA="`fw_printenv -n auto_recovery`" AUTO_RECOVERY_ENA="`fw_printenv -n auto_recovery`"
if [ "$AUTO_RECOVERY_ENA" != "yes" ] ; then if [ "$AUTO_RECOVERY_ENA" != "yes" ] ; then

View File

@ -10,7 +10,7 @@ boot() {
path_to_hwmon='/sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-002e/hwmon/hwmon0' path_to_hwmon='/sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-002e/hwmon/hwmon0'
case $(board_name) in case $(board_name) in
nsa310b) zyxel,nsa310b)
echo 2 > "$path_to_hwmon/pwm1_enable" # fan is on pwm1 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 1 > "$path_to_hwmon/pwm1_auto_channels" # temp1 is the only one that changes
echo 23000 > "$path_to_hwmon/temp1_auto_temp_min" echo 23000 > "$path_to_hwmon/temp1_auto_temp_min"

View File

@ -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
}

View File

@ -1,9 +0,0 @@
#!/bin/sh
do_sysinfo_kirkwood() {
. /lib/kirkwood.sh
kirkwood_board_detect
}
boot_hook_add preinit_main do_sysinfo_kirkwood

View File

@ -11,8 +11,8 @@ platform_do_upgrade() {
local board="$(board_name)" local board="$(board_name)"
case "$board" in case "$board" in
"linksys-audi"|\ "linksys,audi"|\
"linksys-viper") "linksys,viper")
platform_do_upgrade_linksys "$ARGV" platform_do_upgrade_linksys "$ARGV"
;; ;;
*) *)

View File

@ -30,18 +30,21 @@ endef
define Device/dockstar define Device/dockstar
DEVICE_DTS := kirkwood-dockstar DEVICE_DTS := kirkwood-dockstar
DEVICE_TITLE := Seagate FreeAgent Dockstar DEVICE_TITLE := Seagate FreeAgent Dockstar
SUPPORTED_DEVICES += seagate,dockstar
endef endef
TARGET_DEVICES += dockstar TARGET_DEVICES += dockstar
define Device/goflexnet define Device/goflexnet
DEVICE_TITLE := Seagate GoFlexNet DEVICE_TITLE := Seagate GoFlexNet
DEVICE_DTS := kirkwood-goflexnet DEVICE_DTS := kirkwood-goflexnet
SUPPORTED_DEVICES += seagate,goflexnet
endef endef
TARGET_DEVICES += goflexnet TARGET_DEVICES += goflexnet
define Device/goflexhome define Device/goflexhome
DEVICE_TITLE := Seagate GoFlexHome DEVICE_TITLE := Seagate GoFlexHome
DEVICE_DTS := kirkwood-goflexhome DEVICE_DTS := kirkwood-goflexhome
SUPPORTED_DEVICES += seagate,goflexhome
endef endef
TARGET_DEVICES += goflexhome TARGET_DEVICES += goflexhome
@ -53,6 +56,7 @@ define Device/linksys-audi
KERNEL_IN_UBI := 0 KERNEL_IN_UBI := 0
UBINIZE_OPTS := -E 5 UBINIZE_OPTS := -E 5
IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
SUPPORTED_DEVICES += linksys,audi
endef endef
TARGET_DEVICES += linksys-audi TARGET_DEVICES += linksys-audi
@ -64,12 +68,14 @@ define Device/linksys-viper
KERNEL_IN_UBI := 0 KERNEL_IN_UBI := 0
UBINIZE_OPTS := -E 5 UBINIZE_OPTS := -E 5
IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
SUPPORTED_DEVICES += linksys,viper
endef endef
TARGET_DEVICES += linksys-viper TARGET_DEVICES += linksys-viper
define Device/iconnect define Device/iconnect
DEVICE_TITLE := Iomega Iconnect DEVICE_TITLE := Iomega Iconnect
DEVICE_DTS := kirkwood-iconnect DEVICE_DTS := kirkwood-iconnect
SUPPORTED_DEVICES += iom,iconnect-1.1
endef endef
TARGET_DEVICES += iconnect TARGET_DEVICES += iconnect
@ -77,6 +83,7 @@ define Device/nsa310b
DEVICE_TITLE := ZyXEL NSA310b DEVICE_TITLE := ZyXEL NSA310b
DEVICE_DTS := kirkwood-nsa310b DEVICE_DTS := kirkwood-nsa310b
DEVICE_PACKAGES := kmod-r8169 kmod-gpio-button-hotplug kmod-hwmon-lm85 DEVICE_PACKAGES := kmod-r8169 kmod-gpio-button-hotplug kmod-hwmon-lm85
SUPPORTED_DEVICES += zyxel,nsa310b
endef endef
TARGET_DEVICES += nsa310b TARGET_DEVICES += nsa310b
@ -84,6 +91,7 @@ define Device/nsa325
DEVICE_TITLE := ZyXEL NSA325 (v1 and v2) DEVICE_TITLE := ZyXEL NSA325 (v1 and v2)
DEVICE_DTS := kirkwood-nsa325 DEVICE_DTS := kirkwood-nsa325
DEVICE_PACKAGES := kmod-gpio-button-hotplug kmod-rtc-pcf8563 kmod-usb3 DEVICE_PACKAGES := kmod-gpio-button-hotplug kmod-rtc-pcf8563 kmod-usb3
SUPPORTED_DEVICES += zyxel,nsa325
endef endef
TARGET_DEVICES += nsa325 TARGET_DEVICES += nsa325
@ -95,18 +103,21 @@ define Device/on100
KERNEL_IN_UBI := 0 KERNEL_IN_UBI := 0
UBINIZE_OPTS := -E 5 UBINIZE_OPTS := -E 5
IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi IMAGE/factory.bin := append-kernel | pad-to $$$$(KERNEL_SIZE) | append-ubi
SUPPORTED_DEVICES := cisco,on100
endef endef
TARGET_DEVICES += on100 TARGET_DEVICES += on100
define Device/pogo_e02 define Device/pogo_e02
DEVICE_TITLE := Cloud Engines Pogoplug E02 DEVICE_TITLE := Cloud Engines Pogoplug E02
DEVICE_DTS := kirkwood-pogo_e02 DEVICE_DTS := kirkwood-pogo_e02
SUPPORTED_DEVICES += cloudengines,pogoe02
endef endef
TARGET_DEVICES += pogo_e02 TARGET_DEVICES += pogo_e02
define Device/ib62x0 define Device/ib62x0
DEVICE_TITLE := RaidSonic ICY BOX IB-NAS62x0 DEVICE_TITLE := RaidSonic ICY BOX IB-NAS62x0
DEVICE_DTS := kirkwood-ib62x0 DEVICE_DTS := kirkwood-ib62x0
SUPPORTED_DEVICES += raidsonic,ib-nas62x0
endef endef
TARGET_DEVICES += ib62x0 TARGET_DEVICES += ib62x0