Well, we want to compile things. We'll be using the personal PC / laptop, which is probably running on a Intel/AMD-based x86-64 CPU architecture.
But we want to compile code for a foreign architecture: Aarch64 (also known as arm64). So we will need a cross compiler: a compiler that runs on your host but generates binary code for another target.
Cross compilers are usually named using this convention <target_arch>-<vendor>-[<os>-]<abi>-gcc
. In our case, it will be aarch64-none-linux-gnu-gcc
:
Identify the correct toolchain and download it from here. Yes, you can also install it with your package manger but it's always better to have a project-specific copy. New compiler releases are known to sometime break the build process.
After extracting it, consider exporting the compiler's prefix (aarch64-none-linux-gnu-
) from your newly downloaded toolchain as the CROSS_COMPILE
environment variable. Otherwise, you will have to specify the full path of the cross compiler every time when invoking a script. E.g.:
export CROSS_COMPILE=/absolute/path/to/compiler/bin/aarch64-none-linux-gnu- # now you can use the cross compiler as such: "${CROSS_COMPILE}gcc" ... # make will inherit this value, so no need to add a CROSS_COMPILE # when invoking it from your terminal ;) make
But beware: export only affects the terminal it's run from (so run it in each one :P)!
/home/user/arm-summer-school/ ├── toolchain/aarch64-none-linux-gnu/... ├── imx-atf/ # ARM Trusted Firmware code ├── firmware/ # NXP IMX proprietary firmware BLOBs ├── u-boot-tn-imx/ # U-Boot source code ├── imx-mkimage/ # IMX mkimage scripts ├── Makefile # your makefile, highly recommended! :P └── ... # and many others to come!