aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBond_009 <bond.009@outlook.com>2022-10-25 21:00:38 +0200
committerBond_009 <bond.009@outlook.com>2022-10-25 21:00:38 +0200
commit9cb2a38cb33782a6a789f4353abcc227ee5bd42d (patch)
tree9902674fd7f71e53511ba9133cdad2a032128b3a
parent841f50c436078474085e58c79d9200c3097eb53d (diff)
Add script to set up binutils for different targets
-rwxr-xr-xscripts/.local/bin/update-binutils36
1 files changed, 36 insertions, 0 deletions
diff --git a/scripts/.local/bin/update-binutils b/scripts/.local/bin/update-binutils
new file mode 100755
index 0000000..ae2ca80
--- /dev/null
+++ b/scripts/.local/bin/update-binutils
@@ -0,0 +1,36 @@
+#!/bin/sh
+
+set -ef
+
+TARGETS="x86_64-elf aarch64-elf"
+
+[ -z "$1" ] && echo "$0: missing url" && exit 1
+
+if [ -n "$2" ]; then
+ TARGETS="$2"
+fi
+
+TMPFILE=$(mktemp)
+TMPDIR=$(mktemp -d)
+
+echo "downloading..."
+curl -o "$TMPFILE" "$1"
+echo "extracting..."
+tar Jxf "$TMPFILE" --strip-components=1 -C "$TMPDIR"
+echo "cleaning up temp file"
+rm "$TMPFILE"
+cd "$TMPDIR"
+for TARGET in $TARGETS
+do
+ echo "configuring target $TARGET..."
+ ./configure --target="$TARGET" --prefix="$HOME/opt/cross" \
+ --disable-nls --disable-werror --disable-libdecnumber --disable-readline --disable-sim
+ echo "building target $TARGET..."
+ make MAKEINFO=true -j "$(nproc)"
+ echo "installing target $TARGET..."
+ make MAKEINFO=true install
+ echo "cleaning after target $TARGET"
+ make distclean
+done
+echo "cleaning up temp dir"
+rm -rf "$TMPDIR"