[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-11.x_aarch64_cross-compiler [2021/09/28 09:28 (UTC)] – corrected text content - Aarch64 to AArch64 exagahowtos:hardware:arm:gcc-11.x_aarch64_cross-compiler [2022/08/22 07:41 (UTC)] (current) – updated for gcc-12.1.0 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 ARMv8 AArch64 cross-compiler build script (gcc-11.2.0) for the Raspberry Pi 3/4 ======+====== Slackware ARM current ARMv8 AArch64 cross-compiler build script (gcc-12.1.0) for the Raspberry Pi 3/4 ======
  
 ===== Preface ===== ===== Preface =====
  
-With the recent updates of [[http://arm.slackware.com|Slackware ARM 15.0 release candidate 1]] (September 2021) with gcc-11.2.0, this is an ARMv8 AArch64 cross-compiler bash script that's intended for building binaries from source code and turning them into Slackware packages. Or whatever use you may find for this script.+With the updates of [[http://arm.slackware.com|Slackware AArch64]] to gcc-12.1.0, this is an ARMv8 AArch64 cross-compiler bash script that's intended for building binaries from source code and turning them into Slackware packages. Or whatever use you may find for this script.
  
 Previous [[https://docs.slackware.com/howtos:hardware:arm:gcc-10.x_aarch64_cross-compiler|work in this area]] had been done for gcc-10.x and the build script and intructions are mostly the same. Some of the code in the script has changed from the previous version, with updated binutils and glibc versions, and especially the libsanitizer/asan source code patching.  Previous [[https://docs.slackware.com/howtos:hardware:arm:gcc-10.x_aarch64_cross-compiler|work in this area]] had been done for gcc-10.x and the build script and intructions are mostly the same. Some of the code in the script has changed from the previous version, with updated binutils and glibc versions, and especially the libsanitizer/asan source code patching. 
Line 10: Line 10:
 ===== Notes ===== ===== Notes =====
  
-Slackware ARM current was used on a Raspberry Pi 4 [4GB RAM] to build and install the gcc-11.2.0 aarch64-linux cross-compiler. +Slackware ARM current was used on a Raspberry Pi 4 [4GB RAM] to build and install the gcc-12.1.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 21: Line 21:
  
 As a pre-requisite, you should have;  As a pre-requisite, you should have; 
-  * a Raspberry Pi 3 or 4 (i.e. a 64bit CPU) running Slackware ARM current with as much unused [>= 5GB] storage space on your system as possible. \\ +  * a Raspberry Pi 3 or 4 (i.e. a 64-bit CPU) running Slackware ARM current with as much unused [>= 5GB] storage space on your system as possible. \\ 
   * [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/a/|gawk]],   [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/d/|git]], [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/d/|bison]] and [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/d/|flex]], already installed on your system. \\     * [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/a/|gawk]],   [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/d/|git]], [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/d/|bison]] and [[http://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/d/|flex]], already installed on your system. \\  
  
Line 27: Line 27:
 ===== AArch64 cross-compiler script code ===== ===== AArch64 cross-compiler script code =====
  
-Download the 'SARPi64.SlackBuild-gcc-11.2.0-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-12.1.0-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-11.2.0-aarch64-cc.sh' or 'chmod 755 SARPi64.SlackBuild-gcc-11.2.0-aarch64-cc.sh' command. +Make the file executable using 'chmod +x SARPi64.SlackBuild-gcc-12.1.0-aarch64-cc.sh' or 'chmod 755 SARPi64.SlackBuild-gcc-12.1.0-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-11.2.0-aarch64-cc.sh>+<file sh SARPi64.SlackBuild-gcc-12.1.0-aarch64-cc.sh>
  
 #! /bin/bash #! /bin/bash
  
 ############################################################################## ##############################################################################
-# Slackware ARM gcc-11.2.0 aarch64 cross-compiler for Raspberry Pi+# Slackware ARM gcc-12.1.0 aarch64 cross-compiler for Raspberry Pi
 # #
-# SARPi64.SlackBuild-gcc-11.2.0-aarch64-cc [v1.4] - 2021-09-25+# SARPi64.SlackBuild-gcc-12.1.0-aarch64-cc [v1.5] - 2022-06-16
 # #
 +# 2022-06-16 by Exaga     v1.5    gcc-12.x
 # 2021-09-25 by Exaga     v1.4    gcc-11.x # 2021-09-25 by Exaga     v1.4    gcc-11.x
 # 2020-12-29 by Exaga     v1.3    gcc-10.x # 2020-12-29 by Exaga     v1.3    gcc-10.x
Line 52: Line 53:
 # #
 # 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 11.2.x aarch64-linux +# and configures, builds, patches, and installs a gcc 12.1.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 59: Line 60:
 # (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-11.2.0-aarch64-cc.sh +# ~# chmod +x SARPi64.SlackBuild-gcc-12.1.0-aarch64-cc.sh 
-# ~# ./SARPi64.SlackBuild-gcc-11.2.0-aarch64-cc.sh+# ~# ./SARPi64.SlackBuild-gcc-12.1.0-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 136: Line 137:
  
 # Required build packages-versions [* newer versions may exist] # Required build packages-versions [* newer versions may exist]
-BINUTILS_VERSION=binutils-2.37+BINUTILS_VERSION=binutils-2.38
 CLOOG_VERSION=cloog-0.18.1 CLOOG_VERSION=cloog-0.18.1
-GCC_VERSION=gcc-11.2.0 +GCC_VERSION=gcc-12.1.0 
-GLIBC_VERSION=glibc-2.34+GLIBC_VERSION=glibc-2.35
 GMP_VERSION=gmp-6.2.1 GMP_VERSION=gmp-6.2.1
-ISL_VERSION=isl-0.18+ISL_VERSION=isl-0.24
 MPFR_VERSION=mpfr-4.1.0 MPFR_VERSION=mpfr-4.1.0
 MPC_VERSION=mpc-1.2.1 MPC_VERSION=mpc-1.2.1
  
 # RPi GitHub Linux source - working branch [e.g. rpi-4.14.y | rpi-4.19.y | rpi-5.2.y ]  # RPi GitHub Linux source - working branch [e.g. rpi-4.14.y | rpi-4.19.y | rpi-5.2.y ] 
-DEV_BRANCH=rpi-5.14.y+DEV_BRANCH=rpi-5.18.y
  
  
Line 321: Line 322:
 make $PARALLEL_JOBS install-gcc make $PARALLEL_JOBS install-gcc
  
-# create gcc-11.2.0 libsanitizer asan_linux-cpp.patch file+# create gcc-12.1.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-11.2.0/libsanitizer/asan/asan_linux.cpp 2021-07-28 07:55:09.172313645 +0100 +--- gcc-12.1.0/libsanitizer/asan/asan_linux.cpp 2022-05-06 08:31:00.000000000 +0100 
-+++ asan_linux.cpp 2021-09-25 12:35:18.000000000 +0100 ++++ asan_linux.cpp 2022-06-18 09:42:36.000000000 +0100 
-@@ -76,6 +76,10 @@+@@ -77,6 +77,10 @@
  asan_rt_version_t  __asan_rt_version;  asan_rt_version_t  __asan_rt_version;
  }  }
Line 341: Line 342:
 EOF EOF
  
-# Patch gcc-11.2.x/libsanitizerasan/asan_linux.cpp [or the build will fail]+# Patch gcc-12.1.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 414: Line 415:
 ===== 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 this entry appear before all other PATHs. So, for example, 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 [64-bit] 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 479: Line 480:
 # Linux/arm64 5.14.4 Kernel Configuration # Linux/arm64 5.14.4 Kernel Configuration
 # #
-CONFIG_CC_VERSION_TEXT="aarch64-linux-gcc (GCC) 11.2.0"+CONFIG_CC_VERSION_TEXT="aarch64-linux-gcc (GCC) 12.1.0"
 CONFIG_CC_IS_GCC=y CONFIG_CC_IS_GCC=y
 CONFIG_GCC_VERSION=110200 CONFIG_GCC_VERSION=110200
Line 502: Line 503:
 <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>
  
-That's it! When you reboot your system it should now be using a 64bit kernel and modules. One should be mindful that [[http://arm.slackware.com/|Slackware AArch64]] is in development and building kernels using a cross-compiler will soon become superfluous on that system architecture, but for 32bit systems and users a cross-compiler may still be relevant. +That's it! When you reboot your system it should now be using a 64-bit kernel and modules. One should be mindful that [[http://arm.slackware.com/|Slackware AArch64]] is in development and building kernels using a cross-compiler will soon become superfluous on that system architecture, but for 32-bit systems and users a cross-compiler may still be relevant. 
  
 I hope this AArch64 cross-compiler build script and/or information will be useful for Slackware [ARM] users in whatever ways are possible. Any questions or assistance can be addressed via the [[https://www.linuxquestions.org/questions/slackware-arm-108/|Linux Questions forum(s)]] I hope this AArch64 cross-compiler build script and/or information will be useful for Slackware [ARM] users in whatever ways are possible. Any questions or assistance can be addressed via the [[https://www.linuxquestions.org/questions/slackware-arm-108/|Linux Questions forum(s)]]
Line 544: Line 545:
 <!-- You must remove the tag-word "template" below before saving your new page --> <!-- You must remove the tag-word "template" below before saving your new page -->
 {{tag>howtos slackware raspberry pi arm aarch64 arm64 armv8 cross-compile author_exaga}} {{tag>howtos slackware raspberry pi arm aarch64 arm64 armv8 cross-compile author_exaga}}
 +
 howtos:hardware:arm:gcc-11.x_aarch64_cross-compiler ()