1
0
mirror of https://git.openwrt.org/openwrt/openwrt.git synced 2024-06-14 11:13:53 +02:00
openwrt/target/linux/ramips/mt7621/base-files/lib/upgrade/platform.sh
Karim Dehouche 6639623e75 ramips: add support for D-Link DIR-853 A3
Specifications:
* SoC: MT7621AT
* RAM: 256MB
* Flash: 128MB NAND flash
* WiFi: MT7615DN (2.4GHz+5Ghz) with DBDC
* LAN: 5x1000M
* Firmware layout is Uboot with extra 96 bytes in header
* Base PCB is DIR-1360 REV1.0
* LEDs Power Blue+Orange,Wan Blue+Orange,WPS Blue,"2.4G"Blue, "5G" Blue,
  USB Blue
* Buttons Reset,WPS, Wifi

MAC addresses on OEM firmware:

lan      factory 0xe000   f4:*:*:a8:*:65  (label)
wan      factory 0xe006   f4:*:*:a8:*:68
2.4 GHz  [not on flash]   f6:*:*:c8:*:66
5.0 GHz  factory 0x4      f4:*:*:a8:*:66

The increment of the 4th byte for the 2.4g address appears to vary.
Reported cases:

       5g                 2.4g         increment
 f4:XX:XX:a8:XX:66  f6:XX:XX:c8:XX:66  +0x20
 x0:xx:xx:68:xx:xx  x2:xx:xx:48:xx:xx  -0x20
 x4:xx:xx:6a:xx:xx  x6:xx:xx:4a:xx:xx  -0x20

Since increment is inconsistent and there is no obvious pattern
in swapping bytes, and the 2.4g address has local bit set anyway,
it seems safer to use the LAN address with flipped byte here in
order to prevent collisions between OpenWrt devices and OEM devices
for this interface. This way we at least use an address as base
that is definitely owned by the device at hand.

Flashing instruction:

The Dlink "Emergency Room" cannot be accessed through the reset
button on this device. You can either use console or use the
encrypted factory image availble in the openwrt forum.

Once the encrypted image is flashed throuh the stock Dlink web
interface, the sysupgrade images can be used.

Header pins needs to be soldered near the WPS and Wifi buttons.

The layout for the pins is (VCC,RX,TX,GND). No need to connect the VCC.

the settings are:

Bps/Par/Bits          : 57600 8N1
Hardware Flow Control : No
Software Flow Control : No

Connect your client computer to LAN1 of the device
Set your client IP address manually to 192.168.0.101 / 255.255.255.0.
Call the recovery page or tftp for the device at http://192.168.0.1
Use the provided emergency web GUI to upload and flash a new firmware to
the device

At the time of adding support the wireless config needs to be set up by
editing the wireless config file:

 * Setting the country code is mandatory, otherwise the router loses
   connectivity at the next reboot. This is mandatory and can be done
   from luci. After setting the country code the router boots correctly.
   A reset with the reset button will fix the issue and the user has to
   reconfigure.

 * This is minor since the 5g interface does not come up online although
   it is not set as disabled. 2 options here:

   1- Either run the "wifi" command. Can be added from LUCI in system -
      startup - local startup and just add wifi above "exit 0".

   2- Or add the serialize option in the wireless config file as shown
      below. This one would work and bring both interfaces automatically
      at every boot:

      config wifi-device 'radio0'
          option serialize '1'

      config wifi-device 'radio1'
          option serialize '1'

Signed-off-by: Karim Dehouche <karimdplay@gmail.com>
[rebase, improve MAC table, update wireless config comment, fix
 2.4g macaddr setup]
Signed-off-by: Adrian Schmutzler <freifunk@adrianschmutzler.de>
2021-07-12 00:19:14 +02:00

119 lines
2.7 KiB
Bash
Executable File

#
# Copyright (C) 2010 OpenWrt.org
#
PART_NAME=firmware
REQUIRE_IMAGE_METADATA=1
RAMFS_COPY_BIN='fw_printenv fw_setenv'
RAMFS_COPY_DATA='/etc/fw_env.config /var/lock/fw_printenv.lock'
platform_check_image() {
return 0
}
platform_do_upgrade() {
local board=$(board_name)
case "$board" in
alfa-network,quad-e4g)
[ "$(fw_printenv -n dual_image 2>/dev/null)" = "1" ] &&\
[ -n "$(find_mtd_part backup)" ] && {
PART_NAME=backup
if [ "$(fw_printenv -n bootactive 2>/dev/null)" = "1" ]; then
fw_setenv bootactive 2 || exit 1
else
fw_setenv bootactive 1 || exit 1
fi
}
;;
ampedwireless,ally-00x19k|\
ampedwireless,ally-r1900k)
if [ "$(fw_printenv --lock / -n bootImage 2>/dev/null)" != "0" ]; then
fw_setenv --lock / bootImage 0 || exit 1
fi
;;
mikrotik,routerboard-750gr3|\
mikrotik,routerboard-760igs|\
mikrotik,routerboard-m11g|\
mikrotik,routerboard-m33g)
[ "$(rootfs_type)" = "tmpfs" ] && mtd erase firmware
;;
asus,rt-ac65p|\
asus,rt-ac85p)
echo "Backing up firmware"
dd if=/dev/mtd4 bs=1024 count=4096 > /tmp/backup_firmware.bin
dd if=/dev/mtd5 bs=1024 count=52224 >> /tmp/backup_firmware.bin
mtd -e firmware2 write /tmp/backup_firmware.bin firmware2
;;
esac
case "$board" in
ampedwireless,ally-00x19k|\
ampedwireless,ally-r1900k|\
asus,rt-ac65p|\
asus,rt-ac85p|\
dlink,dir-1960-a1|\
dlink,dir-2640-a1|\
dlink,dir-2660-a1|\
dlink,dir-853-a3|\
hiwifi,hc5962|\
jcg,q20|\
linksys,e5600|\
linksys,ea7300-v1|\
linksys,ea7300-v2|\
linksys,ea7500-v2|\
linksys,ea8100-v1|\
linksys,ea8100-v2|\
netgear,r6220|\
netgear,r6260|\
netgear,r6350|\
netgear,r6700-v2|\
netgear,r6800|\
netgear,r6850|\
netgear,wac104|\
netgear,wac124|\
netis,wf2881|\
sercomm,na502|\
xiaomi,mi-router-3g|\
xiaomi,mi-router-3-pro|\
xiaomi,mi-router-4|\
xiaomi,mi-router-ac2100|\
xiaomi,redmi-router-ac2100)
nand_do_upgrade "$1"
;;
iodata,wn-ax1167gr2|\
iodata,wn-ax2033gr|\
iodata,wn-dx1167r)
iodata_mstc_upgrade_prepare "0xfe75"
nand_do_upgrade "$1"
;;
iodata,wn-dx1200gr)
iodata_mstc_upgrade_prepare "0x1fe75"
nand_do_upgrade "$1"
;;
ubnt,edgerouter-x|\
ubnt,edgerouter-x-sfp)
platform_upgrade_ubnt_erx "$1"
;;
zyxel,nr7101)
fw_setenv CheckBypass 0
fw_setenv Image1Stable 0
CI_KERNPART="Kernel"
nand_do_upgrade "$1"
;;
zyxel,wap6805)
local kernel2_mtd="$(find_mtd_part Kernel2)"
[ "$(hexdump -n 4 -e '"%x"' $kernel2_mtd)" = "56190527" ] &&\
[ "$(hexdump -n 4 -s 104 -e '"%x"' $kernel2_mtd)" != "0" ] &&\
dd bs=4 count=1 seek=26 conv=notrunc if=/dev/zero of=$kernel2_mtd 2>/dev/null &&\
echo "Kernel2 sequence number was reset to 0"
CI_KERNPART="Kernel"
nand_do_upgrade "$1"
;;
*)
default_do_upgrade "$1"
;;
esac
}