Installing OpenWrt on Mikrotik wAP R (RBwAPR-2nD)

I'm trying to install OpenWrt on a Mikrotik device. OpenWrt doesn't come up on, and before I look into a serial port, I wanted to make sure I got the sequence right. I pieced the process together from the old wiki and a more recent LEDE commit.

  1. Boot to RouterOS and set the boot protocol to DHCP (System → Routerboard → Settings → Boot protocol: DHCP)
  2. Download an initramfs (I used an openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf nightly snapshot)
  3. Set up a DHCP server that sets options 66 67 to the initramfs and tftp server (I used the dnsmasq example in the wiki)
  4. Power the device on with the reset button pressed for ~15-20 seconds.

After doing this, I saw dnsmasq assign the device an IP address and report that it sent the initramfs file, but after waiting several minutes, I'm unable to ping (timeout). I'm on the correct subnet when I try to ping.

Couple of notes:

  • I don't have another 192.168.1.x device on the network
  • The dhcp server and its address pool aren't in the subnet.
  • I initially didn't change the boot protocol, but the device still requested the initramfs over tftp
  • I'm not convinced dnsmasq sets options 66 and 67; dnsmasq and Wireshark pretty print it in a way that never mentions 66 or 67.

Any ideas, or is it time to resort to hooking up a console?

Looking at the diffs that added a similar device, I might have to specifically add it to get the network to come up.

Well,since there is not support in OpenWrt for wAP R but only wAP it can easily be that ethernet port is not connected in the same place like wAP.

If it's even detected as a wAP. Would I be better off starting with setting up a serial connection or should I poke around adding support in the code?

Well,first read waht Resorces and Routerboard give you in Winbox.
You cant start adding code if you dont know the identifier.
Serial is disabled by Mikrotik,but can be enabled after you know identifier.

Here's what I found in resources:

Uptime 00:45:46
Free Memory 42.6 MiB
Total Memory 64.0 MiB
CPU MIPS 24Kc V7.4
CPU Count 1
CPU Frequency 650 MHz
CPU Load 2 %
Free HDD Space 3232 KiB
Total HDD Size 16.0 MiB
Sector Writes Since Reboot 114
Total Sector Writes 1 025
Bad Blocks 0.0 %
Architecture Name mipsbe
Board Name wAP R
Version 6.42.3 (stable)
Build Time May/24/2018 09:20:22
Factory Software 6.39.2

And here's what I found in Routerboard:

Model RouterBOARD wAP R-2nD
Firmware Type qca9531L
Factory Firmware 3.41
Current Firmware 3.41
Upgrade Firmware 6.42.3

I think the model is the same value in /proc/cpuinfo and needs to be added to ar71xx_board_detect.

I through their GPL code for a possible board value for prom_init() and think it might be wap-lte. It's the only wap type not in OpenWrt yet, and while there are a few wap lte devices, they're all basically the same hardware. I've started work on adding support for the board, but I haven't gotten a chance to test it, yet.

What are the steps for enabling the serial console?

Yeah,wAP LTE is missing.
You can enable serial with adding the board in this patch.

The changes I made didn't work. After about 15s of holding the reset button and powering the device on, it successfully makes a DHCP request and TFTP request for the initramfs, but that's all I see. I'm never able to ping I even changed the patch to force the board (rather than detect it from /proc/cpuinfo), but that didn't work.

I haven't gotten a chance to try the serial change (I'm not even sure which pins the serial connector is on), but I guess that's the next step.

Am I missing something obvious? The board seems so similar to others I'm surprised adding the device type and forcing it didn't work. Is openwrt-ar71xx-mikrotik-vmlinux-initramfs.elf the right tftp image? Is 6.5MB too big?

Bump. Any next steps?

Here's the board. I should take a pic with the wireless card removed. Luckily, it looks like the serial port is labeled (the four pads marked TX, RX, and 3V3). There are also unused pads two usb ports.


Nice looking board, there are always pins for UART but if Mikrotik does not advertise the device as having UART they disable it in RouterBoot.
That is why OpenWrt has a patch to enable it.

Can you try hooking up the UART and then loading initramfs elf image?

Also,can you jailbreak it to actually get root shell so board identifier can be found as well anything else usefull.

Still working on serial access, but I jailbroke the device and got the kernel command:

root=/dev/ram0 bootimage=1 no-uart no-buzzer no-nand parts=1 boot_part_size=16777216 gpio=0 mem=64M kmac=64:D1:54:xx:xx:xx board=wap-lte board=wap-lte ver=6.42.3 hw_opt=00684001 boot=1 mlc=11 rd_start=0xc0512000 rd_size=0x000185ec

The board type is wap-lte.

Well,since its wap-lte then all GPIOs are in GPL.
I can try to add it today.

Like I thought,there is PCI-E power GPIO as well as some GPIO named control.
Also,I will enable UART so debugging is possible

1 Like

I got the initramfs to work! There was something I forgot in the code change. I'll open a PR to OpenWRT.

Is everything working?
We gotta get all of the LEDs properly configured.
They are all exported,can you manually turn them on and note what they are for?

Interestingly enough while it is indeed possible to boot into initramfs - running sysupgrade & booking from flash results in the unit not bringing up the ethernet.

Can you check what is the board detected as in OpenWrt?
It could easily be that I did not configure it in correctly

system type             : Qualcomm Atheros QCA9533 ver 2 rev 0
machine                 : MikroTik RouterBOARD wAP R-2nD
processor               : 0
cpu model               : MIPS 24Kc V7.4
BogoMIPS                : 432.53
wait instruction        : yes
microsecond timers      : yes
tlb_entries             : 16
extra interrupt vector  : yes
hardware watchpoint     : yes, count: 4, address/irw mask: [0x0ffc, 0x0ffc, 0x0ffb, 0x0ffb]
isa                     : mips1 mips2 mips32r1 mips32r2
ASEs implemented        : mips16
shadow register sets    : 1
kscratch registers      : 0
package                 : 0
core                    : 0
VCED exceptions         : not available
VCEI exceptions         : not available

Ok,that is read from cmdline.
There should be board name in /tmo/sysinfo/board_name

This also appears to be correct in --

root@(none):~# cat /tmp/sysinfo/board_name 

Then that is really weird.
Can you post full bootlog and see what ifconfig and ethtool have to say?