Xiaomi Mi Router 4A Gigabit Edition (R4AG/R4A Gigabit) -- fully supported and flashable with OpenWRTInvasion

Did you add model's switch layout to target/linux/ramips/mt7621/base-files/etc/board.d/02_network before compilation?

Did you test juppin's .bin

Yes, thats, what I have copied from Master branch...ifc

thats the setup of 3gv2 originally...

But this sounds, like there is some device definition missing or something..." Cannot read property 'link' of null" and I find it realy hard to get some relevant info on switch config...

No, didnt tested his .bin.

Devices are defined in various places so you would need to change those also.

Best way is to take a look at the files added/changed when the device was given official support.

Will try, thanx for your support:-]

1 Like

@rogerpueyo take a look at this: Idea to bypass RSA signature verification

Hope it can help you

Hi everyone! I have been using openwrt for a long time. I bought this router but then I realized the situation and the need of a SPI programmer.
I used the guides posted here but I have been struggling connecting the router to my laptop because I thing I havent connected everything in the proper way. Can someone guide me please?
I'm using ubuntu as my linux environment to run flashrom.
Thanks in advance.
I can't upload the pictures so here is a shared album with the things I have done.

I dont see much from your photos, but you should check https://www.youtube.com/watch?v=DWWigscuQDY and this https://www.youtube.com/watch?v=2Y06x1f22B0 . Also it takes some time to clamp it properly (and find pin 1). People here were connecting extra 3.3V feed to have extra power, but I was able to read and reflash with only programmer connected - that said, I have used USB3.0 port, because of power.
But how I said, it took some time to properly align clamp with the chip. If you would like to try it on Windows, check what app are you using. Black edition worked for me - i think it was 1.34 or so...?

1 Like

thanks :slight_smile: that video was really helpfull

1 Like

feeding an extra 3.3V is wrong, the Flasher will work even without it. You just have to find the proper USB hub that has enough power to power your flasher. On my Macbook pro 2015 its the one of the left side, the right side USB port doesn't transmit that much power thus it disconnects once the flasher tries to flash the rom.

Though there is nothing wrong with feeding an extra 3.3v to the flasher but just to so be safe don't do it LOL. We are not sure if the CH341A chip itself is designed for a 3.3V operation. The CH341A chip is already powered by the 5V coming from the USB port so the logical outputs will also be around 5V as well.

@tomascl

you can also check my conversation with Araujourm on how to connect things properly. Just scroll up a bit and you'll see the guide he made for me.

For clamping the chip, you have to really really open the clamp wide enough before you put it on the chip the clamp needs to touch the board when you clamp it. Just clamping it on the chip won't do as it needs full contact with the metal parts.

1 Like

i also had to connect additional 3.3v - i have some hp laptop and ANY of the usb was NOT able to give enough power!
so as someone mentioned - i took OTHER usb> UART TTL converter and connected 3.3v from both devices
and then it was working with no problems ! thanks everyone for good work !

I bought a 4A 100M and a 4A Gigabit.
The gigabit version flashed openwrt without problem, but the 100M got these errors.
this may have something to do with International Version.
Tried with both 19.07 stable version and newest snapshot version.


U-Boot 1.1.3 (Jul 24 2019 - 09:37:23)

Board: Ralink APSoC DRAM:  64 MB
Power on memory test. Memory size= 64 MB...OK!
relocate_code Pointer at: 83fb0000
RT2880_RSTSTAT_REG 0xc0030204
******************************
Software System Reset Occurred
******************************
flash manufacture id: c8, device id 40 18
find flash: GD25Q128C
env is right!
============================================
Ralink UBoot Version: 4.3.0.0
--------------------------------------------
ASIC 7628_MP (Port5<->None)
DRAM component: 512 Mbits DDR, width 16
DRAM bus: 16 bit
Total memory: 64 MBytes
Flash component: SPI Flash
Date:Jul 24 2019  Time:09:37:23
============================================
icache: sets:512, ways:4, linesz:32 ,total:65536
dcache: sets:256, ways:4, linesz:32 ,total:32768

 ##### The CPU freq = 575 MHZ ####
 estimate memory size =64 Mbytes
RESET MT7628 PHY!!!!!!
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.
   9: Load Boot Loader code then write to Flash via TFTP.                     3
You choosed 2
                                                                              0


2: System Load Linux Kernel then write to Flash via TFTP.
 Warning!! Erase Linux in Flash then burn new one. Are you sure?(Y/N)
 Please Input new ones /or Ctrl-C to discard
        Input device IP (192.168.31.1) ==:192.168.31.1
        Input server IP (192.168.31.100) ==:192.168.31.100
        Input Linux Kernel filename (test.bin) ==:test.bin

 netboot_common, argc= 3

 NetTxPacket = 0x83FE6000

 KSEG1ADDR(NetTxPacket) = 0xA3FE6000

 NetLoop,call eth_halt !

 NetLoop,call eth_init !
Trying Eth0 (10/100-M)

 Waitting for RX_DMA_BUSY status Start... done


 ETH_STATE_ACTIVE!!
TFTP from server 192.168.31.100; our IP address is 192.168.31.1
Filename 'test.bin'.

 TIMEOUT_COUNT=10,Load address: 0x80100000
Loading: checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
checksum bad
T Got ARP REPLY, set server/gtwy eth addr (e0:cb:4e:eb:41:82)
Got it
#################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         #################################################################
         ############Got ARP REQUEST, return our IP
#####################################################
         ######################################################
done
Bytes transferred = 3932443 (3c011b hex)
NetBootFileXferSize= 003c011b
 Writing OS1 to 0x260000
raspi_erase_write: offs:260000, count:3c011b
raspi_erase: offs:260000 len:3c0000
............................................................
............................................................
raspi_erase: offs:620000 len:10000
.
.
Done!
Erasing SPI Flash...
raspi_erase: offs:20000 len:10000
.
Writing to SPI Flash...
.
done
Booting System 1
Erasing SPI Flash...
raspi_erase: offs:20000 len:10000
.
Writing to SPI Flash...
.
done
## Booting image at bc260000 ...
   Image Name:   MIPS OpenWrt Linux-4.14.162
   Image Type:   MIPS Linux Kernel Image (lzma compressed)
   Data Size:    1762797 Bytes =  1.7 MB
   Load Address: 80000000
   Entry Point:  80000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK
Erasing SPI Flash...
raspi_erase: offs:20000 len:10000
.
Writing to SPI Flash...
.
done
commandline uart_en=0 factory_mode=0 mem=64m root=/dev/mtdblock8
No initrd
## Transferring control to Linux (at address 80000000) ...
## Giving linux memsize in MB, 64

Starting kernel ...

[    0.000000] Linux version 4.14.162 (builder@buildhost) (gcc version 8.3.0 (OpenWrt GCC 8.3.0 r11948-ab16adf80b)) #0 Thu Jan 9 00:01:20 2020
[    0.000000] Board has DDR2
[    0.000000] Analog PMU set to hw control
[    0.000000] Digital PMU set to hw control
[    0.000000] SoC Type: MediaTek MT7628AN ver:1 eco:2
[    0.000000] bootconsole [early0] enabled
[    0.000000] CPU0 revision is: 00019655 (MIPS 24KEc)
[    0.000000] MIPS: machine is Xiaomi Mi Router 4A (100M Edition)
[    0.000000] Determined physical RAM map:
[    0.000000]  memory: 04000000 @ 00000000 (usable)
[    0.000000] Initrd not found or empty - disabling initrd
[    0.000000] Primary instruction cache 64kB, VIPT, 4-way, linesize 32 bytes.
[    0.000000] Primary data cache 32kB, 4-way, PIPT, no aliases, linesize 32 bytes
[    0.000000] Zone ranges:
[    0.000000]   Normal   [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Movable zone start for each node
[    0.000000] Early memory node ranges
[    0.000000]   node   0: [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] Initmem setup node 0 [mem 0x0000000000000000-0x0000000003ffffff]
[    0.000000] random: get_random_bytes called from start_kernel+0x98/0x4a8 with crng_init=0
[    0.000000] Built 1 zonelists, mobility grouping on.  Total pages: 16240
[    0.000000] Kernel command line: console=ttyS0,115200 rootfstype=squashfs,jffs2
[    0.000000] PID hash table entries: 256 (order: -2, 1024 bytes)
[    0.000000] Dentry cache hash table entries: 8192 (order: 3, 32768 bytes)
[    0.000000] Inode-cache hash table entries: 4096 (order: 2, 16384 bytes)
[    0.000000] Writing ErrCtl register=0002d170
[    0.000000] Readback ErrCtl register=0002d170
[    0.000000] Memory: 58044K/65536K available (4144K kernel code, 199K rwdata, 944K rodata, 1232K init, 212K bss, 7492K reserved, 0K cma-reserved)
[    0.000000] SLUB: HWalign=32, Order=0-3, MinObjects=0, CPUs=1, Nodes=1
[    0.000000] NR_IRQS: 256
[    0.000000] intc: using register map from devicetree
[    0.000000] CPU Clock: 575MHz
[    0.000000] timer_probe: no matching timers found
[    0.000000] clocksource: MIPS: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 6647862422 ns
[    0.000009] sched_clock: 32 bits at 287MHz, resolution 3ns, wraps every 7469508094ns
[    0.007547] Calibrating delay loop... 380.92 BogoMIPS (lpj=1904640)
[    0.073453] pid_max: default: 32768 minimum: 301
[    0.078158] Mount-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.084508] Mountpoint-cache hash table entries: 1024 (order: 0, 4096 bytes)
[    0.097242] clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns: 19112604462750000 ns
[    0.106747] futex hash table entries: 256 (order: -1, 3072 bytes)
[    0.112736] pinctrl core: initialized pinctrl subsystem
[    0.120496] NET: Registered protocol family 16
[    0.233020] mt7620-pci 10140000.pcie: Port 0 N_FTS = 1b105000
[    0.387681] PCI host bridge /pcie@10140000 ranges:
[    0.392261]  MEM 0x0000000020000000..0x000000002fffffff
[    0.397281]   IO 0x0000000010160000..0x000000001016ffff
[    0.420515] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.426185] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.431671] mt7621_gpio 10000600.gpio: registering 32 gpios
[    0.438014] PCI host bridge to bus 0000:00
[    0.441921] pci_bus 0000:00: root bus resource [mem 0x20000000-0x2fffffff]
[    0.448603] pci_bus 0000:00: root bus resource [io  0xffffffff]
[    0.454259] pci_bus 0000:00: root bus resource [??? 0x00000000 flags 0x0]
[    0.460822] pci_bus 0000:00: No busn resource found for root bus, will use [bus 00-ff]
[    0.469547] pci 0000:00:00.0: BAR 0: no space for [mem size 0x80000000]
[    0.475924] pci 0000:00:00.0: BAR 0: failed to assign [mem size 0x80000000]
[    0.482599] pci 0000:00:00.0: BAR 8: assigned [mem 0x20000000-0x200fffff]
[    0.489164] pci 0000:00:00.0: BAR 9: assigned [mem 0x20100000-0x201fffff pref]
[    0.496121] pci 0000:00:00.0: BAR 1: assigned [mem 0x20200000-0x2020ffff]
[    0.502695] pci 0000:01:00.0: BAR 0: assigned [mem 0x20000000-0x200fffff 64bit]
[    0.509743] pci 0000:01:00.0: BAR 6: assigned [mem 0x20100000-0x2010ffff pref]
[    0.516713] pci 0000:00:00.0: PCI bridge to [bus 01]
[    0.521490] pci 0000:00:00.0:   bridge window [mem 0x20000000-0x200fffff]
[    0.528052] pci 0000:00:00.0:   bridge window [mem 0x20100000-0x201fffff pref]
[    0.540295] clocksource: Switched to clocksource MIPS
[    0.546298] NET: Registered protocol family 2
[    0.551483] TCP established hash table entries: 1024 (order: 0, 4096 bytes)
[    0.558172] TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
[    0.564361] TCP: Hash tables configured (established 1024 bind 1024)
[    0.570612] UDP hash table entries: 256 (order: 0, 4096 bytes)
[    0.576212] UDP-Lite hash table entries: 256 (order: 0, 4096 bytes)
[    0.582593] NET: Registered protocol family 1
[    0.590472] Crashlog allocated RAM at address 0x3f00000
[    0.597397] workingset: timestamp_bits=14 max_order=14 bucket_order=0
[    0.610231] squashfs: version 4.0 (2009/01/31) Phillip Lougher
[    0.615859] jffs2: version 2.2 (NAND) (SUMMARY) (LZMA) (RTIME) (CMODE_PRIORITY) (c) 2001-2006 Red Hat, Inc.
[    0.637809] io scheduler noop registered
[    0.641602] io scheduler deadline registered (default)
[    0.647401] Serial: 8250/16550 driver, 16 ports, IRQ sharing enabled
[    0.656169] console [ttyS0] disabled
[    0.659610] 10000c00.uartlite: ttyS0 at MMIO 0x10000c00 (irq = 28, base_baud = 2500000) is a 16550A
[    0.668390] console [ttyS0] enabled
[    0.668390] console [ttyS0] enabled
[    0.675383] bootconsole [early0] disabled
[    0.675383] bootconsole [early0] disabled
[    0.684856] spi-mt7621 10000b00.spi: sys_freq: 191666666
[    0.699809] m25p80 spi0.0: gd25q128 (16384 Kbytes)
[    0.704797] 7 fixed-partitions partitions found on MTD device spi0.0
[    0.711251] Creating 7 MTD partitions on "spi0.0":
[    0.716129] 0x000000000000-0x000000020000 : "bootloader"
[    0.722445] 0x000000020000-0x000000030000 : "config"
[    0.728307] 0x000000030000-0x000000040000 : "factory"
[    0.734334] 0x000000040000-0x000000050000 : "crash"
[    0.740057] 0x000000050000-0x000000060000 : "cfg_bak"
[    0.746067] 0x000000060000-0x000000160000 : "overlay"
[    0.752090] 0x000000160000-0x000001000000 : "firmware"
[    0.765909] libphy: Fixed MDIO Bus: probed
[    0.780958] rt3050-esw 10110000.esw: link changed 0x00
[    0.787826] mtk_soc_eth 10100000.ethernet eth0: mediatek frame engine at 0xb0100000, irq 5
[    0.797862] NET: Registered protocol family 10
[    0.806708] Segment Routing with IPv6
[    0.810602] NET: Registered protocol family 17
[    0.815181] bridge: filtering via arp/ip/ip6tables is no longer available by default. Update your scripts to load br_netfilter if you need this.
[    0.828340] 8021q: 802.1Q VLAN Support v1.8
[    0.835727] VFS: Cannot open root device "(null)" or unknown-block(0,0): error -6
[    0.843390] Please append a correct "root=" boot option; here are the available partitions:
[    0.851877] 1f00             128 mtdblock0
[    0.851881]  (driver?)
[    0.858507] 1f01              64 mtdblock1
[    0.858511]  (driver?)
[    0.865146] 1f02              64 mtdblock2
[    0.865149]  (driver?)
[    0.871785] 1f03              64 mtdblock3
[    0.871789]  (driver?)
[    0.878412] 1f04              64 mtdblock4
[    0.878415]  (driver?)
[    0.885050] 1f05            1024 mtdblock5
[    0.885053]  (driver?)
[    0.891689] 1f06           14976 mtdblock6
[    0.891693]  (driver?)
[    0.898315] Kernel panic - not syncing: VFS: Unable to mount root fs on unknown-block(0,0)
[    0.907832] Rebooting in 1 seconds..

Did you flash the correct image? Note that the gigabit image is not the same as the 100m one, it's different hardware. Try flashing another one or compile it yourself, maybe...

The firmwares are right, 100m ones.

I can't really help much further then, I'm afraid :frowning:
Maybe try asking in another topic dedicated to that device, and see if someone there has an image that works for you, since this one is about the gigabit version. Best of luck.

Anyone getting soft reboots or kernel panics on the test build I posted or latest snaphots?

@juppin

I had a chance to test the image you posted.

I didn't have a serial connection running but I was able to send it over tftp in recovery mode, connect power to router while holding reset, it just kept flashing purple 5 minutes after the transfer which usually means it was not accepted as a valid image.

For some reason I only saved a 1024 KB SPI backup :roll_eyes:

Thx for your time

Is 3g v2 firmware compatible with 4a gigabit version? I can't find firmware for 4a in any place.

Yes.
As you see here the mir3g-v2 device has the alternative name set to Mi Router 4A Gigabit Edition: