Both sides previous revisionPrevious revisionNext revision | Previous revisionLast revisionBoth sides next revision |
howtos:hardware:arm:gcc-11.x_aarch64_cross-compiler [2021/09/28 09:28 (UTC)] – corrected text content - Aarch64 to AArch64 exaga | howtos:hardware:arm:gcc-11.x_aarch64_cross-compiler [2021/10/01 09:25 (UTC)] – [AArch64 cross-compiling 'HOWTO' example] removed superfluous text exaga |
---|
| |
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. \\ |
| |
===== 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 |
<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)]] |
<!-- 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}} |
| |