Kernel configuration and compilation for BeagleBone Black using Yocto — a step-by-step, beginner-friendly tutorial. Learn how to configure, compile, and flash your kernel using Yocto, with practical commands and clear explanations.
Introduction
When working with embedded Linux on the BeagleBone Black, customizing the kernel is often necessary to enable specific hardware features or optimize performance. Kernel configuration and compilation using the Yocto Project is a powerful approach because it creates a reproducible, maintainable build for your hardware.
In this guide, we will walk you through the full process — from setting up Yocto for BeagleBone Black to flashing a custom-built kernel image to your device. This tutorial is written in a beginner-friendly way, ensuring you can follow along even if you are new to Yocto.
Why Kernel Configuration and Compilation Matter
The kernel is the core of your Linux operating system. For the BeagleBone Black, the kernel manages hardware interaction — everything from GPIO control to networking. By configuring and compiling your own kernel in Yocto, you can:
- Enable or disable hardware drivers.
- Optimize kernel settings for your specific application.
- Add custom patches or features.
- Ensure reproducibility in embedded development projects.
This approach is essential for developers creating custom embedded solutions, especially in IoT and industrial automation.
Prerequisites
Before starting kernel configuration and compilation for BeagleBone Black using Yocto, ensure you have:
- A Linux host machine (Ubuntu 20.04 / 22.04 recommended).
- Required packages installed (
git,make,gcc,python3,tar,cpio,gawk, etc.). - 50+ GB of free disk space.
- Basic familiarity with Git and shell commands.
- A BeagleBone Black board with an SD card or USB-to-serial for console access.
Step-by-Step Kernel Configuration and Compilation
1. Setup Yocto Project for BeagleBone Black
Create a working directory and clone the necessary layers:
mkdir -p ~/yocto-bbb && cd ~/yocto-bbb
# Clone Poky (Yocto reference build system)
git clone -b kirkstone git://git.yoctoproject.org/poky.git poky
# Clone additional layers
git clone -b kirkstone git://git.openembedded.org/meta-openembedded
git clone -b kirkstone git://git.yoctoproject.org/meta-ti
Here, meta-ti provides support for BeagleBone Black’s hardware.
2. Initialize the Build Environment
Initialize Yocto and add required layers:
cd poky
source oe-init-build-env build
bitbake-layers add-layer ../meta-openembedded/meta-oe
bitbake-layers add-layer ../meta-ti/meta-ti-bsp
Edit conf/local.conf inside the build directory:
- Set:
MACHINE = "beaglebone-yocto". - Optionally tweak
DL_DIR,SSTATE_DIR,BB_NUMBER_THREADS, andPARALLEL_MAKEfor build optimization.
3. Configure the Kernel
Yocto provides a menuconfig interface for kernel configuration:
MACHINE=beaglebone-yocto bitbake -c menuconfig virtual/kernel
This launches an interactive configuration tool where you can enable or disable kernel options.
Once done, generate a configuration fragment with:
MACHINE=beaglebone-yocto bitbake -c diffconfig virtual/kernel
This fragment.cfg file contains only the changes you made — making your kernel modifications repeatable and maintainable.
4. Make Kernel Changes Permanent
Create a custom layer to hold your kernel configuration fragment:
bitbake-layers create-layer ../meta-my-bbb
Copy your fragment.cfg into your custom layer:
cp tmp/work/*/linux*/linux-*/fragment.cfg ../meta-my-bbb/recipes-kernel/linux/files/beaglebone-fragment.cfg
Create a .bbappend file to append your configuration to the kernel recipe. For example:
meta-my-bbb/recipes-kernel/linux/linux-yocto_%.bbappend
FILESEXTRAPATHS_prepend := "${THISDIR}/files:"
SRC_URI += "file://beaglebone-fragment.cfg"
This ensures your changes are always applied during builds.
5. Build the Kernel or Full Image
To build only the kernel:
MACHINE=beaglebone-yocto bitbake virtual/kernel
To build a full image for testing:
MACHINE=beaglebone-yocto bitbake core-image-minimal
This process may take several hours depending on your system.
6. Flash the Image to the BeagleBone Black
Locate the built image under:
tmp/deploy/images/beaglebone-yocto/
Flash the .wic image to your SD card:
sudo dd if=tmp/deploy/images/beaglebone-yocto/core-image-minimal-beaglebone-yocto.wic \
of=/dev/sdX bs=4M conv=fsync status=progress
sync
⚠ Be careful: Replace /dev/sdX with the correct device name to avoid data loss.
Troubleshooting Tips
- Fragment not applied? Verify your
.bbappendpoints to the correct kernel recipe. - Layer priority issues: Ensure your custom layer is in
bblayers.confwith higher priority. - Rebuild clean: Run
bitbake -c cleansstate virtual/kernelbefore rebuilding if changes do not apply.
Benefits of Using Yocto for Kernel Configuration
Using Yocto for kernel configuration and compilation ensures:
- Consistency: The build is reproducible on any machine.
- Maintainability: Changes are version-controlled and portable.
- Efficiency: Only the required drivers and features are included in the kernel.
Conclusion
Kernel configuration and compilation for BeagleBone Black using Yocto is a powerful way to gain control over your embedded Linux system. By following this step-by-step guide, even beginners can confidently configure, compile, and flash a custom kernel.
This approach gives developers a robust foundation for building optimized embedded systems — perfect for IoT, robotics, and industrial applications.
Mr. Raj Kumar is a highly experienced Technical Content Engineer with 7 years of dedicated expertise in the intricate field of embedded systems. At Embedded Prep, Raj is at the forefront of creating and curating high-quality technical content designed to educate and empower aspiring and seasoned professionals in the embedded domain.
Throughout his career, Raj has honed a unique skill set that bridges the gap between deep technical understanding and effective communication. His work encompasses a wide range of educational materials, including in-depth tutorials, practical guides, course modules, and insightful articles focused on embedded hardware and software solutions. He possesses a strong grasp of embedded architectures, microcontrollers, real-time operating systems (RTOS), firmware development, and various communication protocols relevant to the embedded industry.
Raj is adept at collaborating closely with subject matter experts, engineers, and instructional designers to ensure the accuracy, completeness, and pedagogical effectiveness of the content. His meticulous attention to detail and commitment to clarity are instrumental in transforming complex embedded concepts into easily digestible and engaging learning experiences. At Embedded Prep, he plays a crucial role in building a robust knowledge base that helps learners master the complexities of embedded technologies.










