Ser9ei / u-boot_mtk

Bootloader for routers on the mtk chips based on Mediatek SDK 5.0.1.0
7 stars 6 forks source link
              Ralink/MediaTek U-Boot for MIPS SoC
    RT3052/RT3352/RT3883/RT5350/MT7620/MT7621/MT7628/MT7688
                 Based on MediaTek SDK 5.0.1.0

This is a Fork from https://gitlab.com/db260179/u-boot-mt7621/-/tree/master/

New features:

Preparing Toolchain

For MT7621 U-Boot:

For RT3XXX/MT7620/MT7628/MT7688 U-Boot:

Both toolchains require x86 (32-bit) Linux environment. If you are on x64 (64-bit) environment you need to do the following: Ubuntu 18.04 or Debian 9,10

dpkg --add-architecture i386

apt install libc6:i386 libncurses5:i386 libstdc++6:i386

Build Instructions

To clean U-Boot tree:

Build for new Boards

NOTE:

  1. Before building for a new board, know the GPIO number for reset, leds and configure them properly during 'make menuconfig'. Extra careful with the reset button (GPIO_BTN_RESET).
  2. It's better to configure UART baud rate same as your stock firmware 115200 or 57600.
  3. All profiles has disabled option "Enable all Ethernet PHY" to prevent LAN-WAN spoofing (EPHY will be enabled later in FW logic). To force enable EPHY (e.g. for use OpenWRT/PandoraBox), select option "Enable all Ethernet PHY".
  4. See if your board's spi or nand flash chip is listed on here 'uboot-5.x.x.x/drivers/spi_flash.c' (281 line) or 'uboot-5.x.x.x/drivers/nand/nand_device_list.h'. Don't risk it if your flash chip is not on the list.

Flash Instructions

Take a backup of the current u-boot partition (mtd0).

Get info about mtd partitions structure:

  cat /proc/mtd

Make backup of original u-boot (mtd0 - partition device name in the sample with uboot):

  cat /dev/mtd0 > /tmp/uboot_orig.bin

Transfer the backup off the device and to a safe place:

 scp root@192.168.1.1:/tmp/uboot_orig.bin .

Transfer the new uboot to the router:

  scp uboot_new.bin root@192.168.1.1:/tmp/

And flash:

  mtd -e /dev/mtd0 write /tmp/uboot_new.bin /dev/mtd0

Danger: This is the point of no return, if you have any errors or problems, please revert the original image at any time using:

  mtd -e /dev/mtd0 write /tmp/uboot_orig.bin /dev/mtd0

Double check the boot partition name 'Bootloader' by 'cat /proc/mtd', usually it's on /dev/mtd0 or sometimes mtd1.

Main Features

  1. Press and hold the RESET button on Power-On for 2~3 sec, this will switch to Recovery mode. Set your Ethernet ipv4 to 192.168.1.2, subnet mask 255.255.255.0 and gateway 192.168.1.1.
  2. Go to 192.168.1.1 from any browser and upload or upgrade your firmware. You can also upgrade your factory and u-boot partition from 192.168.1.1/factory.html and 192.168.1.1/uboot.html respectively. For Xiaomi routers http server maybe reached by the 192.168.31.1 ip, it depend on envoriment from the Config/BootEnv partition values.
    1 jpg

2 jpg

3

  1. Also you can use TFTP client or ASUS Firmware Restoration (device IP-address is 192.168.1.1). Some devices with usb port can also support Recovery from USB storage.

NOTE: