The background is that the default OpenWRT image for Raspberry Pi lacks drivers for the LAN port (RTL8111) on the DFRobot board. DFRobot provide an image, but that one is made from a quite old daily snapshot of OpenWRT which is not entirely stable. Also, it is better to know how to fish than be given a fish.
DFRobot's page about the router board:
OpenWRT main page:
You are expected to have some general knowledge on Linux and OpenWRT. The instructions for flashing the resulting firmware image are presented on DFRobot's page.
We will use the OpenWRT image builder. This is a quite nifty tool that can generate a firmware image with some additional packages not present in the default image. It is not a cross-compiler, but rather takes already compiled OpenWRT packages and creates a new firmware image.
Download the latest image builder for Raspberry Pi from OpenWRT. At the time of writing, this is RC3. It is under target bcm27xx/bcm2711
I built it on a Debian VirtualBox machine, but pretty much any Linux system would do. You first need to install some Linux tools. These are the tools for Debian/Ubuntu:
root@debian:~# apt install build-essential libncurses5-dev libncursesw5-dev zlib1g-dev gawk git gettext libssl-dev xsltproc rsync wget unzip python
For other Linux distros, see the Prerequisites section here:
Unpack your image builder:
martin@debian:~# tar Jxf openwrt-imagebuilder-21.02.0-rc3-bcm27xx-bcm2711.Linux-x86_64.tar.xz martin@debian:~# cd openwrt-imagebuilder-21.02.0-rc3-bcm27xx-bcm2711.Linux-x86_64/
For some reason, you will need a /etc/config/network file in your image, or your LAN network will not come up.
martin@debian:~# mkdir -p files/etc/config
Put below file in files/etc/config/network
We need to build the image with 3 extra modules:
- luci -- the OpenWRT web interface
- kmod-r8169 -- kernel module for the DFRobot ethernet controller
- kmod-usb-dwc2 -- kernel module for USB. More details:
martin@debian:~# make image PROFILE="rpi-4" PACKAGES="luci kmod-r8169 kmod-usb-dwc2" FILES=files/
The built image(s) will end up at:
The “default” one to use would be:
After you gunzip that file, you can follow the instructions from DFRobot for installation. Or you can use “dd” directly on Linux, instead of Rufus:
martin@debian:~# dd if=/home/martin/openwrt/openwrt-21.02.0-rc3-bcm27xx-bcm2711-rpi-4-ext4-factory.img of=/dev/sdb
Thank you for this. Is there another flag I would need to compile with to be able to run resize2fs so I can expand the filesystem on the pi when it is running?