public inbox for isar-users@googlegroups.com
 help / color / mirror / Atom feed
* [RFC][PATCH v1] linux-custom: Add a provision to support CONFIG_LOCALVERSION_AUTO
@ 2024-10-22 11:58 srinuvasan.a via isar-users
  2024-10-22 13:17 ` 'Jan Kiszka' via isar-users
  0 siblings, 1 reply; 18+ messages in thread
From: srinuvasan.a via isar-users @ 2024-10-22 11:58 UTC (permalink / raw)
  To: isar-users; +Cc: cedric.hombourger, jan.kiszka, srinuvasan

From: srinuvasan <srinuvasan.a@siemens.com>

This change might be useful for downstream layers to set the CONFIG_LOCALVERSION_AUTO
in their base defconfig to append the version automatically to kernel release.

Presently ISAR doesn't have this support, hence add this provision.

Here we try to find the CONFIG_LOCALVERSION_AUTO availability and .git present during
build the kernel package, unfortunately we are not getting the .git directory in the dpkg_build stage
even if we are fetching the git repo, this is due to sbuild always uses the sources (dsc) file
to build the package, when we generate the dsc file it create the tar ball without .git, hence
during dpkg_build stage it is not possible to get the latest commit HEAD value using "git rev-parse --verify HEAD"

To solve this issue we have base .config and .git available in the do_dpkg_source stage, here we try to find the
latest commit and write them into .scmversion file, later during the kernel build package stage
we are calling the kernelrelease target to set the localversion, this setlocalversion script
handle the availability of .scmversion file and append the string accordingly to the kernelrelease.

Signed-off-by: srinuvasan <srinuvasan.a@siemens.com>
---
 .../linux/files/debian/isar/version.cfg.tmpl          |  1 -
 meta/recipes-kernel/linux/linux-custom.inc            | 11 +++++++++++
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/meta/recipes-kernel/linux/files/debian/isar/version.cfg.tmpl b/meta/recipes-kernel/linux/files/debian/isar/version.cfg.tmpl
index 17effe52..1ab699f5 100644
--- a/meta/recipes-kernel/linux/files/debian/isar/version.cfg.tmpl
+++ b/meta/recipes-kernel/linux/files/debian/isar/version.cfg.tmpl
@@ -1,2 +1 @@
 CONFIG_LOCALVERSION="${LINUX_VERSION_EXTENSION}"
-# CONFIG_LOCALVERSION_AUTO is not set
diff --git a/meta/recipes-kernel/linux/linux-custom.inc b/meta/recipes-kernel/linux/linux-custom.inc
index 0f23d6f0..d0787aad 100644
--- a/meta/recipes-kernel/linux/linux-custom.inc
+++ b/meta/recipes-kernel/linux/linux-custom.inc
@@ -296,6 +296,17 @@ EOF
 	done
 }
 
+get_localversion_auto() {
+	if grep -q "^CONFIG_LOCALVERSION_AUTO=y" ${S}/${KERNEL_BUILD_DIR}/.config; then
+		cd ${S}
+		if test -z "$(git rev-parse --show-cdup 2>/dev/null)" &&
+		  head=$(git rev-parse --verify --short HEAD 2>/dev/null); then
+			echo "-g${head}" >${S}/.scmversion
+		fi
+	fi
+}
+
 do_dpkg_source:prepend() {
 	dpkg_configure_kernel
+	get_localversion_auto
 }
-- 
2.39.5

-- 
You received this message because you are subscribed to the Google Groups "isar-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to isar-users+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/isar-users/20241022115836.1395681-1-srinuvasan.a%40siemens.com.

^ permalink raw reply	[flat|nested] 18+ messages in thread

end of thread, other threads:[~2024-11-04 13:52 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-10-22 11:58 [RFC][PATCH v1] linux-custom: Add a provision to support CONFIG_LOCALVERSION_AUTO srinuvasan.a via isar-users
2024-10-22 13:17 ` 'Jan Kiszka' via isar-users
2024-10-23 12:53   ` [PATCH v2 1/2] add new machine qemuamd64-cip and corresponding mc srinuvasan.a via isar-users
2024-10-23 12:53     ` [PATCH v2 2/2] linux-custom: Add a provision to support CONFIG_LOCALVERSION_AUTO srinuvasan.a via isar-users
2024-10-23 12:54       ` 'Arjunan, Srinu' via isar-users
2024-10-23 16:04       ` 'Jan Kiszka' via isar-users
2024-10-23 16:26         ` 'Arjunan, Srinu' via isar-users
2024-10-23 16:31           ` 'Jan Kiszka' via isar-users
2024-10-23 16:43             ` 'Arjunan, Srinu' via isar-users
2024-10-23 16:02     ` [PATCH v2 1/2] add new machine qemuamd64-cip and corresponding mc 'Jan Kiszka' via isar-users
2024-10-24  6:09       ` [PATCH v3 " srinuvasan.a via isar-users
2024-10-24  6:09         ` [PATCH v3 2/2] linux-custom: Add a provision to support CONFIG_LOCALVERSION_AUTO srinuvasan.a via isar-users
2024-10-25  5:14           ` 'Arjunan, Srinu' via isar-users
2024-10-25  9:09             ` 'Jan Kiszka' via isar-users
2024-10-25 13:13               ` Uladzimir Bely
2024-10-26  1:55                 ` [PATCH v4 1/2] add new machine qemuamd64-cip and corresponding mc srinuvasan.a via isar-users
2024-10-26  1:55                   ` [PATCH v4 2/2] linux-custom: Add a provision to support CONFIG_LOCALVERSION_AUTO srinuvasan.a via isar-users
2024-11-04 13:52                   ` [PATCH v4 1/2] add new machine qemuamd64-cip and corresponding mc Uladzimir Bely

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox