Configure wireless in Yocto Linux automatically when the system starts

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Configure wireless in Yocto Linux automatically when the system starts

1,822 Views
krsuresh
Contributor III

Hi Team,

My goal is to configure wireless in Yocto Linux automatically when the system starts, but I am having trouble.
In accordance with expectations, the configuration is working properly, and the client is also connecting, but immediately it gets disconnected.
Kindly let me know if I am missing anything.

BoardDetails: HummingBoard Pulse i.MX8M Plus SOM board
Code details: https://github.com/SolidRun/meta-solidrun-arm-imx8
Branch: hardknott-imx8mp

The steps I followed,

Step1:
Added custom recipe file and my script in systemd folder.
Systemd path: source/meta-imx/meta-bsp/recipes-core/systemd/wifiscript_1.00.bb
My Script File Path: source/meta-imx/meta-bsp/recipes-core/systemd/file/wifi_script.sh


wifiscript_1.00.bb Details:
********************************
LICENSE = "CLOSED"
inherit update-rc.d systemd

SYSTEMD_AUTO_ENABLE = "enable"
SYSTEMD_SERVICE_${PN} = "wifi-script.service"
INITSCRIPT_PACKAGES = "${PN}"

SRC_URI_append = " file://wifi-script.service \
file://wifi-script.sh \
"
FILES_${PN} += "${systemd_unitdir}/system/wifi-script.service"

do_install_append() {
install -d ${D}/${systemd_unitdir}/system
install -d ${D}${bindir}
install -m 0644 ${WORKDIR}/wifi-script.service ${D}/${systemd_unitdir}/system
install -m 0744 ${WORKDIR}/wifi-script.sh ${D}${bindir}


My wifi_script.sh
*********************
WlanCnt=0
connmanctl enable wifi
ifconfig wlan0 up
if [ $? -eq 0 ]; then
while [ 1 ]
do
ifconfig | grep wlan0
if [ $? -eq 0 ]; then
echo "Interface UP"
break;
else
echo "Wlan0 Interface DOWN"
fi
sleep 1
if [ $WlanCnt -eq 10 ]; then
ifconfig wlan0 up
WlanCnt=0
fi
WlanCnt=`expr $WlanCnt + 1`
done
ClientDetected=0;
while [ $ClientDetected -ne 1 ]
do
Count=0;
rm -rf /var/run/wpa_supplicant/wlan0
sleep 20
sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant.conf
if [ $? -eq 0 ]; then
while [ $Count -le 10 ]
do
iw wlan0 link | grep "Connected"
if [ $? -eq 0 ]; then
ClientDetected=1
break;
else
echo "Client not detected"
fi
sleep 1
Count=`expr $Count + 1`
done
if [ $ClientDetected -eq 1 ]; then
echo "Client detected"
sudo udhcpc -i wlan0
fi
fi
done
else
echo "WLAN not available"
fi

Step2: Target details

`root@imx8mpsolidrun:~# [ 63.440976] IPv6: ADDRCONF(NETDEV_CHANGE): wlan0: link becomes ready
[ 64.063630] imx-dwmac 30bf0000.ethernet eth1: PHY [stmmac-0:00] driver [ADIN1300] (irq=POLL)
[ 64.072117] imx-dwmac 30bf0000.ethernet eth1: configuring for phy/rgmii-id link mode

root@imx8mpsolidrun:~#
root@imx8mpsolidrun:~# iw wlan0 link
Connected to ae:ca:9d:c8:20:75 (on wlan0)
SSID: suresh
freq: 5745
RX: 1138 bytes (4 packets)
TX: 5458 bytes (36 packets)
signal: -63 dBm
rx bitrate: 6.0 MBit/s
tx bitrate: 292.5 MBit/s

bss flags:
dtim period: 2
beacon int: 100
root@imx8mpsolidrun:~# ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.22.74 netmask 255.255.255.0 broadcast 192.168.22.255
inet6 fe80::7287:a7ff:fefd:723d prefixlen 64 scopeid 0x20<link>
ether 70:87:a7:fd:72:3d txqueuelen 1000 (Ethernet)
RX packets 2 bytes 676 (676.0 B)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 37 bytes 6336 (6.1 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

root@imx8mpsolidrun:~#
root@imx8mpsolidrun:~# ping 8.8.8.8
PING 8.8.8.8 (8.8.8.8) 56(84) bytes of data.
64 bytes from 8.8.8.8: icmp_seq=1 ttl=115 time=50.1 ms
64 bytes from 8.8.8.8: icmp_seq=2 ttl=115 time=33.7 ms
64 bytes from 8.8.8.8: icmp_seq=3 ttl=115 time=25.0 ms
^C
--- 8.8.8.8 ping statistics ---
3 packets transmitted, 3 received, 0% packet loss, time 2003ms
rtt min/avg/max/mdev = 24.977/36.270/50.106/10.415 ms
root@imx8mpsolidrun:~#
root@imx8mpsolidrun:~#
root@imx8mpsolidrun:~# iw wlan0 link
Not connected.
root@imx8mpsolidrun:~# ifconfig wlan0
wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.22.74 netmask 255.255.255.0 broadcast 192.168.22.255
inet6 fe80::7287:a7ff:fefd:723d prefixlen 64 scopeid 0x20<link>
ether 70:87:a7:fd:72:3d txqueuelen 1000 (Ethernet)
RX packets 13 bytes 2578 (2.5 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 61 bytes 8824 (8.6 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0

root@imx8mpsolidrun:~# iw wlan0 scan | grep SSID
SSID: suresh


0 Kudos
4 Replies

1,742 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @krsuresh,

Is your issue resolved?

waiting for your response.

Thanks & Regards,

Dhruvit Vasavada

0 Kudos

1,716 Views
krsuresh
Contributor III

Sorry for the delay. This issue not yet solved. Am in building core-minimal-image and adding packages one by one. Now am stuck with  .NET build. 

 

0 Kudos

1,690 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @krsuresh,

I hope you are doing well.

 
Please provide me with boot logs,dmseg logs, and Wireshark captures as mentioned in the previous reply for further debugging.
 
Thanks & Regards,
Dhruvit Vasavada.

 

0 Kudos

1,785 Views
Dhruvit
NXP TechSupport
NXP TechSupport

Hi @krsuresh ,

I hope you are doing well.
 
Please add drvdbg=0x20037 in your wi-fi module configuration in the wifi_mod_para_*.conf file to enable wifi driver debug logs.
 
Please provide me with boot logs,dmseg logs and Wireshark captures for further debugging.
 
Thanks & Regards,
Dhruvit Vasavada
0 Kudos