public inbox for openembedded-core@lists.openembedded.org
 help / color / mirror / Atom feed
From: Adrian Freihofer <adrian.freihofer@gmail.com>
To: openembedded-core@lists.openembedded.org
Cc: Adrian Freihofer <adrian.freihofer@siemens.com>
Subject: [PATCH 3/6] kernel: refactor linux compression
Date: Mon, 15 Jul 2024 16:10:40 +0200	[thread overview]
Message-ID: <20240715141448.2158477-4-adrian.freihofer@gmail.com> (raw)
In-Reply-To: <20240715141448.2158477-1-adrian.freihofer@gmail.com>

From: Adrian Freihofer <adrian.freihofer@siemens.com>

This is a step to avoid unecessary kernel rebuilds when the initramfs
changes but not the kernel itself. In case of an unbundled fitImage the
kernel should be staged in the sstate instead of re-compiled.

The uboot_prep_kimage function generates the kernel binary which gets
included into the fitImage. It also defines the variable linux_comp
which is used by the fitimage_assemble function later on.
To make the fitimage_assemble function working with kernel binaries from
sstate it must be decoupled from calling uboot_prep_kimage in ${B} by:
- refactoring uboot_prep_kimage to write the result into files
  (linux.bin, linux.comp).
- calling the uboot_prep_kimage before the artifacts are used or cached.
- refactoring the fitimage_assemble function to use files rather than
  calling the uboot_prep_kimage function which depends on ${B}.

Signed-off-by: Adrian Freihofer <adrian.freihofer@siemens.com>
---
 meta/classes-recipe/kernel-fitimage.bbclass | 5 ++---
 meta/classes-recipe/kernel-uboot.bbclass    | 1 +
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/meta/classes-recipe/kernel-fitimage.bbclass b/meta/classes-recipe/kernel-fitimage.bbclass
index 67c98adb232..02b5fd8e3f5 100644
--- a/meta/classes-recipe/kernel-fitimage.bbclass
+++ b/meta/classes-recipe/kernel-fitimage.bbclass
@@ -579,9 +579,7 @@ fitimage_assemble() {
 	# Step 1: Prepare a kernel image section.
 	#
 	fitimage_emit_section_maint $1 imagestart
-
-	uboot_prep_kimage
-	fitimage_emit_section_kernel $1 $kernelcount linux.bin "$linux_comp"
+	fitimage_emit_section_kernel $1 $kernelcount linux.bin "$(cat linux.comp)"
 
 	#
 	# Step 2: Prepare a DTB image section
@@ -764,6 +762,7 @@ fitimage_assemble() {
 do_assemble_fitimage() {
 	if echo ${KERNEL_IMAGETYPES} | grep -wq "fitImage"; then
 		cd ${B}
+		uboot_prep_kimage
 		fitimage_assemble fit-image.its fitImage-none ""
 		if [ "${INITRAMFS_IMAGE_BUNDLE}" != "1" ]; then
 			ln -sf fitImage-none ${B}/${KERNEL_OUTPUT_DIR}/fitImage
diff --git a/meta/classes-recipe/kernel-uboot.bbclass b/meta/classes-recipe/kernel-uboot.bbclass
index 30a85ccc287..50be7962d46 100644
--- a/meta/classes-recipe/kernel-uboot.bbclass
+++ b/meta/classes-recipe/kernel-uboot.bbclass
@@ -45,5 +45,6 @@ uboot_prep_kimage() {
 		mv -f "linux.bin${linux_suffix}" linux.bin
 	fi
 
+	[ -n "${vmlinux_path}" ] && echo "${linux_comp}" > linux.comp
 	echo "${linux_comp}"
 }
-- 
2.45.2



  parent reply	other threads:[~2024-07-15 14:15 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-07-15 14:10 [PATCH v2 0/6] Use the kernel from sstate when building fitImages Adrian Freihofer
2024-07-15 14:10 ` [PATCH 1/6] kernel-fitimage: fix intentation Adrian Freihofer
2024-07-15 14:10 ` [PATCH 2/6] kernel-fitimage: fix external dtb check Adrian Freihofer
2024-07-15 14:10 ` Adrian Freihofer [this message]
2024-07-15 14:10 ` [PATCH 4/6] kernel-fitimage: refactor fitimage_assemble Adrian Freihofer
2024-07-15 14:10 ` [PATCH 5/6] kernel: refactor fitimage Adrian Freihofer
2024-07-15 14:10 ` [PATCH 6/6] kernel-fitimage: run unbundled fitimage after deploy Adrian Freihofer
2024-07-15 14:22 ` [PATCH v2 0/6] Use the kernel from sstate when building fitImages Adrian Freihofer
2024-07-15 14:32   ` [OE-core] " Martin Jansa
2024-07-18  8:00     ` Adrian Freihofer
2024-07-18  8:39       ` Martin Jansa
2024-07-18 12:37         ` Adrian Freihofer
2024-07-18 13:29           ` Martin Jansa
2024-07-18 10:28       ` Jose Quaresma
2024-07-18 12:44         ` Adrian Freihofer
2024-07-24 15:54 ` Alexandre Belloni

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240715141448.2158477-4-adrian.freihofer@gmail.com \
    --to=adrian.freihofer@gmail.com \
    --cc=adrian.freihofer@siemens.com \
    --cc=openembedded-core@lists.openembedded.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox