I am using a free ARM (aarch64) compute instance from Oracle Cloud as a development machine. I would like to compile an Kernel for my Android phone (arm64), but I'm having trouble with selecting the appropriate toolchain.
Google provides Android-specific toolchains, aarch64-linux-android- and arm-linux-androideabi-, but these are primarily distributed for x86_64 hosts.
After a couple of hours of searching the internet, I found mentions that I could use the host (or native) compiler for my system, which happens to be aarch64-linux-gnu- and arm-linux-gnueabi-. However, these toolchains target a generic Linux environment, and I'm not sure if they would be suitable for compiling a kernel for an Android device. I'm particularly concerned about potential optimization issues or compatibility problems that might arise from using these toolchains.
Questions:
- Is it appropriate to use the generic Linux toolchains (
*-linux-gnu-
) for compiling an Android kernel? - What's the recommended approach to build the Android-specific toolchains (
*-linux-android-
) on an aarch64 host?
I am having difficulty finding answers on my own and would appreciate detailed explanations.
Environment:
- Host: aarch64 (ARM64)
- OS: Ubuntu 22.04.4 LTS
- Target: Android phone (arm64)