How to Setup Banana Pi R3 with OpenWRT

Flow
6 min readApr 1, 2023

This guide is a mirror of: https://wiki.banana-pi.org/Getting_Started_with_BPI-R3, however best explained in a way that is clearer, hopefully.

This guide will install the onto the emmc (the onboard storage). There are 3 of them: the microSD, the NAND, and the EMMC. The fastest one is the storage that comes with the board so we will be setting the OpenWRT on that.

What you will need:

  • Windows Machine (PC)
  • Banana Pi R3
  • The USB TTL Attachment that hooks up to the Banana Pi R3. If you dont have one here is a link: https://www.amazon.com/dp/B00LODGRV8
  • Mobaxterm Program
  • MicroSD Card
  • NVME Drive (Yes you need this.)
You need this

Steps to Setup R3:

  1. Download the OpenWrt image for Banana Pi R3. The file name should be: openwrt-mediatek-filogic-bananapi_bpi-r3-sdcard.img.gz
  2. You must unzip/uncompress that file first. Use winrar or another program. The resulting file should be openwrt-mediatek-filogic-bananapi_bpi-r3-sdcard.img
  3. Flash the OpenWrt image onto the microsd card using Balenca Etcher or Raspberry Pi Imager. I used balenaetcher.

Only do this is you have issues flashing it to the microsd card. Open up CMD prompt as administrator.

Run these commands. Only run these commands if you are having trouble flashing:

diskpart
list disk
select disk 3
attributes disk clear readonly
clean
create partition primary
format fs=ntfs quick

It should look something like this. Note that I selected disk 3. Yours will be different. Make sure you select the correct disk number. You can tell which one it is by running list disk before and after you insert the microsd card in your computer.

4. Put the microsd card into the board. Connect the USB TTL wire to the R3 board. Connect the USB TTL head into your PC (windows PC). Do not plug in the power wire yet.

Important Note: The RX and TX wire is switched. So the pins that you put into the R3 is not the same that goes into the USB. So (GRND > GRND, RX >TX, and TX > RX). So make sure the RX and the TX wires are switched.

Make sure that jumper pins are all up. We need to be referencing the microSD card first.

Referencing SD Card

5. Install MobaXterm: https://mobaxterm.mobatek.net/download.html. This program will be able to go into the R3 the by USB.

6. Click on “Session > Serial > USB Serial CH340 > 150000”. Then click ok. So to recap, the USB should be connected to your PC (Windows PC) and the R3. The microSD card should be in the R3. The power should NOT be attached.

7. Now plug in the power cable.

8. You should see this screen:

If you do not see this screen, or if you see “Permission denied”, it means that the image flashed did not get flashed on the microsd card correctly (even if it says successful). Just flash it again.

9. If you get all the way to the bottom, with the OpenWRT sign, just type

reboot

10. Then you should be prompted to select an option. Select number 8, Install bootloader, recovery, and production to NAND. We need this so that we can have it on the NAND, then install it to the eMMC. The eMMC and microSD occupies the same chip thats why we have to do it this way.

When it is done installing, unplug the power.

11. Now, take out the microsd card and change the white jumper pins in this order.

Up, Down, Up, Down. This will have the R3 boot from NAND instead of microSd.

12. Replug the power plug back in. And type:

reboot

13. Then select number 9: Install bootloader, recovery, and production to eMMC.

14. When it is done installing. Unplug the power. Change the white jumper to this: Down, Up, Up, Down. This will boot up from the eMMC now.

Yay! You are done. But not quite. You got some extra configurations to do.

Make sure you unplug your modem and the R3 so that the DHCP info can be sent properly to your R3. I got stuck here for a whole day, not realizing to do that. Make sure the ethernet connection between the modem and into the WAN port of the R3 is there already. So unplug both power. Wait 30 seconds. Plug in the modem, then plug in the R3. You need to do this to ensure your modem and your new router has proper handshake.

If your ISP does not do DHCP, you will need to modify the /etc/config/network file. For the most part that should not be the case for you. You can figure that out based on your old router — if you forgot.

Setting Up OpenWRT Web User Interface

By default, the web ui is not installed with this version of banana pi R3 image. So we will need to setup and configure that. Make sure you have an ethernet connection from your R3 to your old router.

opkg update
opkg install luci

This may be different for you. So check this first to find out your ip address.

ifconfig

You will be able to find your router’s ip address from there. Most likely it will be 192.168.1.1.

You should be able to type that into your browser after all of this. Viola you are done!

Make sure to add security to your openwrt.

If you have not already created a password make sure you do.

passwd

Currently if you leave it as that, people can attempt to brute force ssh into your openwrt. So we will prevent that, by changing the port number and only allowing local network to ssh. So no external attempts

vi /etc/config/dropbear

Change it to this. Note that i changed the port to 50022, so when you ssh again in the future, remember to use port 50022. To edit for vi/vim, use “i” to enter into interface mode. Then click ESC, “:wq” to save.

config dropbear
option PasswordAuth 'on'
option RootPasswordAuth 'on'
option Port '50022'
option Interface 'lan'
# option BannerFile '/etc/banner'

Then type this to restart the dropbear so changes can take effect.

/etc/init.d/dropbear restart

Increasing the storage space

  • OpenWRT on R3 seems to only allocate around 100mb. For most cases that is enough, but not for me.

Here are the steps to achieve it:

opkg install cfdisk
cfdisk /dev/mmcblk0

Select the “Free space: 7.1G”

Select “New” and “Write”. Then save and “Exit”

mkfs.ext4 /dev/mmcblk0p6
mount /dev/mmcblk0p6 /overlay/

It should look like this:

Other Troubleshooting

  1. If you have trouble installing luci, that most likely means that when you flashed from the nand drive to the emmc, you most likely updated the kernel by accident on the nand. So the newer openwrt flashed to emmc (instead of the banana pi snapshot). Because of the this the kernel version may be out of sync with luci and thus an issue. To fix this issue, redo this entire article.

--

--