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

You can downgrade it up to the factory version directly from RouterBooot itself, I don't think that ROS allows doing a downgrade any other way.

But for me DHCP is broken in 6.47 or v7 but bootp works fine

Hi - Correct, DHCP booting on 6.47 or 6.47.* is completely broken.

I understand that the hap ac3 can be downgraded to whatever factory-firmware image it came with, in my case 6.46.6.

I'm not sure what you mean by downgrading to this version directly from routerboot itself. What's routerboot?

RouterBoot is the bootloader that does the DHCP/Bootp booting on the device, you need to downgrade it or use bootp

I managed to downgrade routeros to v6.46.6 by uploading
routeros-arm-6.46.6.npk
to the 'Files' via the web interface and then selecting System -> Packages -> Downgrade. I did not have to press the reset button on the router.

I now see a multitude of tftp attempts. They bascially don't stop and the dnsmasq server is not serving the contents of the 'vmlinux' file:

16:41:11.724217 IP 192.168.0.20.35112 > 192.168.0.10.69: TFTP, length 28, RRQ "vmlinux" octet blksize 512

192.168.0.20 -> hap ac3 in netboot mode, 192.168.0.20/32 leased by dnsmasq;
192.168.0.10 -> linux computer with dnsmasq listening on eth4 / 192.168.0.10/24

I've read that routerboot (bootloader) requests 'vmlinux' by default. I have renamed the initramfs to 'vmlinux' however it doesn't seem to get trasferred

I'm out of ideas.

You must advertise the boot file, it wont request anything by default but just get the lease and reboot

According to tcpdump, hap ac3 at 192.168.0.20 requests 'vmlinux' from 192.168.0.19:69/udp. dnsmasq is indeed serving this file, however it does not reply back to these tftp requests.

I got it to work and flash accordingly, details below.

  1. It's known that routerboot bootloaders versioned higher than 6.46.6 do not boot correctly via dhcp/tftp. You will need to downgrade the bootloader to 6.46.6 in order to dhcp/tftpboot your hap ac3 device. One can check check the routerboot/routeros version by running /system routerboard print

  2. Download the official npk named 'routeros-arm-6.46.6.npk' located at https://download.mikrotik.com/routeros/6.46.6/routeros-arm-6.46.6.npk and then upload it to your router using either winbox or scp. You can do this easily via the web interface.

  3. In the webui, navigate to System -> Packages -> Downgrade. Your device will reboot and downgrade the 'upgrade-firmware' image to 6.46.6. At this stage I'm not sure what magic I did to set 'current-firmware' to 6.46.6.

  4. Download a current snapshot of OpenWrt initramfs/kernel and place it in a folder;
    Run dnsmasq and do not forget the --enable-tftp option (I did):

dnsmasq -K -d k -P0 --interface=<ethernet_interface> --dhcp-range=192.168.0.15,192.168.0.50,255.255.255.0,5h --dhcp-host=ma:ca:dd:re:ss,192.168.0.20 --dhcp-boot=/path/to/your/initramfs/kernel/image --enable-tftp

NB: You'll need to IP your ethernet interface:

ip addr add 192.168.0.10/24 dev <ethernet_interface>
ip link set <ethernet_interface> up

Press and hold the reset button found at the back of your hapac3 device while unplugging the power adapter. Keep holding the reset button for approx 15 seconds.

NB2: While the router boots/goes in netboot mode, you might need to re-ip your ethernet interface.

You should now see something along these lines in dnsmasq's output:

dnsmasq-dhcp: BOOTP(enp0s25) 192.168.0.20 48:8f:5a:a5:11:e5
dnsmasq-tftp: sent /srv/tftproot/vmlinux to 192.168.0.20
  1. Your hap ac3 device should now have openwrt loaded in ram. You will see DHCP requests on port #1 and most likely the same IP will be assigned. Try ssh-ing: root:nopassword

  2. scp 'openwrt-ipq40xx-mikrotik-mikrotik_hap-ac3-squashfs-nand-sysupgrade.bin' to your router:

scp openwrt-ipq40xx-mikrotik-mikrotik_hap-ac3-squashfs-nand-sysupgrade.bin root@192.168.0.20:/tmp/.

  1. Run the following to permanently flash your hap ac3:
ubidetach -m 1
ubiformat /dev/mtd1 -y
ubiattach -m 1
sysupgrade -v /tmp/openwrt-ipq40xx-mikrotik-mikrotik_hap-ac3-squashfs-nand-sysupgrade.bin

The router will reboot. Connect an ethernet cable to port 2-5 and ssh using root:nopasswd. You can now configure openwrt by editing /etc/config/*

2 Likes

Unfortunately "upgrading" the firmware to 6.46.6 isn't possible on my device :(. Any idea if routerboot is still broken with v7 or RCs?

Do you really want to upgrade firmware? [y/n] 
y
ERROR: can not change firmware to this version, please try newer one

v7 works in bootp mode only

1 Like

I managed to get dnsmasq serving BOOTP using the instructions above - no need to downgrade firmware as dnsmasq seems perfectly capable of serving BOOTP. Image is booted up and looks great so far!

1 Like

PoE LED
Anybody here who knows how to activate the PoE LED of LAN port # 5?
Via gpio #452 can activate and deactivate the PoE voltage, but the LED (rear side, between port 5 and the USB connector) stays off. It is supposed to signal the PoE voltage presence on port #5 but apparently is driven separately.

maybe available under

this is for my RB5009, you must check on you hAP AC3

root@OpenWrt:/# find ./ -name *blue*
./sys/class/leds/blue:hdr1
./sys/class/leds/blue:hdr2
./sys/devices/platform/leds/leds/blue:hdr1
./sys/devices/platform/leds/leds/blue:hdr2

These can be configured under LED Configuration Luci

So it seems we missed OpenWrt 21.02.2 window for the hAP AC3 ?

Only hAP AC2 and SXSTSQ-5-AC image are available

[type or paste code here](https://downloads.openwrt.org/releases/21.02.2/targets/ipq40xx/mikrotik/)

@markbirss Thanks. PoE switching is defined in the device tree as a LED. Controlling the power voltage works fine by switching that LED, but the physical LED itself, signaling voltage presence, apparently is separately controlled.
This PoE function on port #5 is missing in Mtik's user manual.
Would be nice to know which gpio controls this LED, so it can be added to the DT.

		poe {
			label = "red:poe";
			gpios = <&tlmm 36 GPIO_ACTIVE_HIGH>;
		};

@markbirss
Thanks! Indeed works. Wrongly had assumed this gpio 452 being this red LED and PoE voltage combined, since there is a gpio offset. But the offset is 412, not 416. Have adapted my PoE on/off script to also set the LED through /sys/devices/platform/leds/leds/red:poe/brightness

1 Like

For anyone who wants to flash Mikrotik devices under Windows, I modified Tftpd64 so it's compatible with Mikrotik BOOTP since I had trouble finding any other compatible TFTP / BOOTP software. This should work with v7 and any earlier bootloaders.

6 Likes

Hi guys,

Thanks for all your work. This is my first openwrt experience, and it's amazing to have full featured linux terminal now

Hi guys,

Even though I was able to install the snapshot build and everything seemed to work, it appeared that wifi range is very low. Within 1.2meters away SpeedTest on wifi shows ~95mbps (it's around limit of my ISP plan), within ~5 meters only ~2mbps, in 7m -- it drops connection immediately (some devices just don't see the endpoint), while initial mikrotik firmware was able to keep connection stable within 20meters (and 2 walls).

I've tried playing with channels, channels' width, country, disabling 2.4G -- nothing helps. Any ideas how to debug, localize a cause and/or configure?

Can you try removing the board-2.bin from /lib/firmware/ath10k?
Its a bug for it to be included on Mikrotik subtarget, the patch for it is pending

1 Like