From 67649ca70fdd3454f8965ee3a485066e64d875f4 Mon Sep 17 00:00:00 2001 From: Gianluca Busiello Date: Thu, 25 Apr 2024 16:25:21 +0100 Subject: [PATCH] Fixed execution directory issues --- README.md | 13 ++++++++++++- build-gnu-toolchain.sh | 9 +++++++-- extras/source-fetch.py | 4 +++- 3 files changed, 22 insertions(+), 4 deletions(-) mode change 100644 => 100755 extras/source-fetch.py diff --git a/README.md b/README.md index bc0c868..902d639 100644 --- a/README.md +++ b/README.md @@ -297,12 +297,23 @@ After completion of one of the above steps, the full ./src folder should now con The build scripts can be invoked either directly through the generic wrapper script `build-gnu-toolchain.sh` or with a call to the lower-level scripts `build-baremetal-toolchain.sh` (for baremetal toolchains) and `build-cross-linux-toolchain.sh` (for linux targeting toolchains). -First, add the `gnu-devtools-for-arm` folder to your PATH environment variable: +In order to configure the scripts to run, it is possible to either add them to PATH or create a link in the working directory: + +Option1: PATH environment variable: + ``` export PATH="$PWD/src/gnu-devtools-for-arm:$PATH" build-gnu-toolchain.sh --target= start ``` +Option2: symlink in working dir: + +``` +ln -s src/gnu-devtools-for-arm/build-gnu-toolchain.sh +./build-gnu-toolchain.sh --target= start +``` + + ##### Building a toolchain in debug mode for development In order to build a toolchain, the build-gnu-toolchain.sh wrapper script is usually used. It has a simple interface for the usual development use cases. diff --git a/build-gnu-toolchain.sh b/build-gnu-toolchain.sh index daf1050..82822d3 100755 --- a/build-gnu-toolchain.sh +++ b/build-gnu-toolchain.sh @@ -5,15 +5,20 @@ # This script is a top level driver for the build-baremetal-toolchain.sh, # build-cross-linux-toolchain.sh and build-native-toolchain.sh build scripts. # +# The scripts rely on the following paths: +# - execdir: Current working directory +# - script_dir: Directory where the scripts are collected (location of gnu-devtools-for-arm) +# - buildroot: Directory where the builds are created (same as execdir) +# - srcdir: Source directory ($buildroot/src) set -e set -u PS4='+$(date +%Y-%m-%d:%H:%M:%S) (${BASH_SOURCE}:${LINENO}): ${FUNCNAME[0]:+${FUNCNAME[0]}(): }' -execdir=`dirname "$0"` +execdir=`pwd` execdir=`cd "$execdir"; pwd` -script_dir=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) +script_dir=$(dirname $(readlink -f "${BASH_SOURCE[0]}")) if [ ! -f "$script_dir/utilities.sh" ]; then echo "error:Could not find helper script at $script_dir/utilities.sh" exit 1 diff --git a/extras/source-fetch.py b/extras/source-fetch.py old mode 100644 new mode 100755 index 1fe02f6..56dd4f6 --- a/extras/source-fetch.py +++ b/extras/source-fetch.py @@ -1,3 +1,5 @@ +#!/usr/bin/env python3 + try: import configparser except ImportError: @@ -1438,4 +1440,4 @@ def main(): if __name__ == "__main__": - main() \ No newline at end of file + main() -- GitLab