diff options
Diffstat (limited to 'classes/fsl-kernel-localversion.bbclass')
| -rw-r--r-- | classes/fsl-kernel-localversion.bbclass | 39 |
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 000000000..1004e3552 --- /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, 2015 (C) O.S. Systems Software LTDA. | ||
| 11 | |||
| 12 | SCMVERSION ??= "y" | ||
| 13 | LOCALVERSION ??= "+fslc" | ||
| 14 | |||
| 15 | kernel_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" >> ${B}/.config | ||
| 20 | else | ||
| 21 | echo "CONFIG_$1=$2" >> ${B}/.config | ||
| 22 | fi | ||
| 23 | } | ||
| 24 | |||
| 25 | do_configure_prepend() { | ||
| 26 | echo "" > ${B}/.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' >> '${B}/.config' | ||
| 33 | |||
| 34 | if [ "${SCMVERSION}" = "y" ]; then | ||
| 35 | # Add GIT revision to the local version | ||
| 36 | head=`git --git-dir=${S}/.git rev-parse --verify --short HEAD 2> /dev/null` | ||
| 37 | printf "%s%s" +g $head > ${S}/.scmversion | ||
| 38 | fi | ||
| 39 | } | ||
