poky/meta/classes-recipe/kernel-fit-extra-artifacts.bbclass
Adrian Freihofer 36bea94fe7 kernel-fit-image.bbclass: add a new FIT image implementation
The new recipe linux-yocto-fitimage.bb and the new
kernel-fit-image.bbclass are intended to become successors of the
kernel-fitimage.bbclass.

Instead of injecting the FIT image related build steps into the kernel
recipe, the new recipe takes the kernel artifacts from the kernel recipe
and creates the FIT image as an independent task.

This solves some basic problems:
* sstate does not work well when a fitImage contains an initramfs. The
  kernel is rebuilt from scratch if the build runs from an empty TMPDIR.
* A fitImage kernel is not available as a package, but all other kernel
  image types are.
* The task dependencies in the kernel are very complex and difficult to
  debug if something goes wrong. As a separate, downstream recipe, this
  is now much easier.

The recipe takes the kernel artifacts from the deploy folder. There was
also a test implementation passing the kernel artifacts via sysroot
directory. This requires changes on the kernel.bbclass to make it
copying the artifacts also to the sysroot directory while the same
artifacts are already in the sstate-cached deploy directory.

The new class kernel-fit-extra-artifacts.bbclass generates and deploys
the kernel binary intended for inclusion in a FIT image.
Note that the kernel used in a FIT image is a stripped (and optionally
compressed) vmlinux ELF binary - not a self-extracting format like
zImage, which is already available in the deploy directory if needed
separately.
The kernel-fit-extra-artifacts.bbclass can be used like this:
    KERNEL_CLASSES += "kernel-fit-extra-artifacts"
(if uImage support is not needed, or with :append otherwise)

The long story about this issue is here:
[YOCTO #12912]

(From OE-Core rev: 05d0c7342d7638dbe8a9f2fd3d1c709ee87d6579)

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2025-06-05 11:02:21 +01:00

20 lines
570 B
Plaintext

#
# Copyright OpenEmbedded Contributors
#
# SPDX-License-Identifier: MIT
#
# Generate and deploy additional artifacts required for FIT image creation.
# To use this class, add it to the KERNEL_CLASSES variable.
inherit kernel-uboot
kernel_do_deploy:append() {
# Provide the kernel artifacts to post processing recipes e.g. for creating a FIT image
uboot_prep_kimage "$deployDir"
# For x86 a setup.bin needs to be include"d in a fitImage as well
if [ -e ${KERNEL_OUTPUT_DIR}/setup.bin ]; then
install -D "${B}/${KERNEL_OUTPUT_DIR}/setup.bin" "$deployDir/"
fi
}