I recently got my hand on a new router to play with. It's an Orange Pi R1 Plus LTS, an Rockchip RK3328 board with dual-gigabit Ethernet ports. The reason for the LTS or Long Term Support is because of chip shortage, they lacked the Realtek RTL8211 chip for the WAN port, so they substituted it with Motorcomm YT8531C because it was more abundant. I plan to use this board as either a DNS Server to speed up domain querying in place of my Raspberry Pi, or as a router. There is a similar board which this one takes inspiration from (including device tree source, more on that later), NanoPi R2S. However, that board was pricier and I felt a bit adventurous that day. So first off, I tried out Openwrt on this board, since it was recommended by the board manufacturer.
Different flavors of OpenWrt
When I bought this board used, they gave me a metal case, a 32GB SD card with their own version of OpenWrt 21.02 installed. It was packed to the brim with stuff, Docker, adblock, bandwidth monitor, wake on LAN, torrent downloader, DLNA, Dynamic DNS. It wasn't for my liking since it slowed the OS down so I tried something else.
Following this page, I tried out the manufacturer's OpenWrt. Much like the previous one, it was based on 21.02 but fairly minimal. A Youtube named Van Tech Corner created his own OpenWrt release from the source code provided by the manufacturer. You can check out the unboxing and testing video, similar video for NanoPi R2S. The two releases differ in the number of packages preinstalled. I tested the Van Tech's one. It was better because of its slim size. But when I tried to install any package that has a kernel dependency, like Wireguard, 4G USB support (RNDIS), it said The installed version of package kernel is not compatible. According to the OpenWrt page, these were self-compiled image, and couldn't use kernel-related packages from the official repository, but had to be either included in or built beforehand and installed externally. I tried out OpenWrt official download page, but no luck for this board. NanoPi R2S did have an image, though. So I'm out of luck until official support from OpenWrt or Orange Pi, right?
A daring approach: Compile from source
Before this, I compiled Asterisk for my VOIP server experiment. It was the recommended way of installing it, as the one on the Ubuntu repo (repository) is old. I just followed the instructions and it compiled and installed. Another instance is driver install. Some drivers like my RTL8156 2.5Gbps Ethernet USB for my server had to be compiled from source because again, Debian's one was too old to support it. So I checked out source code from Van Tech, which is a derivative (or fork) of the source code from Orange Pi's OpenWrt. At first, I just randomly followed instruction, feeds update, feeds install. Inside menuconfig, Global build settings, I picked Select all target specific packages by default, Select all kernel module packages by default. So it took a few hours to either compiled and didn't run on the R1 Plus board, or it caught an error halfway. After a few more tries, I eventually got it compiling correctly, though I chose to make -j1 because I needed to trace the error if it popped up.
After testing the compiled image on the board to verify it running correctly, I searched Google and found this forum post from OpenWrt and image and source code from walmartshopper. It was newer, version 22.03, and it worked using their provided image.
I got curious about the changes in the source code that Orange Pi made, so I used Visual Studio Code to look into the source. I searched for anything related to Orange Pi R1 Plus (LTS included) and came across multiple results. I will tell you some notable ones:
- The .patch files inside target/linux/rockchip/patches-5.4 and package/boot/uboot-rockchip/patches. According to kernel.org, these are kernel patches. This is how Orange Pi add support for their R1 Plus (and LTS) board to OpenWrt, even though you can't find this board on OpenWrt's download page. They patched dts files in the kernel, in addition to the YT8531C driver for the ethernet.
- target/linux/rockchip/image/armv8.mk shows how OpenWrt build the image for the board, as well as package/boot/uboot-rockchip/Makefile for the bootloader.
Note that this is an ARM processor, so the boot process is different than your computer. It requires a dtb, or a device tree blob that is compiled from dts - device tree source file, and its own bootloader. They usually use U-Boot. To this day, Orange Pi R1 Plus (and LTS) dts files haven't been upstreamed, or merged back to the OpenWrt source. The Linux kernel source has upstreamed dts for R1 Plus on v6.3 and LTS on v6.4. Maybe in the future, as there has been several attempts at doing so at OpenWrt pull requests.
Looking at other git repos like from walmartshopper, baiyut (who is in charge of the patches in Orange Pi OpenWrt, his own repo also has OpenWrt 22.03), ImmortalWrt (which allows non-upstreamable patches), they also applied this technique to support the R1 Plus (and LTS). From walmartshopper's repo, I tried merging OpenWrt 22.03 current branch to his, but the number of conflicts is too big, I wondered if the amount of work put into keeping R1 Plus up-to-date with OpenWrt was this huge. It's quite amazing.
In the future, with the release of OpenWrt 23.05, if those customized repos don't support the board, and OpenWrt doesn't support either, I will see if it's possible to port the files for R1 Plus (and LTS) over.
Note on using Android TV Box as router
Before all this, I tried testing a X96 Air S905X3 4GB and Mecool M8S Pro W S905W 2GB with this OpenWrt implementation by ophub. He used Armbian bootloader to boot to OpenWrt environment. One of the flaws I discovered after testing Coreelec on the Mecool is that I can't boot back to Armbian or OpenWrt anymore, due to Coreelec overwriting the eMMC bootloader and I don't want to re-flash Android on the TV Box. In fact, this was exactly why I purchased this Orange Pi R1 Plus LTS board. So I don't have to go through this hassle with TV Box. And in the event of Raspberry Pi shortage such as right now, I want to switch to alternative single board computers such as Orange Pi from now on. While support is spotty, they outperform the Raspberry Pi and don't cost an arm and a leg to buy.
References: