summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNishanth Menon <nm@ti.com>2022-04-27 22:14:43 -0500
committerRyan Eatmon <reatmon@ti.com>2022-04-28 07:13:35 -0500
commitccbe45c06b2fddf73b4a5c596214fc86b0968d39 (patch)
tree1b2f6e256c58d7783011ae2daf4295de90bb911f
parent9e6c7d69d8d5700ff22ca03a3d1d1b04bce88f85 (diff)
downloadmeta-ti-ccbe45c06b2fddf73b4a5c596214fc86b0968d39.tar.gz
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>
-rw-r--r--recipes-kernel/linux/setup-defconfig.inc10
1 files changed, 1 insertions, 9 deletions
diff --git a/recipes-kernel/linux/setup-defconfig.inc b/recipes-kernel/linux/setup-defconfig.inc
index 850a1dd8..1e97acc0 100644
--- a/recipes-kernel/linux/setup-defconfig.inc
+++ b/recipes-kernel/linux/setup-defconfig.inc
@@ -1,14 +1,6 @@
1# KERNEL_LOCALVERSION can be set to add a tag to the end of the 1# KERNEL_LOCALVERSION can be set to add a tag to the end of the
2# kernel version string. such as the commit id 2# kernel version string. such as the commit id
3def get_git_revision(p): 3KERNEL_LOCALVERSION = "-g${@d.getVar('SRCPV', True).split('+')[1]}"
4 import subprocess
5
6 try:
7 return subprocess.Popen("git rev-parse HEAD 2>/dev/null ", cwd=p, shell=True, stdout=subprocess.PIPE, universal_newlines=True).communicate()[0].rstrip()
8 except OSError:
9 return None
10
11KERNEL_LOCALVERSION = "-g${@get_git_revision('${S}').__str__()[:10]}"
12 4
13# Check the defconfig file and see if it points to an in kernel 5# Check the defconfig file and see if it points to an in kernel
14# defconfig that should be used, or if it is a complete config file 6# defconfig that should be used, or if it is a complete config file