Platform Login

« back to blog overview

qbee-agent for Yocto Project: Enhancing OTA Capabilities in IoT

In the realm of embedded systems, developers constantly wrestle with the challenge of creating lean and secure Linux distributions that align meticulously with their specific device requirements. The Yocto Project emerges as a beacon in this space, providing an all-encompassing framework to define custom Linux distributions, particularly shaped for embedded devices. Another aspect of a Yocto build is that you have a clearly defined build with all packages available locally, thus creating a snapshot and a long term stable foundation. Merging this capability with the qbee-agent can revolutionize the way devices receive OTA (Over-The-Air) updates, introducing a new era of reliability and robustness in IoT deployments.

The Unique Appeal of the qbee-agent

The qbee-agent, acting as a key component for managing and configuring devices, stores its configuration and state within /data/qbee/etc and /data/qbee/var respectively. This design choice is particularly important when considering its deployment within an A/B partition update scenario.

In A/B partitioning – a strategy that’s gaining traction in the IoT space for its ability to execute OTA updates with a full firmware image update, relatively low update times and the possibility to fall back  – the /data partition serves as a repository for non-volatile data. This includes the vital configurations and state data of the qbee-agent, ensuring that critical data persists through updates and does not become a point of failure during the updating process.

Journey to Integration: qbee-agent and Yocto

Integrating the qbee-agent into the Yocto Project, particularly within the LTS release dubbed “kirkstone” in this instance, unfolds through a series of methodical steps. The meta-qbee layer integration can be found on OpenEmbedded.

1. Initialize the Yocto Environment

Cloning the necessary repositories sets the stage:

				
					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 main https://github.com/qbee-io/meta-qbee layers/meta-qbee

				
			

2. Craft the Build Environment

Activate the build environment and assimilate the essential layers:

				
					source layers/poky/oe-init-build-env
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

				
			

3. qbee-agent Configuration Application

The qbee-agent’s configuration needs well defined parameters within the build environment, from assigning bootstrap keys to establishing device name types:

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

				
			

The device name type, by default utilizing the device host name in the UI, can be customized to use either mac-address or machine-id through the DEVICE_NAME_TYPE variable, thereby offering flexibility in device identification.

4. Image Target Building and Testing

Initiating the build and engaging QEMU for testing and verification can be accomplished with:

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

				
			

Subsequently, the device should materialize within the Qbee UI, signifying a successful integration.

Conclusion:

The merger of qbee-agent and the Yocto Project presents developers with a formidable toolset to construct, manage, and securely update IoT devices with increased efficiency, security and reliability. The strategic placement of the qbee-agent’s configuration and state within the /data partition not only adheres to but also enhances the A/B partition update methodology, cementing its place as a vital component in future-proof, robust IoT device management and development.

Leveraging these tools and methodologies, developers can embark on a journey where custom Linux distributions for embedded systems not only become a reality but also a scalable, manageable, and secure process. Find more information here.

Interested to know more?