From a3667f03b7ab54b555a4f06278a29b10a914608d Mon Sep 17 00:00:00 2001 From: Francesco Valla Date: Sun, 31 Jul 2022 15:51:13 +0200 Subject: classes: fsl-kernel-localversion: fix usage with devtool Make fsl-kernel-localversion devtool-compatible, avoiding to depend on ${WORKDIR}/defconfig to be present. Two approaches are taken: - for recipes inheriting kernel-yocto, LINUX_VERSION_EXTENSION is set to LOCALVERSION; in this way, the do_kernel_configme task will use it to set CONFIG_LOCALVERSION once the .config file is generated; - for recipes not inheriting kernel-yocto, CONFIG_LOCALVERSION is simply appended to the .config file contained inside the build directory. The do_kernel_localversion is being made executed after do_kernel_configme rather than do_kernel_metadata; in this way, modifications are applied after the config-by-fragments step has already been performed. Signed-off-by: Francesco Valla (cherry picked from commit 5d96d634568636aa41faf72356c47f0d04532c87) --- classes/fsl-kernel-localversion.bbclass | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/classes/fsl-kernel-localversion.bbclass b/classes/fsl-kernel-localversion.bbclass index c782a3d3..d4322e25 100644 --- a/classes/fsl-kernel-localversion.bbclass +++ b/classes/fsl-kernel-localversion.bbclass @@ -12,34 +12,25 @@ SCMVERSION ??= "y" LOCALVERSION ??= "+fslc" -kernel_conf_variable() { - CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;" - if test "$2" = "n" - then - echo "# CONFIG_$1 is not set" >> ${B}/.config - else - echo "CONFIG_$1=$2" >> ${B}/.config - fi -} +# LINUX_VERSION_EXTENSION is used as CONFIG_LOCALVERSION by kernel-yocto class +LINUX_VERSION_EXTENSION ?= "${LOCALVERSION}" do_kernel_localversion[dirs] += "${S} ${B}" do_kernel_localversion() { - mkdir -p ${B} - echo "" > ${B}/.config - CONF_SED_SCRIPT="" - kernel_conf_variable LOCALVERSION "\"${LOCALVERSION}\"" - if [ "${SCMVERSION}" = "y" ]; then - kernel_conf_variable LOCALVERSION_AUTO y + # Fallback for recipes not able to use LINUX_VERSION_EXTENSION + if [ "${@bb.data.inherits_class('kernel-yocto', d)}" = "False" ]; then + echo "CONFIG_LOCALVERSION=${LOCALVERSION}" >> ${B}/.config fi - sed -e "${CONF_SED_SCRIPT}" < '${WORKDIR}/defconfig' >> '${B}/.config' - if [ "${SCMVERSION}" = "y" ]; then # Add GIT revision to the local version head=`git --git-dir=${S}/.git rev-parse --verify --short HEAD 2> /dev/null` printf "%s%s" +g $head > ${S}/.scmversion + + sed -i -e "/CONFIG_LOCALVERSION_AUTO[ =]/d" ${B}/.config + echo "CONFIG_LOCALVERSION_AUTO=y" >> ${B}/.config fi } -addtask kernel_localversion before do_configure after do_patch do_kernel_metadata +addtask kernel_localversion before do_configure after do_patch do_kernel_configme -- cgit v1.2.3-54-g00ecf