OpenWrt Forum Archive

Topic: Mikrotik RB750r2 ( hEX Lite ) Support

The content of this topic has been archived on 8 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

This has been driving me nuts, but I now have it all working. It's probably not very streamlined - for example it adds a new spi device for driving the LEDs where in reality that device *may* be similar to that in one of the rb400's and so might be re-usable... but to be honest I've spent so much time on this that I need to get on with other things. Similarly, some of the naming is a bit off ( so that spi is called rb400-spi-misc for example, because it's also used in the RB4xx series and that was how it was named in Mikrotik's patches. )

As far as I can tell, Mikrotik's bootloader is buggy, so you have to replace it ( link and instructions in my patch dir. ) This also means that you need a TP-Link style image for the 750r2, which to be honest is no bad thing. However, it also means that the bootloader doesn't set some things up correctly ( took me more than a day to work out why I couldn't get the LEDs to work. ) I don't have a QCA9533 datasheet, so my patch currently just writes a load of registers to the values they have on boot with Mikrotik's bootloader - most of these are probably not needed but again I'd lost the will a bit by that point!

One interesting thing is that the Breed bootloader can write the entire flash in less than a minute, whereas OpenWRT takes more than 5 minutes using dd or mtd write - would be good to know why.

Anyway, I'm hoping that a "real" OpenWRT developer can take this and use it to create "proper" support in OpenWRT - but for now this works and is relatively easy to do... it's just a bit messy.

Instructions, code and patches here. Usual caveats apply about being careful not to brick your router and me not being liable for it smile. Probably best if someone experienced tries it first and feeds back....

Hey sidepipe,

Thanks for your nice patching.
The ramdisk you provided works perfectly. On the other hand, when I am trying to build it for myself it fails.

Applying patch platform/827-MIPS-ath79-add-rb750r2-support-openwrt.patch
patching file arch/mips/ath79/mach-rb750.c
patching file arch/mips/ath79/machtypes.h
patching file arch/mips/ath79/Platform
patching file arch/mips/ath79/prom.c
patch: **** malformed patch at line 270: diff -rupN linux-3.10.49/arch/mips/ath79/rb400/gpio.c linux-3.10.49-new/arch/mips/ath79/rb400/gpio.c

I have checked, and rb400 directory does not exists in my build dir under ath79.
Do you have any ideas what am I doing wrong?

Hmm, I have to admit I don't know what's wrong - I've just followed my own instructions to make sure and it worked fine. All I can suggest is that you make sure that you've followed my README exactly ( though there's not much to it and it does look as though patch is failing. )

I created the patch using diff -rupN.... maybe you have a different version of patch to the one I have which doesn't like that format? The rb400 directory should be created by the patch as far as I remember. Maybe someone else can shed some light ( if I need to change the format of the patch file then of course I can do that, but I'd like to know that's the issue and what parameters to use before I do! )

Finally it is working.

Did you tried to make the serial console working?

+1 question.
Using your image the rootfs size is 30 MB. If I compile it and dd it on the mtdblock1 it is only 6-7 (depending on the selected packages). Is it possible to increase this size?

I know that the rootfs size is a paramter wwhen compiling an img to x86, but no option regarding this was found in the menuconfig. Can you please help?

(Last edited by GABIKA6 on 14 Sep 2015, 18:29)

Yes, the serial console works. There are pads on the board for it - they're TTL level so you'll need a TTL serial adaptor.

As to your question, there is 16M of flash on that device. The rootfs is compressed ( it's a squashfs filesystem ) and is read only - so its size is entirely related to the size of the packages it contains. When you write the image, you have to write it to the partition called "firmware", which is the whole flash minus the boot loader. From memory, "firmware" is mtd5 - but check by doing a cat /proc/mtd

You can also write the image using:

mtd write <image filename> firmware

Hey sidepipe,

Could you make a jffs2 or yaffs rootfs running on this board?
If yes can you please introduce it briefly?

I have created a wiki page for this board, feel free to extend it:
http://wiki.openwrt.org/toh/mikrotik/rb750_r2

I did try making yaffs2 work at one point but couldn't get it to work properly unless I patched in the whole of the Mikrotik version of the Yaffs code, and didn't really have the time to look into why.

The flash layout is actually very similar to the example here, except that the flash is 16M. So, you have a read only squashfs file system, and an overlay jffs2 filesystem, which makes it look as though you can write to the root ( but writes actually go to the overlay in the jffs2 part. ) If you upgrade the box by writing a new image to firmware, you can use the -j option of mtd write to add a saved settings tar containing files from the overlay that you want to keep. This is all pretty standard and similar to other OpenWRT boxes with NOR flash.

Unfortunately I don't really have time to do too much with this now, but will answer questions if I can.

First of all thanks for all your effort, and fast response.

It is not clear for me that actually the you could make the yaffs running or not.
Can you please link the "Mikrotik yaffs" patch for me? I am not able to find it. (If you have already applied this patch I would kindly ask you to write some sentence about the usage of it.).

Annoyingly I'm not getting email updates for this thread so sorry for the late reply.

What I mean is that I used yaffs from the Mikrotik kernel patch that they supply. I had to just modify it so that it worked with the newer kernel, but in reality I just completely replaced the fs/yaffs2 directory of OpenWRT with the one from their patch. That did work, but the box still wouldn't boot from flash, so I abandoned it ( really replacing the whole of the yaffs code with a different fork of it is not an option. ) The squashfs + jffs2 solution works well and is the way all other OpenWRT NOR flash devices work, so I had no real reason to re-try that once I'd worked out that the MT boot loader was snafu.

I think that my modified version of Mikrotik's YAFFS code is in the OldStuff directory within the directory I linked to in the first post.

I wrote a port for the Mikrotik hAP ( rb952-hb ) which uses the same SPI chip as the hEX I believe.

Earlier this year I was able to patch the yaffs mikrotik modification to OpenWRT for the Mikrotik mAP2n ( https://forum.openwrt.org/viewtopic.php?id=54221 ) You can review my patches here. These same patches worked for me on the Mikrotik hAP.

To get the Mikrotik bootloader to find the kernel is you create a yaffs2 kernel partition:
1.) Create a directory inside if it labelled kernel
2.) Put the kernel elf into the kernel directory
3.) Ensure it's executable

There are instructions inside my mAP2n port. I used the same ones to boot the Mikrotik hAP. I was going to update my patches for the kernel and submit a patch; but I haven't found time yet. I am positive the hEX will work with them.

Hello,

Let me thank @sidepipe for the great work on supporting this device.
I was able to port the patches to current trunk (47817), but at the end I coulnd't get the final squashfs-factory/sysupgrade files.
Here's the list of generated files.

openwrt-ar71xx-mikrotik-uboot-root.squashfs
openwrt-ar71xx-mikrotik-uboot-root.squashfs-64k
openwrt-ar71xx-mikrotik-uboot-uImage-gzip.bin
openwrt-ar71xx-mikrotik-uboot-uImage-lzma.bin
openwrt-ar71xx-mikrotik-uboot-vmlinux.bin
openwrt-ar71xx-mikrotik-uboot-vmlinux.elf
openwrt-ar71xx-mikrotik-uboot-vmlinux.gz
openwrt-ar71xx-mikrotik-uboot-vmlinux.lzma
openwrt-ar71xx-mikrotik-uboot-vmlinux-lzma.elf

BTW, it seems that 707-MIPS-ath79-add-support-for-QCA953x-SoC.patch is no longer needed on trunk.
Could someone help on this? I'll be glad to help on whatever I can.

TIA

Well, I think I got it. Now both squashfs-factory/sysupgrade are generated.

Index: target/linux/ar71xx/image/Makefile
===================================================================
--- target/linux/ar71xx/image/Makefile    (revision 47817)
+++ target/linux/ar71xx/image/Makefile    (working copy)
@@ -392,6 +392,14 @@
 endef
 TARGET_DEVICES += archer-c5-v1 archer-c7-v1 archer-c7-v2 tl-wdr7500-v3
 
+define Device/rb750-hb
+    $(Device/tplink-16mlzma)
+    BOARDNAME := 750-hb
+    DEVICE_PROFILE := MTUBoot
+    TPLINK_HWID := 0x08410009
+endef
+TARGET_DEVICES += rb750-hb
+
 define Device/antminer-s1
     $(Device/tplink-8mlzma)
     BOARDNAME := ANTMINER-S1

If those patches work and dont break the older revision - could you send them to the mailing list ?

Hi, I recently got wAP router from mikrotik and I think it is the same CPU as your router
hardware pictures are here https://yadi.sk/d/67KdKUGqpc3Am

I did try few images over tftp but after it collet image nothing happens
dnsmasq-dhcp: DHCPDISCOVER(eth0) e4:8d:8c:48:a3:39
dnsmasq-dhcp: DHCPOFFER(eth0) 192.168.6.101 e4:8d:8c:48:a3:39
dnsmasq-dhcp: DHCPREQUEST(eth0) 192.168.6.101 e4:8d:8c:48:a3:39
dnsmasq-dhcp: DHCPACK(eth0) 192.168.6.101 e4:8d:8c:48:a3:39
dnsmasq-tftp: sent /tftpboot/openwrt-ar71xx-generic-vmlinux-initramfs.elf to 192.168.6.101

I tried then to change my adress to 192.168.1.4 and telnet but nothing
this router has only one port so maybe that is problematic.
On default mikrotik firmware serial port is not working so there is no serial output...

If you can point me how could I build image for this router it would be great

I have rechecked, the cpu is QCA9533 flash is 25Q128 memory is NT5DS32M16DS
with your image I got this on serial output
http://pastebin.com/rPjxC1St

What is the current state of hex poe lite? Does poe work?

The discussion might have continued from here.