diff mbox series

[4/4] sync-with-kernel.sh: create v4l2-tracer patches

Message ID d470d99e37e94ad79ccc8888f0a1bec5f51d66c4.1701114910.git.deborah.brouwer@collabora.com
State New
Headers show
Series v4l2-tracer: track changes from syncing with kernel | expand

Commit Message

Deborah Brouwer Nov. 27, 2023, 8:09 p.m. UTC
After v4l-utils is synced with the latest kernel headers, generate and
apply patches for the changes that need to be made to the v4l2-tracer.
This makes it easier to see how the kernel headers are changing the
v4l2-tracer and also to revert those changes if necessary.

Signed-off-by: Deborah Brouwer <deborah.brouwer@collabora.com>
---
 .gitignore          |  1 +
 sync-with-kernel.sh | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)
diff mbox series

Patch

diff --git a/.gitignore b/.gitignore
index ef546cd4..fcd3d43b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,3 +2,4 @@ 
 patches/
 build/
 *.pc
+v4l2-tracer-gen/
diff --git a/sync-with-kernel.sh b/sync-with-kernel.sh
index ad5681c6..cd6c2b09 100755
--- a/sync-with-kernel.sh
+++ b/sync-with-kernel.sh
@@ -115,8 +115,33 @@  function freebsd {
 	quilt push -a
 }
 
+function v4l2-tracer {
+	V4L2TRACERDIR="${TOPSRCDIR}/utils/v4l2-tracer"
+	V4L2TRACERSOURCES="${TOPSRCDIR}/include/linux/v4l2-controls.h "
+	V4L2TRACERSOURCES+="${TOPSRCDIR}/include/linux/videodev2.h "
+	V4L2TRACERSOURCES+="${TOPSRCDIR}/include/linux/media.h "
+	V4L2TRACERSOURCES+="${TOPSRCDIR}/include/linux/v4l2-common.h "
+
+	mkdir -p $V4L2TRACERDIR/v4l2-tracer-gen
+
+	perl "${V4L2TRACERDIR}/v4l2-tracer-gen.pl" -o $V4L2TRACERDIR/v4l2-tracer-gen $V4L2TRACERSOURCES
+
+	diff -Naur "${V4L2TRACERDIR}/trace-gen.cpp" "${V4L2TRACERDIR}/v4l2-tracer-gen/trace-gen.cpp" > "${V4L2TRACERDIR}/v4l2-tracer-gen/trace-gen.patch"
+	diff -Naur "${V4L2TRACERDIR}/trace-gen.h" "${V4L2TRACERDIR}/v4l2-tracer-gen/trace-gen.h" > "${V4L2TRACERDIR}/v4l2-tracer-gen/trace-gen-h.patch"
+	diff -Naur "${V4L2TRACERDIR}/retrace-gen.cpp" "${V4L2TRACERDIR}/v4l2-tracer-gen/retrace-gen.cpp" > "${V4L2TRACERDIR}/v4l2-tracer-gen/retrace-gen.patch"
+	diff -Naur "${V4L2TRACERDIR}/retrace-gen.h" "${V4L2TRACERDIR}/v4l2-tracer-gen/retrace-gen.h" > "${V4L2TRACERDIR}/v4l2-tracer-gen/retrace-gen-h.patch"
+	diff -Naur "${V4L2TRACERDIR}/v4l2-tracer-info-gen.h" "${V4L2TRACERDIR}/v4l2-tracer-gen/v4l2-tracer-info-gen.h" > "${V4L2TRACERDIR}/v4l2-tracer-gen/v4l2-tracer-info-gen-h.patch"
+
+	patch -d ${V4L2TRACERDIR} --no-backup-if-mismatch <${V4L2TRACERDIR}/v4l2-tracer-gen/trace-gen.patch
+	patch -d ${V4L2TRACERDIR} --no-backup-if-mismatch <${V4L2TRACERDIR}/v4l2-tracer-gen/trace-gen-h.patch
+	patch -d ${V4L2TRACERDIR} --no-backup-if-mismatch <${V4L2TRACERDIR}/v4l2-tracer-gen/retrace-gen.patch
+	patch -d ${V4L2TRACERDIR} --no-backup-if-mismatch <${V4L2TRACERDIR}/v4l2-tracer-gen/retrace-gen-h.patch
+	patch -d ${V4L2TRACERDIR} --no-backup-if-mismatch <${V4L2TRACERDIR}/v4l2-tracer-gen/v4l2-tracer-info-gen-h.patch
+}
+
 keytable
 libdvbv5
 freebsd
 ioctl-test
 xc3028-firmware
+v4l2-tracer