diff mbox

[v4,0/4] Use the kernel from sstate when building fitImages

Message ID 20240819152136.1185744-1-adrian.freihofer@gmail.com
State Not Applicable, archived
Headers show

Commit Message

Adrian Freihofer Aug. 19, 2024, 3:17 p.m. UTC
Compared to v3, only one space changes. Unfortunately it is an important
white space. The diff between v3 and v4 is:

rebuilt when something changes in the initramfs, which happens
frequently.
This is even worse if the build runs from an empty TMPDIR. The kernel
re-build starts by fetching the large kernel git repository and gets
recompiled from scratch.

This cannot be improved if INITRAMFS_IMAGE_BUNDLE = "1". If the kernel
Makefile is needed to generate the initramfs bundle the kernel build
folder is required.
But for a build configuration with INITRAMFS_IMAGE_BUNDLE = "" the
build folder is not needed. Creating the initramfs bundle requires:
linux.bin, DTBs and the initramfs which are available in the deploy
directory. That means creating the fitImage can be done with artifacts
which are already cached by the sstate.

Testing:
- oe-selftest -a --skip-tests distrodata.Distrodata.test_checkpkg \
     reproducible -T yocto-mirrors -T machine -T toolchain-user \
     -T toolchain-system
- Build linux-yocto with empty TMPDIR and empty sstate, followed by a build
  with populated sstate.
  - Clean build config:
    KERNEL_IMAGETYPE = "Image"
    KERNEL_IMAGETYPES += " fitImage "
    KERNEL_CLASSES = " kernel-fitimage "
    IMAGE_FSTYPES += "cpio.gz"
    INITRAMFS_IMAGE = "core-image-minimal"
    IMAGE_NAME_SUFFIX:pn-core-image-minimal = ""
    UBOOT_RD_LOADADDRESS = "0x88000000"
    UBOOT_RD_ENTRYPOINT = "0x88000000"
    UBOOT_LOADADDRESS = "0x80080000"
    UBOOT_ENTRYPOINT = "0x80080000"
    FIT_DESC = "A model description"
    FOO_VAR = "1"
    INHERIT += "image-buildinfo"
    IMAGE_BUILDINFO_VARS:append = " FOO_VAR"
  - bitbake linux-yocto
  - Append the following and rebuild with sstate:
    FOO_VAR = "2"
    TMPDIR = "${TOPDIR}/tmp-2"
  - bitbake linux-yocto
  - Check the log files:
    - tmp/log/cooker/qemux86-64 contains:
      linux-yocto-6.6.43+git-r0: task do_deploy: Succeeded
      linux-yocto-6.6.43+git-r0: task do_deploy_fitimage_unbundled: Succeeded
    - tmp-2/log/cooker/qemux86-64 contains:
      linux-yocto-6.6.43+git-r0: task do_deploy_setscene: Succeeded
      linux-yocto-6.6.43+git-r0: task do_deploy_fitimage_unbundled: Succeeded
- To re-view the changes in the task dependencies, the bash script which was sent as a
  separate (html formated) e-mail with v3 has been used. It confirms:
  - For builds with fitImage and unbundled initramfs:
    - the do_deploy_fitimage_unbundled task runs after do_deploy
    - do_assemble_fitimage_initramfs is not executed
    - do_bundle_initramfs is not executed
    - It works for fitImage in KERNEL_IMAGETYPE as well as for fitImage
      in KERNEL_IMAGETYPES
  - For builds with fitImage and bundled initramfs: No changes
  - For builds with fitImage, without initramfs:
    - do_assemble_fitimage_initramfs is not executed
    - do_bundle_initramfs is not executed


Adrian Freihofer (4):
  kernel: refactor linux compression
  kernel-fitimage: refactor fitimage_assemble
  kernel: refactor fitimage
  kernel-fitimage: run unbundled fitimage after deploy

 meta/classes-recipe/image.bbclass           |  12 +-
 meta/classes-recipe/kernel-fitimage.bbclass | 152 +++++++++++++-------
 meta/classes-recipe/kernel-uboot.bbclass    |   1 +
 meta/classes-recipe/kernel.bbclass          |  32 +++--
 4 files changed, 130 insertions(+), 67 deletions(-)
diff mbox

Patch

--- a/meta/classes-recipe/kernel-fitimage.bbclass
+++ b/meta/classes-recipe/kernel-fitimage.bbclass
@@ -65,7 +65,7 @@  python __anonymous () {
                 fit_assemble_task = 'do_deploy_fitimage_unbundled'
                 bb.build.addtask(fit_assemble_task, 'do_build', 'do_deploy', d)
                 bb.build.addtask(fit_assemble_task + '_setscene', '', '', d)
-                d.appendVar('SSTATETASKS', fit_assemble_task)
+                d.appendVar('SSTATETASKS', ' ' + fit_assemble_task)

Summary:
If the KERNEL_IMAGETYPES(S) contains fitImage, the kernel is always