Igt-dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH i-g-t v2] scripts: Add new script for verbatim sync with kernel
@ 2026-05-14 13:27 Kamil Konieczny
  2026-05-15  8:10 ` Jani Nikula
  2026-05-15 14:37 ` Gustavo Sousa
  0 siblings, 2 replies; 6+ messages in thread
From: Kamil Konieczny @ 2026-05-14 13:27 UTC (permalink / raw)
  To: igt-dev
  Cc: Jani Nikula, Ankit Nautiyal, Ashutosh Dixit, Karthik B S,
	Kamil Konieczny

From: Jani Nikula <jani.nikula@intel.com>

This is a helper script used in cases when a verbatim kernel
file should be copied into igt-dev.

Cc: Ankit Nautiyal <ankit.k.nautiyal@intel.com>
Cc: Ashutosh Dixit <ashutosh.dixit@intel.com>
Cc: Karthik B S <karthik.b.s@intel.com>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Signed-off-by: Kamil Konieczny <kamil.konieczny@linux.intel.com>
---
 scripts/sync_with_kernel.sh | 57 +++++++++++++++++++++++++++++++++++++
 1 file changed, 57 insertions(+)
 create mode 100755 scripts/sync_with_kernel.sh

diff --git a/scripts/sync_with_kernel.sh b/scripts/sync_with_kernel.sh
new file mode 100755
index 000000000..65753677c
--- /dev/null
+++ b/scripts/sync_with_kernel.sh
@@ -0,0 +1,57 @@
+#!/bin/sh
+# SPDX-License-Identifier: MIT
+#
+# Copyright © 2026 Intel Corporation
+#
+# Author: Jani Nikula <jani.nikula@intel.com>
+#
+# Use this for verbatim copies from kernel into igt-dev-tools
+# Change paths to yours, update the repos, cd to IGT, and run.
+
+SINCE=962601ac4c78
+KERNEL=$HOME/src/linux
+IGT=$HOME/src/intel-gpu-tools
+
+declare -g -A map
+map["drivers/gpu/drm/i915/display/intel_vbt_defs.h"]="tools/intel_vbt_defs.h"
+map["drivers/gpu/drm/i915/display/intel_dsi_vbt_defs.h"]="tools/intel_dsi_vbt_defs.h"
+map["include/drm/intel/pciids.h"]="lib/pciids.h"
+
+cd $KERNEL
+
+for infile in "${!map[@]}"; do
+	outfile=${map[$infile]}
+
+	echo "processing $infile -> $outfile"
+
+	last=
+	for commit in $(git log --reverse --pretty=%h $SINCE..HEAD -- $infile); do
+		if ! git cat-file -e $commit:$infile 2>/dev/null; then
+			continue
+		fi
+		if git show $commit:$infile | diff -q $IGT/$outfile - >/dev/null; then
+			last=$commit
+			break
+		fi
+	done
+
+	if [[ -z "$last" ]]; then
+		echo "last update to $infile not found"
+		continue
+	fi
+
+	for commit in $(git log --reverse --pretty=%h $last..HEAD -- $infile); do
+		prefix="${outfile%.*}"
+		base="$(basename $outfile)"
+		# ref=$(git cite $commit)
+		# alias: cite = log -1 --abbrev=12 '--format=%h (\"%s\")'
+		ref=$(git log -1 --abbrev=12 '--format=%h (\"%s\")' $commit)
+		git show $commit:$infile > $IGT/$outfile
+		cd $IGT
+		git commit -as \
+		    -m "${prefix}: sync ${base} with kernel commit $commit" \
+		    -m "Synchronize ${base} with kernel commit:" \
+		    -m "$ref"
+		cd -
+	done
+done
-- 
2.54.0


^ permalink raw reply related	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2026-05-15 15:39 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-05-14 13:27 [PATCH i-g-t v2] scripts: Add new script for verbatim sync with kernel Kamil Konieczny
2026-05-15  8:10 ` Jani Nikula
2026-05-15 10:33   ` Kamil Konieczny
2026-05-15 14:37 ` Gustavo Sousa
2026-05-15 14:53   ` Jani Nikula
2026-05-15 15:39     ` Gustavo Sousa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox