All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Steve Sakoman" <steve@sakoman.com>
To: openembedded-core@lists.openembedded.org
Subject: [OE-core][dunfell 04/25] kernel/yocto: ensure that defconfigs are processed first
Date: Mon,  6 Jul 2020 06:10:06 -1000	[thread overview]
Message-ID: <7a8612998a367dd3a54344ae75983cb210db813d.1594050175.git.steve@sakoman.com> (raw)
In-Reply-To: <cover.1594050175.git.steve@sakoman.com>

From: Bruce Ashfield <bruce.ashfield@gmail.com>

It is uncommon that a BSP definition and a defconfig are used in
a single configuration. That being said, it is a valid way to
organize kernel configuration meta data.

When a defconfig is used, either on the src_uri or from in
the kernel tree, it is normally expected that it is the baseline,
with all options applied on top of it.

With this commit, we detect either type of defconfig and ensure
that it is used first, followed by the fragments in their
previous order. This allows existing configuration stacks to
remain the same, while ensuring that a defconfig combined stack
works as expected.

Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
(cherry picked from commit e6845327b69396d843a2f3c4c3ac9400ae9caedf)
Signed-off-by: Steve Sakoman <steve@sakoman.com>
---
 meta/classes/kernel-yocto.bbclass | 33 ++++++++++++++++++++-----------
 1 file changed, 21 insertions(+), 12 deletions(-)

diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index 5bc627066e..41d8620e67 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -131,7 +131,7 @@ do_kernel_metadata() {
 			else
 				cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig
 			fi
-			sccs="${WORKDIR}/defconfig"
+			in_tree_defconfig="${WORKDIR}/defconfig"
 		else
 			bbfatal "A KBUILD_DEFCONFIG '${KBUILD_DEFCONFIG}' was specified, but not present in the source tree"
 		fi
@@ -153,14 +153,24 @@ do_kernel_metadata() {
 	patches="${@" ".join(find_patches(d,''))}"
 	feat_dirs="${@" ".join(find_kernel_feature_dirs(d))}"
 
-	# a quick check to make sure we don't have duplicate defconfigs
-	# If there's a defconfig in the SRC_URI, did we also have one from
-	# the KBUILD_DEFCONFIG processing above ?
-	if [ -n "$sccs" ]; then
-	    # we did have a defconfig from above. remove any that might be in the src_uri
-	    sccs_from_src_uri=$(echo $sccs_from_src_uri | awk '{ if ($0!="defconfig") { print $0 } }' RS=' ')
+	# a quick check to make sure we don't have duplicate defconfigs If
+	# there's a defconfig in the SRC_URI, did we also have one from the
+	# KBUILD_DEFCONFIG processing above ?
+	src_uri_defconfig=$(echo $sccs_from_src_uri | awk '{ if ($0=="defconfig") { print $0 } }' RS=' ')
+	# drop and defconfig's from the src_uri variable, we captured it just above here if it existed
+	sccs_from_src_uri=$(echo $sccs_from_src_uri | awk '{ if ($0!="defconfig") { print $0 } }' RS=' ')
+	if [ -n "$in_tree_defconfig" ]; then
+		sccs_defconfig=$in_tree_defconfig
+		if [ -n "$src_uri_defconfig" ]; then
+			bbwarn "[NOTE]: defconfig was supplied both via KBUILD_DEFCONFIG and SRC_URI. Dropping SRC_URI defconfig"
+		fi
+	else
+		# if we didn't have an in-tree one, make our defconfig the one
+		# from the src_uri. Note: there may not have been one from the
+		# src_uri, so this can be an empty variable.
+		sccs_defconfig=$src_uri_defconfig
 	fi
-	sccs="$sccs $sccs_from_src_uri"
+	sccs="$sccs_from_src_uri"
 
 	# check for feature directories/repos/branches that were part of the
 	# SRC_URI. If they were supplied, we convert them into include directives
@@ -187,11 +197,10 @@ do_kernel_metadata() {
 	# expand kernel features into their full path equivalents
 	bsp_definition=$(spp ${includes} --find -DKMACHINE=${KMACHINE} -DKTYPE=${LINUX_KERNEL_TYPE})
 	if [ -z "$bsp_definition" ]; then
-		echo "$sccs" | grep -q defconfig
-		if [ $? -ne 0 ]; then
+		if [ -z "$sccs_defconfig" ]; then
 			bbfatal_log "Could not locate BSP definition for ${KMACHINE}/${LINUX_KERNEL_TYPE} and no defconfig was provided"
 		fi
-
+	else
 		# if the bsp definition has "define KMETA_EXTERNAL_BSP t",
 		# then we need to set a flag that will instruct the next
 		# steps to use the BSP as both configuration and patches.
@@ -206,7 +215,7 @@ do_kernel_metadata() {
 	elements="`echo -n ${bsp_definition} ${sccs} ${patches} ${KERNEL_FEATURES}`"
 	if [ -n "${elements}" ]; then
 		echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition
-		scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} ${bsp_definition} ${sccs} ${patches} ${KERNEL_FEATURES}
+		scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} $sccs_defconfig $bsp_definition $sccs $patches ${KERNEL_FEATURES}
 		if [ $? -ne 0 ]; then
 			bbfatal_log "Could not generate configuration queue for ${KMACHINE}."
 		fi
-- 
2.17.1


  parent reply	other threads:[~2020-07-06 16:11 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-06 16:10 [OE-core][dunfell 00/25] Patch review Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 01/25] libdrm: upgrade 2.4.100 -> 2.4.101 Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 02/25] u-boot: support merging .cfg files for UBOOT_CONFIG Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 03/25] u-boot: avoid blind merging all *.cfg Steve Sakoman
2020-07-06 16:10 ` Steve Sakoman [this message]
2020-07-06 16:29   ` [OE-core][dunfell 04/25] kernel/yocto: ensure that defconfigs are processed first Bruce Ashfield
2020-07-06 16:38     ` Steve Sakoman
2020-07-22 21:27       ` Ryan Harkin
2020-07-23  1:58         ` Bruce Ashfield
2020-07-23  3:33           ` Steve Sakoman
2020-07-23  9:34             ` Ryan Harkin
2020-07-23 12:27               ` Bruce Ashfield
2020-07-23 13:38                 ` Ryan Harkin
2020-07-23 15:04                   ` Bruce Ashfield
2020-07-23 16:06                     ` Ryan Harkin
2020-07-23 18:33                       ` Andrey Zhizhikin
2020-07-23 20:46                         ` Bruce Ashfield
2020-07-06 16:10 ` [OE-core][dunfell 05/25] linux-yocto/5.4: update to v5.4.45 Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 06/25] linux-yocto-rt/5.4: update to rt25 Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 07/25] linux-yocto/5.4: update to v5.4.46 Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 08/25] linux-yocto/5.4: update to v5.4.47 Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 09/25] linux-yocto/5.4: update to v5.4.49 and -rt28 Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 10/25] modutils-initscripts: update postinst Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 11/25] initscripts: " Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 12/25] common-licenses: fix filename of BSD-2-Clause-Patent Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 13/25] python3-libarchive-c: add the missing rdepends Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 14/25] classes/archiver: run do_unpack_and_patch after do_preconfigure Steve Sakoman
2020-07-06 17:12   ` Joshua Watt
2020-07-06 18:48     ` Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 15/25] oescripts.py: fix typo Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 16/25] oescripts: ignore whitespaces when comparing lines Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 17/25] gtk-icon-cache.bbclass: add runtime dependency Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 18/25] oeqa/core/loader: refine regex to find module Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 19/25] oeqa/selftest: recipetool/devtool: Avoid load_plugin test race Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 20/25] oeqa/targetcontrol: Attempt to fix log closure warning message Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 21/25] logrotate.py: fix testimage occasionally failure Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 22/25] rootfs-postcommands: Improve/fix rootfs_check_host_user_contaminated Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 23/25] sqlite3: Security fix for CVE-2020-15358 Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 24/25] qemu: fix CVE-2020-10702/10761/13362/13659/13800 Steve Sakoman
2020-07-06 16:10 ` [OE-core][dunfell 25/25] python3: fix CVE-2020-14422 Steve Sakoman

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=7a8612998a367dd3a54344ae75983cb210db813d.1594050175.git.steve@sakoman.com \
    --to=steve@sakoman.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.