aboutsummaryrefslogtreecommitdiffstats
path: root/target/linux/brcm63xx/base-files/lib
diff options
context:
space:
mode:
Diffstat (limited to 'target/linux/brcm63xx/base-files/lib')
-rwxr-xr-xtarget/linux/brcm63xx/base-files/lib/brcm63xx.sh292
-rw-r--r--target/linux/brcm63xx/base-files/lib/preinit/03_do_brcm63xx.sh9
-rw-r--r--target/linux/brcm63xx/base-files/lib/preinit/05_failsafe_config_switch_brcm63xx10
-rw-r--r--target/linux/brcm63xx/base-files/lib/preinit/05_init_interfaces_brcm63xx48
-rw-r--r--target/linux/brcm63xx/base-files/lib/preinit/15_set_preinit_interface_brcm63xx27
-rw-r--r--target/linux/brcm63xx/base-files/lib/preinit/20_failsafe_net_echo_brcm63xx12
-rw-r--r--target/linux/brcm63xx/base-files/lib/upgrade/platform.sh16
7 files changed, 414 insertions, 0 deletions
diff --git a/target/linux/brcm63xx/base-files/lib/brcm63xx.sh b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
new file mode 100755
index 0000000..1a97c86
--- /dev/null
+++ b/target/linux/brcm63xx/base-files/lib/brcm63xx.sh
@@ -0,0 +1,292 @@
+#!/bin/sh
+#
+# Copyright (C) 2007 OpenWrt.org
+#
+#
+
+board_id=""
+sys_mtd_part=""
+ifname=""
+
+brcm63xx_dt_detect() {
+ local board_name
+
+ case "$1" in
+ "ADB P.DG A4001N")
+ board_name="a4001n"
+ ;;
+ "ADB P.DG A4001N1")
+ board_name="a4001n1"
+ ;;
+ "Alcatel RG100A")
+ board_name="rg100a"
+ ;;
+ "ASMAX AR 1004g")
+ board_name="ar100g"
+ ;;
+ "Belkin F5D7633")
+ board_name="f5d7633"
+ ;;
+ "Broadcom 96348R reference board")
+ board_name="bcm96348r"
+ ;;
+ "Broadcom BCM96318REF reference board")
+ board_name="bcm96318ref"
+ ;;
+ "Broadcom BCM96318REF_P300 reference board")
+ board_name="bcm96318ref_p300"
+ ;;
+ "Broadcom BCM963268BU_P300 reference board")
+ board_name="bcm963268bu_p300"
+ ;;
+ "Broadcom BCM963269BHR reference board")
+ board_name="bcm963269bhr"
+ ;;
+ "Broadcom bcm963281TAN reference board")
+ board_name="bcm963281tan"
+ ;;
+ "Broadcom BCM96328avng reference board")
+ board_name="bcm96328avng"
+ ;;
+ "Broadcom BCM96345GW2 reference board")
+ board_name="bcm96345gw2"
+ ;;
+ "Broadcom BCM96348GW-10 reference board")
+ board_name="bcm96348gw-10"
+ ;;
+ "Broadcom BCM96348GW-11 reference board")
+ board_name="bcm96348gw-11"
+ ;;
+ "Broadcom BCM96348GW reference board")
+ board_name="bcm96358gw"
+ ;;
+ "Broadcom BCM96358VW reference board")
+ board_name="bcm96358vw"
+ ;;
+ "Broadcom BCM96358VW2 reference board")
+ board_name="bcm96358vw2"
+ ;;
+ "Broadcom BCM96368MVNgr reference board")
+ board_name="bcm96368mvngr"
+ ;;
+ "Broadcom BCM96368MVWG reference board")
+ board_name="bcm96368mvwg"
+ ;;
+ "BT Home Hub 2.0 Type A")
+ board_name="homehub2a"
+ ;;
+ "BT Voyager 2110")
+ board_name="v2110"
+ ;;
+ "BT Voyager V2500V")
+ board_name="v2500v_bb"
+ ;;
+ "Comtrend AR-5381u")
+ board_name="ar-5381u"
+ ;;
+ "Comtrend AR-5387un")
+ board_name="ar-5387un"
+ ;;
+ "Comtrend CT-5365")
+ board_name="ct-5365"
+ ;;
+ "Comtrend CT-536+/CT-5621T")
+ board_name="ct-536p_5621t"
+ ;;
+ "Comtrend CT-6373")
+ board_name="ct-6373"
+ ;;
+ "Comtrend VR-3025u")
+ board_name="vr-3025u"
+ ;;
+ "Comtrend VR-3025un")
+ board_name="vr-3025un"
+ ;;
+ "Comtrend VR-3026e")
+ board_name="vr-3026e"
+ ;;
+ "Comtrend WAP-5813n")
+ board_name="wap-5813n"
+ ;;
+ "Davolink DV-201AMR")
+ board_name="dv-201amr"
+ ;;
+ "D-Link DSL-2640B rev B2")
+ board_name="dsl-2640b-b"
+ ;;
+ "D-Link DSL-2640U/BRU/C")
+ board_name="dsl-2640u"
+ ;;
+ "D-Link DSL-2650U")
+ board_name="dsl-2650u"
+ ;;
+ "D-Link DSL-2740B/DSL-2741B rev C2/3")
+ board_name="dsl-274xb-c"
+ ;;
+ "D-Link DSL-2740B/DSL-2741B rev F1")
+ board_name="dsl-274xb-f"
+ ;;
+ "D-Link DSL-2750B/DSL-2751 rev D1")
+ board_name="dsl-275xb-d"
+ ;;
+ "D-Link DVA-G3810BN/TL")
+ board_name="dva-g3810bn"
+ ;;
+ "Dynalink RTA770BW")
+ board_name="rta770bw"
+ ;;
+ "Dynalink RTA770W")
+ board_name="rta770w"
+ ;;
+ "Dynalink RTA1025W")
+ board_name="rta1025w"
+ ;;
+ "Dynalink RTA1320")
+ board_name="rta1320"
+ ;;
+ "Huawei EchoLife HG520v")
+ board_name="hg520v"
+ ;;
+ "Huawei EchoLife HG553")
+ board_name="hg553"
+ ;;
+ "Huawei EchoLife HG556a (version A)")
+ board_name="hg556a_a"
+ ;;
+ "Huawei EchoLife HG556a (version B)")
+ board_name="hg556a_b"
+ ;;
+ "Huawei EchoLife HG556a (version C)")
+ board_name="hg556a_c"
+ ;;
+ "Huawei HG655b")
+ board_name="hg655b"
+ ;;
+ "Inteno VG50")
+ board_name="vg50"
+ ;;
+ "Inventel Livebox 1")
+ board_name="livebox1"
+ ;;
+ "Netgear CVG834G")
+ board_name="cvg834g"
+ ;;
+ "Netgear DG834GT/PN")
+ board_name="dg834gt"
+ ;;
+ "Netgear DG834G v4")
+ board_name="dg834g_v4"
+ ;;
+ "Netgear DGND3700v1/DGND3800B")
+ board_name="dgnd3700v1_dgnd3800b"
+ ;;
+ "Pirelli A226G")
+ board_name="a226g"
+ ;;
+ "Pirelli A226M")
+ board_name="a226m"
+ ;;
+ "Pirelli A226M-FWB")
+ board_name="a226m-fwb"
+ ;;
+ "Pirelli Alice Gate AGPF-S0")
+ board_name="agpf-s0"
+ ;;
+ "Sagem F@ST2404")
+ board_name="fast2404"
+ ;;
+ "Sagem F@ST2504n")
+ board_name="fast2504n"
+ ;;
+ "Sagem F@ST2604")
+ board_name="fast2604"
+ ;;
+ "Sagem F@ST2704N")
+ board_name="fast2704n"
+ ;;
+ "Sagem F@ST2704V2")
+ board_name="fast2704v2"
+ ;;
+ "SFR Neuf Box 4"*)
+ board_name="neufbox4"
+ ;;
+ "SFR neufbox 6 (Sercomm)")
+ board_name="neufbox6"
+ ;;
+ "T-Com Speedport W303 V")
+ board_name="spw303v"
+ ;;
+ "T-Com Speedport W500 V")
+ board_name="spw500v"
+ ;;
+ "TECOM GW6000")
+ board_name="g6000"
+ ;;
+ "TECOM GW6200")
+ board_name="g6200"
+ ;;
+ "Telsey CVPA502+")
+ board_name="cpva502p"
+ ;;
+ "Telsey CPVA642-type (CPA-ZNTE60T)")
+ board_name="cpva642"
+ ;;
+ "Telsey MAGIC")
+ board_name="magic"
+ ;;
+ "TP-Link TD-W8900GB")
+ board_name="td-w8900gb"
+ ;;
+ "USRobotics 9108")
+ board_name="usr9108"
+ ;;
+ "Zyxel P870HW-51a v2")
+ board_name="p870hw-51a_v2"
+ ;;
+ *)
+ board_name="unknown"
+ ;;
+ esac
+
+ echo "$board_name"
+}
+
+brcm63xx_legacy_detect() {
+ local board_name
+
+ case "$1" in
+ *)
+ board_name="unknown"
+ ;;
+ esac
+
+ echo "$board_name"
+}
+
+brcm63xx_detect() {
+ local board_name model
+
+ board_id=$(awk 'BEGIN{FS="[ \t:/]+"} /system type/ {print $4}' /proc/cpuinfo)
+
+ if [ -e /proc/device-tree ]; then
+ model=$(cat /proc/device-tree/model)
+ board_name=$(brcm63xx_dt_detect "$model")
+ else
+ model="Unknown bcm63xx board"
+ board_name=$(brcm63xx_legacy_detect "$board_id")
+ fi
+
+ [ -e "/tmp/sysinfo" ] || mkdir -p "/tmp/sysinfo"
+
+ echo "$board_name" > /tmp/sysinfo/board_name
+ echo "$model" > /tmp/sysinfo/model
+}
+
+brcm63xx_board_name() {
+ local name
+
+ [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
+ [ -n "$name" ] || name="unknown"
+
+ echo $name
+}
diff --git a/target/linux/brcm63xx/base-files/lib/preinit/03_do_brcm63xx.sh b/target/linux/brcm63xx/base-files/lib/preinit/03_do_brcm63xx.sh
new file mode 100644
index 0000000..4179695
--- /dev/null
+++ b/target/linux/brcm63xx/base-files/lib/preinit/03_do_brcm63xx.sh
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+do_brcm63xx() {
+ . /lib/brcm63xx.sh
+
+ brcm63xx_detect
+}
+
+boot_hook_add preinit_main do_brcm63xx
diff --git a/target/linux/brcm63xx/base-files/lib/preinit/05_failsafe_config_switch_brcm63xx b/target/linux/brcm63xx/base-files/lib/preinit/05_failsafe_config_switch_brcm63xx
new file mode 100644
index 0000000..e1653e3
--- /dev/null
+++ b/target/linux/brcm63xx/base-files/lib/preinit/05_failsafe_config_switch_brcm63xx
@@ -0,0 +1,10 @@
+#!/bin/sh
+
+failsafe_ip() {
+ [ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
+ ifconfig $pi_ifname $pi_ip netmask $pi_netmask broadcast $pi_broadcast up
+ }
+}
+
+boot_hook_add failsafe failsafe_ip
+
diff --git a/target/linux/brcm63xx/base-files/lib/preinit/05_init_interfaces_brcm63xx b/target/linux/brcm63xx/base-files/lib/preinit/05_init_interfaces_brcm63xx
new file mode 100644
index 0000000..abf5b89
--- /dev/null
+++ b/target/linux/brcm63xx/base-files/lib/preinit/05_init_interfaces_brcm63xx
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+. /lib/brcm63xx.sh
+
+set_preinit_iface() {
+ case "$(brcm63xx_board_name)" in
+ a4001n |\
+ a4001n1 |\
+ ar-5381u |\
+ ar-5387un |\
+ bcm963281tan |\
+ bcm96328avng |\
+ cpva642 |\
+ ct536_ct5621 |\
+ cvg834g |\
+ dgnd3700v1_dgnd3800b |\
+ dsl-2640b-b |\
+ dsl-274xb-c |\
+ dsl-274xb-f |\
+ dsl-275xb-d |\
+ fast2504n |\
+ fast2704v2 |\
+ hg553 |\
+ hg556a_* |\
+ hg520 |\
+ neufbox6 |\
+ p870hw-51a_v2 |\
+ rta770bw |\
+ rta770w |\
+ spw303v |\
+ spw500v |\
+ v2110 |\
+ vr-3025un |\
+ vr-3025u |\
+ vr-3026e |\
+ wap-5813n)
+ ifname=eth0
+ ;;
+ bcm96348gw |\
+ bcm96348gw-11 |\
+ gw6000 |\
+ gw6200)
+ ifname=eth1
+ ;;
+ esac
+}
+
+boot_hook_add preinit_main set_preinit_iface
diff --git a/target/linux/brcm63xx/base-files/lib/preinit/15_set_preinit_interface_brcm63xx b/target/linux/brcm63xx/base-files/lib/preinit/15_set_preinit_interface_brcm63xx
new file mode 100644
index 0000000..7655fb7
--- /dev/null
+++ b/target/linux/brcm63xx/base-files/lib/preinit/15_set_preinit_interface_brcm63xx
@@ -0,0 +1,27 @@
+#!/bin/sh
+
+port_net_echo() {
+ [ -n "$pi_ifname" ] && grep -q "$pi_ifname" /proc/net/dev && {
+ if [ "$pi_preinit_net_messages" = "y" ] || [ "$pi_failsafe_net_message" = "true" ] && [ "$pi_preinit_no_failsafe_netmsg" != "y" ]; then
+ netmsg $pi_broadcast "$1"
+ fi
+ }
+}
+
+preinit_ip_deconfig() {
+ if [ -z "$pi_ifname" ]; then
+ ifconfig $ifname 0.0.0.0 down
+ else
+ grep -q "$pi_ifname" /proc/net/dev && {
+ ifconfig $pi_ifname 0.0.0.0 down
+ }
+ fi
+}
+
+preinit_net_echo() {
+ preinit_ip
+
+ port_net_echo $1
+}
+
+
diff --git a/target/linux/brcm63xx/base-files/lib/preinit/20_failsafe_net_echo_brcm63xx b/target/linux/brcm63xx/base-files/lib/preinit/20_failsafe_net_echo_brcm63xx
new file mode 100644
index 0000000..f030cb2
--- /dev/null
+++ b/target/linux/brcm63xx/base-files/lib/preinit/20_failsafe_net_echo_brcm63xx
@@ -0,0 +1,12 @@
+#!/bin/sh
+
+indicate_failsafe() {
+ preinit_net_echo() {
+ port_net_echo $1
+ }
+ echo "- failsafe -"
+ preinit_net_echo "Entering Failsafe!\n"
+ indicate_failsafe_led
+}
+
+
diff --git a/target/linux/brcm63xx/base-files/lib/upgrade/platform.sh b/target/linux/brcm63xx/base-files/lib/upgrade/platform.sh
new file mode 100644
index 0000000..5c9e2c2
--- /dev/null
+++ b/target/linux/brcm63xx/base-files/lib/upgrade/platform.sh
@@ -0,0 +1,16 @@
+PART_NAME=linux
+platform_check_image() {
+ [ "$#" -gt 1 ] && return 1
+ case "$(get_magic_word "$1")" in
+ 3600|3700|3800)
+ # 6348GW-11 boards use openwrt-96348GW-11-squashfs-cfe.bin files
+ return 0
+ ;;
+ *)
+ echo "Invalid image type. Please use only .bin files"
+ return 1
+ ;;
+ esac
+}
+
+# use default for platform_do_upgrade()