BPI R2 LEDE(openwrt) source code

Hi Pkalemba

Please don’t use the mtk-bpi-r2-SD.img, we are trying to bundle preloader/uboot/kernel/root file system as an image, but it’s not ready. Sorry for this.


i did an fresh clone

but there ist no branch bpi-r2-on-lede-v1


strange online there is that branch…have you defined any options for git to get only the master branch?

Garys repo has newer code…

hi there are no options set at git , it is a fresh install debian ( devuan ) system just for bpi r2 source code compile

ithe is no .git at all.

in my browser i see the diffrent branch bt i i do the git clone with https i get only the master branch

so [update]

i did an

git branch -a ( got )

  • master remotes/origin/HEAD -> origin/master remotes/origin/bpi-r2-on-lede-v1 remotes/origin/lede-17.01 remotes/origin/master


git checkout remotes/origin/bpi-r2-on-lede-v1 git pull https://github.com/garywangcn/bpi-r2_lede.git bpi-r2-on-lede-v1 git checkout bpi-r2-on-lede-v1

i start the make




make fails with

  • ROOTFS_FILE=/home/glaess/bpi-r2_lede/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_32/root.squashfs
  • BS=1024
  • dd bs=1024 if=/home/glaess/bpi-r2_lede/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/image/mtk-bpi-r2-preloader-sd.bin of=/home/glaess/bpi-r2_lede/build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_32/mtk-bpi-r2-SD.img seek=0 dd: failed to open ‘/home/glaess/bpi-r2_lede/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/image/mtk-bpi-r2-preloader-sd.bin’: No such file or directory Makefile:12: recipe for target ‘install-images’ failed make[5]: *** [install-images] Error 1 make[5]: Leaving directory ‘/home/glaess/bpi-r2_lede/target/linux/mediatek/image’ Makefile:21: recipe for target ‘install’ failed make[4]: *** [install] Error 2 make[4]: Leaving directory ‘/home/glaess/bpi-r2_lede/target/linux/mediatek’ Makefile:13: recipe for target ‘install’ failed make[3]: *** [install] Error 2 make[3]: Leaving directory ‘/home/glaess/bpi-r2_lede/target/linux’ target/Makefile:23: recipe for target ‘target/linux/install’ failed make[2]: *** [target/linux/install] Error 2 make[2]: Leaving directory ‘/home/glaess/bpi-r2_lede’ target/Makefile:19: recipe for target ‘/home/glaess/bpi-r2_lede/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/stamp/.target_install’ failed make[1]: *** [/home/glaess/bpi-r2_lede/staging_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/stamp/.target_install] Error 2 make[1]: Leaving directory ‘/home/glaess/bpi-r2_lede’ /home/glaess/bpi-r2_lede/include/toplevel.mk:207: recipe for target ‘world’ failed make: *** [world] Error 2


as gary said: do not use mtk-bpi-r2-preloader-sd.bin…

you can try to move back with

git checkout commit-id


e.g. using 51b0bac as commit-id

hi thanks for help

please be sorry for my missing knowledge about git .

i have to learn … about git and the bpi-r2



kernel build susccessful an bpi-r2 boots him but i miss the wifi interface.


Iassume you must start wifi driver with wmt-tools like in debian/ubuntu.

Please use the latest code, thanks.

Latest souce code of OpenWRT(LEDE)

source code(Please note that the branch is bpi-r2-on-lede-v1)

Configurion of LEDE

TARGET=MediaTek Ralink ARM Boot Loaders=u-boot-bpi_r2 (This option is mandatory) …

How to build

make -j1 V=s


when above steps is done, we will below two images under /build_dir/target-arm_cortex-a7+neon-vfpv4_musl_eabi/linux-mediatek_32/:

  • mtk-bpi-r2-EMMC.img
  • mtk-bpi-r2-SD.img

How to use SD image

A SD card is requried and then install mtk-bpi-r2-SD.img to SD card by running below command:

dd if=mtk-bpi-r2-SD.img of=/dev/sdb

where /dev/sdb is the SD card.

And then install the SD card to R2 board, power it on, the board will boot from SD card.

How to use EMMC image

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 on SD card
2. Program EMMC image to User Data Area of EMMC: dd if=mtk-bpi-r2-EMMC.img of=/dev/mmcblk0
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
6. Power off, remove SD card, and then power on R2 board.

Hello together,

i successfully flashed build Reboot (SNAPSHOT, r4768-b1d4a37) from @garywang to my Banana R2 board. Now i have some questions:

  1. Is it right that WAN Port isn’t working at the moment? (what is the reason / what is to do?)
  2. Is there a way to get Internet without the WAN port ?

Thank you a lot.

Greets Anton

The WAN and br-lan should be working fine, please follow below steps. I think we can get internet via br-lan or wireless, and so on, this depends on you purpose…


Please remove the configuration for lan and wan in /etc/config/network, and then add below lines in that file.

config interface 'lan'
      option type 'bridge'
      option ifname 'lan0 lan1 lan2 lan3'
      option proto 'dhcp'

config interface 'wan'
      option ifname 'wan'
      option proto 'dhcp'

Hey @garywang, I into bananpi r2 from last few hours. I am linux developer and would like to contribute to make better OpenWRT/LEDE functional on this board. Few points: What are you current working on? What I can do here for banana pi r2?

And by “Program preloader to EMMC boot0 block:” do you mean to replace current bootloader?

dmesg.txt (25,3 KB)

@garywang Hi Gary thank you for response. Can you please have a look to my kernel logs? I think i have a bigger problem. Thank you!

Greets Anton

do you see wan-port in “ip a”? in you dmesg there is no wan-port…have you connected a cable to it?

the obvious error is “Error: Driver ‘gpio-keys’ is already registered, aborting…”

i don’t know why the driver is loaded multiple times, but gpio itself failes on the first load

[    3.129754] mediatek-mt7623-pinctrl 1000b000.pinctrl: pin_config_group_set op failed for group 256
[    3.138696] gpio-keys gpio_keys: Error applying setting, reverse things back
[    3.145716] gpio-keys: probe of gpio_keys failed with error -22

maybe you can look in /etc/modules.d/ because of this:

[ 7.433808] kmodloader: loading kernel modules from /etc/modules.d/*

you can try “CONFIG_PINCTRL_MT2701=y” in kernel-config instead of “CONFIG_PINCTRL_MT7623”, maybe dts must be changed like this: https://github.com/frank-w/BPI-R2-4.14/blob/afd4925b8ee9c30ede9de1fe24191d2022157eea/arch/arm/boot/dts/mt7623.dtsi#L229 ( compatible = “mediatek,mt7623-pinctrl”,“mediatek,mt2701-pinctrl”; )

Thanks a lot Kishan. I’m working on supporting wireless on R2 board. And the HDMI and MIPI interface is not supported if we use OpenWRT/LEDE, do you want to focus on them?

For "Program preloader to EMMC boot0 block“, we need to copy preloader from EMMC IMAGE file to EMMC boot0 block, by default, there is no available preloader in EMMC boot0 block.

Hi Anton

I’ll try to fix the error “gpio-keys…”, I’d like to know what else problem did you encounter?

And you’re using old release of LEDE, can you please follow latest release: https://github.com/garywangcn/bpi-r2_lede/tree/bpi-r2-on-lede-v1.

Thanks Gary


Regarding wireless, OpenWRT uses backport drivers, from github I saw that you deleted mt74 Makefile, at first I thought it was by mistake, but now when I look at kernel config file it looks like you are enabling drivers from kernel itself, correct me if I’m wrong.

From my opinion this hack will create mess in future. I will also look for other things you mentioned but moreover I am interested in bringing up wireless as soon as possible. Let me know how are you proceeding for wireless.

@garywang as your master-branch isn’t your current “stable” version you should define the “bpi-r2-on-lede-v1”-branch as the default branch, so that one gets cloned…many users may not know that they must change branch before building it and so using the old version :slight_smile:

like i changed the default branch in my 4.14 (master is from torvalds/linux and my work goes to main) you can do it, maybe then there are less users using the wrong version