%poky; ] > Introduction
Overview Regardless of how you intend to make use of the Yocto Project, chances are you will work with the Linux kernel. This manual introduces the kernel development process and provides background information on the Yocto Linux kernel Metadata, describes common tasks you can perform using the kernel tools, and shows you how to use the kernel Metadata needed to work with the kernel inside the Yocto Project. Each Yocto Project release has a set of Yocto Linux kernel recipes, whose Git repositories you can view in the Yocto Source Repositories under the "Yocto Linux Kernel" heading. New recipes for the release track the latest Linux kernel upstream developments from and introduce newly-supported platforms. Previous recipes in the release are refreshed and supported for at least one additional Yocto Project release. As they align, these previous releases are updated to include the latest from the Long Term Support Initiative (LTSI) project. Also included is a Yocto Linux kernel development recipe (linux-yocto-dev.bb) should you want to work with the very latest in upstream Yocto Linux kernel development and kernel Metadata development. For more on Yocto Linux kernels, see the "Yocto Project Kernel Development and Maintenance section. The Yocto Project also provides a powerful set of kernel tools for managing Yocto Linux kernel sources and configuration data. You can use these tools to make a single configuration change, apply multiple patches, or work with your own kernel sources. In particular, the kernel tools allow you to generate configuration fragments that specify only what you must, and nothing more. Configuration fragments only need to contain the highest level visible CONFIG options as presented by the Yocto Linux kernel menuconfig system. Contrast this against a complete Yocto Linux kernel .config file, which includes all the automatically selected CONFIG options. This efficiency reduces your maintenance effort and allows you to further separate your configuration in ways that make sense for your project. A common split separates policy and hardware. For example, all your kernels might support the proc and sys filesystems, but only specific boards require sound, USB, or specific drivers. Specifying these configurations individually allows you to aggregate them together as needed, but maintains them in only one place. Similar logic applies to separating source changes. If you do not maintain your own kernel sources and need to make only minimal changes to the sources, the released recipes provide a vetted base upon which to layer your changes. Doing so allows you to benefit from the continual kernel integration and testing performed during development of the Yocto Project. If, instead, you have a very specific Linux kernel source tree and are unable to align with one of the official Yocto Linux kernel recipes, an alternative exists by which you can use the Yocto Project Linux kernel tools with your own kernel sources.
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. You can find additional information here: "Patching the Kernel" in the Yocto Project Development Manual. "Configuring the Kernel" in the Yocto Project Development Manual. This illustration and the following list summarizes the kernel modification general workflow. Set up Your Host Development System to Support Development Using the Yocto Project: See "The Linux Distribution" and "The Build Host Packages" sections both in the Yocto Project Quick Start for requirements. Clone the poky Repository: Having the Source Directory on your system gives you access to the build process and tools you need. For information on how to get these files, see the "Cloning the poky Repository" section in the Yocto Project Development Manual. Establish the Temporary Kernel Source Files: Temporary kernel source files are kept in the Build Directory created by the OpenEmbedded build system when you run BitBake. If you have never built the kernel in which you are interested, you need to run an initial build to establish local kernel source files. If you are building an image for the first time, you need to get the build environment ready by sourcing an environment setup script (i.e. oe-init-build-env or oe-init-build-env-memres). You also need to be sure two key configuration files (local.conf and bblayers.conf) are configured appropriately. The entire process for building an image is overviewed in the "Building Images" section of the Yocto Project Quick Start. You might want to reference this information. You can find more information on BitBake in the BitBake User Manual. The build process supports several types of images to satisfy different needs. See the "Images" chapter in the Yocto Project Reference Manual for information on supported images. 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 Build Directory. 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 (e.g. see the workflow illustration in the "Kernel Modification Workflow" section). 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 the yocto-kernel script as well as menuconfig. The yocto-kernel script lets you interactively set up kernel configurations. Rebuild the Kernel Image With Your Changes: Rebuilding the kernel image applies your changes.
Other Resources The remainder of this manual provides instructions for completing specific Linux kernel development tasks. These instructions assume you are comfortable working with BitBake recipes and basic open-source development tools. Understanding these concepts will facilitate the process of working with the kernel recipes. If you find you need some additional background, please be sure to review and understand the following documentation: Yocto Project Quick Start devtool workflow as described in the Yocto Project Software Development Kit (SDK) Developer's Guide. The "Understanding and Creating Layers" section in the Yocto Project Development Manual The "Kernel Modification Workflow" section. Finally, while this document focuses on the manual creation of recipes, patches, and configuration files, the Yocto Project Board Support Package (BSP) tools are available to automate this process with existing content and work well to create the initial framework and boilerplate code. For details on these tools, see the "Using the Yocto Project's BSP Tools" section in the Yocto Project Board Support Package (BSP) Developer's Guide.