BananaPI BPI-R2 Openwrt18.06 Demo Image and Source Code Release 2019-03-06

(ZB) #1

Hello all,sorry for the late update for openwrt18.06 of R2.

Here release source code and demo openwrt18.06 image, which is based on kernel 4.14.98.



  • fork from upstream:

  • How to compile bpi-r2 openwrt kernel

    • check to openwrt-18.06: git checkout -b openwrt-18.06 remotes/origin/openwrt-18.06

    • build code: make menuconfig

          Target System (MediaTek Ralink ARM)                                                                                                     
          Subtarget (MT7623)                                                                                                                       
          Target Profile (MTK7623n BananaPi R2) 
    • after config target, then make

    • after make, put the dtsi/dts(mt7623.dtsi (25.5 KB) mt7623n-bananapi-bpi-r2.dts (10.9 KB) ) to this dir “build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/linux-4.14.82/arch/arm/boot/dts/”

    • then kernel will be generated in this dir “bin/targets/mediatek/mt7623/openwrt-mediatek-mt7623-7623n-bananapi-bpi-r2-initramfs-kernel.bin”

  • images will be generated in this dir:"./build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/"


  • md5sum:
    • mtk-bpi-r2-EMMC.img : 5d1537c45679de352dd25d8dda46b9ad
    • mtk-bpi-r2-SD.img :71fce303abdceed4f1c3548d5a3fc207

3.How to load image to SD card and Emmc?

  • you could use bpi-copy load image to sd card, Here is an example:


  • you could use dd command load image to emmc, Here is an example:

    • Program EMMC image to User Data Area of EMMC: dd if=mtk-bpi-r2-EMMC.img of=/dev/mmcblk0

    • Unlock EMMC boot0 block: echo 0 > /sys/block/mmcblk0boot0/force_ro

    • Program preloader to EMMC boot0 block: dd if=mtk-bpi-r2-EMMC.img of=/dev/mmcblk0boot0 bs=1M count=1

    • Change the Partition configurion of EMMC is 48h:reboot the system which is running SD, and enter the U-boot command line, run command emmc pconf 48


OpenWrt 18.06 malformed ip packets at bridged interface
OpenWrt 18.06 malformed ip packets at bridged interface


the SD image boots properly but there are a few things that are not working out-of-the-box (dhcp server on br-lan, luci) and I have no time to investigate for the moment, I will come back later.

Thanks anyway, from my side it is the most intresting target distribution, but for that I would need a working and HW assisted OpenVPN (with crypto), and all other common router functions with HW (NAT and QoS above all. On-board wifi is really poor both from HW perspective and SW support;

(Holger Glaess) #3


can you please offer an whole image with openwrt for dd 'ing on an emty mmc mem card.

i try to build by my self , but i have trouble with the ethernet switch of the bpi2 after install the image by dd and booting the bpir2 with them,

i can’t ping the default address from my pc with the address


(Alexey Loukianov) #4

Why, why, why the hell did you do this to git?! This one is based on the upstream repo and upstream repo is also a git repo and it even is available on the github. Why had you choosed to distribute your changes as a single huge commit hiding all the changes you’ve done to the upstream repo? Why hadn’t you follow the sane people’s route by using github fork and creating a new branch starting from the upstream commit you choose as a base for your changes?

It’s really painful to deal with this kind of “forks”. Nevertheless thanks for your efforts, maybe other people would be able to extract something useful to be pushed into the upstream from your changeset.

(ZB) #5

Hello, sorry for this, I have changed, thanks for your advice.

(Holger Glaess) #6


ok , then tell me where is an Dokumentation to install openwrt to an blank mmc card for an bananapi r2.

i know the download at , but i can’t deal with the offered files. look like the are can only use for upgrade.


(ZB) #7

Hello, I just push my commit to the fork repo, please have a try.

you will see the image under here: /build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/

you could also use dd command to install image:

(Holger Glaess) #8

Hi ,

Ich will try in the evening today.

I give you then asap an Response Here.


(Alexey Loukianov) #9

Thanks for the quick fix.

(Jan Kruis) #10

Thank you for all the work. I only have a problem, I don’t get an ip from the router and if I manually set my PC to I cannot reach the router.

“ip a” indicates the router should be

I have noticed (with the previous version) that if I make the following modification in the file /etc /config/network, I can ping the router and reach via ssh.

uncomment the “config globals ‘globals’” and “config interface ‘wan6’”

I make the adjustment with vi and check with mat cat whether the adjustment has also been made in the file.

however, if I adjust this file and reboot the router, they will reset the adjustment.

ask : which file should I adjust to make the adjustment permanent

(Holger Glaess) #11


i check my build dir but there is no .img file.

i configure and compile the code like the description says.

i got no error at the compile time



Don’t work. I can access by serial interface, but I can’t access to DHCP don’t work. Static ip don’t work.

(ZB) #13

this demo image only has very basic function, let me check this and then add my .config here. thanks

(ZB) #14

hello, the image will be generated in this path: build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/

if you don’t see this, please provide me your compiled log.

(Frank W.) #15

Please verify you use this patch…

(Cristian) #16

Hi everybody.

I tried to install the pre-built image of OpenWRT for the BananaPi R2 published here:

But all packets coming from the LAN SW seem to be malformed and on the WAN side I can assign an IP using a DHCP but the SSH service is not listening on that interface, I suppose for some firewall configuration. For these reason I can not access my board.

I also tried to compile my own image and I had the same problem with the malformed packets. So I follow this post:

And ended editing this file:


# Copyright (C) 2006

config interface loopback
	option ifname	lo
	option proto	static
	option ipaddr
	option netmask

config interface wan
	option ifname	eth0
	option proto	dhcp

config interface lan
	option type	bridge
	option ifname	eth1
	option proto	static
	option ipaddr
	option netmask
#	option ip6assign 60

#config interface wan6
#	option ifname   eth0
#	option proto    dhcpv6

#config globals globals
#	option ula_prefix auto

After compiling, it works, i can login in root@ using SSH. The problem now is that i can not install any package because I have no free space. Which is not true, because I’m using a 32GB SD card, from which only 70MB are being used by the image…

root@OpenWrt:~# df -h
Filesystem                Size      Used Available Use% Mounted on
tmpfs                   503.7M     72.0K    503.6M   0% /tmp
tmpfs                   512.0K         0    512.0K   0% /dev
root@OpenWrt:~# mount
rootfs on / type rootfs (rw)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)

root@OpenWrt:~# opkg install openvswitch-ovn
Installing openvswitch-ovn (2.8.5-1) to root...
Collected errors:
 * verify_pkg_installable: Only have 0kb available on filesystem /overlay, pkg openvswitch-ovn needs 1
 * opkg_install_cmd: Cannot install package openvswitch-ovn.

Do you know if there is a way to resize the file system or to configure it using make menuconfig ?


(Tobias Preston) #17

did you find a way to get luci working?

(Alexey Loukianov) #18

So I had managed to find a spare hour and took a look into what had been changed compared to the official upstream sources. By the looks of it the main change in sources is an addition of SD and EMMC image building targets - which was done is a “dirty” way having preloader and u-boot binary blobs pushed as files into the git. Second change is the change to the build procedure by injecting device tree files into the kernel build tree halfway across the build.

Am I missing something? What is supported and what is not for this image? Dual GMACs? Hardware assisted VLANs? DSA-enabled switch chip management? Hardware NAT? I mean, it is cool that these sources look extremely close to the upstream OpenWRT but as an end-user what I care more is the available functionality as my goal is to use this board as a router instead of toying with it compiling and testing different stuff.

(Alexey Loukianov) #19

Important notes for people trying to compile this:

  • Beware of make dirclean and make clean: mtk-bpi-r2-preloader-emmc.bin, mtk-bpi-r2-preloader-sd.bin and mtk-bpi-r2-uboot.bin would be cleaned up from staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/image and you will have to re-overwrite dts/dtsi files in the build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_mt7623/linux-4.14.82/arch/arm/boot/dts/. Proper dirclean path: make dirclean; git checkout staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/image/mtk-bpi-r2-{preloader-emmc,preloader-sd,uboot}.bin. Then execute make, then re-copy dts/dtsi files, then repeat make.
  • Make sure you had enabled generation of “ramdisk” in “Target Images” menuconfig. Resulting image won’t be generated if initramfs target image is disabled.
  • For “make oldconfig” users: make sure to switch to “GCC compiler Version (gcc 7.x)” in the “Advanced configuration options (for developers) —> Toolchain Options”. It won’t compile with gcc 5.x without tweaks to compiler flags in some random places.

(Alexey Loukianov) #20

Finally tried the image compiled from this source on my BPiR2. Findings:

  • Default image config lacks a lot of kernel modules that are required to use all available functionality of the SoC. Namely: USB2/3, HW crypto engine, ATA. This is due to a fact that upstream had created a separate subtarget mt7623n for BPiR2 which does not have DEVICE_PACKAGES populated with “kmod-usb-core kmod-usb-ohci kmod-usb2 kmod-usb3 kmod-ata-core kmod-ata-ahci-mtk” the same way it is done for mt7622 reference board target. One will have to enable above modules manually in order to get resp. parts of SoC working.
  • No support for volatile storage. Image is a pure read-only squashfs root without jffs2 partition to store overlay data. One would have to use external root to make this image useful for anything more than basic tests. Or would have to hack in “rootfs_data” partition subdivision somehow to get jffs2 working.
  • Two GMACs seems to be present and working.
  • DSA is working.

Above are findings “at a first glance”. Will report back after doing more tests and tweaks.