[PATCH v5 06/11] dts: Add script to uprev dts/upstream subtree

Sumit Garg sumit.garg at linaro.org
Fri Feb 2 14:05:29 CET 2024


dts/update-dts-subtree.sh is just a wrapper around git subtree commands.
Usage from the top level U-Boot source tree, run:

$ ./dts/update-dts-subtree.sh pull <release-tag>
$ ./dts/update-dts-subtree.sh pick <commit-id>

Signed-off-by: Sumit Garg <sumit.garg at linaro.org>
---

Changes in v5:
- Added support to cherry-pick fixes in subtree update script. Also, used
  https:// instead of git://.

Changes in v4:
- New patch to add script dts/update-dts-subtree.sh as per Rob's comments.

 dts/update-dts-subtree.sh | 45 +++++++++++++++++++++++++++++++++++++++
 1 file changed, 45 insertions(+)
 create mode 100755 dts/update-dts-subtree.sh

diff --git a/dts/update-dts-subtree.sh b/dts/update-dts-subtree.sh
new file mode 100755
index 000000000000..b781bf710025
--- /dev/null
+++ b/dts/update-dts-subtree.sh
@@ -0,0 +1,45 @@
+#!/bin/sh
+# SPDX-License-Identifier: GPL-2.0+
+#
+# Copyright 2024 Linaro Ltd.
+#
+# Usage: from the top level U-Boot source tree, run:
+# $ ./dts/update-dts-subtree.sh pull <release-tag>
+# $ ./dts/update-dts-subtree.sh pick <commit-id>
+#
+# The script will pull changes from devicetree-rebasing repo into U-Boot
+# as a subtree located as <U-Boot>/dts/upstream sub-directory. It will
+# automatically create a squash/merge commit listing the commits imported.
+
+set -e
+
+merge_commit_msg=$(cat << EOF
+Subtree merge tag '$2' of devicetree-rebasing repo [1] into dts/upstream
+
+[1] https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git/
+EOF
+)
+
+remote_add() {
+    if ! git remote | grep -w devicetree-rebasing
+    then
+        git remote add devicetree-rebasing \
+            https://git.kernel.org/pub/scm/linux/kernel/git/devicetree/devicetree-rebasing.git
+    fi
+    git fetch devicetree-rebasing master
+}
+
+if [ ! -z $1 ] && [ $1 = "pull" ]
+then
+    remote_add
+    git subtree pull --prefix dts/upstream devicetree-rebasing \
+        $2 --squash -m "${merge_commit_msg}"
+elif [ ! -z $1 ] && [ $1 = "pick" ]
+then
+    remote_add
+    git cherry-pick -x --strategy=subtree -Xsubtree=dts/upstream/ $2
+else
+    echo "usage: $0 param1 param2"
+    echo "  param1    pull or pick"
+    echo "  param2    release tag [pull] or commit id [pick]"
+fi
-- 
2.34.1



More information about the U-Boot mailing list