[2024-feb-29] Sad news: Eric Layton aka Nocturnal Slacker aka vtel57 passed away on Feb 26th, shortly after hospitalization. He was one of our Wiki's most prominent admins. He will be missed.

Welcome to the Slackware Documentation Project

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
howtos:hardware:arm:gcc-10.x_aarch64_cross-compiler [2021/04/08 06:49 (UTC)] – [Aarch64 cross-compiler script code] revised script code exagahowtos:hardware:arm:gcc-10.x_aarch64_cross-compiler [2021/10/01 09:26 (UTC)] (current) – [AArch64 cross-compiling 'HOWTO' example] removed superfluous text exaga
Line 1: Line 1:
 <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). --> <!-- Add your text below. We strongly advise to start with a Headline (see button bar above). -->
-====== Slackware ARM current gcc-10.2.x armv8 arm64 aarch64 cross-compiler for the Raspberry Pi 4 ======+====== Slackware ARM current gcc-10.3.x armv8 arm64 aarch64 cross-compiler for the Raspberry Pi 4 ======
  
 ===== Preface ===== ===== Preface =====
Line 10: Line 10:
 ===== Notes ===== ===== Notes =====
  
-Slackware ARM current was used on a Raspberry Pi 4 [4GB RAM] to build and install the gcc-10.2.0 aarch64-linux cross-compiler. +Slackware ARM current was used on a Raspberry Pi 4 [4GB RAM] to build and install the gcc-10.3.0 aarch64-linux cross-compiler. 
  
 The Linux kernel source downloaded is from the Raspberry Pi Github repository: https://github.com/raspberrypi/linux The Linux kernel source downloaded is from the Raspberry Pi Github repository: https://github.com/raspberrypi/linux
Line 27: Line 27:
 ===== Aarch64 cross-compiler script code ===== ===== Aarch64 cross-compiler script code =====
  
-Download the 'SARPi64.SlackBuild-gcc-10.2-aarch64-cc.sh' file by clicking the link at the top of the script code (or copy and paste the code if you prefer) below.+Download the 'SARPi64.SlackBuild-gcc-10.3-aarch64-cc.sh' file by clicking the link at the top of the script code (or copy and paste the code if you prefer) below.
  
-Make the file executable using 'chmod +x SARPi64.SlackBuild-gcc-10.2-aarch64-cc.sh' or 'chmod 755 SARPi64.SlackBuild-gcc-10.2-aarch64-cc.sh' command. +Make the file executable using 'chmod +x SARPi64.SlackBuild-gcc-10.3-aarch64-cc.sh' or 'chmod 755 SARPi64.SlackBuild-gcc-10.3-aarch64-cc.sh' command. 
  
 Refer to the commented top section of the script code for usage.  Refer to the commented top section of the script code for usage. 
  
-<file sh SARPi64.SlackBuild-gcc-10.2-aarch64-cc.sh>+<file sh SARPi64.SlackBuild-gcc-10.3-aarch64-cc.sh>
  
 #! /bin/bash #! /bin/bash
  
 ############################################################################## ##############################################################################
-# Slackware ARM gcc-10.2.0 aarch64 cross-compiler for Raspberry Pi+# Slackware ARM gcc-10.3.0 aarch64 cross-compiler for Raspberry Pi
 # #
-# SARPi64.SlackBuild-gcc-10.2.0-aarch64-cc [v3.0] - 2020-12-29+# SARPi64.SlackBuild-gcc-10.3.0-aarch64-cc [v3.0] - 2021-04-22
 # #
 # 2020-12-29 by Exaga     v3.0    gcc-10.x # 2020-12-29 by Exaga     v3.0    gcc-10.x
Line 51: Line 51:
 # #
 # This script downloads RPi Linux kernel source and the required binaries,  # This script downloads RPi Linux kernel source and the required binaries, 
-# and configures, builds, patches, and installs a gcc 10.2.x aarch64-linux +# and configures, builds, patches, and installs a gcc 10.3.x aarch64-linux 
 # cross-compiler on Slackware ARM current running on a Raspberry Pi 3/4. # cross-compiler on Slackware ARM current running on a Raspberry Pi 3/4.
 # #
Line 58: Line 58:
 # (e.g. /tmp/build-dir) and run it from there as a 'root' user.  # (e.g. /tmp/build-dir) and run it from there as a 'root' user. 
 # #
-# ~# chmod +x SARPi64.SlackBuild-gcc-10.2-aarch64-cc.sh +# ~# chmod +x SARPi64.SlackBuild-gcc-10.3-aarch64-cc.sh 
-# ~# ./SARPi64.SlackBuild-gcc-10.2-aarch64-cc.sh+# ~# ./SARPi64.SlackBuild-gcc-10.3-aarch64-cc.sh
 # #
 # You may install the cross-compiler anywhere you like, as long as it can be  # You may install the cross-compiler anywhere you like, as long as it can be 
Line 135: Line 135:
  
 # Required build packages-versions [* newer versions may exist] # Required build packages-versions [* newer versions may exist]
-BINUTILS_VERSION=binutils-2.35+BINUTILS_VERSION=binutils-2.36
 CLOOG_VERSION=cloog-0.18.1 CLOOG_VERSION=cloog-0.18.1
-GCC_VERSION=gcc-10.2.0 +GCC_VERSION=gcc-10.3.0 
-GLIBC_VERSION=glibc-2.32+GLIBC_VERSION=glibc-2.33
 GMP_VERSION=gmp-6.2.1 GMP_VERSION=gmp-6.2.1
 ISL_VERSION=isl-0.18 ISL_VERSION=isl-0.18
Line 187: Line 187:
 echo " ## Build: $GCC_VERSION  Kernel ${DEV_BRANCH} " echo " ## Build: $GCC_VERSION  Kernel ${DEV_BRANCH} "
 echo " ## Timestamp: $(date '+%F %T') " echo " ## Timestamp: $(date '+%F %T') "
-echo " ## SARPi64 Project [sarpi64.fatdog.eu] "+echo " ## SARPi64 Project [sarpi64.penthux.net] "
 echo " ############################################" echo " ############################################"
 echo  echo 
Line 320: Line 320:
 make $PARALLEL_JOBS install-gcc make $PARALLEL_JOBS install-gcc
  
-# create gcc-10.2.0 libsanitizer asan_linux-cpp.patch file+# create gcc-10.3.0 libsanitizer asan_linux-cpp.patch file
 cd "$CWD" cd "$CWD"
 touch asan_linux-cpp.patch touch asan_linux-cpp.patch
 cat << EOF > asan_linux-cpp.patch cat << EOF > asan_linux-cpp.patch
---- gcc-10.2.0/libsanitizer/asan/asan_linux.cpp 2020-12-29 22:57:16.000000000 +0000 +--- gcc-10.3.0/libsanitizer/asan/asan_linux.cpp 2021-04-08 12:56:30.229766760 +0100 
-+++ asan_linux.cpp 2020-12-29 23:20:04.000000000 +0000++++ asan_linux.cpp.new 2021-04-22 13:26:26.000000000 +0100
 @@ -76,6 +76,10 @@ @@ -76,6 +76,10 @@
  asan_rt_version_t  __asan_rt_version;  asan_rt_version_t  __asan_rt_version;
  }  }
- +
 +#ifndef PATH_MAX +#ifndef PATH_MAX
 +#define PATH_MAX 4096 +#define PATH_MAX 4096
Line 335: Line 335:
 + +
  namespace __asan {  namespace __asan {
- +
  void InitializePlatformInterceptors() {}  void InitializePlatformInterceptors() {}
  
 EOF EOF
  
-# Patch gcc-10.2.x/libsanitizerasan/asan_linux.cpp [or the build will fail]+# Patch gcc-10.3.x/libsanitizerasan/asan_linux.cpp [or the build will fail]
 ASANLINUXCC=$CWD/$GCC_VERSION/libsanitizer/asan/asan_linux.cpp ASANLINUXCC=$CWD/$GCC_VERSION/libsanitizer/asan/asan_linux.cpp
 if [ ! -f "$ASANLINUXCC".orig ]; then if [ ! -f "$ASANLINUXCC".orig ]; then
Line 413: Line 413:
 ===== Configuring the system to use the Aarch64 cross-compiler ===== ===== Configuring the system to use the Aarch64 cross-compiler =====
  
-Once the cross-compiler has been built and you intend to use it to compile Aarch64 [64bit] binaries, the location of the tool-chains must be exported to your system's $PATH variable. It's also prudent to have it appear before all other PATHs. So, for example (and this is __ALL__ done as '**root**' user), to check what your existing $PATH includes, use the 'echo $PATH' command like this: +Once the cross-compiler has been built and you intend to use it to compile Aarch64 [64bit] binaries, the location of the tool-chains must be exported to your system's $PATH variable. It's also prudent to have this entry appear before all other PATHs. So, for example, to check what your existing $PATH includes, use the 'echo $PATH' command like this: 
  
 <code>root@slackware:~# echo $PATH <code>root@slackware:~# echo $PATH
Line 420: Line 420:
 This is the output of the $PATH on our Slackware ARM system before adding the '/path/to/cross-compiler/bin' tool-chain location. Your own $PATH might be very different.  This is the output of the $PATH on our Slackware ARM system before adding the '/path/to/cross-compiler/bin' tool-chain location. Your own $PATH might be very different. 
  
-If you didn't change the 'INSTALL_PATH' variable in the build script then the command used to export the PATH will be done like this:+If you didn't change the 'INSTALL_PATH' variable in the build script then the command the script uses to export the PATH will be like this:
  
 <code>root@slackware:~# export PATH=/tmp/.gcc-cross/bin:$PATH</code> <code>root@slackware:~# export PATH=/tmp/.gcc-cross/bin:$PATH</code>
  
-Obviously, if you did install the cross-compiler to another location use that location instead of the default. Then, check the $PATH variable again to ensure that it has been added correctly:+This is the command to use if it doesn't already appear in your system $PATH. Obviously, if you've modified the INSTALL_PATH variable then that location will be used instead of the default. You can check the $PATH variable to ensure that it has been added correctly:
  
 <code>root@slackware:~# echo $PATH <code>root@slackware:~# echo $PATH
 /tmp/.gcc-cross/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib/qt/bin</code> /tmp/.gcc-cross/bin:/usr/local/sbin:/usr/sbin:/sbin:/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/lib/qt/bin</code>
  
-The example output above is what you're trying to achieve and all looks good because the cross compile PATH appears first before everything else.+The example output above all looks good because the cross compile PATH appears first before everything else.
  
 ===== Aarch64 cross-compiling 'HOWTO' example ===== ===== Aarch64 cross-compiling 'HOWTO' example =====
Line 480: Line 480:
  
 # #
-# Compiler: aarch64-linux-gcc (GCC) 10.2.0+# Compiler: aarch64-linux-gcc (GCC) 10.3.0
 # #
 CONFIG_CC_IS_GCC=y CONFIG_CC_IS_GCC=y
-CONFIG_GCC_VERSION=100200+CONFIG_GCC_VERSION=100300
 root@slackware:/tmp/linux-rpi# </code> root@slackware:/tmp/linux-rpi# </code>
  
Line 501: Line 501:
 <note warning>**BEFORE CONTINUING - Make a back-up __FIRST__ of your '/boot/' directory before coping any new files to it, in case things don't go exactly as planned. Only reboot once everything is correctly in place and you have your backup(s) to fall-back on.**</note> <note warning>**BEFORE CONTINUING - Make a back-up __FIRST__ of your '/boot/' directory before coping any new files to it, in case things don't go exactly as planned. Only reboot once everything is correctly in place and you have your backup(s) to fall-back on.**</note>
  
-So with everything compiled and built, you just need to copy the 'kernel' image, 'DTBs' and 'System.map' to your '/boot' directory. Replace KERNEL_IMAGE with the correct filename of the kernel for your Raspberry Pi device:+So with everything compiled and built, you just need to copy the 'kernel' image, 'DTBs' and 'System.map' to your '/boot' directory.
  
-<note important>NB: For the RPi3 the kernel image is named 'kernel7.img' and for the RPi4 the kernel image is named 'kernel7l.img'. This filename __MUST__ be correct in order for the boot-loader to run the kernel! If you have specified a custom kernel image filename in the '/boot/config.txt' file then you already know what you're doing. ;-)</note>+<note important>NB: By default, on Raspberry Pi ARMv7 [32-bit] systems, the kernel image is named 'kernel7.img' on the RPi3, and for the RPi4 the kernel image is named 'kernel7l.img' - where the "L" is actually an indicator for "Large Physical Address Extension (LPAE)". However, on Raspberry Pi ARMv8 [64-bit] systems the kernel is named 'kernel8.img'. This filename __MUST__ be correct in order for the boot-loader to find and run the ARMv8 [64-bit] kernel! If you have specified a custom kernel image filename in the '/boot/config.txt' file then you already know what you're doing here. ;-)</note>
  
-<code>root@slackware:/tmp/linux-rpi# cp -avr arch/arm64/boot/Image /boot/KERNEL_IMAGE"+<code>root@slackware:/tmp/linux-rpi# cp -avr arch/arm64/boot/Image /boot/kernel8.img"
 root@slackware:/tmp/linux-rpi# cp -avr arch/arm64/boot/dts/broadcom/bcm27*.dtb /boot/ root@slackware:/tmp/linux-rpi# cp -avr arch/arm64/boot/dts/broadcom/bcm27*.dtb /boot/
 root@slackware:/tmp/linux-rpi# cp -avr System.map /boot/System.map</code> root@slackware:/tmp/linux-rpi# cp -avr System.map /boot/System.map</code>
 howtos:hardware:arm:gcc-10.x_aarch64_cross-compiler ()