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
