11#! /bin/bash
22
3+ # ARM Cross-Compilation Configuration Script
4+ # ==========================================
5+ # Sets up all environment variables and paths needed for ARM cross-compilation
6+ # Usage: source arm_build_config.sh [arm32|arm64]
7+ # Note: This script must be sourced, not executed directly
8+
9+
10+ # Validate and set architecture-specific variables
11+ # arm32: 32-bit ARM (armhf)
12+ # arm64: 64-bit ARM (aarch64)
313if [ " $1 " == " arm64" ]; then
414 echo " Building for aarch64"
515 TOOLCHAIN_HOST=" aarch64-linux-gnu"
1727 exit
1828fi
1929
30+
31+ # These branches/tags define which version of each dependency to build
32+ # Update these when you need to use different versions of dependencies
2033LIBSERIALPORT_BRANCH=master
2134LIBIIO_VERSION=v0.26
2235LIBAD9361_BRANCH=main
@@ -36,77 +49,82 @@ ECM_BRANCH=kf5
3649KARCHIVE_BRANCH=kf5
3750GENALYZER_BRANCH=main
3851
52+ # This environment variable tells the C++ code to use relative paths for libraries
53+ # When set to 1, the application looks for libraries in the AppImage bundle
54+ # instead of system locations, making the package portable
3955export APPIMAGE=1
4056
57+ # SRC_SCRIPT: Directory containing this script (ci/arm)
58+ # STAGING_AREA: Main working directory for builds
4159SRC_SCRIPT=$( cd -- " $( dirname -- " ${BASH_SOURCE[0]} " ) " & > /dev/null && pwd )
4260[ $CI_SCRIPT == " ON" ] && STAGING_AREA=$HOME /scopy/ci/arm/staging || STAGING_AREA=$SRC_SCRIPT /staging
43- SYSROOT=$STAGING_AREA /sysroot
61+
62+ SYSROOT=$STAGING_AREA /sysroot # root filesystem extracted from Kuiper Linux image
4463SYSROOT_TAR=$STAGING_AREA /sysroot.tar.gz
45- TOOLCHAIN=$STAGING_AREA /cross-pi-gcc
64+ TOOLCHAIN=$STAGING_AREA /cross-pi-gcc # Cross-compiler location
4665TOOLCHAIN_BIN=$TOOLCHAIN /bin
4766TOOLCHAIN_FILE=$SRC_SCRIPT /cmake_toolchain.cmake
48- QT_LOCATION=$SYSROOT /usr/lib/$TOOLCHAIN_HOST /qt5
4967
50- if [ $TOOLCHAIN_HOST == " aarch64-linux-gnu" ]; then
51- QT_BUILD_DEVICE=linux-rasp-pi4-v3d-g++
52- elif [ $TOOLCHAIN_HOST == " arm-linux-gnueabihf" ]; then
53- QT_BUILD_DEVICE=linux-rasp-pi3-vc4-g++
54- fi
68+ QT_LOCATION=$SYSROOT /usr/lib/$TOOLCHAIN_HOST /qt5
69+ QT_BUILD_LOCATION=$QT_LOCATION # The location where Qt will be installed in the system
70+ QT_SYSTEM_LOCATION=/usr/lib/$TOOLCHAIN_HOST /qt5 # The Qt location relative to the sysroot folder
5571
5672CMAKE_BIN=$STAGING_AREA /cmake/bin/cmake
5773QMAKE_BIN=$QT_LOCATION /bin/qmake
58- JOBS=-j14
5974
60- APP_DIR=$SRC_SCRIPT /scopy.AppDir
61- APP_IMAGE=$SRC_SCRIPT /Scopy.AppImage
62- APP_RUN=$SRC_SCRIPT /../general/AppRun
63- APP_DESKTOP=$SRC_SCRIPT /../general/scopy.desktop
75+ JOBS=-j14 # Parallel build configuration
76+
77+ CMAKE_OPTS=(\
78+ -DCMAKE_INSTALL_PREFIX=" $SYSROOT " \
79+ -DCMAKE_TOOLCHAIN_FILE=" $TOOLCHAIN_FILE " \
80+ -DCMAKE_BUILD_TYPE=RelWithDebInfo \
81+ )
82+
83+ CMAKE=" $CMAKE_BIN ${CMAKE_OPTS[*]} " # Complete CMake command with all options
84+
85+ CROSS_COMPILER=$TOOLCHAIN
86+
87+ APP_DIR=$SRC_SCRIPT /scopy.AppDir # Temporary directory structure that becomes the AppImage
88+ APP_IMAGE=$SRC_SCRIPT /Scopy.AppImage # Final AppImage executable file
89+ APP_RUN=$SRC_SCRIPT /../general/AppRun # Entry point script that launches the application
90+ APP_DESKTOP=$SRC_SCRIPT /../general/scopy.desktop # Desktop entry file for Linux desktop integration
6491APP_SQUASHFS=$SRC_SCRIPT /scopy.squashfs
6592
66- # Runetimes downloaded from https://github.com/AppImage/type2-runtime/releases/tag/20251108 8 Dec 2025
93+ # AppImage runtime for ARM
94+ # Downloaded from https://github.com/AppImage/AppImageKit/releases/continuous
95+ # The runtime is a small executable that mounts and runs the AppImage
6796RUNTIME_ARM=$SRC_SCRIPT /runtime-$ARCHITECTURE
6897
69-
70- # The exports below ensure these variables are available to the toolchain file.
98+ # These exports make variables available to cmake_toolchain.cmake
99+ # The toolchain file needs these to properly configure cross-compilation
71100export CMAKE_SYSROOT=" $SYSROOT "
72101export QT_LOCATION=" $QT_LOCATION "
73102export STAGING_AREA=" $STAGING_AREA "
74103export CMAKE_SYSTEM_PROCESSOR=" $CMAKE_SYSTEM_PROCESSOR "
75104export CMAKE_LIBRARY_ARCHITECTURE=" $CMAKE_LIBRARY_ARCHITECTURE "
76105
77- CMAKE_OPTS=(\
78- -DCMAKE_INSTALL_PREFIX=" $SYSROOT " \
79- -DCMAKE_TOOLCHAIN_FILE=" $TOOLCHAIN_FILE " \
80- -DCMAKE_BUILD_TYPE=RelWithDebInfo \
81- )
82-
83- CMAKE=" $CMAKE_BIN ${CMAKE_OPTS[*]} "
84-
85- QT_BUILD_LOCATION=$QT_LOCATION # the location where Qt will be installed in the system
86- QT_SYSTEM_LOCATION=/usr/lib/$TOOLCHAIN_HOST /qt5 # the Qt location relative to the sysroot folder
87- CROSS_COMPILER=$TOOLCHAIN
106+ # CMake 3.29
107+ CMAKE_DOWNLOAD_LINK=https://github.com/Kitware/CMake/releases/download/v3.29.0-rc2/cmake-3.29.0-rc2-linux-x86_64.tar.gz
108+ # Qt 5.15.16 LTS source code
109+ QT_DOWNLOAD_LINK=https://download.qt.io/archive/qt/5.15/5.15.16/single/qt-everywhere-opensource-src-5.15.16.tar.xz
110+ # Script to fix absolute symlinks in sysroot
111+ SYSROOT_RELATIVE_LINKS=https://raw.githubusercontent.com/abhiTronix/rpi_rootfs/master/scripts/sysroot-relativelinks.py
88112
113+ # Sets download URLs and Qt device specs based on target architecture
89114if [ $TOOLCHAIN_HOST == " aarch64-linux-gnu" ]; then
115+ QT_BUILD_DEVICE=linux-rasp-pi4-v3d-g++
90116 CROSSCOMPILER_DOWNLOAD_LINK=https://sourceforge.net/projects/raspberry-pi-cross-compilers/files/Bonus%20Raspberry%20Pi%20GCC%2064-Bit%20Toolchains/Raspberry%20Pi%20GCC%2064-Bit%20Cross-Compiler%20Toolchains/Bookworm/GCC%2012.2.0/cross-gcc-12.2.0-pi_64.tar.gz
117+ KUIPER_DOWNLOAD_LINK=https://github.com/analogdevicesinc/adi-kuiper-gen/releases/download/v2.0.0/image_2025-04-03-ADI-Kuiper-Linux-arm64.zip
118+ IMAGE_NAME=" 2025-04-03-ADI-Kuiper-Linux-arm64"
119+
91120elif [ $TOOLCHAIN_HOST == " arm-linux-gnueabihf" ]; then
121+ QT_BUILD_DEVICE=linux-rasp-pi3-vc4-g++
92122 # bookwork
93123 # CROSSCOMPILER_DOWNLOAD_LINK=https://sourceforge.net/projects/raspberry-pi-cross-compilers/files/Raspberry%20Pi%20GCC%20Cross-Compiler%20Toolchains/Bookworm/GCC%2012.2.0/Raspberry%20Pi%202%2C%203/cross-gcc-12.2.0-pi_2-3.tar.gz
94124 # bullseye, with armv8 flags
95125 # CROSSCOMPILER_DOWNLOAD_LINK=https://sourceforge.net/projects/raspberry-pi-cross-compilers/files/Raspberry%20Pi%20GCC%20Cross-Compiler%20Toolchains/Bullseye/GCC%2010.2.0/Raspberry%20Pi%203A%2B%2C%203B%2B%2C%204%2C%205/cross-gcc-10.2.0-pi_3%2B.tar.gz
96126 # compiler with armv7 flags
97127 CROSSCOMPILER_DOWNLOAD_LINK=https://sourceforge.net/projects/raspberry-pi-cross-compilers/files/Raspberry%20Pi%20GCC%20Cross-Compiler%20Toolchains/Bullseye/GCC%2010.2.0/Raspberry%20Pi%202%2C%203/cross-gcc-10.2.0-pi_2-3.tar.gz
98- fi
99-
100- CMAKE_DOWNLOAD_LINK=https://github.com/Kitware/CMake/releases/download/v3.29.0-rc2/cmake-3.29.0-rc2-linux-x86_64.tar.gz
101-
102- if [ $TOOLCHAIN_HOST == " aarch64-linux-gnu" ]; then
103- KUIPER_DOWNLOAD_LINK=https://github.com/analogdevicesinc/adi-kuiper-gen/releases/download/v2.0.0/image_2025-04-03-ADI-Kuiper-Linux-arm64.zip
104- IMAGE_NAME=" 2025-04-03-ADI-Kuiper-Linux-arm64"
105- elif [ $TOOLCHAIN_HOST == " arm-linux-gnueabihf" ]; then
106128 KUIPER_DOWNLOAD_LINK=https://swdownloads.analog.com/cse/kuiper/image_2023-12-13-ADI-Kuiper-full.zip
107129 IMAGE_NAME=" 2023-12-13-ADI-Kuiper-full"
108130fi
109-
110- QT_DOWNLOAD_LINK=https://download.qt.io/archive/qt/5.15/5.15.16/single/qt-everywhere-opensource-src-5.15.16.tar.xz
111-
112- SYSROOT_RELATIVE_LINKS=https://raw.githubusercontent.com/abhiTronix/rpi_rootfs/master/scripts/sysroot-relativelinks.py
0 commit comments