[OE-core] [PATCH] kernel: Add KERNEL_LOCALVERSION to control version string

Bruce Ashfield bruce.ashfield at gmail.com
Thu Apr 11 00:42:19 UTC 2013


On Wed, Apr 10, 2013 at 5:47 PM, Chase Maupin <Chase.Maupin at ti.com> wrote:
> * Add a variable called KERNEL_LOCALVERSION which when set will
>   place a version string in the .scmversion file of the kernel
>   sources.  This string will be picked up by the kernel Makefile
>   and will be appended to the kernel version.  This is done to
>   make it easier to identify what revision of the kernel sources
>   are being run.  For example you can use a setting like the
>   following to add the short commit id to the kernel version
>   string:
>
> KERNEL_LOCALVERSION = "-g${@d.getVar('SRCPV', True).partition('+')[2][0:7]}"
>
> Signed-off-by: Chase Maupin <Chase.Maupin at ti.com>
> ---
>  meta/classes/kernel.bbclass |    6 +++++-
>  1 files changed, 5 insertions(+), 1 deletions(-)
>
> diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
> index af58887..9757465 100644
> --- a/meta/classes/kernel.bbclass
> +++ b/meta/classes/kernel.bbclass
> @@ -48,6 +48,9 @@ export CMDLINE_CONSOLE = "console=${@d.getVar("KERNEL_CONSOLE",1) or "ttyS0"}"
>
>  KERNEL_VERSION = "${@get_kernelversion('${B}')}"
>
> +# Setting KERNEL_LOCALVERSION will place a string in the .scmversion file
> +# of the kernel tree.  This string will be picked up by the build system
> +# of the kernel and appended to the kernel version.
>  KERNEL_LOCALVERSION ?= ""
>
>  # kernels are generally machine specific
> @@ -210,7 +213,8 @@ kernel_do_configure() {
>         # $ scripts/setlocalversion . => +
>         # $ make kernelversion => 2.6.37
>         # $ make kernelrelease => 2.6.37+
> -       touch ${B}/.scmversion ${S}/.scmversion
> +       echo ${KERNEL_LOCALVERSION} > ${B}/.scmversion
> +       echo ${KERNEL_LOCALVERSION} > ${S}/.scmversion

This would clobber trees that already patch, or otherwise have the file in place
in their source directory.  A test to see if it already exists and only echo
the variable if no one has already set it in their tree would be safer.

This will still be overridden by CONFIG_LOCALVERSION, so it is safe
from that angle, but also note that it can be inhibited by setting
# CONFIG_LOCALVERSION_AUTO is not set, in your .config and
setting LOCALVERSION, but you probably already knew that!

Cheers,

Bruce

>
>         # Copy defconfig to .config if .config does not exist. This allows
>         # recipes to manage the .config themselves in do_configure_prepend().
> --
> 1.7.0.4
>
>
> _______________________________________________
> Openembedded-core mailing list
> Openembedded-core at lists.openembedded.org
> http://lists.linuxtogo.org/cgi-bin/mailman/listinfo/openembedded-core



--
"Thou shalt not follow the NULL pointer, for chaos and madness await
thee at its end"




More information about the Openembedded-core mailing list