From 94d19520195810695a12780b24a9510ca1324b66 Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Sun, 21 Jul 2024 22:55:49 +0200 Subject: bin: added a simple script for cross compilation MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- bin/cross | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100755 bin/cross (limited to 'bin') diff --git a/bin/cross b/bin/cross new file mode 100755 index 0000000..7ef26b6 --- /dev/null +++ b/bin/cross @@ -0,0 +1,18 @@ +#!/bin/bash + +arch=$(uname -m) +if [ "${arch}" != "x86_64" ]; then + echo "This tool is only meant to be used on x86_64!" + exit 1 +fi + +count=$(find /usr/bin/riscv64-*-gcc -printf "%f\n" | grep -v elf -c) +if [ "$count" -lt 1 ]; then + echo "There are too many options for the compiler, not even trying... Bail!" + exit 1 +fi + +bin=$(find /usr/bin/riscv64-*-gcc -printf "%f\n" | grep -v elf | rev | cut -c4- | rev) + +export ARCH="riscv" +export CROSS_COMPILE="${bin}" -- cgit v1.2.3