diff options
author | Bruce Ashfield <bruce.ashfield@gmail.com> | 2020-06-30 01:18:41 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2020-06-30 16:42:11 +0100 |
commit | 23dcff0d396cfe3fed4f63d33e9a84b08fb910dd (patch) | |
tree | e87507393d68d707c6cefb0e5e2465e1805a669d /meta | |
parent | e9012a2c23ef7347e9a31edc7baf4e66579b255d (diff) | |
download | poky-23dcff0d396cfe3fed4f63d33e9a84b08fb910dd.tar.gz |
kernel/yocto: ensure that defconfigs are processed first
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.
(From OE-Core rev: e6845327b69396d843a2f3c4c3ac9400ae9caedf)
Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta')
-rw-r--r-- | meta/classes/kernel-yocto.bbclass | 33 |
1 files 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() { | |||
131 | else | 131 | else |
132 | cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig | 132 | cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig |
133 | fi | 133 | fi |
134 | sccs="${WORKDIR}/defconfig" | 134 | in_tree_defconfig="${WORKDIR}/defconfig" |
135 | else | 135 | else |
136 | bbfatal "A KBUILD_DEFCONFIG '${KBUILD_DEFCONFIG}' was specified, but not present in the source tree" | 136 | bbfatal "A KBUILD_DEFCONFIG '${KBUILD_DEFCONFIG}' was specified, but not present in the source tree" |
137 | fi | 137 | fi |
@@ -153,14 +153,24 @@ do_kernel_metadata() { | |||
153 | patches="${@" ".join(find_patches(d,''))}" | 153 | patches="${@" ".join(find_patches(d,''))}" |
154 | feat_dirs="${@" ".join(find_kernel_feature_dirs(d))}" | 154 | feat_dirs="${@" ".join(find_kernel_feature_dirs(d))}" |
155 | 155 | ||
156 | # a quick check to make sure we don't have duplicate defconfigs | 156 | # a quick check to make sure we don't have duplicate defconfigs If |
157 | # If there's a defconfig in the SRC_URI, did we also have one from | 157 | # there's a defconfig in the SRC_URI, did we also have one from the |
158 | # the KBUILD_DEFCONFIG processing above ? | 158 | # KBUILD_DEFCONFIG processing above ? |
159 | if [ -n "$sccs" ]; then | 159 | src_uri_defconfig=$(echo $sccs_from_src_uri | awk '{ if ($0=="defconfig") { print $0 } }' RS=' ') |
160 | # we did have a defconfig from above. remove any that might be in the src_uri | 160 | # drop and defconfig's from the src_uri variable, we captured it just above here if it existed |
161 | sccs_from_src_uri=$(echo $sccs_from_src_uri | awk '{ if ($0!="defconfig") { print $0 } }' RS=' ') | 161 | sccs_from_src_uri=$(echo $sccs_from_src_uri | awk '{ if ($0!="defconfig") { print $0 } }' RS=' ') |
162 | if [ -n "$in_tree_defconfig" ]; then | ||
163 | sccs_defconfig=$in_tree_defconfig | ||
164 | if [ -n "$src_uri_defconfig" ]; then | ||
165 | bbwarn "[NOTE]: defconfig was supplied both via KBUILD_DEFCONFIG and SRC_URI. Dropping SRC_URI defconfig" | ||
166 | fi | ||
167 | else | ||
168 | # if we didn't have an in-tree one, make our defconfig the one | ||
169 | # from the src_uri. Note: there may not have been one from the | ||
170 | # src_uri, so this can be an empty variable. | ||
171 | sccs_defconfig=$src_uri_defconfig | ||
162 | fi | 172 | fi |
163 | sccs="$sccs $sccs_from_src_uri" | 173 | sccs="$sccs_from_src_uri" |
164 | 174 | ||
165 | # check for feature directories/repos/branches that were part of the | 175 | # check for feature directories/repos/branches that were part of the |
166 | # SRC_URI. If they were supplied, we convert them into include directives | 176 | # SRC_URI. If they were supplied, we convert them into include directives |
@@ -187,11 +197,10 @@ do_kernel_metadata() { | |||
187 | # expand kernel features into their full path equivalents | 197 | # expand kernel features into their full path equivalents |
188 | bsp_definition=$(spp ${includes} --find -DKMACHINE=${KMACHINE} -DKTYPE=${LINUX_KERNEL_TYPE}) | 198 | bsp_definition=$(spp ${includes} --find -DKMACHINE=${KMACHINE} -DKTYPE=${LINUX_KERNEL_TYPE}) |
189 | if [ -z "$bsp_definition" ]; then | 199 | if [ -z "$bsp_definition" ]; then |
190 | echo "$sccs" | grep -q defconfig | 200 | if [ -z "$sccs_defconfig" ]; then |
191 | if [ $? -ne 0 ]; then | ||
192 | bbfatal_log "Could not locate BSP definition for ${KMACHINE}/${LINUX_KERNEL_TYPE} and no defconfig was provided" | 201 | bbfatal_log "Could not locate BSP definition for ${KMACHINE}/${LINUX_KERNEL_TYPE} and no defconfig was provided" |
193 | fi | 202 | fi |
194 | 203 | else | |
195 | # if the bsp definition has "define KMETA_EXTERNAL_BSP t", | 204 | # if the bsp definition has "define KMETA_EXTERNAL_BSP t", |
196 | # then we need to set a flag that will instruct the next | 205 | # then we need to set a flag that will instruct the next |
197 | # steps to use the BSP as both configuration and patches. | 206 | # steps to use the BSP as both configuration and patches. |
@@ -206,7 +215,7 @@ do_kernel_metadata() { | |||
206 | elements="`echo -n ${bsp_definition} ${sccs} ${patches} ${KERNEL_FEATURES}`" | 215 | elements="`echo -n ${bsp_definition} ${sccs} ${patches} ${KERNEL_FEATURES}`" |
207 | if [ -n "${elements}" ]; then | 216 | if [ -n "${elements}" ]; then |
208 | echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition | 217 | echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition |
209 | scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} ${bsp_definition} ${sccs} ${patches} ${KERNEL_FEATURES} | 218 | scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} $sccs_defconfig $bsp_definition $sccs $patches ${KERNEL_FEATURES} |
210 | if [ $? -ne 0 ]; then | 219 | if [ $? -ne 0 ]; then |
211 | bbfatal_log "Could not generate configuration queue for ${KMACHINE}." | 220 | bbfatal_log "Could not generate configuration queue for ${KMACHINE}." |
212 | fi | 221 | fi |