-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsetup.sh
More file actions
executable file
·67 lines (54 loc) · 1.64 KB
/
setup.sh
File metadata and controls
executable file
·67 lines (54 loc) · 1.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#!/usr/bin/env bash
set -e
ROOT_DIR="$(cd "$(dirname "$0")" && pwd)"
TOOLS_DIR="$ROOT_DIR/tools"
TOOLCHAIN_DIR="$TOOLS_DIR/toolchains"
ARM_GNU_VERSION="13.2.Rel1"
ARM_GNU_NAME="arm-gnu-toolchain-${ARM_GNU_VERSION}-x86_64-aarch64-none-elf"
ARM_GNU_ARCHIVE="${ARM_GNU_NAME}.tar.xz"
ARM_GNU_URL="https://developer.arm.com/-/media/Files/downloads/gnu/${ARM_GNU_VERSION}/binrel/${ARM_GNU_ARCHIVE}"
mkdir -p "$TOOLCHAIN_DIR"
# Detect host OS
OS="$(uname -s)"
echo "Setting up prismOS development environment..."
# Install system deps
if [[ "$OS" == "Linux" ]]; then
if command -v apt >/dev/null 2>&1; then
echo "Installing system dependencies (apt)..."
sudo apt update
sudo apt install -y cmake ninja-build qemu-system-arm wget
fi
elif [[ "$OS" == "Darwin" ]]; then
if command -v brew >/dev/null 2>&1; then
echo "Installing system dependencies (brew)..."
brew install cmake ninja qemu wget
else
echo "Homebrew not found. Please install Homebrew first."
exit 1
fi
else
echo "Unsupported OS: $OS"
exit 1
fi
# Install toolchain
if [[ ! -d "$TOOLCHAIN_DIR/$ARM_GNU_NAME" ]]; then
echo "Installing AArch64 bare-metal toolchain..."
cd "$TOOLCHAIN_DIR"
wget "$ARM_GNU_URL"
tar -xf "$ARM_GNU_ARCHIVE"
rm "$ARM_GNU_ARCHIVE"
echo "Toolchain installed."
else
echo "Toolchain already installed."
fi
# Done
TOOLCHAIN_BIN="$TOOLCHAIN_DIR/$ARM_GNU_NAME/bin"
# For local shell
export PATH="$TOOLCHAIN_BIN:$PATH"
# For GitHub Actions
if [[ -n "$GITHUB_PATH" ]]; then
echo "$TOOLCHAIN_BIN" >> "$GITHUB_PATH"
fi
echo
echo "Toolchain added to PATH:"
echo " $TOOLCHAIN_BIN"