Skip to content

Commit b8aa4b6

Browse files
committed
Build-Script: Critical Bug Fixes (Fixes #61)
- Extended build-script sysroot patch to `RTBuilder_32b`. - Replaced incorrect `RPI_TYPE` with `FOLDER_VERSION`. - Replaced `OS_TYPE` with `RPIOS_TYPE` in `RTBuilder_64b. - Added Buster and Stretch native support for `RTBuilder_64b` build script.
1 parent fa53861 commit b8aa4b6

File tree

2 files changed

+25
-19
lines changed

2 files changed

+25
-19
lines changed

build-scripts/RTBuilder_32b

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ mkdir -p "$SYSROOTDIR"/usr/lib
215215
echo "Building binutils..."
216216
if [ -n "$(ls -A "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build/*; fi
217217
cd "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build || exit
218-
../configure --target=$TARGET --prefix= --with-arch=$ARCH --with-fpu=$FPU --with-float=hard --disable-multilib
218+
../configure --target=$TARGET --prefix= --with-arch=$ARCH --with-sysroot=/$TARGET/libc --with-build-sysroot="$SYSROOTDIR" --with-fpu=$FPU --with-float=hard --disable-multilib
219219
make -s -j$(nproc)
220220
make -s install DESTDIR="$INSTALLDIR"
221221
if [ -n "$(ls -A "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/binutils-$BINUTILS_VERSION/build/*; fi
@@ -228,7 +228,7 @@ make -s -j$(nproc) all-gcc
228228
make -s install-gcc DESTDIR="$INSTALLDIR"
229229
if [ -n "$(ls -A "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build)" ]; then rm -rf "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build/*; fi
230230
cd "$DOWNLOADDIR"/glibc-$GLIBC_VERSION/build || exit
231-
../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
231+
../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
232232
make -s install-bootstrap-headers=yes install-headers DESTDIR="$SYSROOTDIR"
233233
make -s -j$(nproc) csu/subdir_lib
234234
install csu/crt1.o csu/crti.o csu/crtn.o "$SYSROOTDIR"/usr/lib

build-scripts/RTBuilder_64b

Lines changed: 23 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -33,43 +33,49 @@ helpfunction() {
3333
figlet -t -k -f /usr/share/figlet/term.flf "Copyright (c) 2020 abhiTronix"
3434
echo ""
3535
echo ""
36-
echo "Usage: $0 -g [GCC version] -t [Target OS type]"
36+
echo "Usage: $0 -g [GCC version] -o [Target Pi OS type]"
3737
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)"
38-
echo -e "\t-t What's yours Target OS type?: (1|2) [default:1]"
38+
echo -e "\t-o What's yours Target Raspberry Pi OS type?: (stretch|buster)"
3939
echo ""
4040
echo ""
4141
exit 1 # Exits script after printing help
4242
}
4343

4444
#input arguments handler
45-
while getopts "g:t:" opt; do
45+
while getopts "g:o:" opt; do
4646
case "$opt" in
4747
g) GCC_VERSION="$OPTARG" ;;
48-
t) OS_TYPE="$OPTARG" ;;
48+
o) RPIOS_TYPE="$OPTARG" ;;
4949
?) helpfunction ;; #prints help function for invalid parameter
5050
esac
5151
done
5252
#validates parameters and print usage helper function in case parameters are missing
53-
if [ -z "$GCC_VERSION" ]; then
54-
echo "Error: Required parameter is missing!"
53+
if [ -z "$GCC_VERSION" ] || [ -z "$RPIOS_TYPE" ]; then
54+
echo "Error: Required parameters are missing!"
5555
helpfunction
56-
elif [ -z "$OS_TYPE" ]; then
57-
OS_TYPE=1
58-
else
59-
echo "Parameters configured!"
6056
fi
6157

6258
#collect dependencies versions from raspberry pi os
63-
if [ "$OS_TYPE" = "1" ] || echo ${GCC_VERSION%.*} "8.3" | awk '{exit ( $1 >= $2 )}'; then
64-
GCCBASE_VERSION=6.3.0
59+
if [ "$RPIOS_TYPE" = "stretch" ]; then
60+
if echo ${GCC_VERSION%.*} "6.3" | awk '{exit ( $1 >= $2 )}'; then
61+
echo "$GCC_VERSION is not supported on stretch!"
62+
exit 0
63+
else
64+
GCCBASE_VERSION=6.3.0
65+
fi
6566
GLIBC_VERSION=2.24
6667
BINUTILS_VERSION=2.28
67-
elif [ "$OS_TYPE" = "2" ]; then
68-
GCCBASE_VERSION=8.3.0
68+
elif [ "$RPIOS_TYPE" = "buster" ]; then
69+
if echo ${GCC_VERSION%.*} "8.3" | awk '{exit ( $1 >= $2 )}'; then
70+
echo "$GCC_VERSION is not supported on buster!"
71+
exit 0
72+
else
73+
GCCBASE_VERSION=8.3.0
74+
fi
6975
GLIBC_VERSION=2.28
7076
BINUTILS_VERSION=2.31
7177
else
72-
echo "Invalid argument value: $OS_TYPE"
78+
echo "Invalid argument value: $RPIOS_TYPE"
7379
exit
7480
fi
7581

@@ -260,7 +266,7 @@ if [ "$GCC_VERSION" != "$GCCBASE_VERSION" ]; then
260266
mv "$BUILDDIR"/native-pi-gcc-"$GCC_VERSION"-$FOLDER_VERSION "$HOME"
261267
cd "$HOME" || exit
262268
#compress with maximum possible compression level.
263-
tar cf - native-pi-gcc-"$GCC_VERSION"-$FOLDER_VERSION | pigz -9 -p 32 >native-gcc-"$GCC_VERSION"-pi_"$RPI_TYPE".tar.gz
269+
tar cf - native-pi-gcc-"$GCC_VERSION"-$FOLDER_VERSION | pigz -9 -p 32 >native-gcc-"$GCC_VERSION"-pi_"$FOLDER_VERSION".tar.gz
264270
rm -rf "$HOME"/native-pi-gcc-"$GCC_VERSION"-$FOLDER_VERSION
265271
echo "Done Building Native GCC $GCC_VERSION Binaries..."
266272
fi
@@ -280,7 +286,7 @@ echo "Done Building Cross GDB Binaries..."
280286
mv "$BUILDDIR"/cross-pi-gcc-"$GCC_VERSION"-$FOLDER_VERSION "$HOME"
281287
cd "$HOME" || exit
282288
#compress with maximum possible compression level.
283-
tar cf - cross-pi-gcc-"$GCC_VERSION"-$FOLDER_VERSION | pigz -9 >cross-gcc-"$GCC_VERSION"-pi_"$RPI_TYPE".tar.gz
289+
tar cf - cross-pi-gcc-"$GCC_VERSION"-$FOLDER_VERSION | pigz -9 >cross-gcc-"$GCC_VERSION"-pi_"$FOLDER_VERSION".tar.gz
284290
echo "Done Building Cross GCC $GCC_VERSION Binaries..."
285291
rm -rf "$HOME"/cross-pi-gcc-"$GCC_VERSION"-$FOLDER_VERSION
286292

0 commit comments

Comments
 (0)