I am trying to establish WiFi connection on my Avenger96 (based on 96Boards STM32MP157) board. Goal is to automatically setup WiFi connection during boot time so that there is no need to manually configure WiFi after every boot.
Steps I have done:
Added
network
section in wpa_supplicant.conf-sane as shown below:poky/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant
:ctrl_interface_group=0 update_config=1 network={ ssid="WiFi" #psk="xxxx" psk=bcc0f1e055c895febe6f4766e90a7972334b2dac4dda015876a185a8bd577a04 }
I generated psk using making use of wpa_passphrase
, a command line tool which generates the minimal configuration needed by wpa_supplicant as:
$ wpa_passphrase WiFi xxxx
Script to initialize the wpa_supplicant and configure WiFi at boot up. I created a custom script “setup-wifi.sh” at the following path
/meta/recipes-core/initscripts/initscripts-1.0/setup-wifi.sh
:ifconfig wlan0 10.233.174.16 #Set the static IP address, should be unique wpa_passphrase WiFi xxxx> /etc/wpa_supplicant.conf route add default gw 10.233.174.254 #Router IP address wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf echo “nameserver 8.8.8.8” >> /etc/resolv.conf echo “nameserver 10.233.174.254” >> /etc/resolv.conf : exit 0
Edited the "initscript bitbake recipe" at
/meta/recipes-core/initscripts/initscripts-1.0.bb
that incorporates the “setup-wifi.sh” and installs it in/etc/initscripts
directory after build.file://setup-wifi.sh \ " do_install () { install -m 0755 ${WORKDIR}/setup-wifi.sh ${D}${sysconfdir}/init.d update-rc.d -r ${D} setup-wifi.sh start 99 2 3 4 5 . } MASKED_SCRIPTS = " \ setup-wifi \ "
Included
IMAGE_INSTALL_append = " wpa-supplicant iw dhcp-client"
andCORE_IMAGE_EXTRA_INSTALL += " packagegroup-base-wifi kernel-modules"
in thebuild/local.conf
file. Also,DISTRO_FEATURES_append = " wifi"
in my custom recipe. Next, ranbitbake
and booted the board using the image.
But, on boot up WiFi is not configured and when I try to connect it manually, I get the following error:
unknown global field 'passphrase must be 8..63 characters'
And when I check the connection using # iw dev wlan0 link
, it shows "Not connected".
Can anyone please let me know what I am missing here and how to resolve this? Your help will be much appreciated.
Thanks in advance!
P.S: I am using Ubuntu 20.04 and Yocto Dunfell branch as build system.