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/ 
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 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 to filesystem etc initscripts directory.

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

update-rc.d -r ${D} 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 script is executed during initial booting which starts wpa_supplication and WiFi is already connected.

Android Android Commands Android Java Applications Application Libraries Bash / Shell Scripts Bluetooth driver Build Frameworks Commands and Packages Core Kernel C Programs Development Environment Setup Documents / Books Errors & Failures File Systems Framebuffer / Display Driver git Go Language Programs Hardware Platforms Home HTML JAVA Programs Kernel & Device Drivers Kernel Booting and Porting Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL NDK / Middleware / HAL Network Driver OS Concepts PHP Programming Languages RaspberryPi Scripting and Automation Search Engine Optimisation ( SEO ) Socurce Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Userspace Utilities Web design and development Wordpress Yocto / Bitbake / Openembedded

Leave a Reply