linux-raspberrypi: fix build with devtool

Currently, building linux-raspberrypi with "devtool build" breaks
because ${B}.config doesn't yet exist when do_configure_prepend runs.

Fix this by taking some logic from kernel.bbclass do_configure to populate
${B}.config before do_configure_prepend.

The full explanation for why this is necessary is fairly complex:

- In devtool builds, externalsrc.bbclass gets inherited and sets a list of
SRCTREECOVEREDTASKS, which don't get run because they affect the source tree
and, when using devtool, we want the developer's changes to be the single
source of truth. kernel-yocto.bbclass adds do_kernel_configme to
SRCTREECOVEREDTASKS, so it doesn't run in a devtool build., In a normal
non-devtool build, do_kernel_configme creates ${B}.config.

- Normally (e.g. in linux-yocto), it would be OK that do_kernel_configme
doesn't run, because the first few lines of do_configure in kernel.bbclass
populate ${B}.config from either ${S}.config (if it exists) for custom
developer changes, or otherwise from ${WORDIR}/defconfig.

- In linux-raspberrypi, we add do_configure_prepend, which tweaks
${B}.config. Since this runs *before* the kernel.bbclass do_configure,
${B}.config doesn't yet exist and we hit an error. Thus we need to move
the logic from do_configure up to before our do_configure_prepend. Because
we are copying only a portion of do_configure and not the whole thing,
there is no clean way to do it using OE functionality, so we just
copy-and-paste.

Signed-off-by: Martin Kelly <mkelly@xevo.com>
This commit is contained in:
Martin Kelly 2017-11-17 15:48:41 -08:00 committed by Andrei Gherzan
parent dfa7f00bab
commit 8643e28c3a

View File

@ -61,7 +61,43 @@ kernel_configure_variable() {
fi
}
config_setup() {
# From kernel.bbclass. Unfortunately, this is needed to support builds that
# use devtool. The reason is as follows:
#
# - In devtool builds, externalsrc.bbclass gets inherited and sets a list of
# SRCTREECOVEREDTASKS, which don't get run because they affect the source
# tree and, when using devtool, we want the developer's changes to be the
# single source of truth. kernel-yocto.bbclass adds do_kernel_configme to
# SRCTREECOVEREDTASKS, so it doesn't run in a devtool build., In a normal
# non-devtool build, do_kernel_configme creates ${B}.config.
#
# - Normally (e.g. in linux-yocto), it would be OK that do_kernel_configme
# doesn't run, because the first few lines of do_configure in kernel.bbclass
# populate ${B}.config from either ${S}.config (if it exists) for custom
# developer changes, or otherwise from ${WORDIR}/defconfig.
#
# - In linux-raspberrypi, we add do_configure_prepend, which tweaks
# ${B}.config. Since this runs *before* the kernel.bbclass do_configure,
# ${B}.config doesn't yet exist and we hit an error. Thus we need to move
# the logic from do_configure up to before our do_configure_prepend. Because
# we are copying only a portion of do_configure and not the whole thing,
# there is no clean way to do it using OE functionality, so we just
# copy-and-paste.
if [ "${S}" != "${B}" ] && [ -f "${S}/.config" ] && [ ! -f "${B}/.config" ]; then
mv "${S}/.config" "${B}/.config"
fi
# Copy defconfig to .config if .config does not exist. This allows
# recipes to manage the .config themselves in do_configure_prepend().
if [ -f "${WORKDIR}/defconfig" ] && [ ! -f "${B}/.config" ]; then
cp "${WORKDIR}/defconfig" "${B}/.config"
fi
}
do_configure_prepend() {
config_setup
mv -f ${B}/.config ${B}/.config.patched
CONF_SED_SCRIPT=""