BPI-R2 new image: BPI-R2 OpenWrt(LEDE) Souce code : 2018-05-09

(gary) #1

Source code

The source code is at: https://github.com/garywangcn/bpi-r2_lede/tree/bpi-r2-on-lede-v1

Please clone the code to local and checkout the code from branch bpi-r2-on-lede-v1.


Run “make menuconfig” to configure this project, and run command “make -j1 V=s” to build it. A configuration file of this project is attached for you referenceconfig (153.1 KB)


The differences between this and the previous release(2018-04-11) is that the following packages are integrated by default:

  • WIFI support package(wmt)
  • MMC tool
  • LUCI(based on branch lede-17.01)
  • Strongwan

You will get three images from below image links:

  • build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_32/mtk-bpi-r2-SD.img: This is for SD image, please program it to SD card by executing command “dd if=mtk-bpi-r2-SD.img of=/dev/mmcblkx”

  • build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_32/mtk-bpi-r2-EMMC.img: This is for EMMC image, please follow below steps to program it EMMC: We need another system which is running on SD card to program EMMC image to EMMC, please follow below steps to do:

    1. Copy EMMC image to a running system which is from SD card
    2. Program EMMC image to User Data Area of EMMC: dd if=mtk-bpi-r2-EMMC.img of=/dev/mmcblk0 (assume /dev/mmcblk0 is for EMMC)
    3. Unlock EMMC boot0 block: echo 0 > /sys/block/mmcblk0boot0/force_ro
    4. Program preloader to EMMC boot0 block: dd if=mtk-bpi-r2-EMMC.img of=/dev/mmcblk0boot0 bs=1M count=1
    5. 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 (for this steps, we can change partition configuration in userspace by using mmc-utils, see more information in BPI-R2 OpenWrt(LEDE) Souce code : 2018-04-11)
    6. Power off, remove SD card, and then power on R2 board.
  • bin/targets/mediatek/32/lede-mediatek-32-bananapi,bpi-r2-sysupgrade.tar:

    This is for runtime upgrade, copy it to R2 board which is running OpenWrt system(no matter where(SD or EMMC) it boots from), and then run command “sysupgrade lede-mediatek-32-bananapi,bpi-r2-sysupgrade.tar” to update both kernel and rootfs.

    Note1: sysupgrade can be executed when jffs2 file system is initialized completely, the log “jffs2_build_xattr_subsystem: complete building xattr subsystem” means the initialization of jffs2 file system is done.

    Note2: The images in Image link2 are compiled with hard-float, and you can install the userland package which is from online repositories.

Image link1(Without hard-float instructions)

Image link2(With hard-float instructions)

Supported Features

  1. Support WIFI module(package package/utils/wmt)
  2. Two pre-program image and one upgrade package are generated
  3. Add uboot package to this project(package/boot/uboot-mtk-bpi-r2)
  4. Two Ethernet interfaces and switch works
  5. Both PCIe0 and PCIe1 works
  6. sysupgrade tool is supported
  7. Both SATA interfaces works
  8. LUCI support(New)
    • Updating from web is supported, please use image lede-mediatek-32-bananapi,bpi-r2-sysupgrade.tar
  9. If you use image from Image link 2, installing a userland package from online repositories is supported.


  1. Both HDMI and MIPI interface do NOT work
  2. PCIe2 (which is shared with USB3.0) does NOT work
  3. BT doesn’t work
  4. If you use image from Image link 1, installing package from online repository(opkg update/install) is not supported, the workaround is that please build the package you required by yourself.
  5. Don’t use the latest code of feeds. looks like they are unstable.

[OpenWrt(LEDE)] how to connect to wifi?
BPI-R2 OpenWrt(LEDE) Souce code : 2018-04-11
Which uboot to use
(Andriy Sementsov) #2

Thank you for new images, but I still does not have WIFI support :frowning:
There is no wlan0 iface((

I downloaded new image (from google-drive, saved as mtk-bpi-r2-EMMC_09-05-2018.img), then:

root@LEDE:~# dd if=mtk-bpi-r2-EMMC_09-05-2018.img of=/dev/mmcblk0 bs=1M
    69+1 records in
    69+1 records out
root@LEDE:~# reboot

booted from eMMC:

root@LEDE:/# cat /proc/version 
Linux version 4.9.44 (gary@gary-Latitude-E6430) (gcc version 5.4.0 (LEDE GCC 5.4.0 r4771-11c30cf) ) #0 SMP PREEMPT Fri Apr 13 13:46:33 2018

and no WIFI-interface ((

root@LEDE:/# ifconfig | grep -v "         " | grep -v '^$' |  awk '{print $1}'

If I want to compile image by myself, I got errors((
and I tries to use already compiled images…
Why I does not see any WIFI-Interfaces with your image? (last image has same problem for me) :roll_eyes: :disappointed_relieved: May be I have different onboard wifi on my BPI-R2?
What information I need provide to you?

Is necessary to make (from instruction):

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

if I have normal boot?.. (I makes Partition configuration changes last time when I has problem with booting from eMMC)

(Frank W.) #3

For wifi you have to do same steps as in other images (wmt_loader,stp_uart_launcher, echo 1)

(Andriy Sementsov) #4

Sorry @frank-w, but your answer is not informative;
echo 1
just print 1 in console; it’s obviously;

Please, if someone have some ask be sure that your answer have a fully recomendation for solve question/problem… or provide a link which contain information about same problem. Thank you!


echo 1

does NOT turning WIFI ON;

(Frank W.) #5


instead of A (for AP-Mode) echo 1 to the wmtWifi-device

(Andriy Sementsov) #6

Thank you for you link @frank-w :smiley::+1:

After commands:

stp_uart_launcher -p /etc/firmware &
echo 1 >/dev/wmtWifi
ifconfig wlan0 up

I got wlan0 interface;

root@LEDE:/# ifconfig | grep -v "         " | grep -v '^$' |  awk '{print $1}'

I’m happy!
Thank you very much! :kissing_heart:

(Frank W.) #7

if you get a client-connection with wlan0-device (you can not do AP-Mode with it) please send me the config, so i can add it to my wiki

have only used AP-Mode before

(Andriy Sementsov) #8

i make client mode via LUCI (long time ago for testing) on my current TP-Link router, but remove this mode;
I need to make AP like on my curent TP-Link… but not sure that be worked on BPI-R2.
my current configs (from TP-Link (MAC/KEYS edited):


root@cemen:/etc# cat /etc/config/network 
config interface 'loopback'
	option ifname 'lo'
	option proto 'static'
	option ipaddr ''
	option netmask ''

config interface 'lan'
	option type 'bridge'
	option proto 'static'
	option netmask ''
	option ip6assign '60'
	option _orig_ifname 'eth0.1 wlan0'
	option _orig_bridge 'true'
	option ipaddr ''
	option ifname 'eth0.1'
	option delegate '0'

config interface 'wan'
	option ifname 'eth0.2'
	option proto 'dhcp'
	option delegate '0'
	option macaddr 'XX:XX:XX:XX:XX:XX'

config switch
	option name 'switch0'
	option reset '1'
	option enable_vlan '1'

config switch_vlan
	option device 'switch0'
	option vlan '1'
	option ports '1 2 3 4 5t'

config switch_vlan
	option device 'switch0'
	option vlan '2'
	option ports '0 5t'


root@cemen:/etc# cat /etc/config/wireless 

config wifi-device 'radio0'
	option type 'mac80211'
	option hwmode '11g'
	option path 'platform/ath9k'
	option channel '4'
	option country 'UA'
	option distance '50'
	option txpower '20'
	option htmode 'HT20'

config wifi-iface
	option device 'radio0'
	option mode 'ap'
	option ssid 'CEMENT_WiFi'
	option wmm '0'
	option key 'WPA-PSK-KEY'
	option network 'lan'
	option wpa_disable_eapol_key_retries '1'
	option encryption 'psk2+ccmp'

and I do not try yet on BPI-R2 (wireless section).
But have question.
is the:

    option type 'mac80211'
	option hwmode '11g'
	option path 'platform/ath9k'

correct for BPI-R2 wifi module?
or which type hwmode path I need to use?

... tries to provide config section with Client-mode...

(Andriy Sementsov) #9

I can not use wireless interface on my BPI-R2, because I do not have driver (nl80211 or mac80211);
build.sh from @frank-w wiki returns many errors

new build.sh default select BPI-R2-720P and pack all boards
supported boards:

BPI-R2-720P configured. Now run `make`
This tool support following building mode(s):
	1. Build all, uboot and kernel and pack to download images.
	2. Build uboot only.
	3. Build kernel only.
	4. kernel configure.
	5. Pack the builds to target download image, this step must execute after u-boot,
	   kernel and rootfs build out
	6. update files for SD
	7. Clean all build.

 Now building...

make -C u-boot-mt mt7623_evb_config CROSS_COMPILE=arm-linux-gnueabihf- -j8
make[1]: Entering directory «/home/cemen/LEDE_09-05-2018/bpi_r2_mt76/u-boot-mt»
Configuring for mt7623_evb board...
make[1]: Leaving directory «/home/cemen/LEDE_09-05-2018/bpi_r2_mt76/u-boot-mt»
make -C u-boot-mt all CROSS_COMPILE=arm-linux-gnueabihf- -j8
make[1]: Entering directory «/home/cemen/LEDE_09-05-2018/bpi_r2_mt76/u-boot-mt»
  GEN     include/autoconf.mk.dep
  GEN     include/autoconf.mk
  CHK     include/config/uboot.release
  CHK     include/generated/version_autogenerated.h
  CHK     include/generated/timestamp_autogenerated.h
  UPD     include/generated/timestamp_autogenerated.h
  CC      lib/asm-offsets.s
  GEN     include/generated/generic-asm-offsets.h
  HOSTCC  tools/dumpimage.o
  HOSTCC  tools/image-host.o
  HOSTCC  tools/mkenvimage.o
  HOSTCC  tools/mkimage.o
  HOSTLD  tools/mkenvimage
  HOSTLD  tools/dumpimage
  HOSTLD  tools/mkimage
  CC      board/mediatek/common/mtk_cmd.o
  CC      arch/arm/cpu/armv7/cache_v7.o
  AS      arch/arm/lib/crt0.o
  CC      disk/part.o
  LD      board/mediatek/common/built-in.o
  CC      board/mediatek/mt7623_evb/mt7623_evb.o
  CC      arch/arm/cpu/armv7/mt7623/init.o
  CC      common/main.o
scripts/Makefile.build:335: recipe for target «common/main.o» failed
Makefile:981: recipe for target «common» failed
  CC      arch/arm/cpu/armv7/cpu.o
  CC      disk/part_dos.o
  CC      arch/arm/cpu/armv7/mt7623/reset.o
  LD      disk/built-in.o
  CC      arch/arm/lib/board.o
  LD      arch/arm/cpu/armv7/mt7623/built-in.o
scripts/Makefile.build:335: recipe for target «arch/arm/lib/board.o» failed
Makefile:981: recipe for target «arch/arm/lib» failed
  CC      board/mediatek/mt7623_evb/uart.o
  CC      arch/arm/cpu/armv7/syslib.o
  CC      drivers/flash/mtk_nor.o
  CC      board/mediatek/mt7623_evb/mtk_wdt.o
  AS      arch/arm/cpu/armv7/start.o
  CC      drivers/pcmcia/rpx_pcmcia.o
  LD      arch/arm/cpu/armv7/built-in.o
  LD      drivers/flash/built-in.o
  LD      board/mediatek/mt7623_evb/built-in.o
  CC      drivers/rtc/date.o
  LD      drivers/rtc/built-in.o
  CC      drivers/pcmcia/tqm8xx_pcmcia.o
  LD      drivers/pcmcia/built-in.o
  LD      drivers/built-in.o
make[1]: Leaving directory «/home/cemen/LEDE_09-05-2018/bpi_r2_mt76/u-boot-mt»
Makefile:40: recipe for target «u-boot» failed

 Build failed!

(Frank W.) #10

which codebase do you try to build? menu looks like Kernel 4.4…

(victors) #11

I’m interested in whether the support is planned PCIe2 and USB3.0

(gary) #12

Both USB3.0 is working fine, but PCIe2 doen’t work, we have a patch to fix, but this will cause one USB3.0 to be unavailable, also on standard R2 board, there is no mPCIe slot for PCIe2.

Thanks Gary

(victors) #13

Then everything is ok. I just thought that USB3 does not work.


make[7]: *** No rule to make target ‘…/extensions/libext.a’, needed by ‘xtables-compat-multi’. Stop. make[7]: Leaving directory ‘/home/***/bpi-r2_lede/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_32/iptables-1.6.1/iptables’ Makefile:524: recipe for target ‘all’ failed make[6]: *** [all] Error 2

Found a Patch, testing…

(Andriy Sementsov) #15

Can someone ask…
After clonning new image your OpenWRT works normally or not?
Any packages which I want to install does not work… any PACKAGES

for example tries to install git:

root@LEDE:~/scripts# opkg list-installed git
root@LEDE:~/scripts# opkg update
Downloading http://downloads.lede-project.org/snapshots/targets/mediatek/32/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/reboot_core
Downloading http://downloads.lede-project.org/snapshots/targets/mediatek/32/packages/Packages.sig
Signature check passed.
Downloading http://downloads.lede-project.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/base/Packages.gz
Updated list of available packages in /var/opkg-lists/reboot_base
Downloading http://downloads.lede-project.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/base/Packages.sig
Signature check passed.
Downloading http://downloads.lede-project.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/luci/Packages.gz
Updated list of available packages in /var/opkg-lists/reboot_luci
Downloading http://downloads.lede-project.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/luci/Packages.sig
Signature check passed.
Downloading http://downloads.lede-project.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/packages/Packages.gz
Updated list of available packages in /var/opkg-lists/reboot_packages
Downloading http://downloads.lede-project.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/packages/Packages.sig
Signature check passed.
Downloading http://downloads.lede-project.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/routing/Packages.gz
Updated list of available packages in /var/opkg-lists/reboot_routing
Downloading http://downloads.lede-project.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/routing/Packages.sig
Signature check passed.
Downloading http://downloads.lede-project.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/telephony/Packages.gz
Updated list of available packages in /var/opkg-lists/reboot_telephony
Downloading http://downloads.lede-project.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/telephony/Packages.sig
Signature check passed.
root@LEDE:~/scripts# opkg install git
Installing git (2.16.3-1) to root...
Downloading http://downloads.lede-project.org/snapshots/packages/arm_cortex-a7_neon-vfpv4/packages/git_2.16.3-1_arm_cortex-a7_neon-vfpv4.ipk
Multiple packages (libpthread and libpthread) providing same name marked HOLD or PREFER. Using latest.
Configuring git.
root@LEDE:~/scripts# opkg list-installed git
git - 2.16.3-1

Package added as binary…
And when I tries to run new package (git in expample), i got not found:

root@LEDE:~/scripts# git
-ash: git: not found
root@LEDE:~/scripts# which git
root@LEDE:~/scripts# ldd /usr/bin/git
        /lib/ld-musl-armhf.so.1 (0xb6eb4000)
        libz.so.1 => /usr/lib/libz.so.1 (0xb6e92000)
        libgcc_s.so.1 => /lib/libgcc_s.so.1 (0xb6e76000)
        libc.so => /lib/ld-musl-armhf.so.1 (0xb6eb4000)
root@LEDE:~/scripts# ls -l /usr/bin/git
-rwxr-xr-x    2 root     root       1601607 May 11 10:26 /usr/bin/git
root@LEDE:~/scripts# /usr/bin/git
-ash: /usr/bin/git: not found

for now I still have a BPI-R2 device that can not work correctly.
I am very disappointed((

I like OpenWRT, and I do not has a plans to use Raspbian(debian) on my BPI-R2

Is someone have properly workes new OpenWRT image??
(can you show succesfully installed package in expamle?)

Thank you!


Wifi should be avaible? What have I do to activate Wifi on luci?


Did you read this?

If you want to install other packages. You need to clone the code from github, use it to “make” package which you want.

(gary) #18

This is an known limitation, the packages in online repository are based on /lib/ld-musl-armhf.so.1, but the default setting of our openwrt project is based on /lib/ld-musl-arm.so.1. So we can NOT install the package from online reposiitory so far.

(Andriy Sementsov) #19

Thank you for your answer @garywang
Can I compile packages on my Ubuntu PC and install they locally on BPI-R2?

(gary) #20

Yes, you can.

Copy the file config (http://forum.banana-pi.org/uploads/default/original/2X/a/ac5af12a99a94655e57e17685e66173e02d4ad92) to openwrt project root directory, and rename it as .config, and then run command “make menuconfig” to select the package you want, and run command make to build them.