Mistake on this page? Email us


This section describes the linux*.bb and linux*.bbappend entities in the UML diagram Figure 4.0.

The discussion is applicable to all targets.

linux*.bb: the top level virtual/kernel control recipe

Figure 4.0 shows the meta-[soc-vendor] linux*.bb base recipe used to build the Linux kernel.

As discussed in Machine configuration files, the [soc-family].inc defines PREFERRED_PROVIDER_virtual/kernel = linux-XXX to specify the kernel recipe.

The nominated Linux recipe linux-XXXX (typically present in the meta-[soc-vendor] BSP layer) expresses its capability of being a virtual/kernel provider by including PROVIDES=virtual/kernel in the recipe. This relationship is expressed in Figure 4.0 by the dotted-line arrow between [soc-family].inc and the interface symbol attached to linux*.bb.

linux*.bbappend customization recipe

Figure 4.0 shows the meta-[soc-vendor]-mbl linux*.bbappend recipe used to customize the meta-[soc-vendor] BSP layer linux*.bb recipe as required for MBL. Customization typically includes:

  • Setting SRC_URI and SRCREV to point to a forked and patched version of the Linux kernel with the required driver support and fixes.
  • Applying additional patches stored in meta-[soc-vendor]-mbl.
  • Specifying the default kernel configuration file to use using the KBUILD_DEFCONFIG_<machine> directive, for example, KBUILD_DEFCONFIG_imx7s-warp-mbl ?= "warp7_mbl_defconfig".
  • Merging kernel configuration fragments into the Linux configuration file to enable MBL-required kernel configuration, for example, to enable verified boot.
  • Setting INITRAMFS_IMAGE = "mbl-image-initramfs", to define the meta-mbl recipe for building initramfs.
  • Setting KERNEL_EXTRA_ARGS to specify extra arguments supplied to the kernel.
  • Setting other symbol values to customize base recipe behavior, for example, to report the current version of the kernel used by the target.

kernel.bbclass openembedded-core support

This section provides detailed discussion of the openembedded-core layer that provides support classes and recipes used by linux*.bb and linux*.bbappend.

figure-7-3 Figure 7.3: The figure shows the openembedded-core kernel.bbclass hierarchy, including mbl-fitimage.

Figure 7.3 shows the UML diagram for the kernel.bbclass used to generate the Linux kernel, and how it relates to linux*.bb(append) and mbl-fitimage.bbclass. This is a more detailed representation of the linux* hierarchy shown in Figure 4.0, drawn to include more of the underlying openembedded-core support for building the kernel.

  • linux*. This entity represents the meta-[soc-vendor] provided recipe for building the kernel. The recipe contains the line inherit kernel to inherit the kernel.bblass functionality.
  • kernel.The kernel.bbclass implements the creation of the Linux kernel image (uImage by default). As you can see in the diagram, the class hierarchy is not well composed because kernel.bbclass inherits from image-specific base classes (such as kernel-uimage.bbclass), rather than image-specific classes being specialized from a general purpose base class. However, this is a recognized problem and is a result of having to maintain backward compatibility with an existing code base of working recipes. The general principle is that the infrastructure for generating kernel images has been partitioned into several logical parts coordinated through kernel.bbclass.
  • linux-kernel-base. The linux-kernel-base.class provides helper functions to kernel.bbclass, including extracting the Linux kernel version from linux/version.h.
  • kernel-uimage. KERNEL_CLASSES defaults to kernel-uimage if unspecified, resulting in kernel.bbclass generating a uImage binary.
  • kernel-arch. kernel.bbclass inherits from kernel-arch.bbclass to set the ARCH environment variable from TARGET_ARCHfor building the Linux kernel.
  • kernel-devicetree. kernel.bbclass inherits from kernel-devicetree.bbclass to generate the kernel device tree, deploying it to DEPLOY_DIR_IMAGE
  • mbl-fitimage.kernel.bbclass is made to inherit from mbl-fitimage.bbclass by setting KERNEL_CLASSES="mbl-fitimage" in ${MACHINE}.conf. (See Figure 4.0, Overview of MBL Yocto layers and the next section for more details). Therefore, MBL does not use kernel-uimage.bbclass.
  • kernel-fitimage. This is the base class for mbl-fitimage.bbclass, and it is responsible for generating the FIT image according to configuration symbol settings.

kernel-fitimage.bbclass and mbl-fitimage.bbclass


Figure 7.4: The figure shows the mbl-fitimage.bbclass class hierarchy.

Figure 7.4 shows a UML class diagram annotated with the processing methods used in generating FIT images.

  • kernel-fitimage.bbclass. The kernel-fitimage.bbclass encapsulates the uboot-mkimage tool invocation to combine a number of image components (such as kernel binary and DTB) into a single multicomponent image (the FIT image). The class member functions fitimage_emit_section_xxx() write FIT image specification metadata sections in the fit-image description file (fit-image.its). The fit_image_assemble() member function is then used to generate the FIT image according to the fit-image.its specification. If UBOOT_SIGN_ENABLE is set (as is the case in MBL ${MACHINE}.conf files), the assemble function signs the newly generated image (again using uboot-mkimage). Processing is hooked into the build by the class promoting certain member functions to task entry points.

  • kernel-uboot.bbclass. This class is used to postprocess the kernel image using the objcopy tool.

  • uboot-sign.bbclass. This class is not used for signing because mbl-fitimage.bbclass processing is used instead.

  • mbl-fitimage.bbclass. The mbl-fitimage.bbclass inherits from kernel-fitimage.bbclass and (re-)implements functions to customize the behavior of the base class. See later in this section for more details.

  • mbl-artefact-names.bbclass. This is a utility class used to define standard names for artifacts, for example, MBL_UBOOT_CMD_FILENAME = "boot.cmd" defines the U-Boot boot script file to be boot.cmd by default.

The main kernel-fitimage.bbclass member functions are:

  • __anonymous(). This is an initialization function for the class that executes after parsing (the class constructor).
  • fitimage_emit_section_setup(). Helper function to write the setup section in the FIT image fit-image.its file.
  • fitimage_emit_section_ramdisk(). Helper function to write the initramfs section in the FIT image fit-image.its file.
  • fitimage_emit_section_config(). Helper function to write the config section in the FIT image fit-image.its file.
  • fitimage_emit_section_dtb(). Helper function to write the device tree binary section in the FIT image fit-image.its file.
  • fitimage_emit_section_kernel(). Helper function to write the kernel section in the FIT image fit-image.its file.
  • fitimage_emit_section_maint(). Helper function to write the main section in the FIT image fit-image.its file.
  • fitimage_assemble(). Orchestrates the n-step procedure for writing the fit-image.its file by, depending on configuration, invoking the appropriate fitimage_emit_section_xxx() helper functions, creating the FIT image and then signing the image.
  • do_assemble_fitimage(). The class promotes this function to be a task entry point for the build process to create a FIT image, without initramfs.
  • do_assemble_fitimage_initramfs(). The class promotes this function to be a task entry point for the build process to create a FIT image, including initramfs.

The key ${MACHINE}.conf symbols controlling FIT image creation are:

  • KERNEL_CLASSES. Setting this symbol to "mbl-fitimage" results in the inclusion of mbl-fitimage.bbclass in the kernel.bbclass hierarchy as shown in Figure 7.3. The processing is then hooked into the build.
  • UBOOT_SIGN_ENABLE. Setting this symbol adds signing headers to the FIT image, according to MBL requirements.

The mbl-fitimage.bbclass member functions of interest are described briefly below:

  • fitimage_emit_section_boot_script(). Helper function to write the boot script fit-image.its section, which incorporates the U-Boot boot.cmd file into the FIT image as the boot.scr.
  • fitimage_emit_section_config(). This writes a modified form of the config to include the new boot.scr boot script section.
  • fitimage_assemble(). This is a modified version of kernel-fitimage.bbclass::fitimage_assemble() to invoke the fitimage_emit_section_boot_script() and fitimage_emit_section_boot_config() functions to add the boot.scr and boot configuration to the FIT image.
Important Information for this Arm website

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies. If you are not happy with the use of these cookies, please review our Cookie Policy to learn how they can be disabled. By disabling cookies, some features of the site will not work.