eisaev / r2350

51 stars 11 forks source link

Files for Xiaomi Mi AIoT Router AC2350 (R2350)

This repository contains the files necessary to extend the capabilities of WiFi router Xiaomi Mi AIoT Router AC2350 in black (however, some of the files are also suitable for the white version).

Table of Contents

Obtain SSH Access

Calculate The Password

On Linux

printf "%s6d2df50a-250f-4a30-a5e6-d44fb0960aa0" "12345/E0QM98765" | md5sum - | head -c8 && echo

On macOS

printf "%s6d2df50a-250f-4a30-a5e6-d44fb0960aa0" "12345/E0QM98765" | md5 | head -c8

Create Full Backup

Flash Modified Firmware (tested on both the white and black versions)

Patch Bdata Partition (on router)

This action is required only once.

Patch art Partition (for black version only; on router)

Required only on the black version of the router. This action is required only once.

Debricking (lite)

If you have a healthy bootloader, you can use recovery via TFTP using programs like TinyPXE on Windows (with firewalls disabled!) or dnsmasq on Linux.

To switch the router to TFTP recovery mode, hold down the reset button, connect the power supply and release the reset button after the steady enlightened orange LED starts blinking (about 10 seconds after power up). The blinking orange LED also indicates that you still have a healthy bootloader.

Check the LAN LEDs (or the TinyPXE log output) to see the whether the data is transferred to the router. Once the blue LED starts flashing fast, you can reboot the router by disconnecting and reconnecting the power supply.

After the reboot the orange LED becomes steady which is fine: The original firmware waits for the initial setup.

Debricking (in the case of unhealthy bootloader)

You will need a full dump of your flash, a CH341 programmer, and a clip for in-circuit programming.

Install OpenWRT

Please use the official documentation on the OpenWRT website.

NB! Before installing OpenWrt on a black version of the router you should follow the 'Patch art Partition' section to be able to switch the 2.4 GHz WiFi transmission power limits from the OpenWrt application. The art partition can not be unlocked and altered after installing OpenWRT so you need to do this with the original firmware.

Repackaging the firmware (3.0.36 INT only!)

On macOS

  1. Install required software
    brew install p7zip squashfs
  2. Extract international version of the stock firmware
    cd utils
    7z x ../fw/miwifi_r2350_firmware_bd55f_3.0.36_INT.bin.7z
  3. Unpack kernel and root FS
    NB! It's really slow because it uses dd with a block size of 1, you can use binwalk as an alternative.
    ./unpack.sh
  4. Unsquash root FS (my is the name of your mod)
    sudo ./unsquash.sh my
  5. Make changes in squashfs-root.my.mod directory
  6. Pack firmware
    sudo ./pack.sh my
  7. Fix permissions
    sudo chown $(id -un):$(id -gn) firmware.my.mod.bin