Search code examples
linuxraspberry-piwifiyocto

Missing dhcp package after yocto build on raspberry Pi


I recently created a custom minimal image for Raspberry Pi 4 board using the Yocto build tool, my goal is to control the board with ssh protocol with my desktop, to do so i tried connecting it to wifi. I configured wpa_supplicant.conf and managed to connect my raspberry to the network but with no internet access. After the wpa_supplicant -B -Dnl80211 -c /etc/wpa_supplicant.conf -iwlan0

I do get :

wlan0 : Associated with XX:XX:XX:XX:XX:XX
wlan0: WPA: Key negociation completed with XX:XX:XX:XX:XX:XX [PTK=CCMP GTK=TKIP]
CTRL-EVENT-CONNECTED - Connection to XX:XX:XX:XX:XX:XX completed [id=0 id_str=]

Then I realized that dhcpd commands weren't working and the library wasn't available on my image. How can I add this library on my image, can I install it directly on my micro SD or must I build a new image? My bblayers.conf looks like this

BBLAYERS ?= " \
  /home/ryan/poky/meta \
  /home/ryan/poky/meta-poky \
  /home/ryan/poky/meta-yocto-bsp \
  /home/ryan/poky/meta-raspberrypi \
  /home/ryan/poky/meta-openembedded/meta-oe \
  /home/ryan/poky/meta-openembedded/meta-python \
  /home/ryan/poky/meta-openembedded/meta-multimedia \
  /home/ryan/poky/meta-openembedded/meta-networking \
  /home/ryan/poky/meta-openembedded/meta-filesystems \"

And inside meta there is : recipes-connectivity which has a dhcpcd file, should have it been added during the build?


Solution

  • There is a dhcpcd recipe in:

    meta-openembedded/meta-networking/recipes-connectivity/dhcpcd
    

    which contains the description for what you need:

    SECTION = "console/network"
    SUMMARY = "dhcpcd - a DHCP client"
    DESCRIPTION = "dhcpcd runs on your machine and silently configures your computer to work on the attached networks without trouble and mostly without configuration."
    

    So, just add it to your image:

    IMAGE_INSTALL_append = " dhcpcd"
    

    There is dhcp recipe also in poky if you want the full server/client package

    poky/meta/recipes-connectivity/dhcp/
    

    Also, busybox has it own DHCP client udhcpc.

    I assume that busybox is integrated into your build, so check for udhcpc command.