The Banana Pi R4 is an open-source smart router. You can use it for networking jobs, as you will tell from the specs on the hardware.
Keep in mind that this Single Board Computer (SBC) may be small, but it is powerful, especially when dealing with networking over any type of connection.
Banana Pi R4 Specs
The main specs are:
Also, note that there is no HDMI connection. This is a headless system that you need to SSH or RDP into. There is also a connection for a USB serial connection.
NOTE: The USB-C connector does not support graphics, so no USB-C to HDMI cable will work.
You can see the front of the R4 in Figure 1 and the back of it in Figure 2.
FIGURE 1
FIGURE 2
The board has ports for connectivity of all kinds and connections for adding NVMe drives.
This is a board to build into a nice little system. Any device that can be useful on a network is what the board has. You can create a NAS, network monitor or anything else you can think of to make.
Initially, I thought it would not work well for me since it had no HDMI port. But this was not the case. I found out you can SSH into the board, or even use a USB to serial connector. We can get into that in a bit; let's look at getting an image to boot the board.
Linux Images
If you go to the website 'https://wiki.banana-pi.org/Banana_Pi_BPI-R4#Release_image'. You can see the list of Operating Systems you can download for the Banana Pi R4.
At the time of the writing of this article, the list is:
After you flash the SD card, you can insert it in the Banana Pi SBC and power it up. A red light should come on to show the board has power. After a bit of time, the system should start booting from the SD Card and a blue light should come on as well.
NOTE: On the side of the board, as shown in Figure 3, there are two switches. In the down position, they are 'on' (1), and in the up position, they are 'off' (0). These specify the boot method:
FIGURE 3
On my board, I used Ubuntu 24.04 Server on the SD Card and set both switches to down (1).
USB to Serial Connection
Next to the USB-C connector, there are 3 pins that are marked as 'G', 'RX' and 'TX'. This is the connection to the Universal Asynchronous Receiver Transmitter (UART) Chip (CP2102). So, to use this, you need a CP2102 USB to TTL Serial Converter, like the one pictured in Figure 4.
FIGURE 4
You can see on the module, there are five connection pins. They are '3V3', 'TXD', 'RXD', 'GND' and '+5V'. With the cable that comes with the module, you need to connect only three pins. The connections are:
You'll configure the software exactly like an old modem, as we will see momentarily.
Connect the Serial Converter as noted, and on the Host system, you need to open a terminal.
From the terminal, you will need to install the program 'minicom', as follows on Ubuntu:
After we install the app, we need to determine the connection port for the USB Serial Converter, so run the command:
You should get a response similar to that shown in Figure 5. The port we want is '/dev/ttyUSB0'.
FIGURE 5
So, the port we will configure the software to is 'ttyUSB0', so to do this, you need to run the command to configure the 'minicom' app:
A screen, like Figure 6, should appear with the menu as shown, and you need to choose 'Serial Port Setup'.
FIGURE 6
Now, you’ll see a menu similar to Figure 7. Here, you need to change the option for 'Serial Device' from '/dev/modem' to the serial converter you got from the 'dmesg' command. In my example, the port is '/dev/ttyUSB0'.
FIGURE 7
You can press the Escape key to go back one menu. Select 'Save setup as dfl' to save your configuration. You can now exit the 'minicom' setup by selecting 'Exit from Minicom'.
Now, you can simply use the following to start the connection:
You should get a screen that resembles an SSH terminal. To log in to the Banana Pi OS, the username and password for the Ubuntu Server image are:
Once connected by either method, you can update the OS:
NOTE: To exit 'minicom', you need to press CTRL+A, then 'x'. Then, select 'Yes' to exit.
Flash NAND
There is an onboard NAND chip that is 128 MB in size. If you have an image that is 128 MB or less, you can place it on the NAND and boot from it.
The image is found on the site 'https://docs.banana-pi.org/en/BPI-R4/BananaPi_BPI-R4' and search for the section for 'OpenWRT MTK MP4.1 wifi SDK wifi driver for BE14000 Wifi Card'. Just below this are two links for the images you need. The first is for the Baidu Cloud, and the second is Google Drive. Once you select one of these, you’ll see a file similar to 'mtk-bpi-r4-MP4_1-NAND-20241216.img'. The date or version number may change, but it should be the one you need with 'NAND' in the title.
Boot from an SD Card (SD), setting the switches accordingly. Place the image onto a USB flash drive. If it doesn't auto-mount, then you'll need to mount it to access it. Keep in mind that all the commands you give are done through the serial or SSH.
To mount the USB device, use the commands:
Use the command 'dd' to copy the image to the NAND (/dev/mtdblock0). You may need to verify the device name with the command 'lsblk'. The command should be something like:
This is assuming the image is in the current folder of the Present Working Directory (PWD). Replace the filename if it is different. When you run 'lsblk', make sure the NAND device name is in the 'of=' parameter.
Once the copy is done, you can change the switches accordingly to boot from the NAND and reboot the board, and it will boot from NAND into an OpenWRT OS.
NVMe as Root
On my Banana Pi R4, I placed an NVMe (M.2 2280) that is 1 TB on the bottom of the R4.
I then booted from an SD card in Ubuntu. The entire Ubuntu image is on and running from the SD card. If you run the command 'lsblk', you should see the following two partitions and mount point:
So, to fix this, we will move the root partition to be on the NVMe device. You can install 'cfdisk' with the command:
After this is complete, we can set the partition on the NVMe and format it. On my NVMe, I am going to remove all existing partitions and format it as EXT4.
Use the following command to start the partition program on the NVMe drive:
Use the program to remove the existing partitions, or however you want to manage this process. Once it completes, write the changes, and exit 'cfdisk'. Go back in with the same command. Set a new partition of whatever size you desire. Set the 'Type' as 'Linux File System'. Write the changes and exit 'cfdisk'.
Now, you need to format the partition as 'ext4' with the command:
Be sure that if your naming is different that you change it accordingly.
The partition should now be 'ext4' and ready to copy information to it from the SD card.
If we plan on making it the Root partition, then we need to copy over the data from the existing Root partition on the SD Card. Use the following command to copy data over:
This should copy all files and folders from the Root Partition (/.) to the folder we mounted at'/mnt/test/'.
Once the copy is done, we need to change a file on the Boot Partition of the SD Card. The Boot Partition is at '/dev/mmcblk0p5'. We can get to it in the folder '/boot' since it is mounted at that folder.
So you need to edit a file named 'uEnv.txt', which is part of the U-Boot system. You can use the command:
There is a line that is:
Change this line to:
Again, if your naming convention is different, then change it accordingly.
The line below it, 'rootopts', shows that the format is 'ext4', so if you use a different format, then you need to change this as well.
Save the file and exit the editor.
Now you can reboot the system. Once the system reloads, and you log into it, then you can run 'lsblk' and see that the mount point for the Root Partition is now the NVMe drive.
The system should be a little faster since the Root partition with all the packages is now on an NVMe and not the SD Card. The SD Card is usable for booting the system, but not used for anything else. If you wanted, you could make a backup of the SD card in case something should happen to it.
Conclusion
This is the basics of the Banana Pi R4. I know there is a lot of information here just for setting up the board.
I usually go over doing something with the board, and I plan on doing that in another article.
Keep in mind that this Single Board Computer (SBC) may be small, but it is powerful, especially when dealing with networking over any type of connection.
Banana Pi R4 Specs
The main specs are:
- MediaTek MT7988A (Filogic 880) quad-core Arm Cortex-A73, 1.8GHz processor
- 4 GB/8 GB DDR4
- 8 GB eMMC flash
- 128MB SPI-NAND Flash
- Micro SD card slot
- 2x 10 Gbe SFP slots
- 4x Gbe network port
- 1x USB 3.2 slot
- 3x SIM Slots (4G/5G)
- 1x M.2 KEY-B slot with USB 3.2/PCIe 3.0 interface for 5G
- 1x M.2 KEY-M slot with PCIe 3.0 - 1 lane interface for NVMe SSD
- 2x miniPCIe slots with PCIe 3.0 - 2 lane interface for Wi-Fi 6/7 NIC
- 26-PIN GPIO Header for expanding applications
Also, note that there is no HDMI connection. This is a headless system that you need to SSH or RDP into. There is also a connection for a USB serial connection.
NOTE: The USB-C connector does not support graphics, so no USB-C to HDMI cable will work.
You can see the front of the R4 in Figure 1 and the back of it in Figure 2.
FIGURE 1
FIGURE 2
The board has ports for connectivity of all kinds and connections for adding NVMe drives.
This is a board to build into a nice little system. Any device that can be useful on a network is what the board has. You can create a NAS, network monitor or anything else you can think of to make.
Initially, I thought it would not work well for me since it had no HDMI port. But this was not the case. I found out you can SSH into the board, or even use a USB to serial connector. We can get into that in a bit; let's look at getting an image to boot the board.
Linux Images
If you go to the website 'https://wiki.banana-pi.org/Banana_Pi_BPI-R4#Release_image'. You can see the list of Operating Systems you can download for the Banana Pi R4.
At the time of the writing of this article, the list is:
- OpenWRT
- 3.0
- 3.1
- 4.0
- Debian
- 11
- 12
- Ubuntu
- 22.04
- 24.04
After you flash the SD card, you can insert it in the Banana Pi SBC and power it up. A red light should come on to show the board has power. After a bit of time, the system should start booting from the SD Card and a blue light should come on as well.
NOTE: On the side of the board, as shown in Figure 3, there are two switches. In the down position, they are 'on' (1), and in the up position, they are 'off' (0). These specify the boot method:
- 11SD Card
- 10eMMC
- 01NAND (USB)
FIGURE 3
On my board, I used Ubuntu 24.04 Server on the SD Card and set both switches to down (1).
USB to Serial Connection
Next to the USB-C connector, there are 3 pins that are marked as 'G', 'RX' and 'TX'. This is the connection to the Universal Asynchronous Receiver Transmitter (UART) Chip (CP2102). So, to use this, you need a CP2102 USB to TTL Serial Converter, like the one pictured in Figure 4.
FIGURE 4
You can see on the module, there are five connection pins. They are '3V3', 'TXD', 'RXD', 'GND' and '+5V'. With the cable that comes with the module, you need to connect only three pins. The connections are:
- GND - G
- TXD - RX
- RXD - TX
You'll configure the software exactly like an old modem, as we will see momentarily.
Connect the Serial Converter as noted, and on the Host system, you need to open a terminal.
From the terminal, you will need to install the program 'minicom', as follows on Ubuntu:
Code:
sudo apt install minicom
After we install the app, we need to determine the connection port for the USB Serial Converter, so run the command:
Code:
sudo dmesg | grep tty
You should get a response similar to that shown in Figure 5. The port we want is '/dev/ttyUSB0'.
FIGURE 5
So, the port we will configure the software to is 'ttyUSB0', so to do this, you need to run the command to configure the 'minicom' app:
Code:
sudo minicom -s
A screen, like Figure 6, should appear with the menu as shown, and you need to choose 'Serial Port Setup'.
FIGURE 6
Now, you’ll see a menu similar to Figure 7. Here, you need to change the option for 'Serial Device' from '/dev/modem' to the serial converter you got from the 'dmesg' command. In my example, the port is '/dev/ttyUSB0'.
FIGURE 7
You can press the Escape key to go back one menu. Select 'Save setup as dfl' to save your configuration. You can now exit the 'minicom' setup by selecting 'Exit from Minicom'.
Now, you can simply use the following to start the connection:
Code:
sudo minicom
You should get a screen that resembles an SSH terminal. To log in to the Banana Pi OS, the username and password for the Ubuntu Server image are:
- Username: root
- Password: bananapi
Once connected by either method, you can update the OS:
Code:
apt update
apt upgrade -y
NOTE: To exit 'minicom', you need to press CTRL+A, then 'x'. Then, select 'Yes' to exit.
Flash NAND
There is an onboard NAND chip that is 128 MB in size. If you have an image that is 128 MB or less, you can place it on the NAND and boot from it.
The image is found on the site 'https://docs.banana-pi.org/en/BPI-R4/BananaPi_BPI-R4' and search for the section for 'OpenWRT MTK MP4.1 wifi SDK wifi driver for BE14000 Wifi Card'. Just below this are two links for the images you need. The first is for the Baidu Cloud, and the second is Google Drive. Once you select one of these, you’ll see a file similar to 'mtk-bpi-r4-MP4_1-NAND-20241216.img'. The date or version number may change, but it should be the one you need with 'NAND' in the title.
Boot from an SD Card (SD), setting the switches accordingly. Place the image onto a USB flash drive. If it doesn't auto-mount, then you'll need to mount it to access it. Keep in mind that all the commands you give are done through the serial or SSH.
To mount the USB device, use the commands:
Code:
mkdir /mnt/test
mount /dev/sda1 /mnt/test
cd /mnt/test
Use the command 'dd' to copy the image to the NAND (/dev/mtdblock0). You may need to verify the device name with the command 'lsblk'. The command should be something like:
Code:
sudo dd if=mtk-bpi-r4-MP4_1-NAND-20241216.img of=/dev/mtdblock0 bs=4M status=progress
This is assuming the image is in the current folder of the Present Working Directory (PWD). Replace the filename if it is different. When you run 'lsblk', make sure the NAND device name is in the 'of=' parameter.
Once the copy is done, you can change the switches accordingly to boot from the NAND and reboot the board, and it will boot from NAND into an OpenWRT OS.
NVMe as Root
On my Banana Pi R4, I placed an NVMe (M.2 2280) that is 1 TB on the bottom of the R4.
I then booted from an SD card in Ubuntu. The entire Ubuntu image is on and running from the SD card. If you run the command 'lsblk', you should see the following two partitions and mount point:
- mmcblk0p5 /boot
- mmcblk0p6 /
So, to fix this, we will move the root partition to be on the NVMe device. You can install 'cfdisk' with the command:
Code:
apt install fdisk -y
After this is complete, we can set the partition on the NVMe and format it. On my NVMe, I am going to remove all existing partitions and format it as EXT4.
Use the following command to start the partition program on the NVMe drive:
Code:
cfdisk /dev/nvme0n1
Use the program to remove the existing partitions, or however you want to manage this process. Once it completes, write the changes, and exit 'cfdisk'. Go back in with the same command. Set a new partition of whatever size you desire. Set the 'Type' as 'Linux File System'. Write the changes and exit 'cfdisk'.
Now, you need to format the partition as 'ext4' with the command:
Code:
mkfs.ext4 /dev/nvme0n1p1
Be sure that if your naming is different that you change it accordingly.
The partition should now be 'ext4' and ready to copy information to it from the SD card.
If we plan on making it the Root partition, then we need to copy over the data from the existing Root partition on the SD Card. Use the following command to copy data over:
Code:
cp -ax /. /mnt/test/
This should copy all files and folders from the Root Partition (/.) to the folder we mounted at'/mnt/test/'.
Once the copy is done, we need to change a file on the Boot Partition of the SD Card. The Boot Partition is at '/dev/mmcblk0p5'. We can get to it in the folder '/boot' since it is mounted at that folder.
So you need to edit a file named 'uEnv.txt', which is part of the U-Boot system. You can use the command:
Code:
nano /boot/bananapi/bpi-r4/linux-5.4/uEnv.txt
There is a line that is:
Code:
root=/dev/mmcblk0p6
Change this line to:
Code:
root=/dev/nvme0n1p1
Again, if your naming convention is different, then change it accordingly.
The line below it, 'rootopts', shows that the format is 'ext4', so if you use a different format, then you need to change this as well.
Save the file and exit the editor.
Now you can reboot the system. Once the system reloads, and you log into it, then you can run 'lsblk' and see that the mount point for the Root Partition is now the NVMe drive.
The system should be a little faster since the Root partition with all the packages is now on an NVMe and not the SD Card. The SD Card is usable for booting the system, but not used for anything else. If you wanted, you could make a backup of the SD card in case something should happen to it.
Conclusion
This is the basics of the Banana Pi R4. I know there is a lot of information here just for setting up the board.
I usually go over doing something with the board, and I plan on doing that in another article.

