1
0
mirror of https://git.yoctoproject.org/poky synced 2026-05-09 17:39:31 +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
+43 -29
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,17 +143,19 @@ do_kernel_metadata() {
fi fi
fi fi
# was anyone trying to patch the kernel meta data ?, we need to do if [ "$mode" = "patch" ]; then
# this here, since the scc commands migrate the .cfg fragments to the # was anyone trying to patch the kernel meta data ?, we need to do
# kernel source tree, where they'll be used later. # this here, since the scc commands migrate the .cfg fragments to the
check_git_config # kernel source tree, where they'll be used later.
patches="${@" ".join(find_patches(d,'kernel-meta'))}" check_git_config
for p in $patches; do patches="${@" ".join(find_patches(d,'kernel-meta'))}"
( for p in $patches; do
cd ${WORKDIR}/kernel-meta (
git am -s $p cd ${WORKDIR}/kernel-meta
) 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,13 +245,15 @@ do_kernel_metadata() {
done done
fi fi
# run1: pull all the configuration fragments, no matter where they come from if [ "$mode" = "config" ]; then
elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} $KERNEL_FEATURES_FINAL`" # run1: pull all the configuration fragments, no matter where they come from
if [ -n "${elements}" ]; then elements="`echo -n ${bsp_definition} $sccs_defconfig ${sccs} ${patches} $KERNEL_FEATURES_FINAL`"
echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition if [ -n "${elements}" ]; then
scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} $sccs_defconfig $bsp_definition $sccs $patches $KERNEL_FEATURES_FINAL echo "${bsp_definition}" > ${S}/${meta_dir}/bsp_definition
if [ $? -ne 0 ]; then scc --force -o ${S}/${meta_dir}:cfg,merge,meta ${includes} $sccs_defconfig $bsp_definition $sccs $patches $KERNEL_FEATURES_FINAL
bbfatal_log "Could not generate configuration queue for ${KMACHINE}." if [ $? -ne 0 ]; then
bbfatal_log "Could not generate configuration queue for ${KMACHINE}."
fi
fi fi
fi fi
@@ -254,12 +264,14 @@ do_kernel_metadata() {
sccs="${bsp_definition} ${sccs}" sccs="${bsp_definition} ${sccs}"
fi fi
# run2: only generate patches for elements that have been passed on the SRC_URI if [ "$mode" = "patch" ]; then
elements="`echo -n ${sccs} ${patches} $KERNEL_FEATURES_FINAL`" # run2: only generate patches for elements that have been passed on the SRC_URI
if [ -n "${elements}" ]; then elements="`echo -n ${sccs} ${patches} $KERNEL_FEATURES_FINAL`"
scc --force -o ${S}/${meta_dir}:patch --cmds patch ${includes} ${sccs} ${patches} $KERNEL_FEATURES_FINAL if [ -n "${elements}" ]; then
if [ $? -ne 0 ]; then scc --force -o ${S}/${meta_dir}:patch --cmds patch ${includes} ${sccs} ${patches} $KERNEL_FEATURES_FINAL
bbfatal_log "Could not generate configuration queue for ${KMACHINE}." if [ $? -ne 0 ]; then
bbfatal_log "Could not generate configuration queue for ${KMACHINE}."
fi
fi fi
fi fi
} }
@@ -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