summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJulian Stecklina <js@alien8.de>2024-03-30 19:46:42 +0100
committerJulian Stecklina <js@alien8.de>2024-03-31 00:15:13 +0100
commit9c864184b07fbd9dc4781404f7128e32e4c41ee0 (patch)
treead016c6ddf989277a8e33029dcaac377f0e6ea39 /tools
parent05fbd4f228a1bfd551e5b0825f02b53814b3504d (diff)
Add tool for checking out Linux sources
Diffstat (limited to 'tools')
-rw-r--r--tools/linux-checkout39
1 files changed, 39 insertions, 0 deletions
diff --git a/tools/linux-checkout b/tools/linux-checkout
new file mode 100644
index 0000000..7069f07
--- /dev/null
+++ b/tools/linux-checkout
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+set -eu
+
+if [ $# -ne 1 ]; then
+ echo "Usage: $0 output-directory" 1>&2
+ echo
+ echo "Check out a Linux development tree and populates it with typical remotes."
+ exit 1
+fi
+
+OUTDIR=$1
+
+if [ -e "$OUTDIR" ]; then
+ echo "$OUTDIR already exists. Bailing out." 1>&2
+ exit 1
+fi
+
+mkdir -p "$OUTDIR"
+
+pushd "$OUTDIR"
+
+git init --initial-branch=torvalds
+
+git remote add torvalds https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
+git remote add stable https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
+git remote add rust-for-linux https://github.com/Rust-for-Linux/linux.git
+git remote add kvm https://git.kernel.org/pub/scm/virt/kvm/kvm.git
+# Add new remotes here.
+
+echo "Fetching all remotes. This will take a while."
+git fetch --all
+
+git merge --ff-only torvalds/master
+
+# Reduces the size of the repo a lot.
+git gc --aggressive --prune=now
+
+popd