Adding OpenWrt support for Mikrotik hAP ac 3 [RBD53iG-5HacD2Hn]

There are on Mikrotik site in download archive

Yeap, find in Stable release tree

Some more progress, got BDF-s extracted.
Without proper BDF-s WLAN was around 5 times worse.

Most of the things are working, I am now working on packaging and how to pernamently flash.
This uses a uncommon layout in which a UBI volumes for kernel and rootfs are used, but kernel is also kept in compressed UBIFS.

I tried without UBIFS and RouterBoot really does not like that.

Ok, so I did some digging and testing.
It appears that RouterBoot does not require kernel and rootfs to be separated with partitions but only UBI volumes.
It also does not care if the kernel is named "kernel" or "Kernel" like in ROS images.
All it cares about is that the kernel is packed in UBIFS, without UBIFS it won't boot the kernel at all, so I manually packed the kernel in UBIFS per what stock kernel is packed and ubinized it and that boots.

So, we just gotta find a way to pack the kernel in UBIFS in OpenWrt buildroot directly.

2 Likes

Big work, many thx, very interesting and waiting next news

OK, so a little update.
The weekend was mostly spent on figuring out how to permanently flash the image as there is no support for the method MikroTik uses on these NAND devices.

Unforunately, its still hit and miss.

You can check the RB450Gx4 thread for some details:

Ok, finally got the sysupgrade working so it can be flashed pernamently.
Now, its mostly complete, but still gotta figure out the WLAN and ETH generic LED-s as there is only one WLAN LED.

For those willing to do some testing my branch is here:

3 Likes

Good news, many tnx for your wokr. Wich wersion of RouterBoot we need to install 6.46.6?

Now I can't test the firmware, my PC has gone to a better world, in 5 days a new laptop with Ryzen 7 will arrive )

Potentially newer RouterBoots will also work, they just dont work for me.

Hey! Can you give me some basic instructions on how to build and test the firmware? I am completely new to this but I am eager to have openwrt instead of routerOS!

:slight_smile:

It is built like any other OpenWrt image, clone the tree, select the board and build.
OpenWrt has docs on that already.

For installation there are instructions in the commit message:

Please note that this is not finished and that you may be stuck in bootloop,

Ok thanks!! I will wait and keep monitoring this thread then :slight_smile:

On debian,

sudo apt update
sudo apt install build-essential ccache ecj fastjar file g++ gawk gettext git java-propose-classpath libelf-dev libncurses5-dev libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget python3-distutils python3-setuptools rsync subversion swig time xsltproc zlib1g-dev binutils bzip2 diffutils findutils flex gawk gcc libgetopt-complete-perl grep install-info libc-dev libz-dev make perl python3.8+ rsync subversion unzip libpam0g-dev liblzma-dev  libnet-snmp-perl
sudo apt install build-essential ccache ecj fastjar file g++ gawk gettext git java-propose-classpath libelf-dev libncurses5-dev libncursesw5-dev libssl-dev python python2.7-dev python3 unzip wget python3-distutils python3-setuptools rsync subversion swig time xsltproc zlib1g-dev binutils bzip2 diffutils findutils flex gawk gcc libgetopt-complete-perl grep install-info libc-dev libz-dev
git clone https://github.com/robimarko/openwrt.git
cd openvpn
git branch

Check which branch your on you need to switch to hap ac3
git checkout mikrotik/hap-ac3

You will notice :slight_smile:

  master
* mikrotik/hap-ac3

From there you can do the standard:

./scripts/feeds update -a
./scripts/feeds install -a
make menuconfig

Then select the target : IPQ40XX
subtarget: mikrotik
target profile: hap ac3

And so on that should get you going.. the more folks testing the better. ( make sure to backup your Lic file and if you can bootimage prior to upgrades to backtrack) unless you know what your doing

May 10th update:

md5
18f096b7ad4ad3056cb0416c995b33c6 openwrt-ipq40xx-mikrotik-mikrotik_hap-ac3-initramfs-kernel.bin
de932787338259cc316549f9c428cf32 openwrt-ipq40xx-mikrotik-mikrotik_hap-ac3-squashfs-nand-sysupgrade.bin

Download:
http://download.cloudatcost.com/download/0jujkbuk4rv20wtz5wmvwsrsh

zip/download pass: voip2014 Built: may 10 2021

Shortening my original post,

The initramfs works fine,

You can revert using:
https://wiki.mikrotik.com/wiki/Manual:Netinstall ( You will need your Lic Key)

`  _______                     ________        __
 |       |.-----.-----.-----.|  |  |  |.----.|  |_
 |   -   ||  _  |  -__|     ||  |  |  ||   _||   _|
 |_______||   __|_____|__|__||________||__|  |____|
          |__| W I R E L E S S   F R E E D O M
 -----------------------------------------------------
 OpenWrt SNAPSHOT, r16598-d99529817e
 -----------------------------------------------------
=== WARNING! =====================================
There is no root password defined on this device!
Use the "passwd" command to set up a new password
in order to prevent unauthorized SSH logins.
--------------------------------------------------
CPU info:
processor       : 0
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 96.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt                               vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

processor       : 1
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 96.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt                               vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

processor       : 2
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 96.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt                               vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

processor       : 3
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 96.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt                               vfpd32 lpae evtstrm
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

Hardware        : Generic DT based system
Revision        : 0000
Serial          : 0000000000000000

Flash:
Filesystem                Size      Used Available Use% Mounted on
tmpfs                   121.4M     10.0M    111.4M   8% /
tmpfs                   121.4M     56.0K    121.3M   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev

Memory:
              total        used        free      shared  buff/cache   available
Mem:         248636       22448      213860       10340       12328      190280
Swap:             0           0           0


dev:    size   erasesize  name
mtd0: 00a00000 00020000 "ubikernel"
mtd1: 07600000 00020000 "ubi"
mtd2: 00080000 00010000 "Qualcomm"
mtd3: 00080000 00010000 "RouterBoot"
mtd4: 00001000 00010000 "hard_config"
mtd5: 00007e87 00010000 "dtb_config"
mtd6: 00001000 00010000 "soft_config"

Looks like the hard and soft config have hard coded versioning someone know how to change these files to accept lower versions perhaps uboot ofset uploads?`

There is a hardcoded factory version in the soft config.
You can search for it with a hex editor and change it then flash the soft_config to the partition.

Then you will be able to downgrade below, but if DHCP is working there is no need to downgrade

I have been really busy and have not been able to debug the pernament sysupgrade as its still hit and miss with sucess.

So I have already hex edited both bin files by dumping them with dd, the trouble is I can dump but how do I write them back, mtd has no permissions, also cannot erase the partitions and rewrite to them or mount them from alternate locations, I have no dhcp , the issue boils down to the factory firmware not being downgraded thats all it is atm

You can use kmod-rw to enable RW and then use dd to flash, but note that DD does not erase things before writing like mtd does.

Its not being downgraded as you are trying to downgrade below the one it shipped with, that can be done but only by editing the soft config

ahh I think this is what I was missing I was trying to install kmod-mtd-rw but no support for arm alright will give this a go

You need to include it in the image, opkg cant install it after.

Alright I will work on recompiling this the thx, this is making a lot more sense nowm should then be able to downgrade and do the sysupgrade.