2011-07-03 15:02:01 +00:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
rt2x00_eeprom_die() {
|
|
|
|
echo "rt2x00 eeprom: " "$*"
|
|
|
|
exit 1
|
|
|
|
}
|
|
|
|
|
|
|
|
rt2x00_eeprom_extract() {
|
|
|
|
local part=$1
|
2019-08-09 15:45:13 +00:00
|
|
|
local offset=$(($2))
|
|
|
|
local count=$(($3))
|
2011-07-03 15:02:01 +00:00
|
|
|
local mtd
|
|
|
|
|
|
|
|
mtd=$(find_mtd_part $part)
|
|
|
|
[ -n "$mtd" ] || \
|
|
|
|
rt2x00_eeprom_die "no mtd device found for partition $part"
|
|
|
|
|
2019-03-17 23:07:31 +00:00
|
|
|
dd if=$mtd of=/lib/firmware/$FIRMWARE iflag=skip_bytes bs=$count skip=$offset count=1 2>/dev/null || \
|
2011-07-03 15:02:01 +00:00
|
|
|
rt2x00_eeprom_die "failed to extract from $mtd"
|
|
|
|
}
|
|
|
|
|
2018-01-20 08:27:03 +00:00
|
|
|
jboot_eeprom_extract() {
|
|
|
|
local part=$1
|
|
|
|
local offset=$2
|
|
|
|
local mtd
|
|
|
|
|
|
|
|
mtd=$(find_mtd_part $part)
|
|
|
|
[ -n "$mtd" ] || \
|
|
|
|
rt2x00_eeprom_die "no mtd device found for partition $part"
|
|
|
|
|
|
|
|
jboot_config_read -i $mtd -o $offset -e /lib/firmware/$FIRMWARE 2>/dev/null || \
|
|
|
|
rt2x00_eeprom_die "failed to extract from $mtd"
|
|
|
|
}
|
|
|
|
|
2015-11-02 10:17:41 +00:00
|
|
|
rt2x00_eeprom_set_macaddr() {
|
|
|
|
local macaddr=$1
|
|
|
|
|
|
|
|
[ -n "$macaddr" ] || \
|
|
|
|
rt2x00_eeprom_die "invalid wlan mac address"
|
|
|
|
|
|
|
|
macaddr_2bin $macaddr | dd of=/lib/firmware/$FIRMWARE \
|
2019-03-17 23:07:31 +00:00
|
|
|
conv=notrunc oflag=seek_bytes bs=6 seek=4 count=1 2>/dev/null || \
|
2015-11-02 10:17:41 +00:00
|
|
|
rt2x00_eeprom_die "failed to write mac address to eeprom file"
|
|
|
|
}
|
|
|
|
|
2013-11-25 08:34:55 +00:00
|
|
|
FW="/lib/firmware/$FIRMWARE"
|
|
|
|
[ -e "$FW" ] && exit 0
|
2011-07-03 15:02:01 +00:00
|
|
|
|
2017-05-12 20:36:07 +00:00
|
|
|
. /lib/functions.sh
|
2015-11-02 10:17:41 +00:00
|
|
|
. /lib/functions/system.sh
|
2012-02-14 17:32:45 +00:00
|
|
|
|
2017-05-12 20:36:07 +00:00
|
|
|
board=$(board_name)
|
2012-02-14 17:32:45 +00:00
|
|
|
|
2011-07-03 15:02:01 +00:00
|
|
|
case "$FIRMWARE" in
|
2012-12-22 16:09:03 +00:00
|
|
|
"soc_wmac.eeprom")
|
2011-07-03 15:02:01 +00:00
|
|
|
case $board in
|
2018-03-19 18:15:29 +00:00
|
|
|
dlink,dir-510l|\
|
2018-03-10 09:34:38 +00:00
|
|
|
dlink,dwr-116-a1|\
|
2018-10-24 12:06:35 +00:00
|
|
|
dlink,dwr-118-a1|\
|
2018-04-19 17:34:22 +00:00
|
|
|
dlink,dwr-118-a2|\
|
2018-11-17 08:47:40 +00:00
|
|
|
dlink,dwr-921-c1|\
|
ramips: add support for DLINK DWR-922-E2
Very similar to the DWR-921-C1, except has a telephony/RJ11 port (not
sure if supported, I didn't try), wireless router with QMI LTE embedded
modem is based on the MT7620N SoC.
Specification:
* MediaTek MT7620N (580 Mhz)
* 64 MB of RAM
* 16 MB of FLASH
* 802.11bgn radio
* 5x 10/100 Mbps Ethernet (1 WAN and 4 LAN)
* 2x external, detachable (LTE) antennas
* UART header on PCB (57600 8n1)
* 6x LED (GPIO-controlled)
* 1x bi-color Signal Strength LED (GPIO-controlled)
* 2x button
* JBOOT bootloader
The status led has been assigned to the dwr-922-e2:green:signalstrength
(lte signal strength) led. At the end of the boot it is switched off and
is available for lte operation. Works correctly also during sysupgrade
operation.
Installation:
Apply factory image via d-link http web-gui, or via recovery interface:
How to recover/revert to OEM firmware:
1.) Push and hold the reset button and turn on the power. Wait until all
LEDs start rapidly blinking (~10sec.)
2.) DHCP should give you an IP in the 192.168.123.0/24 subnet, or set
one manually
3.) Upload original factory image via JBOOT http interface at IP
192.168.123.254
4.) If http doesn't work, it can be done with curl command:
curl -F FN=@XXXXX.bin http://192.168.123.254/upg
where XXXXX.bin is name of firmware file.
5.) You can optionally telnet to 192.168.123.254 before or during the
upload and it will report the flashing status, memory address etc.
6.) Once web UI and/or telnet says "Success", power cycle the router, or
type "reboot" into the telnet session.
Signed-off-by: Simon Quigley <squigley@squigley.net>
[squashed commits, word wrap commit message, rename signal strenght led
name to match what is used for the DWR-921-C1 since they share the led
configuration, add label referenced in the aliases node]
Signed-off-by: Mathias Kresin <dev@kresin.me>
2018-12-20 16:47:52 +00:00
|
|
|
dlink,dwr-922-e2|\
|
2018-11-17 08:47:40 +00:00
|
|
|
lava,lr-25g001)
|
2018-01-20 08:27:03 +00:00
|
|
|
wan_mac=$(jboot_config_read -m -i $(find_mtd_part "config") -o 0xE000)
|
|
|
|
wifi_mac=$(macaddr_add "$wan_mac" 1)
|
|
|
|
jboot_eeprom_extract "config" 0xE000
|
|
|
|
rt2x00_eeprom_set_macaddr $wifi_mac
|
|
|
|
;;
|
2019-07-03 21:22:02 +00:00
|
|
|
dovado,tiny-ac)
|
2016-09-23 22:07:24 +00:00
|
|
|
wifi_mac=$(mtd_get_mac_ascii u-boot-env INIC_MAC_ADDR)
|
2019-08-09 15:45:13 +00:00
|
|
|
rt2x00_eeprom_extract "factory" 0x0 0x200
|
2015-11-02 10:17:51 +00:00
|
|
|
rt2x00_eeprom_set_macaddr $wifi_mac
|
|
|
|
;;
|
2016-11-07 21:02:20 +00:00
|
|
|
*)
|
|
|
|
rt2x00_eeprom_die "Please define mtd-eeprom in $board DTS file!"
|
|
|
|
;;
|
2012-02-14 17:32:45 +00:00
|
|
|
esac
|
|
|
|
;;
|
2011-08-19 15:55:07 +00:00
|
|
|
esac
|