Patchwork [PATCHv2] kernel: Add KERNEL_LOCALVERSION to control version string

login
register
mail settings
Submitter chase maupin
Date April 11, 2013, 1:03 p.m.
Message ID <1365685393-611-1-git-send-email-Chase.Maupin@ti.com>
Download mbox | patch
Permalink /patch/47933/
State New
Headers show

Comments

chase maupin - April 11, 2013, 1:03 p.m.
* 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@ti.com>
---
* Updated in version 2
    * Check if the .scmversion file already exists and don't
      overwrite it if it does.
    * Based on feedback from
      Bruce Ashfield <bruce.ashfield@gmail.com]
---
 meta/classes/kernel.bbclass |   10 +++++++++-
 1 files changed, 9 insertions(+), 1 deletions(-)
chase maupin - April 16, 2013, 11:58 a.m.
> -----Original Message-----
> From: Maupin, Chase
> Sent: Thursday, April 11, 2013 8:03 AM
> To: openembedded-core@lists.openembedded.org
> Cc: Maupin, Chase
> Subject: [PATCHv2] kernel: Add KERNEL_LOCALVERSION to control
> version string
> 
> * 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]}"

Ping on this patch

> 
> Signed-off-by: Chase Maupin <Chase.Maupin@ti.com>
> ---
> * Updated in version 2
>     * Check if the .scmversion file already exists and don't
>       overwrite it if it does.
>     * Based on feedback from
>       Bruce Ashfield <bruce.ashfield@gmail.com]
> ---
>  meta/classes/kernel.bbclass |   10 +++++++++-
>  1 files changed, 9 insertions(+), 1 deletions(-)
> 
> diff --git a/meta/classes/kernel.bbclass
> b/meta/classes/kernel.bbclass
> index af58887..3d82641 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,12 @@ kernel_do_configure() {
>  	# $ scripts/setlocalversion . => +
>  	# $ make kernelversion => 2.6.37
>  	# $ make kernelrelease => 2.6.37+
> -	touch ${B}/.scmversion ${S}/.scmversion
> +
> +	if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]
> +	then
> +		echo ${KERNEL_LOCALVERSION} > ${B}/.scmversion
> +		echo ${KERNEL_LOCALVERSION} > ${S}/.scmversion
> +	fi
> 
>  	# 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

Patch

diff --git a/meta/classes/kernel.bbclass b/meta/classes/kernel.bbclass
index af58887..3d82641 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,12 @@  kernel_do_configure() {
 	# $ scripts/setlocalversion . => +
 	# $ make kernelversion => 2.6.37
 	# $ make kernelrelease => 2.6.37+
-	touch ${B}/.scmversion ${S}/.scmversion
+
+	if [ ! -e ${B}/.scmversion -a ! -e ${S}/.scmversion ]
+	then
+		echo ${KERNEL_LOCALVERSION} > ${B}/.scmversion
+		echo ${KERNEL_LOCALVERSION} > ${S}/.scmversion
+	fi
 
 	# Copy defconfig to .config if .config does not exist. This allows
 	# recipes to manage the .config themselves in do_configure_prepend().