Building the firmware for Raspberry Pi 4 with Wi-Fi enabled before first boot

I don't have an ethernet adapter, so I'll need to SSH into the Raspberry Pi over Wi-Fi, but how do I do that? I tried to add

config  wifi-device    'wl0'
        option disabled '0'
        option country 'US'
        option beacon_int '1000'

config wifi-iface
        option disabled '0'
        option device 'radio0'
        option mode 'ap'
        option ssid 'RPi'
        option network 'lan'
        option encryption 'sae'
        option key 'password'
        option ieee80211w '0'
        option wps_pushbutton '0'

into build_dir/files/etc/config/wireless and build_dir/files/etc/uci-defaults/wireless, but after flashing the SD card with the official RPi imager, my RPi didn't boot up with the Wi-Fi enabled. Did I miss something?

FYI, I replaced wpad-basic-wolfssl with wpad-openssl, not sure if this is still needed, but I did it anyway.

There are several problems with that file. The best way to do this is to set up wifi once on a device of the same model, make sure it works then copy the /etc/config/wireless to the ROM. You don't need to add or change /etc/uci-defaults/wireless.

If there is no Ethernet in your PC you can configure any old router as a dumb AP and connect it to the PI Ethernet, then connect the PC to the AP wifi. Serial and local keyboard/screen access is also possible.

add in package\base-files\files\etc\uci-defaults a file 99_enable_wifi

content:

#!/bin/sh
uci set wireless.@wifi-device[0].disabled=0
uci commit wireless
exit 0
3 Likes

you need to put the files in openwrt/files/etc/config/wireless if you build from source or openwrt-imagebuilder-19.07.7-ramips-mt76x8.Linux-x86_64/files/etc/config/wireless and specify this folder on the command line as said here https://openwrt.org/docs/guide-user/additional-software/imagebuilder#custom_files if you use the image builder (the image builder folder I used is an example, choose the folder you have extracted the image builder in)

Create the "files" folder if it does not exist (it usually does not exist).

build_dir is a folder with temporary build binaries, it is not the right place for the "files" folder

2 Likes

Your script works but placing it in package\base-files\files\etc\uci-defaults is a hack, next time you update sources git will complain, next time you make clean it will be deleted.

Best to place it in openwrt/files/etc/uci-defaults if you build from source or openwrt-imagebuilder-19.07.7-ramips-mt76x8.Linux-x86_64/files/etc/uci-defaults and specify this folder in the command line as said here https://openwrt.org/docs/guide-user/additional-software/imagebuilder#custom_files if you use image builder (folder name is an example, use the folder you have extracted image builder in)

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.