Enable wireless network (and SSH access) on a minimal Linux for the Raspberry Pi 4.
On each board Buildroot ships configuration for, only eth0 is configured by default. The Raspberry Pi boards, on the other hand, are generally capable of wireless connectivity.
Trying to enable wlan0 proved not to be so straight forward, as many of the articles I’ve found are now a bit outdated. But eventually it boils down to few little settings.
Jump to the configuration file already: rpi4_wifi_defconfig
TODO: On top of the default buildroot (2023.11) config, the following settings enabled the wifi:
The brcmfmac drivers alone however, will not get us quite there. If you try to build and run the system now, it will show no dmesg about the driver.
As described in this post the WiFi components on the Pi come up a little late, so we need to modprobe the WiFi driver brcmfmac, manually, or use an hotplug mechanism that would automate that: enter MDEV.
- System Configurations -> /dev management -> Dynamic using Devtmpfs + mdev
will set the following value:
For some more insights refer to 6.2. /dev management.
# network interfaces manager
# SSH support
Here iwd is preferred to the wpa_supplicant, since it works pretty much out-of-the-box with a simple rootfs overlay:
The Buildroot manual describes how to add custom users, besides “root”, in 9.6. Adding custom user accounts. A user(table) file that defines the standard Raspberry Pi user looks like this:
pi -1 pi -1 =raspberry /home/pi /bin/sh -
Then the user file must be added to the configuration:
Watch out! Each line MUST be terminated and MUST be terminated right, which is each line having a trailing \n, and the last line being an empty one.
Watch out! The user home folder like for example /home/pi is created automatically by Buildroot.
Watch out! To make sure the format is correct and no other character are injected, use nano, vi or another basic editor.
- Rohit’s Rants - Building a Linux Filesystem on Raspberry Pi 3 : notes about using MDEV and adding RPI firmware. A lot of the other settings apart from that are not useful as of today (November 2023). Also, wpa_supplicant which requires few more steps than iwd, seems outdated.
- Raspberry Pi Forum - Enabling wlan on Raspberry Pi 3 custom linux : forum thread with the link to the previous blog
SO - How to connect to Wifi on start-up using Buildroot? : hint on using iwd in place of wpa_supplicant
- http://lists.busybox.net/pipermail/buildroot/2017-October/204137.html : thread about user table