How to build OpenWrt for Mikrotik hap ac^2 (RBD52G-5HacD2HnD-TC)

Hello,
I want to build an image for the Mikrotik hap ac^2 (RBD52G-5HacD2HnD-TC).
The hardware is :

|Architecture|ARM 32bit|
|CPU|IPQ-4018|
|CPU core count|4|
|CPU nominal frequency|716 MHz|
|Size of RAM|128 MB|
|Storage size|16 MB|
|Storage type|FLASH|

I saw that the IPQ-4018 it is already supported for other devices, how can I build and install an OpenWRT image for this device?
I saw that in make menuconfig if I select the Qualcomm IPQ-40XX architecture I cannot select Mikrotik for the device. Can I somehow build the sysupgrade.bin and .elf file ?

Thank you!

Again,there is no support for Mikrotik devices on IPQ40xx platform

I am aware that currently it is not supported, but taking into consideration that the CPU is already supported for other devices I thought that it might be easy to make some changes to the build/make files to support it. I currently own a device and I am willing to test on it. Please let me know if I can help/contribute in any way.
Thank you.

Regards,

Vlad

Well, its not the CPU thats the issue.
Its the fact that Mikrotik has its own RouterBoot bootloader for which I dont think we can generate images outside of ar71xx/ath79

Also, last GPL patch from Mikrotik does not include any of these new IPQ40XX devices so GPIOs are unknown too.

I will ask the support from mikrotik to see if I can get the latest GPL patch with the IPQ devices. I'll post here my success or the lack of it :slight_smile:

Already tried, on July 2nd they told me the following:
Hello,

It takes some time until we prepare the patches, we do not keep them up to date automatically, it is a manual process. We make a new patch every few months.

Best regards,
Normunds R.

I have a decrypted supout from hapac2. Pm me for complete file as it may contain some private user data.

Here are some parts i find interesting:

\00\00\00\00a\00\00\00cmdline\00\00\00$\81\00\00\A8\00\00\00root=/dev/ram0 bootimage=1 no-uart no-nand parts=1 boot_part_size=16777216 eth_mac=CC:2D:E0:XX:XX:XX board=hap-dk Board=hap-dk ver=6.42.7 hw_opt=08284005 boot=1 mlc=11
 17.59@0: Unpacking initramfs...
		 17.59@0: Freeing initrd memory: 88K
		 17.59@0: squashfs: version 4.0 (2009/01/31) Phillip Lougher
		 17.59@0: yaffs Aug 10 2018 13:33:02 Installing. 
		 17.59@0: msgmni has been set to 466
		 17.59@0: io scheduler noop registered (default)
		 17.59@0: al_dma: Annapurna Labs DMA Driver 0.01
		 17.59@0: msm_serial: driver initialized
		 17.59@0: msm_serial_hsl: driver initialized
		 17.59@0: m25p80 spi0.0: found w25q128jv, expected m25p80
		 17.59@0: m25p80 spi0.0: w25q128jv (16384 Kbytes)
		 17.59@0: 2 ofpart partitions found on MTD device spi0.0
		 17.59@0: Creating 2 MTD partitions on "spi0.0":
		 17.59@0: 0x000000100000-0x000001000000 : "RouterOS"
		 17.59@0: 0x000000080000-0x0000000c0000 : "RouterBoot"
		 17.59@0: i2c /dev entries driver
		 17.59@0: Registered gpio 3 as user-led
		 17.59@0: Registered led device: user-led
		 17.59@0: Registered gpio 0 as power-led
		 17.59@0: Registered led device: power-led
		 17.59@0: Registered gpio 63 as button
		 17.59@0: Registered gpio 5 as mode-button
		 17.59@0: Registered gpio 2 as usb-power-off
		 17.59@0: Registered led device: usb-power-off
		 17.59@0: Registered led device: all-leds
		 17.59@0: TCP cubic registered
		 17.59@0: NET: Registered protocol family 17
		 17.59@0: VFP support v0.3: implementor 41 architecture 2 part 30 variant 7 rev 5
		 17.59@0: Registering SWP/SWPB emulation handler
		 17.59@0: Warning: unable to open an initial console.
		 17.59@0: Freeing init memory: 200K
		 17.59@0: yaffs: dev is 32505856 name is "mtdblock0"
		 17.59@0: yaffs: Attempting MTD mount on 31.0, "mtdblock0"
		 17.59@0: new-flash: starting...
		 17.59@0: using MTD device
		 17.59@0: HW_OPT[08284005]
		 17.59@0: board name = RouterBOARD D52G-5HacD2HnD-TC
		 17.59@0: market name = hAP acĀ²

It should not be hard to make a image for it, but getting the bootloader to accept it is not easy.
Also, we gotta figure out how to get radio calibration out

So I got a response from Mikrotik with the patch from march (https://mikrotik.com/download/share/linux_3_3_5_patch.gz), they say it is actual , but not everything. I hope this helps.

I got the March one but there are no IPQ based devices in it

config ARCH_IPQ806X
+	bool "IPQ806X support"
+	select ARCH_MSM
+	select HAVE_CLK
+	select GENERIC_CLOCKEVENTS
+	select ARCH_REQUIRE_GPIOLIB
+	select ARCH_HAS_CPUFREQ
+	select CLKDEV_LOOKUP
+	select MSM_SMP
+	select MSM_BUS_SCALING
+	select ARCH_MSM_KRAIT
+	select HAVE_SCHED_CLOCK
+	select MACH_IPQ806X_RB3011
+	select HAVE_CLK_PREPARE
+	select SWP_EMULATE
+	select ARM_GIC
+	select CPU_V7
+	select PM
+	select PCI
+	select PCI_MSI
+        select ARCH_SUPPORTS_MSI
+	select MSM_PCIE
+	select MSM_ADM3
+	select MSM_V2_TLMM
+	select MSM_GPIOMUX
+	select MSM_RPM
+	select USB_EHCI_MSM
+	select MSM_SCM if SMP
+	select QCOM_SCM if SMP
+	select HAVE_SMP
+	select SMP
+	help
+	  Support for Qualcomm's ipq806x.
+
+config ARCH_IPQ40XX
+	bool "IPQ40XX"
+	select REGMAP_MMIO
+	select PCI
+	select PCI_MSI
+	select QCOM_PCIE
+	select MSM_PCIE
+	select HAVE_CLK
+	select HAVE_SCHED_CLOCK
+	select HAVE_CLK_PREPARE
+	select COMMON_CLK
+	select ARCH_HAS_CPUFREQ
+	select CPU_V7
+	select MSM_V2_TLMM
+	select ARCH_SUPPORTS_MSI
+	select USB_EHCI_MSM
+	select QCOM_SCM if SMP
+	help
+	  Support for ipq40XX
+

Yeah, IPQ806X is there for RB3011 but there are no IPQ40XX devices defined.

You are trolling me or what?
There are no IPQ devices there except for RB3011 defined.
I only got the new GPL patch couple of days ago

No, sorry.

Do you guys know if Mikrotik will ever release the means to flash those with custom firmwares ?