diff mbox series

[meta-ti,master/scarthgap] linux: Reproducibility patches from meta-ti-upstream for 6.10

Message ID 20240719160828.28447-1-reatmon@ti.com
State Superseded
Delegated to: Ryan Eatmon
Headers show
Series [meta-ti,master/scarthgap] linux: Reproducibility patches from meta-ti-upstream for 6.10 | expand

Commit Message

Ryan Eatmon July 19, 2024, 4:08 p.m. UTC
Backport the reproducibility patches from meta-ti-upstream for the v6.10
mainline and next kernels.

Signed-off-by: Ryan Eatmon <reatmon@ti.com>
---
 ...msm-registers-improve-reproducibilit.patch | 56 +++++++++++++++++
 ...sh-improve-reproducibility-for-v6.10.patch | 61 +++++++++++++++++++
 .../recipes-kernel/linux/ti-kernel.inc        | 10 +++
 3 files changed, 127 insertions(+)
 create mode 100644 meta-ti-bsp/recipes-kernel/linux/files/0001-drivers-gpu-drm-msm-registers-improve-reproducibilit.patch
 create mode 100644 meta-ti-bsp/recipes-kernel/linux/files/0001-vt-conmakehash-improve-reproducibility-for-v6.10.patch
diff mbox series

Patch

diff --git a/meta-ti-bsp/recipes-kernel/linux/files/0001-drivers-gpu-drm-msm-registers-improve-reproducibilit.patch b/meta-ti-bsp/recipes-kernel/linux/files/0001-drivers-gpu-drm-msm-registers-improve-reproducibilit.patch
new file mode 100644
index 00000000..f83746ee
--- /dev/null
+++ b/meta-ti-bsp/recipes-kernel/linux/files/0001-drivers-gpu-drm-msm-registers-improve-reproducibilit.patch
@@ -0,0 +1,56 @@ 
+From 2c78d22a78584f2a17eb33b5b5fd6fa602c2af8d Mon Sep 17 00:00:00 2001
+From: Ryan Eatmon <reatmon@ti.com>
+Date: Wed, 17 Jul 2024 16:19:20 -0500
+Subject: [PATCH] drivers: gpu: drm: msm: registers: improve reproducibility
+
+The files generated by gen_header.py capture the source path to the
+input files and the date.  While that can be informative, it varies
+based on where and when the kernel was built as the full path is
+captured.
+
+Since all of the files that this tool is run on is under the drivers
+directory, this modifies the application to strip all of the path before
+drivers.  Additionally it prints <stripped> instead of the date.
+
+Both changes solve the reproducibility issue.
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Ryan Eatmon <reatmon@ti.com>
+---
+ drivers/gpu/drm/msm/registers/gen_header.py | 8 +++++---
+ 1 file changed, 5 insertions(+), 3 deletions(-)
+
+diff --git a/drivers/gpu/drm/msm/registers/gen_header.py b/drivers/gpu/drm/msm/registers/gen_header.py
+index 3926485bb197..a409404627c7 100644
+--- a/drivers/gpu/drm/msm/registers/gen_header.py
++++ b/drivers/gpu/drm/msm/registers/gen_header.py
+@@ -11,6 +11,7 @@ import collections
+ import argparse
+ import time
+ import datetime
++import re
+ 
+ class Error(Exception):
+ 	def __init__(self, message):
+@@ -877,13 +878,14 @@ The rules-ng-ng source files this header was generated from are:
+ """)
+ 	maxlen = 0
+ 	for filepath in p.xml_files:
+-		maxlen = max(maxlen, len(filepath))
++		new_filepath = re.sub("^.+drivers","drivers",filepath)
++		maxlen = max(maxlen, len(new_filepath))
+ 	for filepath in p.xml_files:
+-		pad = " " * (maxlen - len(filepath))
++		pad = " " * (maxlen - len(new_filepath))
+ 		filesize = str(os.path.getsize(filepath))
+ 		filesize = " " * (7 - len(filesize)) + filesize
+ 		filetime = time.ctime(os.path.getmtime(filepath))
+-		print("- " + filepath + pad + " (" + filesize + " bytes, from " + filetime + ")")
++		print("- " + new_filepath + pad + " (" + filesize + " bytes, from <stripped>)")
+ 	if p.copyright_year:
+ 		current_year = str(datetime.date.today().year)
+ 		print()
+-- 
+2.17.1
+
diff --git a/meta-ti-bsp/recipes-kernel/linux/files/0001-vt-conmakehash-improve-reproducibility-for-v6.10.patch b/meta-ti-bsp/recipes-kernel/linux/files/0001-vt-conmakehash-improve-reproducibility-for-v6.10.patch
new file mode 100644
index 00000000..056220a5
--- /dev/null
+++ b/meta-ti-bsp/recipes-kernel/linux/files/0001-vt-conmakehash-improve-reproducibility-for-v6.10.patch
@@ -0,0 +1,61 @@ 
+From 4907fa9ff1dbdd72ce9fa7855091fb604a35a62d Mon Sep 17 00:00:00 2001
+From: Ryan Eatmon <reatmon@ti.com>
+Date: Wed, 17 Jul 2024 14:55:10 -0500
+Subject: [PATCH] vt/conmakehash: improve reproducibility for v6.10
+
+The file generated by conmakehash capture the application
+path used to generate the file. While that can be informative,
+it varies based on where the kernel was built, as the full
+path is captured.
+
+We tweak the application to use a second input as the "capture
+name", and then modify the Makefile to pass the basename of
+the source, making it reproducible.
+
+This could be improved by using some sort of path mapping,
+or the application manipualing argv[1] itself, but for now
+this solves the reprodicibility issue.
+
+Signed-off-by: Bruce Ashfield <bruce.ashfield@gmail.com>
+
+Upstream-Status: Inappropriate
+
+Signed-off-by: Denys Dmytriyenko <denys@konsulko.com>
+
+This is a minior rework of Bruce's original patch for the v6.10 kernel.
+
+Signed-off-by: Ryan Eatmon <reatmon@ti.com>
+---
+ drivers/tty/vt/Makefile      | 2 +-
+ drivers/tty/vt/conmakehash.c | 2 ++
+ 2 files changed, 3 insertions(+), 1 deletion(-)
+
+diff --git a/drivers/tty/vt/Makefile b/drivers/tty/vt/Makefile
+index 2c8ce8b592ed..8532077ed3bb 100644
+--- a/drivers/tty/vt/Makefile
++++ b/drivers/tty/vt/Makefile
+@@ -15,7 +15,7 @@ clean-files := consolemap_deftbl.c defkeymap.c
+ hostprogs += conmakehash
+ 
+ quiet_cmd_conmk = CONMK   $@
+-      cmd_conmk = $(obj)/conmakehash $< > $@
++      cmd_conmk = $(obj)/conmakehash $< $(shell basename $<) > $@
+ 
+ $(obj)/consolemap_deftbl.c: $(src)/$(FONTMAPFILE) $(obj)/conmakehash
+ 	$(call cmd,conmk)
+diff --git a/drivers/tty/vt/conmakehash.c b/drivers/tty/vt/conmakehash.c
+index dc2177fec715..9cd4096a8ffa 100644
+--- a/drivers/tty/vt/conmakehash.c
++++ b/drivers/tty/vt/conmakehash.c
+@@ -112,6 +112,8 @@ int main(int argc, char *argv[])
+   else
+     rel_tblname = tblname;
+ 
++  rel_tblname = argv[2];
++
+   /* For now we assume the default font is always 256 characters. */
+   fontlen = 256;
+ 
+-- 
+2.17.1
+
diff --git a/meta-ti-bsp/recipes-kernel/linux/ti-kernel.inc b/meta-ti-bsp/recipes-kernel/linux/ti-kernel.inc
index 1831ba66..5e27bcff 100644
--- a/meta-ti-bsp/recipes-kernel/linux/ti-kernel.inc
+++ b/meta-ti-bsp/recipes-kernel/linux/ti-kernel.inc
@@ -15,6 +15,16 @@  KERNEL_DTBVENDORED = "1"
 
 KERNEL_PATCHES = ""
 
+KERNEL_PATCHES:bsp-mainline = " \
+    file://0001-vt-conmakehash-improve-reproducibility-for-v6.10.patch \
+    file://0001-drivers-gpu-drm-msm-registers-improve-reproducibilit.patch \
+"
+
+KERNEL_PATCHES:bsp-next = " \
+    file://0001-vt-conmakehash-improve-reproducibility-for-v6.10.patch \
+    file://0001-drivers-gpu-drm-msm-registers-improve-reproducibilit.patch \
+"
+
 KERNEL_PATCHES:bsp-ti-6_6 = " \
     file://0001-lib-build_OID_registry-fix-reproducibility-issues.patch \
     file://0001-vt-conmakehash-improve-reproducibility.patch \