Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Major Bug Fixes and Improvements (Fixes #61) #62

Merged
merged 11 commits into from
Feb 5, 2021
12 changes: 9 additions & 3 deletions .github/workflows/builder_64.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ jobs:
strategy:
matrix:
gcc_versions: [6.3.0, 8.3.0]
rpios_types: [stretch, buster]
env:
RPIOS_TYPE: ${{ matrix.rpios_types }}
GCC_VERSION: ${{ matrix.gcc_versions }}
COMPILER_TYPE: CROSS
BASE: true
Expand All @@ -84,7 +86,7 @@ jobs:
source ~/.bashrc && echo $PATH
if: success()
- name: script
run: bash build-scripts/CI/CIBB_64b -g $GCC_VERSION
run: bash build-scripts/CI/CIBB_64b -g $GCC_VERSION -o $RPIOS_TYPE
shell: bash
if: success() && (github.event_name == 'pull_request' || github.event_name == 'release')
- name: before_script
Expand All @@ -103,7 +105,9 @@ jobs:
strategy:
matrix:
gcc_versions: [6.3.0, 8.3.0, 9.3.0, 10.2.0]
rpios_types: [stretch, buster]
env:
RPIOS_TYPE: ${{ matrix.rpios_types }}
GCC_VERSION: ${{ matrix.gcc_versions }}
COMPILER_TYPE: CROSS
steps:
Expand All @@ -129,7 +133,7 @@ jobs:
source ~/.bashrc && echo $PATH
if: success()
- name: script
run: bash build-scripts/CI/CICTB_64b -g $GCC_VERSION
run: bash build-scripts/CI/CICTB_64b -g $GCC_VERSION -o $RPIOS_TYPE
shell: bash
if: success()
- name: before_script
Expand All @@ -148,7 +152,9 @@ jobs:
strategy:
matrix:
gcc_versions: [8.3.0, 9.3.0, 10.2.0]
rpios_types: [stretch, buster]
env:
RPIOS_TYPE: ${{ matrix.rpios_types }}
GCC_VERSION: ${{ matrix.gcc_versions }}
COMPILER_TYPE: NATIVE
steps:
Expand All @@ -174,7 +180,7 @@ jobs:
source ~/.bashrc && echo $PATH
if: success()
- name: script
run: bash build-scripts/CI/CINTB_64b -g $GCC_VERSION
run: bash build-scripts/CI/CINTB_64b -g $GCC_VERSION -o $RPIOS_TYPE
shell: bash
if: success()
- name: before_script
Expand Down
26 changes: 20 additions & 6 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -194,18 +194,32 @@ jobs:
bash utils/SF_docs_deployer -t "native" -f "main" -o "stretch"
shell: bash
if: success()
- name: move_deploy_cross_64
- name: move_deploy_cross_64_buster
run: |
mkdir -p $HOME/main
cp docs/cross-gcc64-buster.md $HOME/main/README.md
bash utils/SF_docs_deployer -t "cross_64" -f "main" -o "buster"
shell: bash
if: success()
- name: move_deploy_cross_64_stretch
run: |
mkdir -p $HOME/main
cp docs/cross-gcc64-stretch.md $HOME/main/README.md
bash utils/SF_docs_deployer -t "cross_64" -f "main" -o "stretch"
shell: bash
if: success()
- name: move_deploy_native_64_buster
run: |
mkdir -p $HOME/main
cp docs/cross-gcc64.md $HOME/main/README.md
bash utils/SF_docs_deployer -t "cross_64" -f "main"
cp docs/native-gcc64-buster.md $HOME/main/README.md
bash utils/SF_docs_deployer -t "native_64" -f "main" -o "buster"
shell: bash
if: success()
- name: move_deploy_native_64
- name: move_deploy_native_64_stretch
run: |
mkdir -p $HOME/main
cp docs/native-gcc64.md $HOME/main/README.md
bash utils/SF_docs_deployer -t "native_64" -f "main"
cp docs/native-gcc64-stretch.md $HOME/main/README.md
bash utils/SF_docs_deployer -t "native_64" -f "main" -o "stretch"
shell: bash
if: success()

Expand Down
18 changes: 9 additions & 9 deletions build-scripts/CI/CIBB_64b
Original file line number Diff line number Diff line change
Expand Up @@ -33,41 +33,41 @@ helpfunction() {
figlet -t -k -f /usr/share/figlet/term.flf "Copyright (c) 2020 abhiTronix"
echo ""
echo ""
echo "Usage: $0 -g [GCC version] -t [OS Type]"
echo "Usage: $0 -g [GCC version] -o [Target Pi OS type]"
echo -e "\t-g GCC base version?: (6.3.0|8.3.0)"
echo -e "\t-t What's yours Raspberry Pi OS type?: (1|2) [default:1]"
echo -e "\t-o What's yours Target Raspberry Pi OS type?: (stretch|buster)"
echo ""
echo ""
exit 1 # Exits script after printing help
}

#input arguments handler
while getopts "g:t:" opt; do
while getopts "g:o:" opt; do
case "$opt" in
g) GCC_VERSION="$OPTARG" ;;
t) OS_TYPE="$OPTARG" ;;
o) RPIOS_TYPE="$OPTARG" ;;
?) helpfunction ;; #prints help function for invalid parameter
esac
done
#validates parameters and print usage helper function in case parameters are missing
if [ -z "$GCC_VERSION" ]; then
echo "Required parameter is missing!"
helpfunction
elif [ -z "$OS_TYPE" ]; then
OS_TYPE=1
elif [ -z "$RPIOS_TYPE" ]; then
RPIOS_TYPE="stretch"
else
echo "Parameters configured!"
fi

#collect dependencies versions from raspberry pi os
if [ "$OS_TYPE" = "1" ]; then
if [ "$RPIOS_TYPE" = "stretch" ]; then
GLIBC_VERSION=2.24
BINUTILS_VERSION=2.28
elif [ "$OS_TYPE" = "2" ]; then
elif [ "$RPIOS_TYPE" = "buster" ]; then
GLIBC_VERSION=2.28
BINUTILS_VERSION=2.31
else
echo "Invalid argument value: $OS_TYPE"
echo "Invalid argument value: $RPIOS_TYPE"
exit
fi

Expand Down
20 changes: 10 additions & 10 deletions build-scripts/CI/CICTB_64b
Original file line number Diff line number Diff line change
Expand Up @@ -33,39 +33,39 @@ helpfunction() {
figlet -t -k -f /usr/share/figlet/term.flf "Copyright (c) 2020 abhiTronix"
echo ""
echo ""
echo "Usage: $0 -g [GCC version] -t [Target OS type]"
echo -e "\t-g GCC version you want to compile?: (7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|9.1.0|9.2.0|9.3.0)"
echo -e "\t-t What's yours Target OS type?: (1|2) [default:1]"
echo "Usage: $0 -g [GCC version] -o [Target OS type]"
echo -e "\t-g GCC version you want to compile?: (7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|9.1.0|9.2.0|9.3.0|10.1.0|10.2.0)"
echo -e "\t-o What's yours Target Raspberry Pi OS type?: (stretch|buster)"
echo ""
echo ""
exit 1 # Exits script after printing help
}

#input arguments handler
while getopts "g:t:" opt; do
while getopts "g:o:" opt; do
case "$opt" in
g) GCC_VERSION="$OPTARG" ;;
t) OS_TYPE="$OPTARG" ;;
o) RPIOS_TYPE="$OPTARG" ;;
?) helpfunction ;; #prints help function for invalid parameter
esac
done
#validates parameters and print usage helper function in case parameters are missing
if [ -z "$GCC_VERSION" ]; then
echo "Error: Required parameter is missing!"
helpfunction
elif [ -z "$OS_TYPE" ]; then
OS_TYPE=1
elif [ -z "$RPIOS_TYPE" ]; then
RPIOS_TYPE="stretch"
else
echo "Parameters configured!"
fi

#collect dependencies versions from raspberry pi os
if [ "$OS_TYPE" = "1" ] || [ "$GCC_VERSION" \< "8.3.0" ]; then
if [ "$RPIOS_TYPE" = "stretch" ] || [ "$GCC_VERSION" \< "8.3.0" ]; then
GCCBASE_VERSION=6.3.0
elif [ "$OS_TYPE" = "2" ]; then
elif [ "$RPIOS_TYPE" = "buster" ]; then
GCCBASE_VERSION=8.3.0
else
echo "Invalid argument value: $OS_TYPE"
echo "Invalid argument value: $RPIOS_TYPE"
exit
fi

Expand Down
12 changes: 6 additions & 6 deletions build-scripts/CI/CINTB_64b
Original file line number Diff line number Diff line change
Expand Up @@ -33,28 +33,28 @@ helpfunction() {
figlet -t -k -f /usr/share/figlet/term.flf "Copyright (c) 2020 abhiTronix"
echo ""
echo ""
echo "Usage: $0 -g [GCC version] -t [Target OS type]"
echo "Usage: $0 -g [GCC version] -o [Target OS type]"
echo -e "\t-g GCC version you want to compile?: (7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|9.1.0|9.2.0|9.3.0|10.1.0|10.2.0)"
echo -e "\t-t What's yours Target OS type?: (1|2) [default:1]"
echo -e "\t-o What's yours Target Raspberry Pi OS type?: (stretch|buster)"
echo ""
echo ""
exit 1 # Exits script after printing help
}

#input arguments handler
while getopts "g:t:" opt; do
while getopts "g:o:" opt; do
case "$opt" in
g) GCC_VERSION="$OPTARG" ;;
t) OS_TYPE="$OPTARG" ;;
o) RPIOS_TYPE="$OPTARG" ;;
?) helpfunction ;; #prints help function for invalid parameter
esac
done
#validates parameters and print usage helper function in case parameters are missing
if [ -z "$GCC_VERSION" ]; then
echo "Error: Required parameter is missing!"
helpfunction
elif [ -z "$OS_TYPE" ]; then
OS_TYPE=1
elif [ -z "$RPIOS_TYPE" ]; then
RPIOS_TYPE="stretch"
else
echo "Parameters configured!"
fi
Expand Down
57 changes: 32 additions & 25 deletions build-scripts/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,19 +109,23 @@ You can run these bash scripts to manually compile any GCC toolchains version th
* **Usage parameters:** This script requires a few command-line parameters, just run `./RTBuilder_32b` on terminal:

```shellsession
Usage: ./RTBuilder_32b -g [GCC version] -r [Target Pi type] -o [Target Pi OS type]
-g GCC version you want to compile?: (7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|8.4.0|9.1.0|9.2.0|9.3.0|10.1.0|10.2.0)
-r What's yours Raspberry Pi type?: (0-1|2-3|3+)
-o What's yours Raspberry Pi OS type?: (stretch|buster)

Usage: ./RTBuilder_32b -g [GCC version] -r [Target Pi type] -o [Target Pi OS type] -V
-g GCC version you want to compile?: (7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|9.1.0|9.2.0|9.3.0|10.1.0|10.2.0)
-r What's yours Target Raspberry Pi type?: (0-1|2-3|3+)
-o What's yours Target Raspberry Pi OS type?: (stretch|buster)
-V Verbose output for debugging?

```

* **Usage:** Just pass _targeted [GCC version](#supported-gcc-versions)_ to `-g` parameter, _targeted raspberry pi type_ to `-r` parameter, and _targeted raspberry pi OS type_ to `-o` parameter of this script:

***:warning: You must NOT compile GCC version [less than GCC 8.3.0 for Buster OS](#supported-gcc-versions), otherwise script will automatically switch to build for Stretch OS.***

```shellsession

chmod +x RTBuilder_32b
./RTBuilder_32b -g "9.3.0" -r "2-3" -o "buster"
./RTBuilder_32b -g "9.3.0" -r "2-3" -o "buster" -V

```

Expand All @@ -135,18 +139,21 @@ You can run these bash scripts to manually compile any GCC toolchains version th
* **Usage parameters:** This script requires few command-line parameters, just run `./RTBuilder_64b`:

```shellsession
Usage: ./RTBuilder_64b -g [GCC version] -t [OS Type]
-g GCC version you want to compile?: (7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|8.4.0|9.1.0|9.2.0|9.3.0|10.1.0|10.2.0)
-t What's yours Raspberry Pi OS type?: (1|2) [default:1]

Usage: ./RTBuilder_64b -g [GCC version] -o [Target Pi OS type] -V
-g GCC version you want to compile?: (7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|9.1.0|9.2.0|9.3.0|10.1.0|10.2.0)
-o What's yours Target Raspberry Pi OS type?: (stretch|buster)
-V Verbose output for debugging?

```


* **Usage:** Just pass _targeted [GCC version](#supported-gcc-versions)_ to `-g` parameter of this script:

```shellsession

chmod +x RTBuilder_64b
./RTBuilder_64b -g "9.3.0"
./RTBuilder_64b -g "9.3.0" -V

```

Expand Down Expand Up @@ -180,22 +187,22 @@ These scripts provide a few additional environment variables to tweak Toolchain

These scripts only support newer GCC versions, those are as follows:

| GCC Version | Stretch OS build (32-bit) | Buster OS build (32-bit) | any 64-bit OS build |
| :-----------: | :----------: | :---------: | :---------: |
| 7.1.0 | supported | x | supported |
| 7.2.0 | supported | x | supported |
| 7.3.0 | supported | x | supported |
| 7.4.0 | supported | x | supported |
| 7.5.0 | supported | x | supported |
| 8.1.0 | supported | x | supported |
| 8.2.0 | supported | x | supported |
| 8.3.0 | supported | supported | supported |
| 8.4.0 | supported | supported | supported |
| 9.1.0 | supported | supported | supported |
| 9.2.0 | supported | supported | supported |
| 9.3.0 | supported | supported | supported |
| 10.1.0 | supported | supported | supported |
| 10.2.0 | supported | supported | supported |
| GCC Version | Stretch OS build (32/64-bit) | Buster OS build (32/64-bit) |
| :-----------: | :----------: | :---------: |
| 7.1.0 | supported | x |
| 7.2.0 | supported | x |
| 7.3.0 | supported | x |
| 7.4.0 | supported | x |
| 7.5.0 | supported | x |
| 8.1.0 | supported | x |
| 8.2.0 | supported | x |
| 8.3.0 | supported | supported |
| 8.4.0 | supported | supported |
| 9.1.0 | supported | supported |
| 9.2.0 | supported | supported |
| 9.3.0 | supported | supported |
| 10.1.0 | supported | supported |
| 10.2.0 | supported | supported |

&nbsp;

Expand Down
21 changes: 16 additions & 5 deletions build-scripts/RTBuilder_32b
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,36 @@ helpfunction() {
figlet -t -k -f /usr/share/figlet/term.flf "Copyright (c) 2020 abhiTronix"
echo ""
echo ""
echo "Usage: $0 -g [GCC version] -r [Target Pi type] -o [Target Pi OS type]"
echo "Usage: $0 -g [GCC version] -r [Target Pi type] -o [Target Pi OS type] -V"
echo -e "\t-g GCC version you want to compile?: (7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|9.1.0|9.2.0|9.3.0|10.1.0|10.2.0)"
echo -e "\t-r What's yours Target Raspberry Pi type?: (0-1|2-3|3+)"
echo -e "\t-o What's yours Target Raspberry Pi OS type?: (stretch|buster)"
echo -e "\t-V Verbose output for debugging?"
echo ""
echo ""
exit 1 # Exit script after printing help
}

#input arguments handler
while getopts "g:r:o:" opt; do
while getopts "g:r:o:V" opt; do
case "$opt" in
g) GCC_VERSION="$OPTARG" ;;
r) RPI_TYPE="$OPTARG" ;;
o) RPIOS_TYPE="$OPTARG" ;;
V)
VERBOSE=1
echo "Info: Activated verbose output!"
echo ""
set -eov pipefail # Set verbose mode.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hm. The script will fail on error only if someone chooses the verbose option. Errors would still be silently ignored otherwise.

Wouldn't it make sense to put set -eo pipefail at the top of every script and call set -v during cmdline parsing in scripts which support the verbose option?

;;
?) helpfunction ;; #prints help function for invalid parameter
esac
done
#validates parameters and print usage helper function in case parameters are missing
if [ -z "$VERBOSE" ]; then
VERBOSE=0
set -eo pipefail # stop the script and exit with return code != 0 if errored
fi
if [ -z "$GCC_VERSION" ] || [ -z "$RPI_TYPE" ] || [ -z "$RPIOS_TYPE" ]; then
echo "Error: Required parameters are missing!"
helpfunction
Expand Down Expand Up @@ -121,7 +132,7 @@ TARGET=arm-linux-gnueabihf
GDB_VERSION=9.2

#validate env variables
if ! [[ "$GCC_VERSION" =~ ^(7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|9.1.0|9.2.0|9.3.0|10.1.0|10.2.0)$ ]]; then exit 1; fi
if ! [[ "$GCC_VERSION" =~ ^(6.3.0|7.1.0|7.2.0|7.3.0|7.4.0|7.5.0|8.1.0|8.2.0|8.3.0|9.1.0|9.2.0|9.3.0|10.1.0|10.2.0)$ ]]; then exit 1; fi
if ! [[ "$GCCBASE_VERSION" =~ ^(6.3.0|8.3.0)$ ]]; then exit 1; fi
if ! [[ "$GLIBC_VERSION" =~ ^(2.24|2.28)$ ]]; then exit 1; fi
if ! [[ "$BINUTILS_VERSION" =~ ^(2.28|2.31)$ ]]; then exit 1; fi
Expand Down Expand Up @@ -215,7 +226,7 @@ mkdir -p "$SYSROOTDIR"/usr/lib
echo "Building binutils..."
if [ -n "$(ls -A "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build/*; fi
cd "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build || exit
../configure --target=$TARGET --prefix= --with-arch=$ARCH --with-fpu=$FPU --with-float=hard --disable-multilib
../configure --target=$TARGET --prefix= --with-arch=$ARCH --with-sysroot=/$TARGET/libc --with-build-sysroot="$SYSROOTDIR" --with-fpu=$FPU --with-float=hard --disable-multilib
make -s -j$(nproc)
make -s install DESTDIR="$INSTALLDIR"
if [ -n "$(ls -A "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build/*; fi
Expand All @@ -228,7 +239,7 @@ make -s -j$(nproc) all-gcc
make -s install-gcc DESTDIR="$INSTALLDIR"
if [ -n "$(ls -A "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build/*; fi
cd "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build || exit
../configure --prefix=/usr --build="$MACHTYPE" --host=$TARGET --target=$TARGET --with-arch=$ARCH --with-fpu=$FPU --with-float=hard --with-headers="$SYSROOTDIR"/usr/include --with-lib="$SYSROOTDIR"/usr/lib --disable-multilib libc_cv_forced_unwind=yes
../configure --prefix=/usr --build="$MACHTYPE" --host=$TARGET --target=$TARGET --with-arch=$ARCH --with-sysroot=/$TARGET/libc --with-build-sysroot="$SYSROOTDIR" --with-fpu=$FPU --with-float=hard --with-headers="$SYSROOTDIR"/usr/include --with-lib="$SYSROOTDIR"/usr/lib --disable-multilib libc_cv_forced_unwind=yes
make -s install-bootstrap-headers=yes install-headers DESTDIR="$SYSROOTDIR"
make -s -j$(nproc) csu/subdir_lib
install csu/crt1.o csu/crti.o csu/crtn.o "$SYSROOTDIR"/usr/lib
Expand Down
Loading