Search code examples
embedded-linuxyocto

How to include tools/commands in yocto image recipe?


I have a question regarding including different tools into Yocto image recipe. Currently I am building image recipe for my Avenger96 board. I have created a base image and it runs fine on the device. But when I try to do sgdisk after booting it says -sh: sgdisk: command not found. I understand that these commands are not available by default and need to install it.

But I am not sure how to do it given my board is not connected to internet. Can I include these commands/tools in image recipe? I want to use some other commands like ufw, etc but I have same issue with them too.

Can someone please let me know how to do this?

Your help will be much appreciated.

Thanks in advance.

P.S: I am using Ubuntu 20.04 with Yocto as build system.


Solution

  • sgdisk is present under recipe: meta/recipes-devtools/fdisk/gptdisk_xx.bb

    For xx it depends on your poky version.

    For dunfell this is the recipe here.

    ufw is present in meta-openembedded/meta-networking/recipes-connectivity/ufw

    So, make sure meta-openembedded/meta-networking is present in your bblayers.conf and to include both of them add the following line to local.conf or to your custom image file:

    IMAGE_INSTALL_append = " gptfdisk ufw"
    

    If you still do not find sgdisk try gptdisk-sgdisk.

    If you want to add any recipe in the future, try to look for it in the official yocto git repositories in this link.

    It is not recommended to add tools manually into the board, unless you are in the development process and you need to gain time, so here are some ideas for you:

    • Create an image for development that includes all dev features (gcc, g++, cmake, ..etc)
    • Include git and other fetching tools
    • Clone the tool's source code and compile it in the board
    • Or: bitbake the recipe with Yocto and copy the output binary directly to the image via ssh or other ways.