aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/lantiq/base-files
diff options
context:
space:
mode:
authorblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-10-05 10:12:53 +0000
committerblogic <blogic@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-10-05 10:12:53 +0000
commit5c105d9f3fd086aff195d3849dcf847d6b0bd927 (patch)
tree1229a11f725bfa58aa7c57a76898553bb5f6654a /target/linux/lantiq/base-files
downloadopenwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.tar.gz
openwrt-5c105d9f3fd086aff195d3849dcf847d6b0bd927.zip
branch Attitude Adjustment
git-svn-id: svn://svn.openwrt.org/openwrt/branches/attitude_adjustment@33625 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'target/linux/lantiq/base-files')
-rw-r--r--target/linux/lantiq/base-files/etc/hotplug.d/button/10-generic.sh22
-rw-r--r--target/linux/lantiq/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom41
-rw-r--r--target/linux/lantiq/base-files/etc/inittab4
-rwxr-xr-xtarget/linux/lantiq/base-files/etc/uci-defaults/leds58
-rwxr-xr-xtarget/linux/lantiq/base-files/etc/uci-defaults/network87
-rw-r--r--target/linux/lantiq/base-files/lib/lantiq.sh17
-rw-r--r--target/linux/lantiq/base-files/lib/preinit/42_athfix19
-rwxr-xr-xtarget/linux/lantiq/base-files/lib/upgrade/platform.sh25
8 files changed, 273 insertions, 0 deletions
diff --git a/target/linux/lantiq/base-files/etc/hotplug.d/button/10-generic.sh b/target/linux/lantiq/base-files/etc/hotplug.d/button/10-generic.sh
new file mode 100644
index 000000000..b2fdda23f
--- /dev/null
+++ b/target/linux/lantiq/base-files/etc/hotplug.d/button/10-generic.sh
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+[ "${ACTION}" = "released" ] || exit 0
+
+. /lib/functions.sh
+
+case "${BUTTON}" in
+ BTN_0)
+ logger "reset pressed"
+ sync
+ reboot
+ ;;
+ BTN_1)
+ logger "factory pressed"
+ jffs2_mark_erase "rootfs_data"
+ sync
+ reboot
+ ;;
+ *)
+ logger "unknown button ${BUTTON}"
+ ;;
+esac
diff --git a/target/linux/lantiq/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
new file mode 100644
index 000000000..1eee55e22
--- /dev/null
+++ b/target/linux/lantiq/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
@@ -0,0 +1,41 @@
+#!/bin/sh
+# based on gabors ralink wisoc implementation
+
+rt2x00_eeprom_die() {
+ echo "rt2x00 eeprom: " "$*"
+ exit 1
+}
+
+rt2x00_eeprom_extract() {
+ local part=$1
+ local offset=$2
+ local count=$3
+ local mtd
+
+ . /etc/functions.sh
+
+ mtd=$(find_mtd_part $part)
+ [ -n "$mtd" ] || \
+ rt2x00_eeprom_die "no mtd device found for partition $part"
+
+ dd if=$mtd of=/lib/firmware/$FIRMWARE bs=1 skip=$offset count=$count || \
+ rt2x00_eeprom_die "failed to extract from $mtd"
+}
+
+[ -e /lib/firmware/$FIRMWARE ] && exit 0
+
+. /lib/lantiq.sh
+
+case "$FIRMWARE" in
+"RT2860.eeprom" )
+ local board=$(lantiq_board_name)
+ case $board in
+ ARV7525PW|ARV752DPW)
+ rt2x00_eeprom_extract "board_config" 1040 272
+ ;;
+ *)
+ rt2x00_eeprom_die "board $board is not supported yet"
+ ;;
+ esac
+ ;;
+esac
diff --git a/target/linux/lantiq/base-files/etc/inittab b/target/linux/lantiq/base-files/etc/inittab
new file mode 100644
index 000000000..96afec9e7
--- /dev/null
+++ b/target/linux/lantiq/base-files/etc/inittab
@@ -0,0 +1,4 @@
+::sysinit:/etc/init.d/rcS S boot
+::shutdown:/etc/init.d/rcS K stop
+ttyLTQ0::askfirst:/bin/ash --login
+ttyLTQ1::askfirst:/bin/ash --login
diff --git a/target/linux/lantiq/base-files/etc/uci-defaults/leds b/target/linux/lantiq/base-files/etc/uci-defaults/leds
new file mode 100755
index 000000000..64b080f33
--- /dev/null
+++ b/target/linux/lantiq/base-files/etc/uci-defaults/leds
@@ -0,0 +1,58 @@
+#!/bin/sh
+#
+# Copyright (C) 2011 OpenWrt.org
+# based on ar71xx
+#
+
+. /lib/functions/uci-defaults.sh
+. /lib/lantiq.sh
+
+board=$(lantiq_board_name)
+
+case "$board" in
+ARV4520PW|ARV452CPW)
+ ucidef_set_led_netdev "wifi" "wifi" "soc:blue:wifi" "wlan0"
+ ucidef_set_led_usbdev "usb" "USB" "soc:blue:usb" "1-1"
+ ucidef_set_led_default "fxs1" "fxs1" "soc:blue:fxs1" "1"
+ ucidef_set_led_default "fxs2" "fxs2" "soc:blue:fxs2" "1"
+ ucidef_set_led_default "online" "online" "soc:blue:internet" "1"
+ ;;
+
+ARV7525PW)
+ ucidef_set_led_netdev "wifi" "wifi" "soc:green:wifi" "wlan0"
+ ucidef_set_led_default "fxs1" "fxs1" "soc:green:fxs1" "1"
+ ucidef_set_led_default "fxs2" "fxs2" "soc:green:fxs2" "1"
+ ucidef_set_led_default "dsl" "dsl" "soc:red:dsl" "1"
+ ucidef_set_led_default "online" "online" "soc:green:online" "1"
+ ;;
+
+ARV4525PW)
+ ucidef_set_led_netdev "wifi" "wifi" "soc:green:wifi" "wlan0"
+ ucidef_set_led_default "fxs1" "fxs1" "soc:green:fxs1" "1"
+ ucidef_set_led_default "fxs2" "fxs2" "soc:green:fxs2" "1"
+ ucidef_set_led_default "dsl" "dsl" "soc:green:dsl" "1"
+ ucidef_set_led_default "online" "online" "soc:green:online" "1"
+ ;;
+
+GIGASX76X)
+ ucidef_set_led_wlan "wifi" "wifi" "soc:green:wifi" "phy0radio"
+ ucidef_set_led_netdev "online" "online" "soc:green:online" "pppoe-wan"
+ ucidef_set_led_usbdev "usb" "USB" "soc:green:usb" "1-1"
+ ;;
+
+ARV4519PW)
+ ucidef_set_led_wlan "wifi" "wifi" "soc:green:wifi" "phy0radio"
+ ucidef_set_led_netdev "internet" "internet" "soc:green:internet" "pppoe-wan"
+ ucidef_set_led_usbdev "usb" "USB" "soc:green:usb" "1-1"
+ ;;
+
+ARV7518PW)
+ ucidef_set_led_wlan "wifi" "wifi" "soc:green:wifi" "phy0radio"
+ ucidef_set_led_netdev "internet" "internet" "soc:green:internet" "pppoe-wan"
+ ucidef_set_led_usbdev "usb" "USB" "soc:green:usb" "1-1"
+ ;;
+esac
+
+ucidef_commit_leds
+
+exit 0
diff --git a/target/linux/lantiq/base-files/etc/uci-defaults/network b/target/linux/lantiq/base-files/etc/uci-defaults/network
new file mode 100755
index 000000000..b40134d93
--- /dev/null
+++ b/target/linux/lantiq/base-files/etc/uci-defaults/network
@@ -0,0 +1,87 @@
+#!/bin/sh
+#
+# Copyright (C) 2011-2012 OpenWrt.org
+#
+
+[ -e /etc/config/network ] && exit 0
+
+set_atm_wan() {
+ local vpi=$1
+ local vci=$2
+ local encaps=$3
+ local payload=$4
+ uci batch <<EOF
+set network.atm='atm-bridge'
+set network.atm.unit='0'
+set network.atm.vpi='$vpi'
+set network.atm.vci='$vci'
+set network.atm.encaps='$encaps'
+set network.atm.payload='$payload'
+set network.wan='interface'
+set network.wan.ifname='nas0'
+set network.wan.proto='pppoe'
+set network.wan.username='foo'
+set network.wan.password='bar'
+EOF
+}
+
+set_adsl() {
+ local fwannex=$1
+ local annex=$2
+ uci batch <<EOF
+set network.adsl='adsl-device'
+set network.adsl.fwannex='$fwannex'
+set network.adsl.annex='$annex'
+EOF
+}
+
+. /lib/functions/uci-defaults.sh
+. /lib/lantiq.sh
+
+touch /etc/config/network
+
+ucidef_set_interface_loopback
+ucidef_set_interface_lan 'eth0'
+
+vpi=1
+vci=32
+encaps="llc"
+payload="bridged"
+fwannex=$(lantiq_dsl_fwannex)
+board=$(lantiq_board_name)
+dsl=$(lantiq_soc_has_adsl)
+
+case "$board" in
+# annex B with adm6996
+ARV4520PW)
+ ucidef_set_interface_lan "eth0.1"
+ ucidef_add_switch "eth0" "1" "1"
+ ucidef_add_switch_vlan "eth0" "1" "3 2 1 0 5t"
+ set_adsl "b" "b2p"
+ ;;
+
+GIGASX76X)
+ ucidef_set_interface_lan "eth0.1"
+ ucidef_add_switch "eth0" "1" "1"
+ ucidef_add_switch_vlan "eth0" "1" "4 3 2 1 5t"
+ set_adsl "b" "b2p"
+ ;;
+
+# annex A with ar8316
+ARV4519PW|ARV7518PW)
+ ucidef_set_interface_lan "eth0.1"
+ ucidef_add_switch "eth0" "1" "1"
+ ucidef_add_switch_vlan "eth0" "1" "0t 2 3 4 5"
+ set_adsl "a" "a2p"
+ ;;
+
+ARV7525PW|ARV4525PW|*)
+ set_adsl "$fwannex" "${fwannex}2p"
+ ;;
+esac
+
+[ -z "$dsl" ] || set_atm_wan "$vpi" "$vci" "$encaps" "$payload"
+
+uci commit network
+
+exit 0
diff --git a/target/linux/lantiq/base-files/lib/lantiq.sh b/target/linux/lantiq/base-files/lib/lantiq.sh
new file mode 100644
index 000000000..e4f1471a9
--- /dev/null
+++ b/target/linux/lantiq/base-files/lib/lantiq.sh
@@ -0,0 +1,17 @@
+#!/bin/sh
+
+lantiq_soc_has_adsl() {
+ ls /lib/modules/*/drv_dsl_cpe_api.ko
+}
+
+lantiq_soc_name() {
+ grep ^system /proc/cpuinfo | sed "s/system type.*: \(.*\)/\1/g"
+}
+
+lantiq_board_name() {
+ grep ^machine /proc/cpuinfo | sed "s/machine.*: \(.*\)/\1/g" | sed "s/\(.*\) - .*/\1/g"
+}
+
+lantiq_dsl_fwannex() {
+ ls /lib/firmware/dsl-fw-*.bin 2> /dev/null | sed "s/.*\([ab]\)\.bin/\1/g"
+}
diff --git a/target/linux/lantiq/base-files/lib/preinit/42_athfix b/target/linux/lantiq/base-files/lib/preinit/42_athfix
new file mode 100644
index 000000000..114aaffc8
--- /dev/null
+++ b/target/linux/lantiq/base-files/lib/preinit/42_athfix
@@ -0,0 +1,19 @@
+#!/bin/sh
+
+. /lib/lantiq.sh
+
+init_atheeprom() {
+ local board=$(lantiq_board_name)
+ case $board in
+ "Netgear DGN3500B")
+ echo "- loading eeprom -"
+ dd if=/dev/mtd2 of=/sys/firmware/ath_eeprom bs=1k skip=60 count=4
+ echo 0 > /sys/bus/pci/slots/0000\:00\:0e.0/power
+ sleep 1
+ echo 1 > /sys/bus/pci/rescan
+ ;;
+ esac
+}
+
+boot_hook_add preinit_essential init_atheeprom
+
diff --git a/target/linux/lantiq/base-files/lib/upgrade/platform.sh b/target/linux/lantiq/base-files/lib/upgrade/platform.sh
new file mode 100755
index 000000000..247ba1a25
--- /dev/null
+++ b/target/linux/lantiq/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,25 @@
+PART_NAME=linux
+
+platform_check_image() {
+ [ "$ARGC" -gt 1 ] && return 1
+
+ case "$(get_magic_word "$1")" in
+ # .trx files
+ 2705) return 0;;
+ *)
+ echo "Invalid image type"
+ return 1
+ ;;
+ esac
+}
+
+# use default for platform_do_upgrade()
+
+disable_watchdog() {
+ killall watchdog
+ ( ps | grep -v 'grep' | grep '/dev/watchdog' ) && {
+ echo 'Could not disable watchdog'
+ return 1
+ }
+}
+append sysupgrade_pre_upgrade disable_watchdog