[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
Next revisionBoth sides next revision
howtos:hardware:arm:gcc-11.x_aarch64_cross-compiler [2021/09/25 15:09 (UTC)] – [Aarch64 cross-compiling 'HOWTO' example] updated code exagahowtos:hardware:arm:gcc-11.x_aarch64_cross-compiler [2021/09/28 09:28 (UTC)] – corrected text content - Aarch64 to AArch64 exaga
Line 25: Line 25:
  
  
-===== 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-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.
Line 412: Line 412:
 </file> </file>
  
-===== 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 [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 432: Line 432:
 The example output above 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 =====
  
-So, when the Aarch64 tool-chains feature in the $PATH on the system, they can be utilised to build software for the ARMv8 architecture instead of your Slackware ARM system's [ARMv7] existing infrastructure. It's all done via the 'make' process.+So, when the AArch64 tool-chains feature in the $PATH on the system, they can be utilised to build software for the ARMv8 architecture instead of your Slackware ARM system's [ARMv7] existing infrastructure. It's all done via the 'make' process.
  
 As an example to show how this can be achieved, the bespoke RPi kernel source 'master' branch will be used. This kernel source will be downloaded and located in '/tmp/linux-rpi' directory. [**NB: note that this is __NOT__ '/usr/src/linux' - it should never reside in that standard location for cross-compiling purposes!**]. After downloading the Linux source, use 'cd' to the directory where it's located: As an example to show how this can be achieved, the bespoke RPi kernel source 'master' branch will be used. This kernel source will be downloaded and located in '/tmp/linux-rpi' directory. [**NB: note that this is __NOT__ '/usr/src/linux' - it should never reside in that standard location for cross-compiling purposes!**]. After downloading the Linux source, use 'cd' to the directory where it's located:
Line 460: Line 460:
 root@slackware:/tmp/linux-rpi# </code> root@slackware:/tmp/linux-rpi# </code>
  
-At the time of writing, this is kernel 5.4.83 source from the Raspberry Pi Github repository 'master' branch. You can download and work with other branches by simply maniplulating the 'git' command options. Right now the downloaded kernel source is in a "raw state" (i.e. it includes no settings or configurations) and it's not going to build anything until some form of instructions exist regarding specifically how/what/which to compile. +At the time of writing, this is kernel 5.14.source from the Raspberry Pi Github repository 'master' branch. You can download and work with other branches by simply maniplulating the 'git' command options. Right now the downloaded kernel source is in a "raw state" (i.e. it includes no settings or configurations) and it's not going to build anything until some form of instructions exist regarding specifically how/what/which to compile. 
  
 What's missing now is a kernel '.config' - a file that includes instructions (i.e. settings) that's an essential prerequisite in order to compile the Linux source into a resulting kernel image file - and you won't be doing much without creating one first. This is __much__ easier said than done if you're starting from scratch, because it requires intimate knowledge about the the computer/device hardware that you're building the kernel to support. However, with the Raspberry Pis (and many other ARM devices) there is such a thing as a 'default config', or 'defconfig', that can be called to build the kernel '.config' file for you and save a lot of time and effort (and unfortunately a huge amount of education and experience is also wasted in this process). So in the interest of saving time, let's do it the easy and lazy way for this example... What's missing now is a kernel '.config' - a file that includes instructions (i.e. settings) that's an essential prerequisite in order to compile the Linux source into a resulting kernel image file - and you won't be doing much without creating one first. This is __much__ easier said than done if you're starting from scratch, because it requires intimate knowledge about the the computer/device hardware that you're building the kernel to support. However, with the Raspberry Pis (and many other ARM devices) there is such a thing as a 'default config', or 'defconfig', that can be called to build the kernel '.config' file for you and save a lot of time and effort (and unfortunately a huge amount of education and experience is also wasted in this process). So in the interest of saving time, let's do it the easy and lazy way for this example...
  
-For the Raspberry Pi 3 to build a default kernel '.config' file for Aarch64 architecture:+For the Raspberry Pi 3 to build a default kernel '.config' file for AArch64 architecture:
  
 <code>root@slackware:/tmp/linux-rpi# make ARCH=arm64 CROSS_COMPILE=aarch64-linux- bcm2709_defconfig </code> <code>root@slackware:/tmp/linux-rpi# make ARCH=arm64 CROSS_COMPILE=aarch64-linux- bcm2709_defconfig </code>
  
-For the Raspberry Pi 4 to build a default kernel '.config' file for Aarch64 architecture:+For the Raspberry Pi 4 to build a default kernel '.config' file for AArch64 architecture:
  
 <code>root@slackware:/tmp/linux-rpi# make ARCH=arm64 CROSS_COMPILE=aarch64-linux- bcm2711_defconfig </code> <code>root@slackware:/tmp/linux-rpi# make ARCH=arm64 CROSS_COMPILE=aarch64-linux- bcm2711_defconfig </code>
Line 510: Line 510:
 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 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. 
  
-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)]]
  
-Thanks very much for your interest in this Aarch64 cross-compiler on the Raspberry Pi. +Thanks very much for your interest in this AArch64 cross-compiler on the Raspberry Pi. 
  
 ====== Sources ====== ====== Sources ======
 howtos:hardware:arm:gcc-11.x_aarch64_cross-compiler ()