summaryrefslogtreecommitdiffstats
path: root/classes/fsl-kernel-localversion.bbclass
diff options
context:
space:
mode:
authorFrancesco Valla <valla.francesco@gmail.com>2022-07-31 15:51:13 +0200
committerFrancesco Valla <valla.francesco@gmail.com>2022-07-31 16:48:22 +0200
commit5d96d634568636aa41faf72356c47f0d04532c87 (patch)
treef12aee5ce4129d1d6b5506681ec4f01dd775f90b /classes/fsl-kernel-localversion.bbclass
parente195433d946dfcd335bc0431d0e0ffaf0f169799 (diff)
downloadmeta-freescale-5d96d634568636aa41faf72356c47f0d04532c87.tar.gz
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 <valla.francesco@gmail.com>
Diffstat (limited to 'classes/fsl-kernel-localversion.bbclass')
-rw-r--r--classes/fsl-kernel-localversion.bbclass27
1 files 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 @@
12SCMVERSION ??= "y" 12SCMVERSION ??= "y"
13LOCALVERSION ??= "+fslc" 13LOCALVERSION ??= "+fslc"
14 14
15kernel_conf_variable() { 15# LINUX_VERSION_EXTENSION is used as CONFIG_LOCALVERSION by kernel-yocto class
16 CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;" 16LINUX_VERSION_EXTENSION ?= "${LOCALVERSION}"
17 if test "$2" = "n"
18 then
19 echo "# CONFIG_$1 is not set" >> ${B}/.config
20 else
21 echo "CONFIG_$1=$2" >> ${B}/.config
22 fi
23}
24 17
25do_kernel_localversion[dirs] += "${S} ${B}" 18do_kernel_localversion[dirs] += "${S} ${B}"
26do_kernel_localversion() { 19do_kernel_localversion() {
27 mkdir -p ${B}
28 echo "" > ${B}/.config
29 CONF_SED_SCRIPT=""
30 20
31 kernel_conf_variable LOCALVERSION "\"${LOCALVERSION}\"" 21 # Fallback for recipes not able to use LINUX_VERSION_EXTENSION
32 if [ "${SCMVERSION}" = "y" ]; then 22 if [ "${@bb.data.inherits_class('kernel-yocto', d)}" = "False" ]; then
33 kernel_conf_variable LOCALVERSION_AUTO y 23 echo "CONFIG_LOCALVERSION=${LOCALVERSION}" >> ${B}/.config
34 fi 24 fi
35 25
36 sed -e "${CONF_SED_SCRIPT}" < '${WORKDIR}/defconfig' >> '${B}/.config'
37
38 if [ "${SCMVERSION}" = "y" ]; then 26 if [ "${SCMVERSION}" = "y" ]; then
39 # Add GIT revision to the local version 27 # Add GIT revision to the local version
40 head=`git --git-dir=${S}/.git rev-parse --verify --short HEAD 2> /dev/null` 28 head=`git --git-dir=${S}/.git rev-parse --verify --short HEAD 2> /dev/null`
41 printf "%s%s" +g $head > ${S}/.scmversion 29 printf "%s%s" +g $head > ${S}/.scmversion
30
31 sed -i -e "/CONFIG_LOCALVERSION_AUTO[ =]/d" ${B}/.config
32 echo "CONFIG_LOCALVERSION_AUTO=y" >> ${B}/.config
42 fi 33 fi
43} 34}
44 35
45addtask kernel_localversion before do_configure after do_patch do_kernel_metadata 36addtask kernel_localversion before do_configure after do_patch do_kernel_configme