[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <34207c8fbffc4b35b03f2ab45d3691edc09f063e.1681858286.git.mkubecek@suse.cz>
Date: Wed, 19 Apr 2023 01:02:21 +0200 (CEST)
From: Michal Kubecek <mkubecek@...e.cz>
To: netdev@...r.kernel.org
Cc: Thomas Devoogdt <thomas@...oogdt.com>
Subject: [PATCH ethtool 1/3] scripts: add ethtool-import-uapi
Add script to update sanitized uapi header copies. This script has been
available on kernel.org ethtool web for some time, adding it into the
repository is going to make it more at hand and will allow tracking its
history publicly.
Signed-off-by: Michal Kubecek <mkubecek@...e.cz>
---
scripts/ethtool-import-uapi | 41 +++++++++++++++++++++++++++++++++++++
1 file changed, 41 insertions(+)
create mode 100755 scripts/ethtool-import-uapi
diff --git a/scripts/ethtool-import-uapi b/scripts/ethtool-import-uapi
new file mode 100755
index 000000000000..8e48332cfcc8
--- /dev/null
+++ b/scripts/ethtool-import-uapi
@@ -0,0 +1,41 @@
+#!/bin/bash -e
+#
+# ethtool-import-uapi [commit]
+#
+# Imports sanitized copies of kernel uapi headers from <commit> (can be
+# a commit id, a tag or a branch name). If the argument is omitted,
+# commit currently checked out in the kernel repository is used.
+
+sn="${0##*/}"
+export ARCH="x86_64"
+mkopt="-j$(nproc)" || mkopt=''
+
+if [ ! -d "$LINUX_GIT" ]; then
+ echo "${sn}: please set LINUX_GIT to the location of kernel git" >&2
+ exit 1
+fi
+
+pushd "$LINUX_GIT"
+if [ -n "$1" ]; then
+ git checkout "$1"
+fi
+desc=$(git describe --exact-match 2>/dev/null \
+ || git show -s --abbrev=12 --pretty='commit %h')
+kobj=$(mktemp -d)
+make $mkopt O="$kobj" allmodconfig
+make $mkopt O="$kobj" prepare
+make $mkopt O="$kobj" INSTALL_HDR_PATH="${kobj}/hdr" headers_install
+popd
+
+pushd uapi
+find . -type f -name '*.h' -exec cp -v "${kobj}/hdr/include/{}" {} \;
+popd
+rm -rf "$kobj"
+
+git add uapi
+git commit -s -F - <<EOT
+update UAPI header copies
+
+Update to kernel ${desc}.
+
+EOT
--
2.40.0
Powered by blists - more mailing lists