Banana pi bpi-r2 installation manual

I was able to install the original openwrt on this board.
The original kernel from the image builder does not find partitions on MTD devices and as a consequence does not start. To do this, you need to rebuild the kernel by changing bootloader options.

  1. Download the original openwrt sources from git according to this instruction
    https://openwrt.org/docs/guide-developer/build-system/use-buildsystem
  2. Configure it in the minimum configuration. We indicate the type of our board correctly.
    In order to use the original packages from the openwrt repository, you need to enable build the image builder. Also, in the Kernel modules section it is necessary to mark the necessary kernel modules, since the kernel we will have our own packages with modules from the repository will not fit.
    make menuconfig

    Next, you need to change the kernel configuration,
    make kernel_menuconfig
    See the Boot options section for a picture.

    My original kernel was constantly missing the network connection. The following patch solved the problem.
    The file must be saved in target / linux / mediatek / patches-4.19
diff -ur a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts
--- a/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts	2020-02-17 20:48:50.237176337 +0200
+++ b/arch/arm/boot/dts/mt7623n-bananapi-bpi-r2.dts	2020-02-17 20:53:24.700691493 +0200
@@ -111,7 +111,7 @@
 
 	memory@80000000 {
 		device_type = "memory";
-		reg = <0 0x80000000 0 0x80000000>;
+		reg = <0 0x80000000 0 0x40000000>;
 	};
 };

Now is the time to build a new image builder.
make -j4
after completion the built image builder will be in bin / targets / mediatek / mt7623 / openwrt-imagebuilder-mediatek-mt7623.Linux-x86_64.tar.xz

Get it
tar xJf openwrt-imagebuilder-mediatek-mt7623.Linux-x86_64.tar.xz
then it is necessary to replace the existing repositories.conf file with the same file from the original image builder in order to connect the original openwrt repositories
Build the firmware according to this instruction https://openwrt.org/docs/guide-user/additional-software/imagebuilder
Now the most interesting thing is the firmware.

  1. Download the bootloader, this requires an original firmware, such as this one
    https://drive.google.com/drive/folders/1J-1BmMXu-odVWMJNwPsXtaRaLIlGrj6r
    You need both files
    mkt-bpi-r2-SD.img and mtk-bpi-r2-EMMC.img
    Install the original firmware according to this instruction http://wiki.banana-pi.org/Getting_Started_with_R2#OpenWrt_On_SD_.26_Emmc_Steps see item 6.

After downloading from EMMC, it's time to upgrade the firmware to the newly built original openwrt. This will require two files from the folder with the image builder, the kernel
build_dir / target-arm_cortex-a7 + neon-vfpv4_musl_eabi / linux-mediatek_mt7623 / bpi_bananapi-r2-kernel.bin
and root file system build_dir / target-arm_cortex-a7 + neon-vfpv4_musl_eabi / linux-mediatek_mt7623 / root.squashfs
Write them on the board, for example in / tmp
we connect to the board on ssh and stitch them in EMMC
mtd write /tmp/bpi_bananapi-r2-kernel.bin kernel
mtd write /tmp/root.squashfs rootfs
We reboot the board and get the original one

 _______                     ________        __ 
|       |.-----.-----.-----.|  |  |  |.----.|  |_ 
|   -   ||  _  |  -__|     ||  |  |  ||   _||   _| 
|_______||   __|_____|__|__||________||__|  |____| 
         |__| W I R E L E S S   F R E E D O M 
----------------------------------------------------- 
OpenWrt SNAPSHOT, r12319-083eb80bf2 
-----------------------------------------------------
# df -hT 
Filesystem           Type            Size      Used Available Use% Mounted on 
/dev/root            squashfs       10.3M     10.3M         0 100% /rom 
tmpfs                tmpfs        1010.4M    548.0K   1009.9M   0% /tmp 
/dev/mtdblock7       jffs2         245.8M      5.8M    240.0M   2% /overlay 
overlayfs:/overlay   overlay       245.8M      5.8M    240.0M   2% / 
tmpfs                tmpfs         512.0K         0    512.0K   0% /dev 
/dev/sda             ext4          457.4G     26.5G    407.6G   6% /home/ftp

# lspci -k 
00:00.0 PCI bridge: MEDIATEK Corp. Device 0801 (rev 01) 
       Kernel driver in use: pcieport 
lspci: Unable to load libkmod resources: error -12 
00:01.0 PCI bridge: MEDIATEK Corp. Device 0801 (rev 01) 
       Kernel driver in use: pcieport 
01:00.0 Network controller: Qualcomm Atheros QCA9565 / AR9565 Wireless Network Adapter (rev 01) 
       Subsystem: Dell Device 020c 
       Kernel driver in use: ath9k 
02:00.0 IDE interface: ASMedia Technology Inc. ASM1061 SATA IDE Controller (rev 02) 
       Subsystem: ASMedia Technology Inc. Device 1060 
       Kernel driver in use: ahci

I builded the firmware with ahci and ath9k, everything works.
But the built-in wifi does not work, also there is no module for hwnat.
And to do this work, I highly recommend using a usb-serial adapter.

6 Likes

FYI - I have created the skeleton of a devicepage for the Banana Pi R2 in the OpenWrt wiki.

Feel free to add useful information regarding installation, configuration, etc.
In case of questions regarding how to fill in information into the devicepage, just give me a ping and I will try to help.

I'll try to write it there but my english is very bad .....

thanks for the guide. can you share the image file you made?

I wrote a little bit the install section.
Tomorrow I will add some photos of the real board and boot logs
How do I fix a table of unsupported features? really does not work hdmi
and built-in wifi

What package list do you need? My image is highly customized for my task

luci only and zapret dependencies (ipset, iptables-mod-conntrack-extra, iptables-mod-extra, iptables-mod-filter, iptables-mod-ipopt, iptables-mod-nfqueue, curl, gzip, grep)

Unsupported Functions is currently set to:
LAN ports, USB, HDMI

Please let me know how this string should look like, I can then update it for you.

please try it
https://vanessa.org.ua/files/OpenWrt/openwrt-bpi_bananapi-r2.tar.xz

WIFI, HDMI, HW NAT

That means LAN ports + USB are working now?

There is a 403 Forbidden error.

corrected, now works

I wrote it, will it be okay?
https://openwrt.org/toh/sinovoip/sinovoip_banana_pi_r2

Thank's for this precious guide.
Installing OpenWrt on my BPi-R2, I pass the fourth first steps (getting openwrt sources, configure,...), but the last time I follow the recipe - succesfully for the first time -, I forget the patch step.
So I have two questions :
1er) I suppose I must record the piece of code : "diff ... };" in a .patch file and place in openwrt/target/linux/mediatek/patches-4.19 directory. What name do I give at this file ?
2nd) As I build successfully the new image builder without the patch, how rebuild it with the patch? Have I to clean something?
I apologize for these questions, but I'm a newbie and it takes yet a lot of time to reach this point.

I named the file this way:
0239-memory.patch
For everything to work, do it

make clean && make -j4

The patch will be applied automatically

Thank you.
I got only 2 clean error msg :
/home/francis/Dvp/sources/openwrt/include/toplevel.mk:202: recipe for target 'clean' failed
make: *** [clean] Error 1 (near the beginning of make msg) and :
[1]+ Exit 2 make clean (at the end).
I got also this msg at the top beginning :
make[2]: *** No rule to make target '/home/francis/Dvp/sources/openwrt/tmp/info/.files-packageinfo-23412'. Stop.

But it seems to be good :

openwrt/bin/targets/mediatek/mt7623$ ls -al
...
-rw-r--r-- 1 francis francis 60479028 mar  2 18:55 openwrt-imagebuilder-mediatek-mt7623.Linux-x86_64.tar.xz
-rw-r--r-- 1 francis francis  4686726 mar  2 18:53 openwrt-mediatek-mt7623-bpi_bananapi-r2-initramfs-kernel.bin
-rw-r--r-- 1 francis francis     2432 mar  2 18:53 openwrt-mediatek-mt7623-bpi_bananapi-r2.manifest
-rw-r--r-- 1 francis francis  4981515 mar  2 18:53 openwrt-mediatek-mt7623-bpi_bananapi-r2-squashfs-sysupgrade.bin

I keep going on.

try it this way

make target/linux/clean

Work perfectly. No errors.
Change on size of openwrt-imagebuilder-mediatek-mt7623.Linux-x86_64.tar.xz:
openwrt/bin/targets/mediatek/mt7623$ ls -al *.tar.xz
-rw-r--r-- 1 francis francis 60469940 mar 2 22:13 openwrt-imagebuilder-mediatek-mt7623.Linux-x86_64.tar.xz
Thanks. I keep going on.

I pull the 19.07.2 tag and build it as the instruction above and all 4 lan ports not working......wan working fine, any one knows why? and the kernel version is 4.14,not 4.199

I have installed with the steps above. But it hangs after starting kernel as below. Do you have an idea what may be the problem?

##Booting kernel from Legacy Image at 84000000 ...
   Image Name:   ARM OpenWrt Linux-4.19.108
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    2722630 Bytes = 2.6 MiB
   Load Address: 80008000
   Entry Point:  80008000
   Verifying Checksum ... OK
   Loading Kernel Image ... OK

Starting kernel ...