Home » Development and Build » Yocto Embedded Linux » Modifying bitbake/yocto initscripts to start wifi during boot

Modifying bitbake/yocto initscripts to start wifi during boot

We will need to change the wpa-supplicant.conf file as below, by modifying poky/meta/recipes-connectivity/wpa-supplicant/wpa-supplicant/wpa_supplicant.conf-sane



Now, once we modified wpa_supplicant configuration files, we need to create an script which will start the wpa_supplicant application which uses this conf file to connect to WiFi access point.

$ vim poky/meta/recipes-core/initscripts/initscripts-1.0/start-wifi.sh
ifconfig wlan0
route add default gw

wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf
: exit 0

As you can see above, if you don’t have DHCP enabled and server is unable to assign IP address to wifi device wlan0 , we have assigned free IP address manually i.e. in your case it may be different.

Now, we need to modify initscript bitbake recipe to start the above script during the boot, modify initscripts.bb SRC_URI so bitbake build system considers this as source file from local files folder and then we modify install function “do_install” to copy this start-wifi.sh to filesystem etc initscripts directory.

$ vim poky/meta/recipes-core/initscripts/initscripts_1.0.bb
file://start-wifi.sh \
do_install () {
install -m 0755    ${WORKDIR}/start-wifi.sh     ${D}${sysconfdir}/init.d

update-rc.d -r ${D} start-wifi.sh start 99 2 3 4 5 .

start-wifi \

Now if you compile the root file system which contains initscripts and boot the board with this new file system, you can see start-wifi.sh script is executed during initial booting which starts wpa_supplication and WiFi is already connected.

Subscribe our Rurban Life YouTube Channel.. "Rural Life, Urban LifeStyle"

1 thought on “Modifying bitbake/yocto initscripts to start wifi during boot”

Leave a Comment