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

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.

But why downgrade?

I had to do it as DHCP was not working for me, if it works for you then you dont have to downgrade

DHCP is not working at all, I have a static IP to get into the initramfs atm, and sysupgrade ends in a boot loop

That is normal, downgrading the ROS wont help.
Sysupgrading as well, like I said its still hit and miss.

DHCP I was reffering to is being able to use DHCP to load the initramfs at all.

O I see, so downgrading to 6.46 wont help in my case because I can already load the initramfs without issues

Yes, thats correct.

Sysupgrading is really tricky and I have not found why it wont work as I added support for UBIFS packing the kernel and then ubinizing it separately and flashing to a separate partition.
It sometimes works, sometimes not.

I have all my mtd partitions dumped would supplying you with any of my partition dumps help?

Not really, as the bug is universal for all boards.
I just have to have a free weekend to debug it.

I will try the recompile later tommorw and see if downgrading does anything other then that thanks for your support.

I doubt it will help, but thanks for trying.