ramips: add CUDY WR1000 support
authorDavide Fioravanti <pantanastyle@gmail.com>
Mon, 20 May 2019 03:20:37 +0000 (05:20 +0200)
committerChristian Lamparter <chunkeey@gmail.com>
Fri, 31 May 2019 08:36:36 +0000 (10:36 +0200)
commit7c91144ae6a45dc8d7ca6b68b3403e166185a498
tree181e12347d7adee2f75cf39b1a3f82043a5b128d
parent62ce6d58f2ed280744ea6ef793c2342494b12ce7
ramips: add CUDY WR1000 support

Cudy WR1200 is an AC1200 AP with 3-port FE and 2 non-detachable antennas

Specifications:

MT7628 (580 MHz)
64 MB of RAM (DDR2)
8 MB of FLASH
2T2R 2.4 GHz (MT7628)
2T2R 5 GHz (MT7612E)
3x 10/100 Mbps Ethernet (2 LAN + 1 WAN)
2x external, non-detachable antennas (5dbi)
UART header on PCB (57600 8n1)
7x LED, 2x button

Known issues:
The Power LED is always ON, probably because it is connected
directly to power.

Flash instructions
------------------
Load the ...-factory.bin image via the stock web interface.

Openwrt upgrade instructions
----------------------------
Use the ...-sysupgrade.bin image for future upgrades.

Revert to stock FW
------------------
Warning! This tutorial will work only with the following OEM FW:
  WR1000_EU_92.122.2.4987.201806261618.bin
  WR1000_US_92.122.2.4987.201806261609.bin
If in the future these firmwares will not be available anymore,
you have to find the new XOR key.

1) Download the original FW from the Cudy website.

   (For example WR1000_EU_92.122.2.4987.201806261618.bin)

2) Remove the header.

   dd if="WR1000_EU_92.122.2.4987.201806261618.bin" of="WR1000_EU_92.122.2.4987.201806261618.bin.mod" skip=8 bs=64

3) XOR the new file with the region key.

   FOR EU: 7B76741E67594351555042461D625F4545514B1B03050208000603020803000D
   FOR US: 7B76741E675943555D5442461D625F454555431F03050208000603060007010C

   You can use OpenWrt's tools/firmware-utils/src/xorimage.c tool for this:

   xorimage -i WR1000..bin.mod -o stock-firmware.bin -x -p 7B767..

   Or, you can use this tool (CHANGE THE XOR KEY ACCORDINGLY!):
   https://gchq.github.io/CyberChef/#recipe=XOR(%7B'option':'Hex','string':''%7D,'',false)

4) Check the resulting decrypted image.

   Check if bytes from 0x20 to 0x3f are:
   4C 69 6E 75 78 20 4B 65 72 6E 65 6C 20 49 6D 61 67 65 00 00 00 00 00 00 00 00 00 00 00 00 00 00

   Alternatively, you can use u-boot's tool dumpimage tool to check
   if the decryption was successful. It should look like:

   # dumpimage -l stock-firmware.bin
   Image Name:   Linux Kernel Image
   Created:      Tue Jun 26 10:24:54 2018
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    4406635 Bytes = 4303.35 KiB = 4.20 MiB
   Load Address: 80000000
   Entry Point:  8000c150

5) Flash it via forced firmware upgrade and don't "Keep Settings"

   CLI: sysupgrade -F -n stock-firmware.bin

   LuCI: make sure to click on the "Keep settings" checkbox
         to disable it. You'll need to do this !TWICE! because
         on the first try, LuCI will refuse the image and reset
 the "Keep settings" to enable. However a new
         "Force upgrade" checkbox will appear as well.
         Make sure to do this very carefully!

Signed-off-by: Davide Fioravanti <pantanastyle@gmail.com>
Signed-off-by: Christian Lamparter <chunkeey@gmail.com>
[added wifi compatible, spiffed-up the returned to stock instructions]
target/linux/ramips/base-files/etc/board.d/01_leds
target/linux/ramips/base-files/etc/board.d/02_network
target/linux/ramips/dts/WR1000.dts [new file with mode: 0644]
target/linux/ramips/image/mt76x8.mk