Initial commit
This commit is contained in:
53
target/linux/kirkwood/base-files/etc/board.d/01_leds
Executable file
53
target/linux/kirkwood/base-files/etc/board.d/01_leds
Executable file
@@ -0,0 +1,53 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2012-2015 OpenWrt.org
|
||||
#
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
"cloudengines,pogoe02")
|
||||
ucidef_set_led_default "health" "health" "pogo_e02:green:health" "1"
|
||||
ucidef_set_led_default "fault" "fault" "pogo_e02:orange:fault" "1"
|
||||
;;
|
||||
"linksys,audi")
|
||||
ucidef_set_led_default "power" "power" "audi:green:power" "1"
|
||||
;;
|
||||
"linksys,viper")
|
||||
ucidef_set_led_default "health" "health" "viper:white:health" "1"
|
||||
ucidef_set_led_default "pulse" "pulse" "viper:white:pulse" "1"
|
||||
;;
|
||||
"raidsonic,ib-nas62x0")
|
||||
ucidef_set_led_default "health" "health" "ib62x0:green:os" "1"
|
||||
ucidef_set_led_default "fault" "fault" "ib62x0:red:os" "1"
|
||||
;;
|
||||
"seagate,dockstar")
|
||||
ucidef_set_led_default "health" "health" "status:green:health" "1"
|
||||
ucidef_set_led_default "fault" "fault" "status:orange:fault" "1"
|
||||
;;
|
||||
"seagate,goflexhome"|\
|
||||
"seagate,goflexnet")
|
||||
ucidef_set_led_default "health" "health" "status:green:health" "1"
|
||||
ucidef_set_led_default "fault" "fault" "status:orange:fault" "0"
|
||||
;;
|
||||
"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"
|
||||
;;
|
||||
"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:hdd1" "1"
|
||||
ucidef_set_led_ataport "hdd2" "HDD2" "nsa325:green:hdd2" "2"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
43
target/linux/kirkwood/base-files/etc/board.d/02_network
Executable file
43
target/linux/kirkwood/base-files/etc/board.d/02_network
Executable file
@@ -0,0 +1,43 @@
|
||||
#!/bin/sh
|
||||
#
|
||||
# Copyright (C) 2012-2015 OpenWrt.org
|
||||
#
|
||||
|
||||
. /lib/functions/uci-defaults.sh
|
||||
. /lib/functions/system.sh
|
||||
|
||||
board_config_update
|
||||
|
||||
board=$(board_name)
|
||||
|
||||
case "$board" in
|
||||
"cisco,on100")
|
||||
ucidef_set_interface_lan "eth0 eth1"
|
||||
;;
|
||||
"cloudengines,pogoe02"|\
|
||||
"cloudengines,pogoplugv4"|\
|
||||
"iom,iconnect-1.1"|\
|
||||
"raidsonic,ib-nas62x0"|\
|
||||
"seagate,dockstar"|\
|
||||
"seagate,goflexhome"|\
|
||||
"seagate,goflexnet")
|
||||
ucidef_set_interface_lan "eth0" "dhcp"
|
||||
;;
|
||||
"linksys,audi"|\
|
||||
"linksys,viper")
|
||||
ucidef_add_switch "switch0" \
|
||||
"0:lan" "1:lan" "2:lan" "3:lan" "4:wan" "5@eth0" "6@eth1"
|
||||
;;
|
||||
"zyxel,nsa310b"|\
|
||||
"zyxel,nsa325")
|
||||
ucidef_set_interface_lan "eth0" "dhcp"
|
||||
ucidef_set_interface_macaddr "lan" $( mtd_get_mac_ascii uboot_env ethaddr )
|
||||
;;
|
||||
*)
|
||||
ucidef_set_interface_lan "eth0"
|
||||
;;
|
||||
esac
|
||||
|
||||
board_config_flush
|
||||
|
||||
exit 0
|
||||
52
target/linux/kirkwood/base-files/etc/diag.sh
Executable file
52
target/linux/kirkwood/base-files/etc/diag.sh
Executable file
@@ -0,0 +1,52 @@
|
||||
#!/bin/sh
|
||||
# Copyright (C) 2014 OpenWrt.org
|
||||
|
||||
. /lib/functions.sh
|
||||
. /lib/functions/leds.sh
|
||||
|
||||
get_status_led() {
|
||||
case $(board_name) in
|
||||
cisco,on100)
|
||||
status_led="on100:green:health"
|
||||
;;
|
||||
cloudengines,pogoe02)
|
||||
status_led="pogo_e02:orange:fault"
|
||||
;;
|
||||
cloudengines,pogoplugv4)
|
||||
status_led="pogoplugv4:green:health"
|
||||
;;
|
||||
linksys,audi)
|
||||
status_led="audi:green:power"
|
||||
;;
|
||||
linksys,viper)
|
||||
status_led="viper:white:health"
|
||||
;;
|
||||
seagate,dockstar|\
|
||||
seagate,goflexhome|\
|
||||
seagate,goflexnet)
|
||||
status_led="status:orange:fault"
|
||||
;;
|
||||
zyxel,nsa310b)
|
||||
status_led="nsa310:green:sys"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
|
||||
set_state() {
|
||||
get_status_led
|
||||
|
||||
case "$1" in
|
||||
preinit)
|
||||
status_led_blink_preinit
|
||||
;;
|
||||
failsafe)
|
||||
status_led_blink_failsafe
|
||||
;;
|
||||
preinit_regular)
|
||||
status_led_blink_preinit_regular
|
||||
;;
|
||||
done)
|
||||
status_led_on
|
||||
;;
|
||||
esac
|
||||
}
|
||||
19
target/linux/kirkwood/base-files/etc/init.d/linksys_recovery
Executable file
19
target/linux/kirkwood/base-files/etc/init.d/linksys_recovery
Executable file
@@ -0,0 +1,19 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
# Copyright (C) 2015 OpenWrt.org
|
||||
|
||||
START=97
|
||||
boot() {
|
||||
. /lib/functions.sh
|
||||
|
||||
case $(board_name) in
|
||||
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
|
||||
fw_setenv auto_recovery yes
|
||||
fi
|
||||
# reset the boot counter
|
||||
mtd resetbc s_env
|
||||
;;
|
||||
esac
|
||||
}
|
||||
20
target/linux/kirkwood/base-files/etc/init.d/nsa310_fancontrol
Executable file
20
target/linux/kirkwood/base-files/etc/init.d/nsa310_fancontrol
Executable file
@@ -0,0 +1,20 @@
|
||||
#!/bin/sh /etc/rc.common
|
||||
|
||||
START=98
|
||||
boot() {
|
||||
. /lib/functions.sh
|
||||
|
||||
#configuring lm85 onboard temp/fan controller to run the fan on its own
|
||||
#for more information, please read https://www.kernel.org/doc/Documentation/hwmon/sysfs-interface
|
||||
|
||||
path_to_hwmon='/sys/devices/platform/ocp@f1000000/f1011000.i2c/i2c-0/0-002e/hwmon/hwmon0'
|
||||
|
||||
case $(board_name) in
|
||||
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"
|
||||
echo 43000 > "$path_to_hwmon/temp1_auto_temp_max" # next step is 49600 millicelsius, or 50 celsius, 43 celsius is better
|
||||
;;
|
||||
esac
|
||||
}
|
||||
71
target/linux/kirkwood/base-files/lib/upgrade/linksys.sh
Normal file
71
target/linux/kirkwood/base-files/lib/upgrade/linksys.sh
Normal file
@@ -0,0 +1,71 @@
|
||||
#
|
||||
# Copyright (C) 2014 OpenWrt.org
|
||||
#
|
||||
|
||||
linksys_get_target_firmware() {
|
||||
cur_boot_part=`/usr/sbin/fw_printenv -n boot_part`
|
||||
target_firmware=""
|
||||
if [ "$cur_boot_part" = "1" ]
|
||||
then
|
||||
# current primary boot - update alt boot
|
||||
target_firmware="kernel2"
|
||||
fw_setenv boot_part 2
|
||||
fw_setenv bootcmd "run altnandboot"
|
||||
elif [ "$cur_boot_part" = "2" ]
|
||||
then
|
||||
# current alt boot - update primary boot
|
||||
target_firmware="kernel1"
|
||||
fw_setenv boot_part 1
|
||||
fw_setenv bootcmd "run nandboot"
|
||||
fi
|
||||
|
||||
echo "$target_firmware"
|
||||
}
|
||||
|
||||
linksys_get_root_magic() {
|
||||
(get_image "$@" | dd skip=786432 bs=4 count=1 | hexdump -v -n 4 -e '1/1 "%02x"') 2>/dev/null
|
||||
}
|
||||
|
||||
platform_do_upgrade_linksys() {
|
||||
local magic_long="$(get_magic_long "$1")"
|
||||
|
||||
mkdir -p /var/lock
|
||||
local part_label="$(linksys_get_target_firmware)"
|
||||
touch /var/lock/fw_printenv.lock
|
||||
|
||||
if [ ! -n "$part_label" ]
|
||||
then
|
||||
echo "cannot find target partition"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
local target_mtd=$(find_mtd_part $part_label)
|
||||
|
||||
[ "$magic_long" = "73797375" ] && {
|
||||
CI_KERNPART="$part_label"
|
||||
if [ "$part_label" = "kernel1" ]
|
||||
then
|
||||
CI_UBIPART="rootfs1"
|
||||
else
|
||||
CI_UBIPART="rootfs2"
|
||||
fi
|
||||
|
||||
nand_upgrade_tar "$1"
|
||||
}
|
||||
[ "$magic_long" = "27051956" ] && {
|
||||
# check firmwares' rootfs types
|
||||
local target_mtd=$(find_mtd_part $part_label)
|
||||
local oldroot="$(linksys_get_root_magic $target_mtd)"
|
||||
local newroot="$(linksys_get_root_magic "$1")"
|
||||
|
||||
if [ "$newroot" = "55424923" -a "$oldroot" = "55424923" ]
|
||||
# we're upgrading from a firmware with UBI to one with UBI
|
||||
then
|
||||
# erase everything to be safe
|
||||
mtd erase $part_label
|
||||
get_image "$1" | mtd -n write - $part_label
|
||||
else
|
||||
get_image "$1" | mtd write - $part_label
|
||||
fi
|
||||
}
|
||||
}
|
||||
22
target/linux/kirkwood/base-files/lib/upgrade/platform.sh
Normal file
22
target/linux/kirkwood/base-files/lib/upgrade/platform.sh
Normal file
@@ -0,0 +1,22 @@
|
||||
RAMFS_COPY_BIN='fw_printenv fw_setenv'
|
||||
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
|
||||
|
||||
REQUIRE_IMAGE_METADATA=1
|
||||
|
||||
platform_check_image() {
|
||||
return 0
|
||||
}
|
||||
|
||||
platform_do_upgrade() {
|
||||
local board="$(board_name)"
|
||||
|
||||
case "$board" in
|
||||
"linksys,audi"|\
|
||||
"linksys,viper")
|
||||
platform_do_upgrade_linksys "$ARGV"
|
||||
;;
|
||||
*)
|
||||
nand_do_upgrade "$ARGV"
|
||||
;;
|
||||
esac
|
||||
}
|
||||
Reference in New Issue
Block a user