lunes, 10 de julio de 2017

Actualizando a LEDE (Openwrt based) el router Afoundry EW-1200

Tenemos aquí un router "chino" que en principio llama la atención por las 6 antenas que trae. Por el precio sería un router de gama media-alta.


Aquí viene una review. Me quedo con la aparente potencia del procesador Mediatek MT7621 de 2 núcleos a 880 Mhz y la capacidad de emitir wifi simultáneamente en las bandas de 2.4 y 5 Ghz. Incorpora además


128 MB DDR3 RAM

- 128 Mb SPI flash

- 1 USB 3.0


Funciona bastante bien, pero la interfaz web es demasiado austera y deja muchos parámetros ocultos que lo harían más potente. En concreto trae instalado el Openwrt Barrier Breaker 14.07 pero modificado. Para manipularlo abrimos la carcasa y conectamos por el puerto serial que trae, en este caso de solo 3 pines Rx,Gnd,Tx. No trae JTAG. Para conectar usamos de nuevo un cable prolific Plugable USB to RS-232 DB9 y un Serial Port Converter JY-R2T V1.2 RS232. Al ser una conexión de solo tres pines sin VCC (alimentación), tenemos que alimentar manualmente el Serial Port Converter con un cable usb al ordenador.









Usando Hyperterminal y conexión 57600 8N1 obtenemos lo siguiente:

...

===================================================================



      MT7621   stage1 code done 



      CPU=50000000 HZ BUS=16666666 HZ



===================================================================



Uboot identify string is mt7621:s1200en:0.1.4(U-Boot 1.1.3 (Sep 19 2016 - 17:11:09))

Board: Ralink APSoC DRAM:  128 MB
relocate_code Pointer at: 87fb8000

Config XHCI 40M PLL 
flash manufacture id: c2, device id 20 18
find flash: MX25L12805D
*** Warning - bad CRC, using default environment

============================================ 
Ralink UBoot Version: 4.2.1.0
-------------------------------------------- 
ASIC 7621_MP (MAC to MT7530 Mode)
DRAM_CONF_FROM: Auto-Detection 
DRAM_TYPE: DDR3 
DRAM bus: 16 bit
Xtal Mode=3 OCP Ratio=1/3
Flash component: SPI Flash
Date:Sep 19 2016  Time:17:11:09
============================================ 
icache: sets:256, ways:4, linesz:32 ,total:32768
dcache: sets:256, ways:4, linesz:32 ,total:32768 

 ##### The CPU freq = 880 MHZ #### 
 estimate memory size =128 Mbytes
#Reset_MT7530
set LAN/WAN LLLLW

Please choose the operation: 
   1: Load system code to SDRAM via TFTP. 
   2: Load system code then write to Flash via TFTP. 
   3: Boot system code via Flash (default).
   4: Entr boot command line interface.
   7: Load Boot Loader code then write to Flash via Serial. 
   9: Load Boot Loader code then write to Flash via TFTP. 


You choosed 3

 0 
Upgrade mode read(-1:0:0)
   
3: System Boot system code via Flash.
## Booting image at bfc50000 ...
   Image Name:   OpenWrt Linux-3.10.14
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1555786 Bytes =  1.5 MB
   Load Address: 80001000
   Entry Point:  80001000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
No initrd
## Transferring control to Linux (at address 80001000) ...
## Giving linux memsize in MB, 128

Starting kernel ...


LINUX started...

 THIS IS ASIC

SDK 5.0.S.0
[    0.000000] Linux version 3.10.14 (yibo@cmp-server) (gcc version 4.8.3 (OpenWrt/Linaro GCC 4.8-2014.04 r9) ) #1 SMP Thu Nov 3 13:15:31 CST 2016
[    0.000000] 
[    0.000000]  The CPU feqenuce set to 880 MHz
[    0.000000] GCMP present
[    0.000000] CPU0 revision is: 0001992f (MIPS 1004Kc)
[    0.000000] Software DMA cache coherency
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 08000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x00000000-0x07ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x00000000-0x07ffffff]
[    0.000000] Detected 3 available secondary CPU(s)
[    0.000000] Primary instruction cache 32kB, 4-way, VIPT, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.000000] PERCPU: Embedded 7 pages/cpu @81103000 s6400 r8192 d14080 u32768
[    0.000000] Built 1 zonelists in Zone order, mobility grouping on.  Total pages: 32512
[    0.000000] Kernel command line: console=ttyS1,57600n8 root=/dev/mtdblock5 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 512 (order: -1, 2048 bytes)
[    0.000000] Dentry cache hash table entries: 16384 (order: 4, 65536 bytes)
[    0.000000] Inode-cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Writing ErrCtl register=0007a542
[    0.000000] Readback ErrCtl register=0007a542
[    0.000000] Memory: 125148k/131072k available (3370k kernel code, 5924k reserved, 841k data, 264k init, 0k highmem)
[    0.000000] Hierarchical RCU implementation.
[    0.000000] NR_IRQS:128
[    0.000000] console [ttyS1] enabled
[    0.116000] Calibrating delay loop... 562.17 BogoMIPS (lpj=1124352)
[    0.148000] pid_max: default: 32768 minimum: 301
[    0.152000] Mount-cache hash table entries: 512
[    0.156000] launch: starting cpu1
[    0.160000] launch: cpu1 gone!
[    0.160000] CPU1 revision is: 0001992f (MIPS 1004Kc)
[    0.160000] Primary instruction cache 32kB, 4-way, VIPT, linesize 32 bytes.
[    0.160000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.160000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.192000] Synchronize counters for CPU 1: done.
[    0.200000] launch: starting cpu2
[    0.204000] launch: cpu2 gone!
[    0.204000] CPU2 revision is: 0001992f (MIPS 1004Kc)
[    0.204000] Primary instruction cache 32kB, 4-way, VIPT, linesize 32 bytes.
[    0.204000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.204000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.232000] Synchronize counters for CPU 2: done.
[    0.240000] launch: starting cpu3
[    0.244000] launch: cpu3 gone!
[    0.244000] CPU3 revision is: 0001992f (MIPS 1004Kc)
[    0.244000] Primary instruction cache 32kB, 4-way, VIPT, linesize 32 bytes.
[    0.244000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.244000] MIPS secondary cache 256kB, 8-way, linesize 32 bytes.
[    0.272000] Synchronize counters for CPU 3: done.
[    0.280000] Brought up 4 CPUs
[    0.284000] NET: Registered protocol family 16
[    0.576000] release PCIe RST: RALINK_RSTCTRL = 7000000
[    0.580000] PCIE PHY initialize
[    0.584000] ***** Xtal 40MHz *****
[    0.588000] start MT7621 PCIe register access
[    1.164000] RALINK_RSTCTRL = 7000000
[    1.168000] RALINK_CLKCFG1 = 77ffeff8
[    1.172000] 
....

Habiendo arrancado, tenemos el siguiente shell busybox

BusyBox v1.22.1 (2016-11-03 13:11:16 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 BARRIER BREAKER (Barrier Breaker, r37)
 -----------------------------------------------------
  * 1/2 oz Galliano         Pour all ingredients into
  * 4 oz cold Coffee        an irish coffee mug filled
  * 1 1/2 oz Dark Rum       with crushed ice. Stir.
  * 2 tsp. Creme de Cacao
 -----------------------------------------------------
 MTK OpenWrt SDK V3.4
 revision :  benchmark : APSoC SDK 5.0.1.0
 kernel : 144992

Aparte de lo austera de la interfaz web, no hay actualizaciones de firmware por parte del fabricante ni soporte Openwrt. De hecho, si entramos por telnet podemos ver que las actualizaciones opkg van a direcciones inexistentes (Barrier Breaker mt7621). La cuestión es entonces incorporarle algún firmware de código abierto, pero hay pocas posibilidades en este momento. En esta página de los foros de Openwrt hablaban de que hay soporte abierto LEDE, que es lo que vamos a instalar (sobre OpenWrt y LEDE interesante discusión)

Como se dice aquí:

Firmware update page on the stock web interface can not accept sysupgrade images, it bricks the device. At this point, the only working solution I found was to connect to the serial console port (available on J4 header) and to use opkg to install dropbear. Then scp the sysupgrade file in the device's /tmp and run sysupgrade from console without preserving configuration files.

Para instalar LEDE  seguiremos esa idea + los requisitos propios de este firmware que comentan aquí en el LEDE project forum:

File i've used (here):

- ew1200-initramfs-kernel.bin
- ew1200-squashfs-sysupgrade.bin
How i've proceed:

- Serial header to force TFTP Flash over Ethernet (initramfs-kernel.bin)
- Winscp to copy and do sysupgrade (squashfs-sysupgrade.bin)
- Wired WAN, reboot, and install LUCI

Tenemos que instalar primero el kernel via serial y con la opción 2 del bootloader



Hay que pulsar rápidamente al conectar por serial. Podemos usar cualquier programa TFTP, pero lo importante es conectar el router por un puerto Ethernet, nunca por el WAN pues no funcionaría. El bootloader nos pide que configuremos su ip y la del servidor, y luego se conectará automáticamente.

Instalado el kernel  hay que hacer un sysupgrade, que podemos hacerlo por el serial o ya por telnet.



1- Nos vamos a /tmp, 
2- hacemos wget https://downloads.lede-project.org/snapshots/targets/ramips/mt7621/lede-ramips-mt7621-ew1200-squashfs-sysupgrade.bin
3- luego sysupgrade -v lede-ramips-mt7621-ew1200-squashfs-sysupgrade.bin
4- reboot

Por último instalaremos la interfaz gráfica que no viene por defecto y es la luci:

- opkg update
- opkg install luci

Y ya podremos acceder al router via WEB con el firmware actualizado, que a partir de ahora podremos cambiarlo desde la propia interfaz gráfica.

POST

El router trae 4 puertos Ethernet y 1 WAN. Si queremos permanecer en el mismo nivel de red que el resto de equipos, que puedan estar conectados al receptor principal, debemos configurar el WAN como unmanaged y la LAN dejarla en estático con una ip de la red principal.




2 comentarios:

  1. Gracias por esto. Me ha sido de gran utilidad. Estaba hasta los mismísimos de los continuos cuelgues del router. Ahora, con Lede, noto incluso más señal en zonas lejanas al router!

    Gracias!!

    ResponderEliminar