Openembedded Core Discussions
 help / color / mirror / Atom feed
* [PATCH RESEND] kernel-yocto: fix merge_config.sh flag set when KBUILD_DEFCONFIG is used
@ 2025-01-26 13:20 Slawomir Stepien
  2025-01-26 15:51 ` [OE-core] " Jörg Sommer
  2025-01-26 21:42 ` Bruce Ashfield
  0 siblings, 2 replies; 4+ messages in thread
From: Slawomir Stepien @ 2025-01-26 13:20 UTC (permalink / raw)
  To: openembedded-core; +Cc: Slawomir Stepien

Based on the documentation of KCONFIG_MODE[1], when we use "in-tree"
defconfig (the KBUILD_DEFCONFIG is set), then the alldefconfig mode
should be used with merge_config.sh.

This commit fixes the logic behind setting the flag by checking if the
provided defconfig file exists in the linux source tree.

[1] https://docs.yoctoproject.org/ref-manual/variables.html#term-KCONFIG_MODE

Signed-off-by: Slawomir Stepien <sst@poczta.fm>
---
 meta/classes-recipe/kernel-yocto.bbclass | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/meta/classes-recipe/kernel-yocto.bbclass b/meta/classes-recipe/kernel-yocto.bbclass
index c45abf6ddc..ffda41ffc9 100644
--- a/meta/classes-recipe/kernel-yocto.bbclass
+++ b/meta/classes-recipe/kernel-yocto.bbclass
@@ -113,6 +113,14 @@ def get_dirs_with_fragments(d):
 
     return " ".join(extrafiles)
 
+kbuild_defconfig_exists() {
+	if [ -f "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" ]; then
+		return 0
+	fi
+
+	return 1
+}
+
 do_kernel_metadata() {
 	set +e
 
@@ -155,7 +163,7 @@ do_kernel_metadata() {
 	# precendence.
 	#
 	if [ -n "${KBUILD_DEFCONFIG}" ]; then
-		if [ -f "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" ]; then
+		if $(kbuild_defconfig_exists); then
 			if [ -f "${UNPACKDIR}/defconfig" ]; then
 				# If the two defconfig's are different, warn that we overwrote the
 				# one already placed in UNPACKDIR
@@ -478,8 +486,12 @@ do_kernel_configme() {
 			config_flags=""
 			;;
 		*)
-			if [ -f ${UNPACKDIR}/defconfig ]; then
-				config_flags="-n"
+			if $(kbuild_defconfig_exists); then
+				config_flags=""
+			else
+				if [ -f ${UNPACKDIR}/defconfig ]; then
+					config_flags="-n"
+				fi
 			fi
 			;;
 	esac
-- 
2.48.1



^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2025-01-28  7:32 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-26 13:20 [PATCH RESEND] kernel-yocto: fix merge_config.sh flag set when KBUILD_DEFCONFIG is used Slawomir Stepien
2025-01-26 15:51 ` [OE-core] " Jörg Sommer
2025-01-28  7:31   ` Slawomir Stepien
2025-01-26 21:42 ` Bruce Ashfield

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox