1
0
mirror of https://git.yoctoproject.org/poky synced 2026-06-01 13:09:50 +00:00

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>
This commit is contained in:
Bruce Ashfield
2020-08-12 13:03:28 -04:00
committed by Richard Purdie
parent c74b763e04
commit 095175595d
+19 -5
View File
@@ -87,6 +87,13 @@ def get_machine_branch(d, default):
do_kernel_metadata() { do_kernel_metadata() {
set +e set +e
if [ -n "$1" ]; then
mode="$1"
else
mode="patch"
fi
cd ${S} cd ${S}
export KMETA=${KMETA} export KMETA=${KMETA}
@@ -120,14 +127,13 @@ do_kernel_metadata() {
if [ -n "${KBUILD_DEFCONFIG}" ]; then if [ -n "${KBUILD_DEFCONFIG}" ]; then
if [ -f "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" ]; then if [ -f "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" ]; then
if [ -f "${WORKDIR}/defconfig" ]; then if [ -f "${WORKDIR}/defconfig" ]; then
# If the two defconfig's are different, warn that we didn't overwrite the # If the two defconfig's are different, warn that we overwrote the
# one already placed in WORKDIR by the fetcher. # one already placed in WORKDIR
cmp "${WORKDIR}/defconfig" "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}" cmp "${WORKDIR}/defconfig" "${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG}"
if [ $? -ne 0 ]; then if [ $? -ne 0 ]; then
bbwarn "defconfig detected in WORKDIR. ${KBUILD_DEFCONFIG} skipped" bbdebug 1 "detected SRC_URI or unpatched defconfig in WORKDIR. ${KBUILD_DEFCONFIG} copied over it"
else
cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig
fi fi
cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig
else else
cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig cp -f ${S}/arch/${ARCH}/configs/${KBUILD_DEFCONFIG} ${WORKDIR}/defconfig
fi fi
@@ -137,6 +143,7 @@ do_kernel_metadata() {
fi fi
fi fi
if [ "$mode" = "patch" ]; then
# was anyone trying to patch the kernel meta data ?, we need to do # was anyone trying to patch the kernel meta data ?, we need to do
# this here, since the scc commands migrate the .cfg fragments to the # this here, since the scc commands migrate the .cfg fragments to the
# kernel source tree, where they'll be used later. # kernel source tree, where they'll be used later.
@@ -148,6 +155,7 @@ do_kernel_metadata() {
git am -s $p git am -s $p
) )
done done
fi
sccs_from_src_uri="${@" ".join(find_sccs(d))}" sccs_from_src_uri="${@" ".join(find_sccs(d))}"
patches="${@" ".join(find_patches(d,''))}" patches="${@" ".join(find_patches(d,''))}"
@@ -237,6 +245,7 @@ do_kernel_metadata() {
done done
fi fi
if [ "$mode" = "config" ]; then
# run1: pull all the configuration fragments, no matter where they come from # run1: pull all the configuration fragments, no matter where they come from
elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} $KERNEL_FEATURES_FINAL`" elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} $KERNEL_FEATURES_FINAL`"
if [ -n "${elements}" ]; then if [ -n "${elements}" ]; then
@@ -246,6 +255,7 @@ do_kernel_metadata() {
bbfatal_log "Could not generate configuration queue for ${KMACHINE}." bbfatal_log "Could not generate configuration queue for ${KMACHINE}."
fi fi
fi fi
fi
# if KMETA_EXTERNAL_BSPS has been set, or it has been detected from # if KMETA_EXTERNAL_BSPS has been set, or it has been detected from
# the bsp definition, then we inject the bsp_definition into the # the bsp definition, then we inject the bsp_definition into the
@@ -254,6 +264,7 @@ do_kernel_metadata() {
sccs="${bsp_definition} ${sccs}" sccs="${bsp_definition} ${sccs}"
fi fi
if [ "$mode" = "patch" ]; then
# run2: only generate patches for elements that have been passed on the SRC_URI # run2: only generate patches for elements that have been passed on the SRC_URI
elements="`echo -n ${sccs} ${patches} $KERNEL_FEATURES_FINAL`" elements="`echo -n ${sccs} ${patches} $KERNEL_FEATURES_FINAL`"
if [ -n "${elements}" ]; then if [ -n "${elements}" ]; then
@@ -262,6 +273,7 @@ do_kernel_metadata() {
bbfatal_log "Could not generate configuration queue for ${KMACHINE}." bbfatal_log "Could not generate configuration queue for ${KMACHINE}."
fi fi
fi fi
fi
} }
do_patch() { do_patch() {
@@ -363,6 +375,8 @@ do_kernel_configme[depends] += "bc-native:do_populate_sysroot bison-native:do_po
do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot" do_kernel_configme[depends] += "kern-tools-native:do_populate_sysroot"
do_kernel_configme[dirs] += "${S} ${B}" do_kernel_configme[dirs] += "${S} ${B}"
do_kernel_configme() { do_kernel_configme() {
do_kernel_metadata config
# translate the kconfig_mode into something that merge_config.sh # translate the kconfig_mode into something that merge_config.sh
# understands # understands
case ${KCONFIG_MODE} in case ${KCONFIG_MODE} in