MikroTik rb450gx4 support

Hm, thats a tool issue.
I dont know whats the latest branch.

But they are all out of date and need to be rebased onto master to build cleanly

I mean the "up to date"........ branch.

understand, When will there have a rebase branch?

Probably not anytime soon as I dont have time and the intermediate loader is prevent the merge of other IPQ40xx devices

hi, robimarko,

any progress in RB450gX4 ? I can't build successfully using any newer version.

Hope you can make a usable rebase .

Hi, I guess I'm joining the club...

Is there an update on how to get this working from NAND or maybe SD?

[    0.786920] nand: device found, Manufacturer ID: 0xef, Chip ID: 0xdc
[    0.787767] nand: Winbond W29N04GV
[    0.794425] nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 64
[    0.797625] 2 fixed-partitions partitions found on MTD device qcom_nand.0
[    0.805157] Creating 2 MTD partitions on "qcom_nand.0":
[    0.812008] 0x000000000000-0x000001000000 : "kernel"
[    0.841077] random: fast init done
[    0.842254] 0x000001000000-0x000020000000 : "ubi"
[    1.602791] spi_qup 78b5000.spi: IN:block:16, fifo:64, OUT:block:16, fifo:64
[    1.612537] m25p80 spi0.0: w25q16jv (2048 Kbytes)
[    1.612600] 6 fixed-partitions partitions found on MTD device spi0.0
[    1.616219] Creating 6 MTD partitions on "spi0.0":
[    1.622675] 0x000000000000-0x000000023000 : "Qualcomm-boot1"
[    1.627974] 0x000000023000-0x000000080000 : "Qualcomm-boot2"
[    1.633741] 0x000000080000-0x00000008e000 : "RouterBoot"
[    1.639322] 0x00000008e000-0x00000008f000 : "hard_config"
[    1.644646] 0x000000090000-0x0000000a0000 : "dts_config"
[    1.649924] 0x0000000bd000-0x0000000be000 : "soft_config"

Ok, I found out how to compile the branch, but I'm getting a vague error.

make[3]: Entering directory '/home/teun/workspace/openwrt_rb450/tools/mkimage'
make -C /home/teun/workspace/openwrt_rb450/build_dir/host/u-boot-2018.03 HOSTCFLAGS="-O2 -I/home/teun/workspace/openwrt_rb450/staging_dir/host/include " HOSTLDFLAGS="-L/home/teun/workspace/openwrt_rb450/staging_dir/host/lib " no-dot-config-targets=tools-only CONFIG_MKIMAGE_DTC_PATH=dtc CONFIG_FIT_SIGNATURE=y tools-only
make[4]: Entering directory '/home/teun/workspace/openwrt_rb450/build_dir/host/u-boot-2018.03'
  HOSTCC  scripts/basic/fixdep
  CHK     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  HOSTCC  tools/mkenvimage.o
In file included from /usr/include/asm-generic/types.h:7,
                 from /usr/include/asm/types.h:1,
                 from /usr/include/linux/types.h:5,
                 from /usr/include/linux/stat.h:5,
                 from /usr/include/bits/statx.h:31,
                 from /usr/include/sys/stat.h:446,
                 from tools/mkenvimage.c:21:
/usr/include/asm-generic/int-ll64.h:31:42: error: conflicting types for '__u64'
   31 | __extension__ typedef unsigned long long __u64;
      |                                          ^~~~~
In file included from <command-line>:
././include/compiler.h:69:18: note: previous declaration of '__u64' was here
   69 | typedef uint64_t __u64;
      |                  ^~~~~
make[5]: *** [scripts/Makefile.host:116: tools/mkenvimage.o] Error 1
make[4]: *** [Makefile:1509: tools-only] Error 2
make[4]: Leaving directory '/home/teun/workspace/openwrt_rb450/build_dir/host/u-boot-2018.03'
make[3]: *** [Makefile:47: /home/teun/workspace/openwrt_rb450/build_dir/host/u-boot-2018.03/.built] Error 2
make[3]: Leaving directory '/home/teun/workspace/openwrt_rb450/tools/mkimage'
time: tools/mkimage/compile#0.48#0.19#0.68
make[2]: *** [tools/Makefile:159: tools/mkimage/compile] Error 2
make[2]: Leaving directory '/home/teun/workspace/openwrt_rb450'
make[1]: *** [tools/Makefile:155: /home/teun/workspace/openwrt_rb450/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/stamp/.tools_compile_yynyynnyyynyyyyynyynnyyyynyyyyyyyyyyyyyyynyynynnyyynnyyy] Error 2
make[1]: Leaving directory '/home/teun/workspace/openwrt_rb450'
make: *** [/home/teun/workspace/openwrt_rb450/include/toplevel.mk:218: world] Error 2
~/workspace/openwrt_rb450 >>>                                                            ±[●][RB450Gx4-rebase-sdhci]

Not sure whether this is because of something in the menuconfig file...

I had to change include/prereq-build.mk for gcc version 10

$(eval $(call SetupHostCommand,gcc, \
        Please install the GNU C Compiler (gcc) 4.8 or later, \
        $(CC) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \
        gcc -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \
        gcc --version | grep -E 'Apple.(LLVM|clang)' ))

$(eval $(call TestHostCommand,working-gcc, \
        \nPlease reinstall the GNU C Compiler (4.8 or later) - \
        it appears to be broken, \
        echo 'int main(int argc, char **argv) { return 0; }' | \
                gcc -x c -o $(TMP_DIR)/a.out -))

$(eval $(call SetupHostCommand,g++, \
        Please install the GNU C++ Compiler (g++) 4.8 or later, \
        $(CXX) -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \
        g++ -dumpversion | grep -E '^(4\.[8-9]|[5-9]\.?|10\.?)', \
        g++ --version | grep -E 'Apple.(LLVM|clang)' ))

$(eval $(call TestHostCommand,working-g++, \
        \nPlease reinstall the GNU C++ Compiler (4.8 or later) - \
        it appears to be broken, \
        echo 'int main(int argc, char **argv) { return 0; }' | \
                g++ -x c++ -o $(TMP_DIR)/a.out - -lstdc++ && \

Do you have any plans for when you will be continue with this router to get it supported?

Not really, It depends on when hAP ac2 will get merged so all of the prerequisites are there.

1 Like

Hello. What about DSA driver support for this device? Are there any developments?

@robimarko @bm42 Do You have working image with Winbond NAND?

@robimarko Thanks for everything. Works great with the exception of the latest generation of the RB450Gx4 with RouterBoot 6.45.9 and AMD Flash. The RAM image will still work, but the device will not start after sysupgrading the standard image you provided.


RouterBOOT booter 6.45.9


CPU frequency: 716 MHz
  Memory size: 1024 MiB
    NAND size: 512 MiB

Press any key within 2 seconds to enter setup..

loading kernel... OK
setting up elf image... OK
jumping to kernel code

OpenWrt kernel loader for Qualcomm IPQ-4XXX/IPQ-806X
Copyright (C) 2019  Sergey Sergeev <adron@mstnt.com>

Op ret = -97
Auto reboot in 5 sec
[    0.786943] nand: device found, Manufacturer ID: 0x01, Chip ID: 0xdc
[    0.787783] nand: AMD/Spansion S34ML04G2
[    0.794437] nand: 512 MiB, SLC, erase size: 128 KiB, page size: 2048, OOB size: 128

Its because of block and page sizes

Thanks for the quick reply. Would a donated device help fix the problem? If so, then I need a postal address from you.


I have an RB450Gx4 with the older NAND, I know the issue with the never, and it simply requires different block/page sizes.

RB450Gx4 support is on hold until hAP ac2 is merged as it introduces all of the stuff needed for any other Mikrotik board.

Any chance of opening up the device and providing the exact details on the nand chip?

I ran into a similar issue on a rb2011 and had to patch the full chip description in the kernel as described in thread marked below.
It looks like it gets detected, but the it's probably badly detected.

See this thread

Its detected properly, but MikroTik has 2 revisions of the board.
One NAND uses 128k blocks while other one uses 256k blocks.

There is a single Spansion S34ML04G200TF100 NAND mounted as U902 and it looks like I/O0 - I/O7 (×8) is connected to the CPU.

❐Page size:
1 Gb: (2048 + 64) bytes; 64-byte spare area
2 Gb / 4 Gb: (2048 + 128) bytes; 128-byte spare area

1 Gb: (1024 + 32) words; 32-word spare area
2 Gb / 4 Gb (1024 + 64) words; 64-word spare area

❐Block size: 64 Pages
1 Gb: 128 KB+ 4 KB
2 Gb / 4 Gb: 128 KB + 8 KB

1 Gb: 64k + 2k words
2 Gb / 4 Gb: 64k + 4k words

❐Plane size
1 Gb: 1024 blocks per plane or (128 MB + 4 MB
2 Gb: 1024 blocks per plane or (128 MB + 8 MB
4 Gb: 2048 blocks per plane or (256 MB + 16 MB

1 Gb: 1024 blocks per plane or (64M + 2M) words
2 Gb: 1024 Blocks per Plane or (64M + 4M) words
4 Gb: 2048 Blocks per Plane or (128M + 8M) words

Now that hAP ac2 is merged. Could it be possible to merge rb450gx4 in OpenWrt 21.02?

I doubt 21.02, but it needs to be rebased on the current master as the code is way out of sync.
I honestly have no idea when will I get to it.

I have been doing some testing with a netboot image. Started from @robimarko's work, and rebased to 2021 master 1.

I am not sure how we should partition the NAND. Please provide any advice or corrections.

OEM splits NAND to two mtd paritions:

  • 0x000000000000-0x000000800000 : "RouterBoard NAND 1 Boot"
    UBI volume "Kernel"
    contains the ELF kernel, and VERSION

  • 0x000000800000-0x000020000000 : "RouterBoard NAND 1 Main"
    UBI volume "RouterOS"
    contains bootimage (NPK), plus various directories & files

I guess RouterBoot loads the mtd0 UBI volume Kernel/kernel ELF, which loads the mtd1 UBI volume RouterOS/bootimage.

From what I can see, OpenWrt upgrade/nand.sh 2 is only designed to work with one UBI (mtd) partition, usually labelled "ubi" in DTB, with possibly multiple volumes under it:
local ubidev="$( nand_find_ubi "$CI_UBIPART" )"
With the image was using adron's loader, the kernel was packed into a ubi partition image. For tar sysupgrade, with an mtd partition labelled "kernel", nand_upgrade_tar for kernel only uses openwrt's mtd 3 to write to the mtd partition, which would lose the UBI erase counts?


  • Keep OEM mtd partitions:
    • extend or build custom upgrade script to install the self-extracting ELF kernel to mtd0 UBI partition Kernel/kernel:
      • Allow different CI_UBIPART for rootfs & kernel?
      • mount, and replace the file, or
      • ubiupdatevol?, and
    • ubiformat mtd1 UBI partition to Openwrt "ubi" volumes for rootfs

I have not tried, or looked into RouterBoot to check the limitations to see if we could remove OEM mtd partitions, and use single UBI partition. Might lose UBI erase counts in this process?

define the PoE output compat GPIO input as a gpio key (extcon-gpio does not have DTS bindings)?
define the PoE output control GPIO as a LED, or leave as sysfs / gpio-export?

Any feedback would be great.