[BPI-R4] Debian 11 with basic router modules

Hi,

I recently acquired a BPI-R4 and encountered some issues while trying to use it properly. First, I downloaded the Debian 11 image with Linux version 6.1, as found in the wiki: Banana Pi BPI-R4 - Banana Pi Wiki I then transferred it onto an SD card and inserted the SD card into the BananaPi-R4. In this case, it seems that I cannot use the SFP ports eth2 and eth1.

Secondly, I made an other test. I downloaded the Debian 11 image with Linux version 5.4, as found in the wiki: Banana Pi BPI-R4 - Banana Pi Wiki I succed in using SFP ports but there is no module installed allowing me to use openvpn or wireguard.

When I try to start openvpn, I get those logs :

Apr  3 14:33:35 LB-BURST ovpn-LB_BURST[54921]: ERROR: Cannot open TUN/TAP dev /dev/net/tun: No such file or directory (errno=2)
Apr  3 14:33:35 LB-BURST ovpn-LB_BURST[54921]: Exiting due to fatal error
Apr  3 14:33:35 LB-BURST systemd[1]: openvpn@LB_BURST.service: Main process exited, code=exited, status=1/FAILURE
Apr  3 14:33:35 LB-BURST systemd[1]: openvpn@LB_BURST.service: Failed with result 'exit-code'.

So Finally, I’m trying to find a way to add the modules :

CONFIG_TUN=m
CONFIG_WIREGUARD=m

I have copied the BPI-R4-bsp-5.4-main.zip file to the BPI-R4 as found in the wiki : Banana Pi BPI-R4 - Banana Pi Wiki

unzip BPI-R4-bsp-5.4-main.zip -d /usr/src/
cd /usr/src/BPI-R4-bsp-5.4-main
./build.sh

I chose option 4 to find the modules and place “M” in the corresponding cases, then executed ./build.sh again and selected option 3.

 [...]
  CHK     include/generated/compile.h
  OBJCOPY arch/arm64/boot/Image
arch/arm64/boot/mkimage -E -B 0x1000 -p 0x1000 -f arch/arm64/boot/bpi_script arch/arm64/boot/uImage
arch/arm64/boot/mkimage: 1: Syntax error: "(" unexpected
make[2]: *** [arch/arm64/boot/Makefile:23 : arch/arm64/boot/Image] Erreur 2
make[2]: *** Suppression du fichier « arch/arm64/boot/Image »
make[1]: *** [arch/arm64/Makefile:142 : Image] Erreur 2
make[1] : on quitte le répertoire « /usr/src/BPI-R4-bsp-5.4-main/linux-mt »
make: *** [Makefile:76 : kernel] Erreur 2

 Build success!

I received errors, but it’s saying that it’s a success. Could I get some help?

I am not sure if I really have to compile just to have a Debian 11 with the basic gateway/router modules. If I have to do it, could I get a notice or a tutorial to do it, please?

Thanks for your help.

Balou

You can use my debian image as base

And use up2date linux kernel from my repo…not yet all supported,but imho better than outdated kernel which is not compilable with newer compile tools

Thank you for your response. We succeeded in making the compilation, but it seems that the SFP ports cannot be used with your version… Is that normal ?

they should work, but it depends on the sfp you use…maybe a quirk or additional phy driver is needed…and the mac must be set to up (by default down as not defined in my systemd-network-config)

so a bit more information would be needed (at least “dmesg | grep -i sfp”, “ip a”, “ethtool eth1/eth2”, same with -m switch, maybe i2cdetect/i2cdump commands later for the sfp-busses)

Did You tried to build image with omv?

Seems you can install omv in debian

https://wiki.omv-extras.org/doku.php?id=omv6:raspberry_pi_install#install_omv

Finnaly, I made a recompilation from your source and add the Marvells Phy Drivers during the ./buildsh config. It looks to work.

I have not use omv to build image. I used the tutorial send by Franck. I was blocked because the size of the image was just a little bit larger than the 8GB SD Card. But I finally succeed to resize the image via the mac disk utility app.

I still have questions :

  • How can I put the image I made on emmc ?
  • What represent this interface ?

ip a

[...]
2: sit0@NONE: <NOARP> mtu 1480 qdisc noop state DOWN group default qlen 1000
    link/sit 0.0.0.0 brd 0.0.0.0
[...]

Thanks for your help.

Thats strange because i made the image only 7456 mb :stuck_out_tongue:

The sit interface is created by debian/linux by default

Ok ! Thanks for those informations. And do you know how to flash image into emmc ?

same as on r3, booting from nand (with emmc active) and then flashing sdcard image, then overwriting fip and writing bl2 to boot0

I succeed with a openwrt image but not with my image. Is the BPI-R4 bl2_emmc-r4.img need to be different for my image ? Or I can use this one ? (found in the openwrt section of the wiki).

So, I am at the last step, flashing EMMC from NAND. There is no errors when I follow this tuto : Getting Started with BPI-R3 - Banana Pi Wiki but when I’m booting from emmc, see what I have :

F0: 102B 0000
FA: 1042 0000
FA: 1042 0000 [0200]
F9: 1041 0000
F3: 1006 0033 [0200]
F3: 4001 00E0 [0200]
F3: 0000 0000
V0: 0000 0000 [0001]
00: 0000 0000
BP: 0600 0041 [0000]
G0: 1190 0000
EC: 0000 0000 [2000]
MK: 0000 0000 [0000]
T0: 0000 01F6 [0101]
Jump to BL

NOTICE:  WDT: Cold boot
NOTICE:  WDT: disabled
NOTICE:  Unexpected CPU frequency measured
NOTICE:  CPU: MT7988 (1500MHz)
NOTICE:  EMI: Using DDR unknown settings
NOTICE:  EMI: Detected DRAM size: 4096 MB
NOTICE:  EMI: complex R/W mem test passed
NOTICE:  BL2: v2.9(release):
NOTICE:  BL2: Built : 09:52:16, Jun  9 2023
ERROR:   BL2: Failed to load image id 3 (-2)

It looks like I have not the right BL2_emmc.img… But where can I find it ?

If you use the emmc.img from my uboot repo you have to use also the bl2 from there…bl2 from openwrt searches fip in a ubi partition where my bl2 uses mediatek way with the fip gpt partition

I do not understand where is your bl2… I have generated the image from your repo this way :

git clone -b 6.8-dango https://github.com/frank-w/BPI-Router-Linux.git
apt install build-essential libncurses-dev bison flex libssl-dev libelf-dev bc u-boot-tools make bc gcc libc6-dev ccache
cd BPI-Router-Linux
./build.sh importconfig
./build.sh config
./build.sh
option 1 Pack

cd ..
git clone https://github.com/frank-w/BPI-Router-Images
apt-get install python3 parted qemu-user-static debootstrap binfmt-support -y
cd BPI-Router-Images
cp /root/SD/bpi-r4_6.8.0-rc3-dango.tar.gz .

vi sourcefiles_bpi-r4.conf 
	imgfile=bpi-r4_sdmmc.img.gz
	skipkerneldownload=1
	kernelfile=bpi-r4_6.8.0-rc3-dango.tar.gz 

./buildimg.sh bpi-r4 bookworm

That generate : bpi-r4_bookworm_6.8.0-rc3-dango.img and I use it to flash the SD card. But there is not a bl2.img file generated with it.

the image you generated is for sdmmc :wink:

but it uses the related files from my uboot github repo (seem imgfile)

for emmc you have to replace fip (partition 4) and use bl2 (to be put in boot0) from same source

there you should have all files needed :wink:

Ok I downloaded your files:

  • bpi-r4_emmc.img.gz
  • bpi-r4_emmc_bl2.img
  • bpi-r4_emmc_fip.bin

I put them into an USB key, untar the gz one. I start in NAND mode and put the USB key into the banana.

Then I have done :

echo 0 > /sys/block/mmcblk0boot0/force_ro
dd if=bpi-r4_emmc_bl2.img of=/dev/mmcblk0boot0
480+1 records in
480+1 records out

dd if=bpi-r4_emmc.img of=/dev/mmcblk0
15269888+0 records in
15269888+0 records out

dd if=bpi-r4_emmc_fip.bin of=/dev/mmcblk0p4
546+1 records in
546+1 records out

mmc bootpart enable 1 1 /dev/mmcblk0

Finally, switchig to emmc, try to boot and nothing…

## Error: "initrd" not defined
EXT_CSD[179], PARTITION_CONFIG:
BOOT_ACK: 0x1
BOOT_PARTITION_ENABLE: 0x1
PARTITION_ACCESS: 0x0
emmc available
bootconf=#conf-emmc
fit=bpi-r4.itb
Failed to load 'bpi-r4.itb'
BPI-R4> 

I am desperate…

You are in uboot, so far so good

You have a partition5 with a bpi-r4.itb? The emmc image on the uboot-repo already contains fip for emmc,but no rootfs and no kernel…it is the base image my images repo uses to add rootfs and kernel.

So first flash your generated sdmmc image to userpartition (no mmc partconf needed now as you have bl2 already flashed). And then flash fip image to part 4.

Alternative you can tar contents of p5 and p6 from sdmmc to emmc. But this needs an initrd as you need running linux (uboot cannot unpack tar and write files) and you cannot have sdmmc and emmc simultanously.

How does debian perform on bpi r4?

What do you mean exactly? Debian is a userspace…performance is mainly based on kernel and settings done. Userspace is more a toolbox to do these settings.

We still have not rss/lro working. Wifi is making good steps.