Skip to content

Yocto

What is Yocto?

In the ever-expanding landscape of embedded systems, the demand for customizable, efficient, and secure Linux distributions has given rise to powerful tools and frameworks. Among them, the Yocto Project stands out as a robust solution for creating custom Linux distributions tailored to the specific needs of embedded devices. Qbee is an official Yocto Project Partner and committed to maintain the agent integrations and meta layers for the project. You can also build the qbee agent from source now since the open source packages are available here.

How to integrate the agent with Yocto?

Integrating the qbee-agent with Yocto Project involves a series of steps to ensure that the qbee-agent is incorporated into the custom Linux distribution generated by Yocto. Below is a guide on how to achieve this integration:

  1. Set up the Yocto environment. We are using Yocto project name kirkstone in this example as it is the latest LTS release.:

    git clone -b kirkstone https://git.yoctoproject.org/poky layers/poky
    git clone -b kirkstone https://github.com/openembedded/meta-openembedded layers/meta-openembedded
    git clone -b master https://github.com/qbee-io/meta-qbee layers/meta-qbee
    
  2. Set up the build environment:

    source layers/poky/oe-init-build-env
    

    Then add the needed layers to your build

    bitbake-layers add-layer ../layers/poky/meta
    bitbake-layers add-layer ../layers/poky/meta-poky
    bitbake-layers add-layer ../layers/poky/meta-yocto-bsp
    bitbake-layers add-layer ../layers/meta-openembedded/meta-oe
    bitbake-layers add-layer ../layers/meta-qbee/meta-qbee
    

    Apply qbee-agent configuration to build environment:

    CONF_VERSION = "2"
    INIT_MANAGER = "systemd"
    EXTRA_IMAGE_FEATURES += "ssh-server-openssh"
    QBEE_BOOTSTRAP_KEY="<bootstrap_key>"
    QBEE_DEVICE_NAME_TYPE="mac-address"
    

    Qbee device name type

    By default qbee uses the device host name as the identifier in the UI. However, in the seed configuration you can specify a variable DEVICE_NAME_TYPE which can either have values mac-address or machine-id. The qbee-agent will then use either the machine-id (/etc/machine-id) or the mac-address of the default network device when bootstrapping.

  3. Build the image target. This example builds the target core-image-minimal for a qemux86-64 machine.

    MACHINE="qemux86-64" bitbake core-image-minimal
    
  4. Run the qemu image and check that the device appears in the qbee UI

    MACHINE="qemux86-64" runqemu slirp nographic core-image-minimal
    

    Now the device will be visible in the Qbee UI.

    Qbee configuration and state directory

    The qbee-agent will put all it's configuration and state under respectively /data/qbee/etc and /data/qbee/var. The reason for this is that qbee-agent for Yocto is designed to run in a A/B partition update scenario, which has become popular way to do OTA updates in IoT. In such a setup the /data partition will serve as storage for non-volatile data (like qbee-agent configuration and state).