How to enable Wifi with yocto

If you want to have WiFi integrated with yocto root filesystem, follow below mentioned steps,

Open file, meta-mylayer/images/mydistro-image.bb and add below mentioned line,

DISTRO_FEATURES += "wifi"

This will add wifi into the root filesystem but unless you have a proper network manager and UI, you will not be able to connect to internet.

So, we will follow manual configuration, so we can connect without network manager,

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

ctrl_interface=/var/run/wpa_supplicant
ctrl_interface_group=0
update_config=1

network={
        ssid="MYSSID"
        psk="MY-SECURE-PASSKEY"
        proto=RSN
        key_mgmt=WPA-PSK
}

Compile, the rootfs image “bitbake mydistro-image” which will integrate this conf file into rootfs at /etc/wpa_supplicant.conf

Now, we will need to do following things manually to get the internet working properly, [ If you want to Skip all of this manual procedure and want to start WiFi on yocto during boot time refer to this article ]

Related :   What is Clang ? How to compile C program using clang ?

To Start WPA Supplicant, use below command on terminal,

$ wpa_supplicant -Dnl80211 -iwlan0 -c/etc/wpa_supplicant.conf

If you now connected with WiFi, but wlan0 still not have IP Assigned,

$ ifconfig wlan0 192.168.X.XXX

Here it depends on whether you use 192.168.1.150 or 192.168.0.150 ( 150 is just example, you can use any IP ), this will assign IP address to wlan0 and you should be able to ping to the router, as

$ ping 192.168.1.1

If this works and you are not able to ping to “google.com” , check with “route -n” if gateway has IP assinged, if not use following command,

$ route add default gw 192.168.1.1

Where we assume, 192.168.1.1 is your gateway IP,

Now you should have “ping google.com” working. 🙂 Do share this article if helps you.

Alternatively , you can also enable WiFi by appending conf/local.config as,

IMAGE_INSTALL_append = " wpa-supplicant wireless-tools dhcp-client linux-firmware"

lynxbee_ezoic

Subscribe with Valid Email Id to receive updates in Inbox. ( Secured by Google FeedBurner )

   


6 thoughts on “How to enable Wifi with yocto”

    • This article is only about how you can switch on your RaspberryPi Wireless which you can then connect to hotspot/router and access internet on Raspberry Pi, so this article do not provide details of how you can create RPi as hotspot.

      Reply

Leave a Comment

Android Android Applications Android Build system Android Commands Application Libraries Application Stack / User Interface Bash / Shell Scripts Bluetooth driver Cloud Technologies Commands and Packages Compilation Content Management System Core Kernel C Programs Development & Build Development, Debugging and Performance Tools Development Environment Setup Django & REST Api Errors & Failures Git Hardware Platforms HTML JAVA Programs Linux, OS Concepts and Networking Linux Device Drivers Linux Host, Ubuntu, SysAdmin Linux Kernel Linux Networking Middleware Libraries, HAL Multimedia Audio, Video, Images NDK / Middleware / HAL OS Concepts PHP Programming Languages Scripting and Automation Search Engine Optimisation ( SEO ) Social Media Source Code Management ( SCM ) System Administration, Security Testing and Debugging Uncategorized Web design and development Website Hosting Wordpress Yocto / Bitbake / Openembedded