summaryrefslogtreecommitdiffstats
path: root/classes/fsl-kernel-localversion.bbclass
diff options
context:
space:
mode:
Diffstat (limited to 'classes/fsl-kernel-localversion.bbclass')
-rw-r--r--classes/fsl-kernel-localversion.bbclass39
1 files changed, 39 insertions, 0 deletions
diff --git a/classes/fsl-kernel-localversion.bbclass b/classes/fsl-kernel-localversion.bbclass
new file mode 100644
index 0000000..bb4bdf5
--- /dev/null
+++ b/classes/fsl-kernel-localversion.bbclass
@@ -0,0 +1,39 @@
1# Freescale Kernel LOCALVERSION extension
2#
3# This allow to easy reuse of code between different kernel recipes
4#
5# The following options are supported:
6#
7# SCMVERSION Puts the Git hash in kernel local version
8# LOCALVERSION Value used in LOCALVERSION (default to '+fslc')
9#
10# Copyright 2014 (C) O.S. Systems Software LTDA.
11
12SCMVERSION ??= "y"
13LOCALVERSION ??= "+fslc"
14
15kernel_conf_variable() {
16 CONF_SED_SCRIPT="$CONF_SED_SCRIPT /CONFIG_$1[ =]/d;"
17 if test "$2" = "n"
18 then
19 echo "# CONFIG_$1 is not set" >> ${S}/.config
20 else
21 echo "CONFIG_$1=$2" >> ${S}/.config
22 fi
23}
24
25do_configure_prepend() {
26 echo "" > ${S}/.config
27 CONF_SED_SCRIPT=""
28
29 kernel_conf_variable LOCALVERSION "\"${LOCALVERSION}\""
30 kernel_conf_variable LOCALVERSION_AUTO y
31
32 sed -e "${CONF_SED_SCRIPT}" < '${WORKDIR}/defconfig' >> '${S}/.config'
33
34 if [ "${SCMVERSION}" = "y" ]; then
35 # Add GIT revision to the local version
36 head=`git rev-parse --verify --short HEAD 2> /dev/null`
37 printf "%s%s" +g $head > ${S}/.scmversion
38 fi
39}