Mikhail Zhilkin 3619b28006 mediatek: add OpenWrt UBI layout for ASUS RT-AX59U
This commit implements the OpenWrt UBI layout for the ASUS RT-AX59U. The
primary goal is get working Kernel Address Space Layout Randomization
(KASLR). Additionally, this layout frees up ~6MB of extra storage space
for package installation.

Preparation
------------
Make a backup (from OpenWrt for stock bootloader):
* Backup partitions:
   apk update && apk add nand-utils
   nanddump /dev/mtd0 | gzip -1 -c > /tmp/mtd0_u-boot.bin.gz
   nanddump /dev/mtd1 | gzip -1 -c > /tmp/mtd1_UBI_DEV.bin.gz

* Backup nvram, Factory and Factory2 volumes:
   cat /dev/ubi0_0 > /tmp/nvram.bin
   cat /dev/ubi0_1 > /tmp/Factory.bin
   cat /dev/ubi0_2 > /tmp/Factory2.bin

* Copy backup from the /tmp dir on your router to a safe place using scp

Installation
------------
* Attach UART (see 'UART' section for details)

* Run mtkuartboot (see 'mtkuartboot recovery' section for details), exit
  the boot menu, and run:
   mtd erase ubi

* Run mtkuartboot again and write ubi bl2 and fip via the network, then
  reboot.

  Default tftp server ip: 192.168.1.254
  Default router ip:      192.168.1.1

* Load the ubi initramfs image via tftpboot and execute sysupgrade to
  write OpenWrt to spi-nand.

* Copy Factory backup to your router:
   scp -O Factory.bin root@192.168.1.1:/tmp

* Check factory volume index:
   ubinfo -a

* Prepare and write new factory ubi volume (substitute X with your
  factory volume index):
   dd if=/tmp/Factory.bin of=/tmp/factory.bin bs=1 count=$((0x65000))
   ubiupdatevol /dev/ubi0_X /tmp/factory.bin

UART
----
UART pins are silkscreened on PCB. Connection parameters:
115200, 8N1, 3.3V

U-Boot tftp recovery
--------------------
* Place OpenWrt ubi-initramfs-recovery.itb image on the tftp server (IP:
  192.168.1.254)

* Press reset button and power on the router. After ~10 sec release the
  button.

* Use OpenWrt initramfs system for recovery (for example, run sysupgrade)

mtkuartboot recovery
--------------------
Use mtk_uartboot and UART connetion for the installation or if BL2 or FIP
in UBI is destroyed:

Link: https://github.com/981213/mtk_uartboot

Start script:
'''
sudo ./mtk_uartboot \
  -p mt7986-ram-ddr4-bl2.bin \
  --aarch64 \
  -f openwrt-mediatek-filogic-asus_rt-ax59u-ubi-preloader.bin \
  -s /dev/ttyUSB0
picocom -b 115200 /dev/ttyUSB0
'''

Notes
-----
1. A simple installation without serial console is also possible using a
   fork of Daniel's UBI Installer (requires adaptation)
Link: https://github.com/dangowrt/owrt-ubi-installer

Signed-off-by: Mikhail Zhilkin <csharper2005@gmail.com>
Link: https://github.com/openwrt/openwrt/pull/25278
Signed-off-by: Robert Marko <robimarko@gmail.com>
2026-09-28 14:54:09 +02:00
2026-09-28 14:12:42 +02:00
2024-05-17 22:03:06 +03:00
2021-02-05 14:54:47 +01:00

OpenWrt logo

OpenWrt Project is a Linux operating system targeting embedded devices. Instead of trying to create a single, static firmware, OpenWrt provides a fully writable filesystem with package management. This frees you from the application selection and configuration provided by the vendor and allows you to customize the device through the use of packages to suit any application. For developers, OpenWrt is the framework to build an application without having to build a complete firmware around it; for users this means the ability for full customization, to use the device in ways never envisioned.

Sunshine!

Download

Built firmware images are available for many architectures and come with a package selection to be used as WiFi home router. To quickly find a factory image usable to migrate from a vendor stock firmware to OpenWrt, try the Firmware Selector.

If your device is supported, please follow the Info link to see install instructions or consult the support resources listed below.

An advanced user may require additional or specific package. (Toolchain, SDK, ...) For everything else than simple firmware download, try the wiki download page:

Development

To build your own firmware you need a GNU/Linux, BSD or macOS system (case sensitive filesystem required). Cygwin is unsupported because of the lack of a case sensitive file system.

Requirements

You need the following tools to compile OpenWrt, the package names vary between distributions. A complete list with distribution specific packages is found in the Build System Setup documentation.

binutils bzip2 diff find flex gawk gcc-6+ getopt grep install libc-dev libz-dev
make4.1+ perl python3.8+ rsync subversion unzip which

Quickstart

  1. Run ./scripts/feeds update -a to obtain all the latest package definitions defined in feeds.conf / feeds.conf.default

  2. Run ./scripts/feeds install -a to install symlinks for all obtained packages into package/feeds/

  3. Run make menuconfig to select your preferred configuration for the toolchain, target system & firmware packages.

  4. Run make to build your firmware. This will download all sources, build the cross-compile toolchain and then cross-compile the GNU/Linux kernel & all chosen applications for your target system.

The main repository uses multiple sub-repositories to manage packages of different categories. All packages are installed via the OpenWrt package manager called opkg. If you're looking to develop the web interface or port packages to OpenWrt, please find the fitting repository below.

  • LuCI Web Interface: Modern and modular interface to control the device via a web browser.

  • OpenWrt Packages: Community repository of ported packages.

  • OpenWrt Routing: Packages specifically focused on (mesh) routing.

  • OpenWrt Video: Packages specifically focused on display servers and clients (Xorg and Wayland).

Support Information

For a list of supported devices see the OpenWrt Hardware Database

Documentation

Support Community

  • Forum: For usage, projects, discussions and hardware advise.
  • Support Chat: Channel #openwrt on oftc.net.

Developer Community

License

OpenWrt is licensed under GPL-2.0

S
Description
This repository is a mirror of https://git.openwrt.org/openwrt/openwrt.git It is for reference only and is not active for check-ins. We will continue to accept Pull Requests here. They will be merged via staging trees then into openwrt.git.
Readme BSD-2-Clause BSD-3-Clause GPL-1 GPL-2 ISC Linux-syscall-note MIT
1.2 GiB
0 Stars 1 Watchers 0 Forks
Languages
C 60.5%
Makefile 23%
Shell 8.4%
UnrealScript 2.5%
Perl 2.5%
Other 2.8%