[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
Last revisionBoth sides next revision
howtos:hardware:arm:gcc-9.x_aarch64_cross-compiler [2019/07/26 16:05 (UTC)] – [Slackware ARM gcc-9.1.x armv8 arm64 aarch64 cross-compiler for the Raspberry Pi 4] more rewording exagahowtos:hardware:arm:gcc-9.x_aarch64_cross-compiler [2019/08/03 12:46 (UTC)] – [Building the gcc aarch64 cross-compiler] missing CFLAG exaga
Line 157: Line 157:
 === Building binutils === === Building binutils ===
  
-First move back into the 'BUILD' directory and then create a build directory for binutils. You'll notice the various build options but as a quick explanation; '--with-sysroot' basically tells binutils to enable 'sysroot' support in the cross-compiler by pointing it to a default empty directory, '--target=aarch64-linux' is the target system type (arm64), and '--disable-multilib' means that we only want binutils to work with the aarch64 instruction set and nothing else. +First move back into the 'BUILD' directory and then create a build directory for binutils. You'll notice the various CFLAGS but as a quick explanation; '--with-sysroot' basically tells binutils to enable 'sysroot' support in the cross-compiler by pointing it to a default empty directory, '--target=aarch64-linux' is the target system type (arm64), and '--disable-multilib' means that we only want binutils to work with the aarch64 instruction set and nothing else. 
  
 <code> <code>
Line 163: Line 163:
 mkdir build-binutils mkdir build-binutils
 cd build-binutils cd build-binutils
-../binutils-2.32/configure --prefix=/tmp/.gcc-cross --target=aarch64-linux --disable-multilib+../binutils-2.32/configure --prefix=/tmp/.gcc-cross --target=aarch64-linux --with-sysroot --disable-multilib
 make -j4  make -j4 
 make install make install
Line 314: Line 314:
 ==== Building the arm64 kernel, modules, and device tree blob (DTB) ==== ==== Building the arm64 kernel, modules, and device tree blob (DTB) ====
  
-To build the aarch64 kernel, modules and device tree blob(s) is exactly the same method as you would carry it out under normal circumstances. Commands such as 'make bzImage && make modules && make modules_install' may be all too familiar to you. The major difference when cross-compiling is that you'll use certain Makefile options/variables/arguments/switches, commonly known as CFLAGS. In our case, CFLAGS will be used to instruct the gcc cross-compiler to build for the aarch64 (arm64) architecture specifically.+To build the aarch64 kernel, modules and device tree blob(s) is exactly the same method as you would carry it out under normal circumstances. Commands such as 'make bzImage && make modules && make modules_install' may be all too familiar to you. The major difference when cross-compiling is that you'll use certain Makefile variables/arguments/switches, commonly known as //build options//<. In our case, //build options// will be used to instruct the gcc cross-compiler to build for the aarch64 (arm64) architecture specifically.
  
 === Creating the arm64 kernel .config === === Creating the arm64 kernel .config ===
Line 325: Line 325:
 </code> </code>
  
-<note important>Make a note here of the CFLAGS which have been specified. They should be self-explanatory by now. Pay special attention to the trailing '-' of 'CROSS_COMPILE=aarch64-linux-' because that's **NOT** a typo. __It needs to be like that!__</note>+<note important>Make a note here of the //build options// [ARCH=arm64 CROSS_COMPILE=aarch64-linux-] which have been specified. They should be self-explanatory by now. Pay special attention to the trailing '-' of 'CROSS_COMPILE=aarch64-linux-' because that's **NOT** a typo. __It needs to be like that!__</note>
  
 Now that you've created a kernel .config which contains the default settings for your hardware, some settings within need to be checked and possibly modified. The Raspberry Pi 4's "VideoCore VI" GPU is not //64-bit compatible// and the build process will crash each time you attempt to compile the module's source code for ARMv8 architecture. Now that you've created a kernel .config which contains the default settings for your hardware, some settings within need to be checked and possibly modified. The Raspberry Pi 4's "VideoCore VI" GPU is not //64-bit compatible// and the build process will crash each time you attempt to compile the module's source code for ARMv8 architecture.
Line 373: Line 373:
 === Building the arm64 kernel === === Building the arm64 kernel ===
  
-Next up is building the kernel, based on the .config file you have just created. Again, you'll use the same CFLAGS as before. You can even set a 'LOCALVERSION' here which appends whatever you set to the end of the kernel version (e.g. LOCALVERSION="-aarch64" would eventually give you 5.2.1-v8-aarch64) once the kernel and modules have been built. Just as an example we'll use it here. Run the following command to start building the arm64 Linux kernel:+Next up is building the kernel, based on the .config file you have just created. Again, you'll use the same //build options// as before. You can even set a 'LOCALVERSION' here which appends whatever you set to the end of the kernel version (e.g. LOCALVERSION="-aarch64" would eventually give you 5.2.1-v8-aarch64) once the kernel and modules have been built. Just as an example we'll use it here. Run the following command to start building the arm64 Linux kernel:
  
 <code> <code>
Line 406: Line 406:
 === Installing the arm64 modules === === Installing the arm64 modules ===
  
-Once the modules have been built, you have to 'make modules_install' The process will install your kernel modules to '/tmp/lib/modules/5.2.1-v8-aarch64'+Once the modules have been built, you have to 'make modules_install' The process will install your kernel modules to '/lib/modules/5.2.1-v8-aarch64'
  
-You could build  //out-of-tree// kernel modules but, to keep things simple, you're going to install them to the usual location. Again, you will use the same CFLAGS as before but without any 'LOCALVERSION' set.+You could build  //out-of-tree// kernel modules but, to keep things simple, you're going to install them to the usual location. Again, you will use the same //build options// as before but without any 'LOCALVERSION' set.
  
 First you need become '**root**' user and enter a passwd when prompted. To install the aarch64 modules run the following commands: First you need become '**root**' user and enter a passwd when prompted. To install the aarch64 modules run the following commands:
Line 492: Line 492:
 <code> <code>
 ls -lah rpi-boot/boot/kernel* ls -lah rpi-boot/boot/kernel*
-ls -lah rpi-boot/boot/bcm*-rpi-3-b.dtb +ls -lah rpi-boot/boot/bcm*-rpi-4-b.dtb 
 ls -lah rpi-root/lib/modules/5.2.1-v8* ls -lah rpi-root/lib/modules/5.2.1-v8*
 </code> </code>
Line 552: Line 552:
  
 ====== Sources ====== ====== Sources ======
-# If you need to install any of the packages above [* check for updates!]:+# If you need to install any of the software above [* check for updates!]:
  
 [[ftp://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/a/gawk-5.0.1-arm-1.txz]]  # Slackware ARM current - gawk package. \\ [[ftp://ftp.arm.slackware.com/slackwarearm/slackwarearm-current/slackware/a/gawk-5.0.1-arm-1.txz]]  # Slackware ARM current - gawk package. \\
Line 566: Line 566:
 [[slackwarearm:faq|http://arm.slackware.com/FAQs]] # Slackware ARM Linux Project Frequently Asked Questions. \\  [[slackwarearm:faq|http://arm.slackware.com/FAQs]] # Slackware ARM Linux Project Frequently Asked Questions. \\ 
 [[http://wiki.osdev.org/GCC_Cross-Compiler]] # gcc cross-compiler documentation. \\  [[http://wiki.osdev.org/GCC_Cross-Compiler]] # gcc cross-compiler documentation. \\ 
 +[[howtos:hardware:arm:gcc_aarch64_cross-compiler|Slackware ARM GCC aarch64-linux cross-compiler]] for the Raspberry Pi. \\
 [[https://www.raspberrypi.org/documentation/linux/kernel]] # Raspberry Pi Linux kernel documentation. \\  [[https://www.raspberrypi.org/documentation/linux/kernel]] # Raspberry Pi Linux kernel documentation. \\ 
  
 howtos:hardware:arm:gcc-9.x_aarch64_cross-compiler ()