public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
From: Stefan Koch <stefan-koch@siemens.com>
To: isar-users@googlegroups.com
Cc: stefan-koch@siemens.com, jan.kiszka@siemens.com,
	christian.storm@siemens.com, michael.adler@siemens.com,
	simon.sudler@siemens.com, cedric.hombourger@siemens.com,
	adriaan.schmidt@siemens.com, felix.moessbauer@siemens.com,
	ubely@ilbers.de, amikan@ilbers.de
Subject: [PATCH v2] linux-custom: Speedup build of target specific linux-kbuild package
Date: Fri,  7 Jun 2024 16:11:26 +0200	[thread overview]
Message-ID: <20240607141126.2983943-1-stefan-koch@siemens.com> (raw)

Avoids time expensive QEMU-emulated merging of kernel config by using
the existing kernel config for the target specific linux-kbuild

Using DEPENDS instead of RDEPENDS ensures creation of
kernel (including config) before build of target specific linux-kbuild

Signed-off-by: Stefan Koch <stefan-koch@siemens.com>
---
 .../linux/files/debian/isar/configure.tmpl     | 18 ++++++++++++++----
 meta/recipes-kernel/linux/linux-custom.inc     | 10 +++++++---
 2 files changed, 21 insertions(+), 7 deletions(-)

diff --git a/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl b/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl
index 389c9a85..72eae448 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/configure.tmpl
@@ -10,10 +10,20 @@ do_configure() {
     # Trace what we do here
     set -x
 
-    # Process kernel config target and fragments
-    ${MAKE} O=${KERNEL_BUILD_DIR} ${KERNEL_CONFIG_TARGET}
-    ./scripts/kconfig/merge_config.sh -O ${KERNEL_BUILD_DIR}/ \
-        ${KERNEL_BUILD_DIR}/.config ${KERNEL_CONFIG_FRAGMENTS}
+    kernelconfig="$(find /boot -maxdepth 1 -name "config-${PV}*" -print -quit)"
+    if [ -e "${kernelconfig}" ]; then
+        # Prefer existing kernel config
+        # So, very expensive QEMU-emulated merge_config.sh
+        # can be skipped for target specific linux-kbuild package
+        mkdir -p ${KERNEL_BUILD_DIR}
+        cp "${kernelconfig}" ${KERNEL_BUILD_DIR}/.config
+        ${MAKE} O=${KERNEL_BUILD_DIR} olddefconfig
+    else
+        # Process kernel config target and fragments
+        ${MAKE} O=${KERNEL_BUILD_DIR} ${KERNEL_CONFIG_TARGET}
+        ./scripts/kconfig/merge_config.sh -O ${KERNEL_BUILD_DIR}/ \
+            ${KERNEL_BUILD_DIR}/.config ${KERNEL_CONFIG_FRAGMENTS}
+    fi
 
     # Stop tracing
     set +x
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index 647f09dd..dc354e13 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -25,6 +25,7 @@ KBUILD_DEPENDS ?= "build-essential:native, \
                    flex, \
                    git, \
                    kmod, \
+                   linux-image-${KERNEL_NAME_PROVIDED}:${DISTRO_ARCH} <kbuild !kernel>, \
                    rsync,"
 
 KERNEL_DEBIAN_DEPENDS ?= "initramfs-tools | linux-initramfs-tool, \
@@ -112,7 +113,7 @@ BUILD_PROFILES = "kernel kbuild"
 BBCLASSEXTEND:append:cross-profile = " kbuildtarget"
 
 # When cross-profile is active:
-# build only kernel with the default variant of the recipe
+# build only kernel (including config) with the default variant of the recipe
 BUILD_PROFILES:cross-profile = "kernel"
 
 # -native: kbuild package for host
@@ -122,14 +123,17 @@ RECIPE_PROVIDES:class-native = " \
     linux-kbuild-${KERNEL_NAME_PROVIDED}"
 # Use pseudo target to pull in the base variant of the recipe.
 # Will be auto-extended with -native by multiarch.bbclass.
-RDEPENDS:class-native += "${BPN}-pseudo"
+# Using DEPENDS, see below
+DEPENDS:class-native += "${BPN}-pseudo"
 
 # -kbuildtarget: kbuild package for target, enforcing non-cross-build
 BUILD_PROFILES:class-kbuildtarget = "kbuild"
 RECIPE_PROVIDES:class-kbuildtarget = " \
     linux-headers-${KERNEL_NAME_PROVIDED} \
     linux-kbuild-${KERNEL_NAME_PROVIDED}"
-RDEPENDS:class-kbuildtarget = "${BPN}"
+# Using DEPENDS instead of RDEPENDS to ensure creation of kernel including
+# pregenerated kernel config before target specific linux-kbuild package build
+DEPENDS:class-kbuildtarget = "${BPN}"
 ISAR_CROSS_COMPILE:class-kbuildtarget = "0"
 
 # Make bitbake know we will be producing linux-image and linux-headers packages
-- 
2.39.2


             reply	other threads:[~2024-06-07 14:11 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-06-07 14:11 Stefan Koch [this message]
2024-06-07 15:07 ` Jan Kiszka
2024-06-07 15:37   ` Koch, Stefan

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=20240607141126.2983943-1-stefan-koch@siemens.com \
    --to=stefan-koch@siemens.com \
    --cc=adriaan.schmidt@siemens.com \
    --cc=amikan@ilbers.de \
    --cc=cedric.hombourger@siemens.com \
    --cc=christian.storm@siemens.com \
    --cc=felix.moessbauer@siemens.com \
    --cc=isar-users@googlegroups.com \
    --cc=jan.kiszka@siemens.com \
    --cc=michael.adler@siemens.com \
    --cc=simon.sudler@siemens.com \
    --cc=ubely@ilbers.de \
    /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