summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBruce Ashfield <bruce.ashfield@gmail.com>2020-08-12 13:03:28 -0400
committerRichard Purdie <richard.purdie@linuxfoundation.org>2020-08-13 08:07:00 +0100
commit095175595d9f28d5a0eb7ea520c9af0100bb8dfd (patch)
tree3fd41d500769cc51ad3aa1c28529b46041e6f45d
parentc74b763e04dc40decb651b61cc23fc102b454d59 (diff)
downloadpoky-095175595d9f28d5a0eb7ea520c9af0100bb8dfd.tar.gz
kernel-yocto: split meta data gathering into patch and config phases
do_kernel_metadata gathers and sanitizes the meta-data that is used in later steps of the kernel-yocto build process. The processing takes the form of configuration and patch gathering. The current single pass of both config and patch gathering means that patches can't modify in-tree configuration elements (although this makes tracing configuration changes harder, it is a valid workflow). We can divide the routine into a patch and configuration phase, and call the config variant after patching is done. This keeps the common parts of the gahering intact, but allows us flexibilty in when the stages happen. (From OE-Core rev: 004da4c6c6029bb2bdcea6da8afa70368ddd1bca) Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--meta/classes/kernel-yocto.bbclass72
1 files changed, 43 insertions, 29 deletions
diff --git a/meta/classes/kernel-yocto.bbclass b/meta/classes/kernel-yocto.bbclass
index fa8466e587..96ea612258 100644
--- a/meta/classes/kernel-yocto.bbclass
+++ b/meta/classes/kernel-yocto.bbclass
@@ -87,6 +87,13 @@ def get_machine_branch(d, default):
87 87
88do_kernel_metadata() { 88do_kernel_metadata() {
89 set +e 89 set +e
90
91 if [ -n "$1" ]; then
92 mode="$1"
93 else
94 mode="patch"
95 fi
96
90 cd ${S} 97 cd ${S}
91 export KMETA=${KMETA} 98 export KMETA=${KMETA}
92 99
@@ -120,14 +127,13 @@ do_kernel_metadata() {
120 if [ -n "${KBUILD_DEFCONFIG}" ]; then 127 if [ -n "${KBUILD_DEFCONFIG}" ]; then
121 if [ -f "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" ]; then 128 if [ -f "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" ]; then
122 if [ -f "${WORKDIR}/defconfig" ]; then 129 if [ -f "${WORKDIR}/defconfig" ]; then
123 # If the two defconfig's are different, warn that we didn't overwrite the 130 # If the two defconfig's are different, warn that we overwrote the
124 # one already placed in WORKDIR by the fetcher. 131 # one already placed in WORKDIR
125 cmp "${WORKDIR}/defconfig" "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" 132 cmp "${WORKDIR}/defconfig" "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}"
126 if [ $? -ne 0 ]; then 133 if [ $? -ne 0 ]; then
127 bbwarn "defconfig detected in WORKDIR. ${KBUILD_DEFCONFIG} skipped" 134 bbdebug 1 "detected SRC_URI or unpatched defconfig in WORKDIR. ${KBUILD_DEFCONFIG} copied over it"
128 else
129 cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig
130 fi 135 fi
136 cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig
131 else 137 else
132 cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig 138 cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig
133 fi 139 fi
@@ -137,17 +143,19 @@ do_kernel_metadata() {
137 fi 143 fi
138 fi 144 fi
139 145
140 # was anyone trying to patch the kernel meta data ?, we need to do 146 if [ "$mode" = "patch" ]; then
141 # this here, since the scc commands migrate the .cfg fragments to the 147 # was anyone trying to patch the kernel meta data ?, we need to do
142 # kernel source tree, where they'll be used later. 148 # this here, since the scc commands migrate the .cfg fragments to the
143 check_git_config 149 # kernel source tree, where they'll be used later.
144 patches="${@" ".join(find_patches(d,'kernel-meta'))}" 150 check_git_config
145 for p in $patches; do 151 patches="${@" ".join(find_patches(d,'kernel-meta'))}"
146 ( 152 for p in $patches; do
147 cd ${WORKDIR}/kernel-meta 153 (
148 git am -s $p 154 cd ${WORKDIR}/kernel-meta
149 ) 155 git am -s $p
150 done 156 )
157 done
158 fi
151 159
152 sccs_from_src_uri="${@" ".join(find_sccs(d))}" 160 sccs_from_src_uri="${@" ".join(find_sccs(d))}"
153 patches="${@" ".join(find_patches(d,''))}" 161 patches="${@" ".join(find_patches(d,''))}"
@@ -237,13 +245,15 @@ do_kernel_metadata() {
237 done 245 done
238 fi 246 fi
239 247
240 # run1: pull all the configuration fragments, no matter where they come from 248 if [ "$mode" = "config" ]; then
241 elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} $KERNEL_FEATURES_FINAL`" 249 # run1: pull all the configuration fragments, no matter where they come from
242 if [ -n "${elements}" ]; then 250 elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} $KERNEL_FEATURES_FINAL`"
243 echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition 251 if [ -n "${elements}" ]; then
244 scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} $sccs_defconfig $bsp_definition $sccs $patches $KERNEL_FEATURES_FINAL 252 echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition
245 if [ $? -ne 0 ]; then 253 scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} $sccs_defconfig $bsp_definition $sccs $patches $KERNEL_FEATURES_FINAL
246 bbfatal_log "Could not generate configuration queue for ${KMACHINE}." 254 if [ $? -ne 0 ]; then
255 bbfatal_log "Could not generate configuration queue for ${KMACHINE}."
256 fi
247 fi 257 fi
248 fi 258 fi
249 259
@@ -254,12 +264,14 @@ do_kernel_metadata() {
254 sccs="${bsp_definition} ${sccs}" 264 sccs="${bsp_definition} ${sccs}"
255 fi 265 fi
256 266
257 # run2: only generate patches for elements that have been passed on the SRC_URI 267 if [ "$mode" = "patch" ]; then
258 elements="`echo -n ${sccs} ${patches} $KERNEL_FEATURES_FINAL`" 268 # run2: only generate patches for elements that have been passed on the SRC_URI
259 if [ -n "${elements}" ]; then 269 elements="`echo -n ${sccs} ${patches} $KERNEL_FEATURES_FINAL`"
260 scc --force -o ${S}/${meta_dir}:patch --cmds patch ${includes} ${sccs} ${patches} $KERNEL_FEATURES_FINAL 270 if [ -n "${elements}" ]; then
261 if [ $? -ne 0 ]; then 271 scc --force -o ${S}/${meta_dir}:patch --cmds patch ${includes} ${sccs} ${patches} $KERNEL_FEATURES_FINAL
262 bbfatal_log "Could not generate configuration queue for ${KMACHINE}." 272 if [ $? -ne 0 ]; then
273 bbfatal_log "Could not generate configuration queue for ${KMACHINE}."
274 fi
263 fi 275 fi
264 fi 276 fi
265} 277}
@@ -363,6 +375,8 @@ do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_po
363do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot" 375do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot"
364do_kernel_configme[dirs] += "${S} ${B}" 376do_kernel_configme[dirs] += "${S} ${B}"
365do_kernel_configme() { 377do_kernel_configme() {
378 do_kernel_metadata config
379
366 # translate the kconfig_mode into something that merge_config.sh 380 # translate the kconfig_mode into something that merge_config.sh
367 # understands 381 # understands
368 case ${KCONFIG_MODE} in 382 case ${KCONFIG_MODE} in