summaryrefslogtreecommitdiffstats
path: root/target/linux/ramips/base-files
diff options
context:
space:
mode:
authorRoman Yeryomin <roman@advem.lv>2013-05-26 01:02:55 +0300
committerRoman Yeryomin <roman@advem.lv>2013-05-26 01:02:55 +0300
commit342045a35b1981a89e4bc80842b10c065e1050da (patch)
tree4140720b20e8d641c11da882010d6130a75fef21 /target/linux/ramips/base-files
parent7338133dde8238afce34676214b494c8db96689b (diff)
parent1a116ce7818ecee5d167a9c0ebb1a0feca9120e6 (diff)
Merge trunk into realtek-unstable
Conflicts: Config.in feeds.conf.default package/base-files/files/etc/hotplug2-common.rules package/network/config/netifd/files/etc/init.d/network
Diffstat (limited to 'target/linux/ramips/base-files')
-rwxr-xr-xtarget/linux/ramips/base-files/etc/diag.sh63
-rw-r--r--target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom25
-rw-r--r--target/linux/ramips/base-files/etc/inittab1
-rwxr-xr-xtarget/linux/ramips/base-files/etc/uci-defaults/01_leds (renamed from target/linux/ramips/base-files/etc/uci-defaults/leds)44
-rwxr-xr-xtarget/linux/ramips/base-files/etc/uci-defaults/02_network (renamed from target/linux/ramips/base-files/etc/uci-defaults/network)125
-rwxr-xr-xtarget/linux/ramips/base-files/etc/uci-defaults/09_fix-seama-header (renamed from target/linux/ramips/base-files/etc/uci-defaults/fixseama)0
-rw-r--r--target/linux/ramips/base-files/lib/preinit/03_preinit_do_ramips.sh2
-rw-r--r--target/linux/ramips/base-files/lib/preinit/04_disable_wnce2001_flash_checksumming43
-rw-r--r--target/linux/ramips/base-files/lib/preinit/06_set_iface_mac38
-rw-r--r--target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips12
-rwxr-xr-xtarget/linux/ramips/base-files/lib/ramips.sh110
-rwxr-xr-xtarget/linux/ramips/base-files/lib/upgrade/platform.sh13
12 files changed, 342 insertions, 134 deletions
diff --git a/target/linux/ramips/base-files/etc/diag.sh b/target/linux/ramips/base-files/etc/diag.sh
index d189db518..1970ae0bc 100755
--- a/target/linux/ramips/base-files/etc/diag.sh
+++ b/target/linux/ramips/base-files/etc/diag.sh
@@ -1,42 +1,33 @@
#!/bin/sh
-#
-# Copyright (C) 2010 OpenWrt.org
-#
-#
+# Copyright (C) 2010-2013 OpenWrt.org
+. /lib/functions/leds.sh
. /lib/ramips.sh
-status_led=""
-
-led_set_attr() {
- [ -f "/sys/class/leds/$1/$2" ] && echo "$3" > "/sys/class/leds/$1/$2"
-}
-
-status_led_set_timer() {
- led_set_attr $status_led "trigger" "timer"
- led_set_attr $status_led "delay_on" "$1"
- led_set_attr $status_led "delay_off" "$2"
-}
-
-status_led_on() {
- led_set_attr $status_led "trigger" "none"
- led_set_attr $status_led "brightness" 255
-}
-
-status_led_off() {
- led_set_attr $status_led "trigger" "none"
- led_set_attr $status_led "brightness" 0
-}
-
get_status_led() {
case $(ramips_board_name) in
3g-6200n)
status_led="edimax:green:power"
;;
+ 3g300m | w150m)
+ status_led="tenda:blue:ap"
+ ;;
argus-atp52b)
status_led="argus-atp52b:green:run"
;;
- dir-300-b1 | dir-600-b1 | dir-600-b2 | dir-615-h1 | dir-615-d | dir-620-a1)
+ asl26555)
+ status_led="asl26555:green:power"
+ ;;
+ br6524n)
+ status_led="edimax:blue:power"
+ ;;
+ br6425)
+ status_led="edimax:green:power"
+ ;;
+ d105)
+ status_led="d105:red:power"
+ ;;
+ dir-300-b1 | dir-600-b1 | dir-600-b2 | dir-615-h1 | dir-615-d | dir-620-a1| dir-620-d1)
status_led="d-link:green:status"
;;
dir-645)
@@ -70,7 +61,8 @@ get_status_led() {
nw718)
status_led="nw718:amber:cpu"
;;
- omni-emb)
+ omni-emb|\
+ omni-emb-hpm)
status_led="emb:green:status"
;;
psr-680w)
@@ -122,6 +114,15 @@ get_status_led() {
wr512-3gn)
status_led="wr512:green:wps"
;;
+ wnce2001)
+ status_led="netgear:green:power"
+ ;;
+ mzk-w300nh2)
+ status_led="mzkw300nh2:green:power"
+ ;;
+ ur-326n4g)
+ status_led="ur326:green:wps"
+ ;;
ur-336un)
status_led="ur336:green:wps"
;;
@@ -136,11 +137,11 @@ set_state() {
case "$1" in
preinit)
- insmod leds-gpio
- status_led_set_timer 200 200
+ insmod leds-gpio 2> /dev/null
+ status_led_blink_preinit
;;
failsafe)
- status_led_set_timer 50 50
+ status_led_blink_failsafe
;;
done)
status_led_on
diff --git a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
index d02b1e0b4..320e01d90 100644
--- a/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
+++ b/target/linux/ramips/base-files/etc/hotplug.d/firmware/10-rt2x00-eeprom
@@ -11,7 +11,7 @@ rt2x00_eeprom_extract() {
local count=$3
local mtd
- . /etc/functions.sh
+ . /lib/functions.sh
mtd=$(find_mtd_part $part)
[ -n "$mtd" ] || \
@@ -28,13 +28,13 @@ rt2x00_eeprom_extract() {
board=$(ramips_board_name)
case "$FIRMWARE" in
-"RT288X.eeprom" | \
-"RT305X.eeprom" | \
-"RT3883.eeprom")
+"soc_wmac.eeprom")
case $board in
+ asl26555 | \
dir-300-b1 | \
dir-600-b1 | \
- dir-600-b2)
+ dir-600-b2 | \
+ dir-615-d)
rt2x00_eeprom_extract "devdata" 16384 272
;;
@@ -42,7 +42,6 @@ case "$FIRMWARE" in
rt2x00_eeprom_extract "devdata" 0 272
;;
- dir-615-d | \
rt-n10-plus | \
rt-g32-b1)
rt2x00_eeprom_extract "devconf" 0 272
@@ -54,14 +53,23 @@ case "$FIRMWARE" in
;;
3g-6200n | \
+ 3g-6200nl | \
+ 3g300m | \
+ air3gii | \
all0239-3g | \
all0256n | \
all5002 | \
+ all5003 | \
argus-atp52b | \
bc2 | \
+ br6425 | \
+ broadway | \
+ br6524n | \
carambola | \
+ d105 | \
dir-615-h1 | \
dir-620-a1 | \
+ dir-620-d1 | \
esr-9753 | \
fonera20n | \
rt-n13u | \
@@ -72,6 +80,7 @@ case "$FIRMWARE" in
nbg-419n | \
nw718 | \
omni-emb | \
+ omni-emb-hpm | \
psr-680w | \
rt-n15 | \
rt-n56u | \
@@ -79,6 +88,7 @@ case "$FIRMWARE" in
v11st-fe | \
v22rw-2x2 | \
w306r-v20 | \
+ w150m | \
w502u | \
wcr-150gn | \
whr-g300n | \
@@ -86,8 +96,11 @@ case "$FIRMWARE" in
wl-330n3g | \
wl-351 | \
wli-tx4-ag300n | \
+ wnce2001 | \
wr512-3gn | \
wr6202 | \
+ mzk-w300nh2 | \
+ ur-326n4g | \
ur-336un | \
xdxrn502j)
rt2x00_eeprom_extract "factory" 0 272
diff --git a/target/linux/ramips/base-files/etc/inittab b/target/linux/ramips/base-files/etc/inittab
index 67c36a6a9..870b3cc76 100644
--- a/target/linux/ramips/base-files/etc/inittab
+++ b/target/linux/ramips/base-files/etc/inittab
@@ -1,4 +1,3 @@
::sysinit:/etc/init.d/rcS S boot
::shutdown:/etc/init.d/rcS K shutdown
ttyS0::askfirst:/bin/ash --login
-ttyS1::askfirst:/bin/ash --login
diff --git a/target/linux/ramips/base-files/etc/uci-defaults/leds b/target/linux/ramips/base-files/etc/uci-defaults/01_leds
index 81d9c44ea..ec031883e 100755
--- a/target/linux/ramips/base-files/etc/uci-defaults/leds
+++ b/target/linux/ramips/base-files/etc/uci-defaults/01_leds
@@ -18,6 +18,16 @@ case $board in
set_wifi_led "edimax:amber:wlan"
set_usb_led "edimax:blue:3g"
;;
+ 3g-6200nl)
+ set_wifi_led "edimax:green:wlan"
+ ;;
+ 3g300m)
+ set_usb_led "tenda:blue:3g"
+ ;;
+ air3gii)
+ set_wifi_led "airlive:green:wlan"
+ set_usb_led "airlive:green:mobile"
+ ;;
all0256n)
ucidef_set_rssimon "wlan0" "40000" "1"
ucidef_set_led_rssi "rssilow" "RSSILOW" "all0256n:green:rssilow" "wlan0" "1" "40" "0" "6"
@@ -25,9 +35,29 @@ case $board in
ucidef_set_led_rssi "rssihigh" "RSSIHIGH" "all0256n:green:rssihigh" "wlan0" "70" "100" "-69" "8"
set_wifi_led "rt2800pci-phy0::radio"
;;
+ asl26555)
+ ucidef_set_led_default "power" "POWER" "asl26555:green:power" "1"
+ ucidef_set_led_netdev "eth" "ETH" "asl26555:green:eth" "eth0"
+ set_wifi_led "asl26555:green:wlan"
+ set_usb_led "asl26555:green:3g"
+ ;;
bc2)
set_usb_led "bc2:blue:usb"
;;
+ br6425)
+ set_wifi_led "edimax:orange:wlan"
+ ;;
+ broadway)
+ set_usb_led "red:diskmounted"
+ set_wifi_led "red:wps_active"
+ ;;
+ br6524n)
+ set_wifi_led "edimax:blue:wlan"
+ ;;
+ d105)
+ ucidef_set_led_default "power" "POWER" "d105:red:power" "1"
+ set_usb_led "d105:green:usb"
+ ;;
dir-300-b1|\
dir-600-b1|\
dir-600-b2|\
@@ -41,6 +71,9 @@ case $board in
ucidef_set_led_default "status" "Status LED (amber)" "d-link:amber:status" "0"
set_wifi_led "rt2800pci-phy0::radio"
;;
+ dir-620-d1)
+ set_wifi_led "d-link:green:wifi"
+ ;;
esr-9753)
set_wifi_led "rt2800pci-phy0::radio"
;;
@@ -61,9 +94,17 @@ case $board in
mofi3500-3gn)
set_usb_led "mofi3500-3gn:green:usb"
;;
+ mzk-w300nh2)
+ set_wifi_led "mzkw300nh2:amber:wlan"
+ ;;
nw718)
set_usb_led "nw718:amber:usb"
;;
+ omni-emb-hpm)
+ ucidef_set_led_default "power" "POWER" "emb:orange:power" "1"
+ ucidef_set_led_netdev "eth" "ETH" "emb:green:eth" "eth0"
+ set_wifi_led "emb:green:wifi"
+ ;;
sl-r7205)
set_wifi_led "rt2800pci-phy0::radio"
;;
@@ -80,6 +121,9 @@ case $board in
wcr-150gn)
set_usb_led "wcr150gn:amber:user"
;;
+ wnce2001)
+ set_wifi_led "netgear:green:wlan"
+ ;;
esac
ucidef_commit_leds
diff --git a/target/linux/ramips/base-files/etc/uci-defaults/network b/target/linux/ramips/base-files/etc/uci-defaults/02_network
index dff0fd66f..fe81899e7 100755
--- a/target/linux/ramips/base-files/etc/uci-defaults/network
+++ b/target/linux/ramips/base-files/etc/uci-defaults/02_network
@@ -1,14 +1,9 @@
#!/bin/sh
-. /etc/functions.sh
+. /lib/functions.sh
. /lib/ramips.sh
. /lib/functions/uci-defaults.sh
-if [ ! -x /usr/sbin/maccalc ]; then
- echo "$0: maccalc not found!"
- return
-fi
-
ramips_setup_rt3x5x_vlans()
{
if [ ! -x /sbin/swconfig ]; then
@@ -42,12 +37,18 @@ ramips_setup_interfaces()
ucidef_set_interface_loopback
case $board in
+ 3g300m | \
+ w150m | \
all0256n | \
- all5002)
+ all5002 | \
+ all5003 | \
+ broadway | \
+ wnce2001)
+ ucidef_add_switch "switch0" "1" "0"
ucidef_set_interface_lan "eth0"
;;
- dir-615-h1 | \
+ 3g-6200nl | \
wl-330n)
ucidef_set_interface_lan "eth0.1"
;;
@@ -63,6 +64,12 @@ ramips_setup_interfaces()
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
;;
+ asl26555)
+ ucidef_set_interface_lan "eth0.1"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
+ ;;
+
dir-645)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
@@ -70,12 +77,28 @@ ramips_setup_interfaces()
ucidef_add_switch_vlan "switch0" "2" "0 6t"
;;
+ dir-615-h1 | \
+ mzk-w300nh2)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "0 1 2 3 6t"
+ ucidef_add_switch_vlan "switch0" "2" "4 6t"
+ ;;
+
f5d8235-v1 | \
f5d8235-v2 | \
+ ur-326n4g)
+ ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
+ ucidef_add_switch "switch0" "1" "1"
+ ucidef_add_switch_vlan "switch0" "1" "1 2 3 4 6t"
+ ucidef_add_switch_vlan "switch0" "2" "0 6t"
+ ;;
+
ur-336un)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
;;
+ br6524n | \
v11st-fe)
ucidef_set_interfaces_lan_wan "eth0.1" "eth0.2"
ucidef_add_switch "switch0" "1" "1"
@@ -106,11 +129,12 @@ ramips_setup_interfaces()
ucidef_add_switch_vlan "switch0" "2" "0t 5"
;;
- freestation5 | \
wcr-150gn)
ucidef_set_interfaces_lan_wan "eth0.2" "eth0.1"
;;
+ d105 | \
+ omni-emb-hpm|\
wli-tx4-ag300n)
ucidef_set_interface_lan "eth0"
;;
@@ -136,96 +160,115 @@ ramips_setup_macs()
all0256n | \
all5002 | \
dir-615-h1)
- lan_mac=$(ramips_get_mac_binary factory 40)
+ lan_mac=$(mtd_get_mac_binary factory 40)
;;
3g-6200n | \
+ 3g300m | \
+ w150m | \
+ air3gii | \
argus-atp52b | \
bc2 | \
+ br6425 | \
+ broadway | \
+ dir-620-d1 | \
f5d8235-v1 | \
+ mzk-w300nh2 | \
nw718 | \
psr-680w | \
rt-n15 | \
sl-r7205 | \
wl-351)
- lan_mac=$(ramips_get_mac_binary factory 4)
- wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
+ lan_mac=$(mtd_get_mac_binary factory 4)
+ wan_mac=$(macaddr_add "$lan_mac" 1)
+ ;;
+
+ asl26555)
+ lan_mac=$(mtd_get_mac_binary devdata 16388)
;;
w306r-v20)
- lan_mac=$(ramips_get_mac_binary factory 4)
- wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 5)
+ lan_mac=$(mtd_get_mac_binary factory 4)
+ wan_mac=$(macaddr_add "$lan_mac" 5)
;;
rt-n13u | \
fonera20n)
- lan_mac=$(ramips_get_mac_binary factory 40)
- wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
+ lan_mac=$(mtd_get_mac_binary factory 40)
+ wan_mac=$(macaddr_add "$lan_mac" 1)
;;
dir-300-b1 |\
dir-300-b2 |\
dir-600-b1)
- lan_mac=$(ramips_get_mac_binary devdata 16388)
- wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
+ lan_mac=$(mtd_get_mac_binary devdata 16388)
+ wan_mac=$(macaddr_add "$lan_mac" 1)
;;
dir-620-a1)
- lan_mac=$(ramips_get_mac_binary factory 4)
- lan_mac=$(maccalc or "$lan_mac" "02:00:00:00:00:00")
- wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
+ lan_mac=$(mtd_get_mac_binary factory 4)
+ lan_mac=$(macaddr_setbit_la "$lan_mac")
+ wan_mac=$(macaddr_add "$lan_mac" 1)
;;
dir-645)
- lan_mac=$(ramips_get_mac_nvram nvram lanmac)
- wan_mac=$(ramips_get_mac_nvram nvram wanmac)
+ lan_mac=$(mtd_get_mac_ascii nvram lanmac)
+ wan_mac=$(mtd_get_mac_ascii nvram wanmac)
;;
esr-9753 | \
+ ur-326n4g | \
ur-336un)
- lan_mac=$(ramips_get_mac_binary devdata 16388)
- wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
+ lan_mac=$(mtd_get_mac_binary devdata 16388)
+ wan_mac=$(macaddr_add "$lan_mac" 1)
;;
nbg-419n | \
wcr-150gn)
- lan_mac=$(ramips_get_mac_binary factory 4)
- wan_mac=$(ramips_get_mac_binary factory 40)
+ lan_mac=$(mtd_get_mac_binary factory 4)
+ wan_mac=$(mtd_get_mac_binary factory 40)
+ ;;
+
+ omni-emb-hpm)
+ lan_mac=$(mtd_get_mac_binary factory 40)
;;
f5d8235-v2)
- lan_mac=$(ramips_get_mac_binary "u-boot" 262148)
- wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
+ lan_mac=$(mtd_get_mac_binary "u-boot" 262148)
+ wan_mac=$(macaddr_add "$lan_mac" 1)
;;
rt-n56u)
- lan_mac=$(ramips_get_mac_binary factory 4)
- wan_mac=$(ramips_get_mac_binary factory 32772)
+ lan_mac=$(mtd_get_mac_binary factory 4)
+ wan_mac=$(mtd_get_mac_binary factory 32772)
;;
tew-691gr)
- lan_mac=$(ramips_get_mac_binary factory 40)
- wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 3)
+ lan_mac=$(mtd_get_mac_binary factory 40)
+ wan_mac=$(macaddr_add "$lan_mac" 3)
;;
tew-692gr)
- lan_mac=$(ramips_get_mac_binary factory 40)
- wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 4)
+ lan_mac=$(mtd_get_mac_binary factory 40)
+ wan_mac=$(macaddr_add "$lan_mac" 4)
;;
all0239-3g | \
carambola | \
- w502u)
- lan_mac=$(ramips_get_mac_binary factory 40)
- wan_mac=$(ramips_get_mac_binary factory 46)
+ freestation5 | \
+ w502u | \
+ wnce2001)
+ lan_mac=$(mtd_get_mac_binary factory 40)
+ wan_mac=$(mtd_get_mac_binary factory 46)
;;
wl341v3)
- lan_mac=$(ramips_get_mac_binary board-nvram 65440)
- wan_mac=$(/usr/sbin/maccalc add "$lan_mac" 1)
+ lan_mac=$(mtd_get_mac_binary board-nvram 65440)
+ wan_mac=$(macaddr_add "$lan_mac" 1)
;;
+ d105 | \
wli-tx4-ag300n)
- lan_mac=$(ramips_get_mac_binary factory 4)
+ lan_mac=$(mtd_get_mac_binary factory 4)
;;
esac
diff --git a/target/linux/ramips/base-files/etc/uci-defaults/fixseama b/target/linux/ramips/base-files/etc/uci-defaults/09_fix-seama-header
index d8bed7951..d8bed7951 100755
--- a/target/linux/ramips/base-files/etc/uci-defaults/fixseama
+++ b/target/linux/ramips/base-files/etc/uci-defaults/09_fix-seama-header
diff --git a/target/linux/ramips/base-files/lib/preinit/03_preinit_do_ramips.sh b/target/linux/ramips/base-files/lib/preinit/03_preinit_do_ramips.sh
index e76418dad..31ef5f814 100644
--- a/target/linux/ramips/base-files/lib/preinit/03_preinit_do_ramips.sh
+++ b/target/linux/ramips/base-files/lib/preinit/03_preinit_do_ramips.sh
@@ -2,6 +2,8 @@
do_ramips() {
. /lib/ramips.sh
+
+ ramips_board_detect
}
boot_hook_add preinit_main do_ramips
diff --git a/target/linux/ramips/base-files/lib/preinit/04_disable_wnce2001_flash_checksumming b/target/linux/ramips/base-files/lib/preinit/04_disable_wnce2001_flash_checksumming
new file mode 100644
index 000000000..67a1746f1
--- /dev/null
+++ b/target/linux/ramips/base-files/lib/preinit/04_disable_wnce2001_flash_checksumming
@@ -0,0 +1,43 @@
+#!/bin/sh
+
+# Netgear WNCE2001 has does a checksum check on boot and goes into recovery
+# tftp mode when the check fails. Initializing the JFFS2 partition triggers
+# this, so we make sure to zero checksum and size to be checksummed before
+# that happens, so this needs to run very early during boot.
+
+do_wnce2001_checksumming_disable() {
+ . /lib/ramips.sh
+
+ local board=$(ramips_board_name)
+
+ case "$board" in
+ wnce2001)
+ echo "Board is WNCE2001, updating checksum partition..."
+ local zeroes=/dev/zero
+ local tmpfile=/tmp/wnce2001_checksum
+ local partname=checksum
+ local mtd=$(find_mtd_part $partname)
+ dd if=$mtd of=$tmpfile bs=80 count=1 2>/dev/null
+ signature=$(dd if=$tmpfile bs=1 skip=24 count=20 2>/dev/null)
+ checksum=$(dd if=$tmpfile bs=1 count=4 2>/dev/null | hexdump -v -n 4 -e '1/1 "%02x"')
+ if [ "$signature" != "RT3052-AP-WNCE2001-3" ]; then
+ echo "Signature of checksum partition is wrong, bailing."
+ return 0
+ fi
+ if [ "$checksum" != "00000000" ]; then
+ echo "Checksum is set, zeroing."
+ # zero out checksum
+ dd if=$zeroes of=$tmpfile conv=notrunc bs=1 seek=0 count=4 2>/dev/null
+ # zero out bytecount to be checksummed
+ dd if=$zeroes of=$tmpfile conv=notrunc bs=1 seek=60 count=4 2>/dev/null
+ mtd write $tmpfile $partname
+ else
+ echo "Checksum is already zero, nothing to do."
+ fi
+ ;;
+ esac
+
+ return 0
+}
+
+boot_hook_add preinit_main do_wnce2001_checksumming_disable
diff --git a/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac b/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
index 379f74dd5..022f72e24 100644
--- a/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
+++ b/target/linux/ramips/base-files/lib/preinit/06_set_iface_mac
@@ -5,14 +5,24 @@
preinit_set_mac_address() {
local mac
+ . /lib/functions.sh
. /lib/ramips.sh
case $(ramips_board_name) in
- 3g-6200n)
- mac=$(ramips_get_mac_binary factory 4)
+ 3g-6200n |\
+ 3g-6200nl |\
+ 3g300m | \
+ dir-620-d1 |\
+ w150m | \
+ mzk-w300nh2 |\
+ wl-330n |\
+ wl-330n3g)
+ mac=$(mtd_get_mac_binary factory 4)
ifconfig eth0 hw ether $mac 2>/dev/null
;;
bc2 |\
+ broadway |\
+ d105 |\
dir-620-a1 |\
esr-9753 |\
freestation5 |\
@@ -20,28 +30,30 @@ preinit_set_mac_address() {
psr-680w |\
rt-n56u |\
sl-r7205)
- mac=$(ramips_get_mac_binary factory 4)
- mac=$(maccalc or "$mac" "02:00:00:00:00:00")
+ mac=$(mtd_get_mac_binary factory 4)
+ mac=$(macaddr_setbit_la "$mac")
ifconfig eth0 hw ether $mac 2>/dev/null
;;
+ asl26555 |\
dir-300-b1 |\
dir-300-b2 |\
dir-600-b1)
- mac=$(ramips_get_mac_binary devdata 16388)
+ mac=$(mtd_get_mac_binary devdata 16388)
ifconfig eth0 hw ether $mac 2>/dev/null
;;
dir-645)
- mac=$(ramips_get_mac_nvram nvram lanmac)
- mac=$(maccalc or "$mac" "02:00:00:00:00:00")
+ mac=$(mtd_get_mac_ascii nvram lanmac)
+ mac=$(macaddr_setbit_la "$mac")
ifconfig eth0 hw ether $mac 2>/dev/null
;;
dap-1350)
- mac=$(ramips_get_mac_binary devdata 46)
+ mac=$(mtd_get_mac_binary devdata 46)
ifconfig eth0 hw ether $mac 2>/dev/null
;;
all0239-3g |\
all0256n |\
all5002 |\
+ all5003 |\
carambola |\
dir-615-h1 |\
fonera20n |\
@@ -49,23 +61,23 @@ preinit_set_mac_address() {
hw550-3g |\
nbg-419n |\
omni-emb |\
+ omni-emb-hpm |\
tew-691gr |\
tew-692gr |\
w306r-v20 |\
w502u |\
- wl-330n |\
- wl-330n3g |\
wr6202 |\
+ wnce2001 |\
xdxrn502j)
- mac=$(ramips_get_mac_binary factory 40)
+ mac=$(mtd_get_mac_binary factory 40)
ifconfig eth0 hw ether $mac 2>/dev/null
;;
wl341v3)
- mac=$(ramips_get_mac_binary board-nvram 65440)
+ mac=$(mtd_get_mac_binary board-nvram 65440)
ifconfig eth0 hw ether $mac 2>/dev/null
;;
rt-n10-plus)
- mac=$(ramips_get_mac_binary devconf 4)
+ mac=$(mtd_get_mac_binary devconf 4)
ifconfig eth0 hw ether $mac 2>/dev/null
;;
esac
diff --git a/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
new file mode 100644
index 000000000..c8b7f2ad3
--- /dev/null
+++ b/target/linux/ramips/base-files/lib/preinit/07_set_preinit_iface_ramips
@@ -0,0 +1,12 @@
+#!/bin/sh
+#
+# Copyright (C) 2013 OpenWrt.org
+#
+
+. /lib/ramips.sh
+
+ramips_set_preinit_iface() {
+ ifname=eth0
+}
+
+boot_hook_add preinit_main ramips_set_preinit_iface
diff --git a/target/linux/ramips/base-files/lib/ramips.sh b/target/linux/ramips/base-files/lib/ramips.sh
index abefdc520..63af00d03 100755
--- a/target/linux/ramips/base-files/lib/ramips.sh
+++ b/target/linux/ramips/base-files/lib/ramips.sh
@@ -1,46 +1,12 @@
#!/bin/sh
#
-# Copyright (C) 2010 OpenWrt.org
+# Copyright (C) 2010-2013 OpenWrt.org
#
-ramips_get_mac_binary()
-{
- local mtdname="$1"
- local seek="$2"
- local part
+RAMIPS_BOARD_NAME=
+RAMIPS_MODEL=
- . /lib/functions.sh
-
- part=$(find_mtd_part "$mtdname")
- if [ -z "$part" ]; then
- echo "ramips_get_mac_binary: partition $mtdname not found!" >&2
- return
- fi
-
- dd bs=1 skip=$seek count=6 if=$part 2>/dev/null | /usr/sbin/maccalc bin2mac
-}
-
-ramips_get_mac_nvram()
-{
- local mtdname="$1"
- local key="$2"
- local part
- local mac_dirty
-
- . /lib/functions.sh
-
- part=$(find_mtd_part "$mtdname")
- if [ -z "$part" ]; then
- echo "ramips_get_mac_nvram: partition $mtdname not found!" >&2
- return
- fi
-
- mac_dirty=$(strings "$part" | sed -n 's/'"$key"'=//p')
- # "canonicalize" mac
- /usr/sbin/maccalc add "$mac_dirty" 0
-}
-
-ramips_board_name() {
+ramips_board_detect() {
local machine
local name
@@ -53,6 +19,15 @@ ramips_board_name() {
*"Edimax 3g-6200n")
name="3g-6200n"
;;
+ *"Edimax 3g-6200nl")
+ name="3g-6200nl"
+ ;;
+ *"AirLive Air3GII")
+ name="air3gii"
+ ;;
+ *"Edimax BR-6425")
+ name="br6425"
+ ;;
*"Allnet ALL0239-3G")
name="all0239-3g"
;;
@@ -62,18 +37,27 @@ ramips_board_name() {
*"Allnet ALL5002")
name="all5002"
;;
+ *"Allnet ALL5003")
+ name="all5003"
+ ;;
*"ARC FreeStation5")
name="freestation5"
;;
*"Argus ATP-52B")
name="argus-atp52b"
;;
+ *"BR6524N")
+ name="br6524n"
+ ;;
*"Asus WL-330N")
name="wl-330n"
;;
*"Asus WL-330N3G")
name="wl-330n3g"
;;
+ *"Alpha ASL26555")
+ name="asl26555"
+ ;;
*"Aztech HW550-3G")
name="hw550-3g"
;;
@@ -89,6 +73,9 @@ ramips_board_name() {
*"DIR-620 A1")
name="dir-620-a1"
;;
+ *"DIR-620 D1")
+ name="dir-620-d1"
+ ;;
*"DIR-615 H1")
name="dir-615-h1"
;;
@@ -98,9 +85,9 @@ ramips_board_name() {
*"DIR-645")
name="dir-645"
;;
- *"DAP-1350")
- name="dap-1350"
- ;;
+ *"DAP-1350")
+ name="dap-1350"
+ ;;
*"ESR-9753")
name="esr-9753"
;;
@@ -110,6 +97,12 @@ ramips_board_name() {
*"F5D8235 v2")
name="f5d8235-v2"
;;
+ *"Hauppauge Broadway")
+ name="broadway"
+ ;;
+ *"Huawei D105")
+ name="d105"
+ ;;
*"La Fonera 2.0N")
name="fonera20n"
;;
@@ -122,18 +115,27 @@ ramips_board_name() {
*"NBG-419N")
name="nbg-419n"
;;
+ *"Netgear WNCE2001")
+ name="wnce2001"
+ ;;
*"NexAira BC2")
name="bc2"
;;
*"NW718")
name="nw718"
;;
+ *"Omnima EMB HPM")
+ name="omni-emb-hpm"
+ ;;
*"Omnima MiniEMBWiFi")
name="omni-emb"
;;
*"Petatel PSR-680W"*)
name="psr-680w"
;;
+ *"Planex MZK-W300NH2"*)
+ name="mzk-w300nh2"
+ ;;
*"PWH2004")
name="pwh2004"
;;
@@ -170,9 +172,15 @@ ramips_board_name() {
*"Sitecom WL-351 v1 002")
name="wl-351"
;;
+ *"Tenda 3G300M")
+ name="3g300m"
+ ;;
*"Tenda W306R V2.0")
name="w306r-v20"
;;
+ *"Tenda W150M")
+ name="w150m"
+ ;;
*"TEW-691GR")
name="tew-691gr"
;;
@@ -191,6 +199,9 @@ ramips_board_name() {
*"WR512-3GN-like router")
name="wr512-3gn"
;;
+ *"UR-326N4G Wireless N router")
+ name="ur-326n4g"
+ ;;
*"UR-336UN Wireless N router")
name="ur-336un"
;;
@@ -205,5 +216,20 @@ ramips_board_name() {
;;
esac
- echo $name
+ [ -z "$RAMIPS_BOARD_NAME" ] && RAMIPS_BOARD_NAME="$name"
+ [ -z "$RAMIPS_MODEL" ] && RAMIPS_MODEL="$machine"
+
+ [ -e "/tmp/sysinfo/" ] || mkdir -p "/tmp/sysinfo/"
+
+ echo "$RAMIPS_BOARD_NAME" > /tmp/sysinfo/board_name
+ echo "$RAMIPS_MODEL" > /tmp/sysinfo/model
+}
+
+ramips_board_name() {
+ local name
+
+ [ -f /tmp/sysinfo/board_name ] && name=$(cat /tmp/sysinfo/board_name)
+ [ -z "$name" ] && name="unknown"
+
+ echo "$name"
}
diff --git a/target/linux/ramips/base-files/lib/upgrade/platform.sh b/target/linux/ramips/base-files/lib/upgrade/platform.sh
index 1acbbffa4..b2fa0bd95 100755
--- a/target/linux/ramips/base-files/lib/upgrade/platform.sh
+++ b/target/linux/ramips/base-files/lib/upgrade/platform.sh
@@ -15,17 +15,26 @@ platform_check_image() {
case "$board" in
3g-6200n | \
+ 3g-6200nl | \
+ 3g300m | \
+ w150m | \
+ air3gii | \
all0239-3g | \
all0256n | \
all5002 | \
+ all5003 | \
+ asl26555 | \
bc2 | \
+ broadway | \
carambola | \
+ d105 | \
dir-300-b1 | \
dir-600-b1 | \
dir-600-b2 | \
dir-615-h1 | \
dir-615-d | \
dir-620-a1 | \
+ dir-620-d1 | \
dap-1350 | \
esr-9753 | \
fonera20n | \
@@ -33,9 +42,11 @@ platform_check_image() {
freestation5 | \
hw550-3g | \
mofi3500-3gn | \
+ mzk-w300nh2 | \
nbg-419n | \
nw718 | \
omni-emb | \
+ omni-emb-hpm | \
psr-680w | \
rt-g32-b1 | \
rt-n10-plus | \
@@ -51,8 +62,10 @@ platform_check_image() {
wl341v3 | \
wl-330n | \
wl-351 | \
+ wnce2001 | \
wli-tx4-ag300n | \
whr-g300n |\
+ ur-326n4g |\
ur-336un |\
wr512-3gn)
[ "$magic" != "27051956" ] && {