3

Has anyone got WiFi working in buildroot for the Raspberry Pi Zero W? I can't find any online notes or walkthroughs on it.

The raspberrypi0_defconfig works fairly well, but doesn't include wireless.

I'm using the latest iteration of buildroot, 2017-08. I've added the rpi-wifi-firmware. Which packages are needed as a bare minimum to connect to a WiFi network?

5

I also tried to find the "bare minimum wireless" for RPi Zero W using buildroot so this Q&A came quite high on the search results. Eventhough the original answer was somewhat helpful, it's definitely not the best one so I though it would be worth sharing my own findings:

Using buildroot 2018.02.2

make raspberrypi0_defconfig

to clean you config. Then (make menuconfig and) select following from Target packages:

Hardware Handling -> Firmware -> rpi-wifi-firmware
Networking applications -> wpa_supplicant
Networking applications -> wpa_supplicant - Enable 80211 support

Everything else that's necessary should already be pre-selected.

Then at /etc/network/interfaces

auto wlan0
iface wlan0 inet dhcp
  pre-up wpa_supplicant -D nl80211 -i wlan0 -c /etc/wpa_supplicant.conf -B
  post-down killall -q wpa_supplicant

and at /etc/wpa_supplicant.conf

ctrl_interface=/var/run/wpa_supplicant
ap_scan=1

network={
   ssid="My WLAN"
   psk="my_wlan_password"
}

and now we're still missing the secret ingredient: the wifi driver must be loaded before the networking init-scripts kick in. You could Enable WCHAR support (at Toolchain -menu) in order to have eudev as /dev management (at System configuration -menu) which would automatically handle the driver loading. Actually I recommend this if you're going to connect UBS devices to your RPi....

...but if not, edit /etc/inittab and modprobe brcmfmac yourself just before the rc scripts are ran:

...
# Load Wifi driver
::sysinit:/sbin/modprobe brcmfmac 

# now run any rc scripts
::sysinit:/etc/init.d/rcS
...

That's it.

1

Turned out that an incorrect /etc/network/interfaces and/or /etc/wpa_supplicant was to blame. In between builds I've been adding additional packages, so I'm not 100% sure if these are all needed, but anyway these are the ones I included:

Hardware Handling Hardware Handling -> Firmware -> linux-firmware -> Broadcom BRCM bcm43xxx Hardware Handling -> Firmware -> rpi-firmware (extended 'x' firmware) Hardware Handling -> Firmware -> Install DTB overlays Hardware Handling -> Firmware -> rpi-wifi-firmware Hardware Handling -> dbus Hardware Handling -> dbus-glib

Networking applications Networking applications -> dhcpd Networking applications -> ifupdown scripts Networking applications -> iproute2 Networking applications -> iptables Networking applications -> wireless-tools (+install shared lib) Networking applications -> wpa_supplicant Networking applications -> wpa_supplicant - Enable 80211 support Networking applications -> wpa_supplicant - Enable EAP Networking applications -> wpa_supplicant - Install wpa_cli binary Networking applications -> wpa_supplicant - Install wpa_client shared library Networking applications -> wpa_supplicant - Install wpa_passphrase binary

I don't think any other categories are relevant to WiFi networking.

/etc/network/interfaces auto lo iface lo inet loopback allow-hotplug wlan0 iface wlan0 inet manual wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

/etc/wpa_supplicant.conf ctrl_interface=/var/run/wpa_supplicant update_config=1 network={ ssid="OpenWrt" psk=<your psk key here> }

After boot I run: wpa_supplicant -B -i wlan0 -W -D nl80211, wext -c /etc/wpa_supplicant.conf wpa_cli -B -i wlan0 -p /var/run/wpa_supplicant -a /sbin/wpa_action dhcpcd -q -w

I want networking to come up well after boot as it's embedded linux and some more important stuff needs to start first. Therefore I'll add it to some post boot script somewhere. If you want to have your interface up at boot, then add these to your boot process somewhere. I'll consider this out of the scope for this question.

So, this works, it's not perfect, but it will be a good starting point for those that like me struggled. I am pretty sure not all mentioned packages are the bare minimum, also /sbin/wpa_action doesn't exist, but when leaving it out you'll enter interactive mode. I'll be refining this answer once I have a better grip on it. Suggestions are welcome!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.