Add OpenWrt support for NanoPi R1

I have nanopi r1 but i still waiting openwrt :frowning:

1 Like

any news about nanopi r1 ? :frowning:

I have obtained an R1S-H3, and would like to get this supported in mainline, rather than depending on the vendor supplied image.
Can anybody point me to a similar base from which to start?

1 Like

Ok, I have started with the Banana Pi M2 Plus as a base, and have both WAN and LAN ethernet ports working (somewhat, I still need to solve a problem with MAC addresses). Now I am trying to get the WiFi working. From what I can see, I need to update the device tree to refer to the RTL8189ES chip in use, rather than the BPi M2's bcm4329-fmac.
That would imply deleting or overriding:

        brcmf: wifi@1 {
                reg = <1>;
                compatible = "brcm,bcm4329-fmac";
                interrupt-parent = <&pio>;
                interrupts = <6 10 IRQ_TYPE_LEVEL_LOW>; /* PG10 / EINT10 */
                interrupt-names = "host-wake";
        };

and putting something else in its place. I'm just struggling to figure out what to add, as I am not very familiar with device trees.
Looking at arch/arm/boot/dts/sun8i-h2-plus-orangepi-r1.dts, since it also uses the rtl8189es, I see:

&mmc1 {
        vmmc-supply = <&reg_vcc3v3>;
        vqmmc-supply = <&reg_vcc3v3>;

        rtl8189etv: sdio_wifi@1 {
                reg = <1>;
        };
};

Following the include files to arch/arm/boot/dts/sun8i-h2-plus-orangepi-zero.dts, I see:

&mmc1 {
        vmmc-supply = <&reg_vcc_wifi>;
        mmc-pwrseq = <&wifi_pwrseq>;
        bus-width = <4>;
        non-removable;
        status = "okay";

        /*
         * Explicitly define the sdio device, so that we can add an ethernet
         * alias for it (which e.g. makes u-boot set a mac-address).
         */
        xr819: sdio_wifi@1 {
                reg = <1>;
        };
};

That same file also has:

        aliases {
                serial0 = &uart0;
                /* ethernet0 is the H3 emac, defined in sun8i-h3.dtsi */
                ethernet0 = &emac;
                ethernet1 = &xr819;
        };

suggesting that I need to do something similar in my R1S.dts to get U-Boot to allocate/pass a MAC address for the different interfaces, if available?
It also seems like the physical hardware changed from one board to the next, being the xr819 on the zero, to a Broadcom chip on the M2 Plus.

You can use FriendlyARM NanoPi NEO Plus2 image to run R1S-H5. Routes 300MBit internet with 5% cpu usage (using single glan interface). You will be missing Wlan and USB ethernet, but atleast usb ethernet should be fairly easy to install.

NanoPi-R1 support patch for version 19.07.2. Both ethernet adapters and wifi seem to work.

DTS files are taken from the armbian project.

4 Likes

Thanks ! how make a sd card image with this ? or how to setup ?

Build OpenWrt as usual:

https://openwrt.org/docs/guide-developer/quickstart-build-images

before "make menuconfig" switch to v19.07.2:

git checkout v19.07.2

and apply patch:

patch -p1 < nanopi-r1-19.07.2.patch

in menu select

"Target System" -> "Allwinner A1x/A20/A3x"
"Subtarget" -> "Allwinner A20/A3x"
"Target Profile" -> "FriendlyArm NanoPi R1"

1 Like

@inoremap ah really thanks ! i do tonight :smiley: Take care yourself from corona :smiley:

i run this command patch -p1 < nanopi-r1-19.07.2.patch
and ssh says:
patch: **** malformed patch at line 387:

I forgot to add a newline at end of file. Uploaded new revision.

1 Like

if possible upload your image/build ? :smiley: i apply "./scripts/feeds update -a" this command and ssh say this... and your patch(new version) give some error :frowning:

2

It looks like you are applying a patch to the master branch, not to v19.07.2.

Try download OpenWrt sources again and run

git checkout v19.07.2
./scripts/feeds update -a
./scripts/feeds install -a
patch -p1 < nanopi-r1-19.07.2.patch
make menuconfig

Image files - https://drive.google.com/open?id=1jSwaLg6pwAPV_5wWVk3D5P3t6JXLEKGD

1 Like

thanks ! working now :smiley: when time add officially ? what you think ?

Patch quality is not suitable for the mainline. I took the DTS file from the 5.4 kernel and modified it for the 4.14, but I'm not sure if the changes are correct.

1 Like

Create a pull request with the modified configuration at openwrt upstream.

builds from openwrt-master.
link: https://github.com/jayanta525/build-openwrt-nanopi-r1
kernel: 5.4

1 Like

Do you have the patches that you are using to build these images available somewhere?

i created a PR at openwrt, its still hasn't gone through because of some conflicts.
you can find the fork here: