[master][PATCH 02/10] recipes-kernel: setup-defconfig: Use SRCPV to update KERNEL_LOCALVERSION


Denys Dmytriyenko
 

From: Nishanth Menon <nm@...>

Due to recent security update[1] in git, a subprocess will be unable
to run git rev-parse to fetch revision.

So instead, use the SRCPV to parse the short commit ID and set the
KERNEL_LOCALVERSION variable.

[1] https://github.blog/2022-04-12-git-security-vulnerability-announced/

Inspired-by: Devarsh Thakkar <devarsht@...>
Signed-off-by: Nishanth Menon <nm@...>
Signed-off-by: Ryan Eatmon <reatmon@...>
Signed-off-by: Denys Dmytriyenko <denys@...>
---
meta-ti-bsp/recipes-kernel/linux/setup-defconfig.inc | 10 +---------
1 file changed, 1 insertion(+), 9 deletions(-)

diff --git a/meta-ti-bsp/recipes-kernel/linux/setup-defconfig.inc b/meta-=
ti-bsp/recipes-kernel/linux/setup-defconfig.inc
index 850a1dd8..1e97acc0 100644
--- a/meta-ti-bsp/recipes-kernel/linux/setup-defconfig.inc
+++ b/meta-ti-bsp/recipes-kernel/linux/setup-defconfig.inc
@@ -1,14 +1,6 @@
# KERNEL_LOCALVERSION can be set to add a tag to the end of the
# kernel version string. such as the commit id
-def get_git_revision(p):
- import subprocess
-
- try:
- return subprocess.Popen("git rev-parse HEAD 2>/dev/null ", cwd=3D=
p, shell=3DTrue, stdout=3Dsubprocess.PIPE, universal_newlines=3DTrue).com=
municate()[0].rstrip()
- except OSError:
- return None
-
-KERNEL_LOCALVERSION =3D "-g${@get_git_revision('${S}').__str__()[:10]}"
+KERNEL_LOCALVERSION =3D "-g${@d.getVar('SRCPV', True).split('+')[1]}"
=20
# Check the defconfig file and see if it points to an in kernel
# defconfig that should be used, or if it is a complete config file
--=20
2.25.1

Join meta-ti@lists.yoctoproject.org to automatically receive all group messages.