1.2. Kernel Modification Workflow

Kernel modification involves changing the Yocto Project kernel, which could involve changing configuration options as well as adding new kernel recipes. Configuration changes can be added in the form of configuration fragments, while recipe modification comes through the kernel's recipes-kernel area in a kernel layer you create.

This section presents a high-level overview of the Yocto Project kernel modification workflow. The illustration and accompanying list provide general information and references for further information.

  1. Set up Your Host Development System to Support Development Using the Yocto Project: See the "Setting Up the Development Host to Use the Yocto Project" section in the Yocto Project Development Tasks Manual for options on how to get a build host ready to use the Yocto Project.

  2. Set Up Your Host Development System for Kernel Development: It is recommended that you use devtool and an extensible SDK for kernel development. Alternatively, you can use traditional kernel development methods with the Yocto Project. Either way, there are steps you need to take to get the development environment ready.

    Using devtool and the eSDK requires that you have a clean build of the image and that you are set up with the appropriate eSDK. For more information, see the "Getting Ready to Develop Using devtool" section.

    Using traditional kernel development requires that you have the kernel source available in an isolated local Git repository. For more information, see the "Getting Ready for Traditional Kernel Development" section.

  3. Make Changes to the Kernel Source Code if applicable: Modifying the kernel does not always mean directly changing source files. However, if you have to do this, you make the changes to the files in the eSDK's Build Directory if you are using devtool. For more information, see the "Using devtool to Patch the Kernel" section.

    If you are using traditional kernel development, you edit the source files in the kernel's local Git repository. For more information, see the "Using Traditional Kernel Development to Patch the Kernel" section.

  4. Make Kernel Configuration Changes if Applicable: If your situation calls for changing the kernel's configuration, you can use menuconfig, which allows you to interactively develop and test the configuration changes you are making to the kernel. Saving changes you make with menuconfig updates the kernel's .config file.

    Warning

    Try to resist the temptation to directly edit an existing .config file, which is found in the Build Directory among the source code used for the build. Doing so, can produce unexpected results when the OpenEmbedded build system regenerates the configuration file.

    Once you are satisfied with the configuration changes made using menuconfig and you have saved them, you can directly compare the resulting .config file against an existing original and gather those changes into a configuration fragment file to be referenced from within the kernel's .bbappend file.

    Additionally, if you are working in a BSP layer and need to modify the BSP's kernel's configuration, you can use menuconfig.

  5. Rebuild the Kernel Image With Your Changes: Rebuilding the kernel image applies your changes. Depending on your target hardware, you can verify your changes on actual hardware or perhaps QEMU.

The remainder of this developer's guide covers common tasks typically used during kernel development, advanced Metadata usage, and Yocto Linux kernel maintenance concepts.