Skip to content

Use the kernel from sstate when building fitImages

Adrian Freihofer openembedded-core 4 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v4 Latest4 patches 3 repliesIn review
  2. v34 patches 0 repliesSuperseded
  3. v26 patches 9 repliesSuperseded
Earlier versions · 1
VersionPostedPatchesRepliesStatus
v114 patches6 repliesSuperseded

Patches in v4 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/4kernel: refactor linux compressionmeta/classes-recipe/kernel-fitimage.bbclass meta/classes-recipe/kernel-uboot.bbclass+3 -30 replies
2/4kernel-fitimage: refactor fitimage_assemblemeta/classes-recipe/kernel-fitimage.bbclass+24 -80 replies
3/4kernel: refactor fitimagemeta/classes-recipe/kernel-fitimage.bbclass meta/classes-recipe/kernel.bbclass+50 -361 reply
4/4kernel-fitimage: run unbundled fitimage after deploymeta/classes-recipe/image.bbclass meta/classes-recipe/kernel-fitimage.bbclass meta/classes-recipe/kernel.bbclass+67 -342 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v4 yet.

Read the v4 thread

Cover letter [PATCH v4 0/4] Use the kernel from sstate when building fitImages

Compared to v3, only one space changes. Unfortunately it is an important white space. The diff between v3 and v4 is:

meta/classes-recipe/kernel-fitimage.bbclass +1 -1
@@ -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 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(-)
Signature · 1 line
2.46.0