-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinstall_atfl
More file actions
executable file
·59 lines (48 loc) · 2.16 KB
/
install_atfl
File metadata and controls
executable file
·59 lines (48 loc) · 2.16 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
#!/usr/bin/env bash
# Install Arm Toolchain for Linux (ATfL)
# Usage: ./install_atfl
set -euo pipefail
# Update package lists and install prerequisites
sudo apt update || true # Ignore errors from apt update
sudo apt install -y curl gpg environment-modules
# Add Arm repository and install arm-toolchain-for-linux
VERSION_YEAR=$( (lsb_release -rs 2>/dev/null || (. /etc/os-release && echo "$VERSION_ID")) | cut -d. -f1 ) # e.g., "24" for Ubuntu 24.04
VERSION_CODE=$( (lsb_release -sc 2>/dev/null || (. /etc/os-release && echo "$VERSION_CODENAME")) ) # e.g., "noble" for Ubuntu 24.04
echo "Detected Ubuntu version: ${VERSION_YEAR} (${VERSION_CODE})"
curl "https://developer.arm.com/packages/arm-toolchains:ubuntu-${VERSION_YEAR}/${VERSION_CODE}/Release.key" \
| sudo gpg --dearmor -o /usr/share/keyrings/obs-oss-arm-com.gpg
echo "deb [signed-by=/usr/share/keyrings/obs-oss-arm-com.gpg] https://developer.arm.com/packages/arm-toolchains:ubuntu-${VERSION_YEAR}/${VERSION_CODE}/ ./" \
| sudo tee /etc/apt/sources.list.d/obs-oss-arm-com.list
# Update package lists and install the toolchain
sudo apt update && sudo apt install -y arm-toolchain-for-linux
# Initialize module command
if [ -f /etc/profile.d/modules.sh ]; then
source /etc/profile.d/modules.sh
elif [ -f /usr/share/modules/init/bash ]; then
source /usr/share/modules/init/bash
else
echo "Warning: Module initialization script not found." >&2
fi
# Add Arm modulefiles
module use /opt/arm/modulefiles
# List available modules
module avail
# Load the module for Arm Toolchain for Linux
module load atfl
# Verify installation
for tool in armflang armclang armclang++; do
type $tool > /dev/null 2>&1 || \
{ echo "$tool not found after the installation, which probably failed." >&2 ; exit 1; }
done
# Final messages
echo "Arm Toolchain installation completed."
for tool in armflang armclang armclang++; do
echo -e "\nThe $tool version is:\n"
$tool --version
echo -e "\nThe path to $tool is:\n"
command -v $tool
done
# Set environment variable for subsequent steps if running in GitHub Actions
if [[ -n "${GITHUB_ENV:-}" ]]; then
env | grep -i 'arm\|atfl\|flang\|clang' >> "$GITHUB_ENV"
fi