1
0
mirror of https://git.yoctoproject.org/meta-ti synced 2026-04-20 19:53:43 +00:00

recipes-kernel: setup-defconfig: Use SRCPV to update KERNEL_LOCALVERSION

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@ti.com>
Signed-off-by: Nishanth Menon <nm@ti.com>
Signed-off-by: Ryan Eatmon <reatmon@ti.com>
Signed-off-by: Denys Dmytriyenko <denys@konsulko.com>
Signed-off-by: Ryan Eatmon <reatmon@ti.com>
This commit is contained in:
Nishanth Menon
2022-05-09 17:59:39 +00:00
committed by Ryan Eatmon
parent e3505e2cd0
commit 038882c616

View File

@@ -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=p, shell=True, stdout=subprocess.PIPE, universal_newlines=True).communicate()[0].rstrip()
except OSError:
return None
KERNEL_LOCALVERSION = "-g${@get_git_revision('${S}').__str__()[:10]}"
KERNEL_LOCALVERSION = "-g${@d.getVar('SRCPV', True).split('+')[1]}"
# 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