Issue
For the last little while I have been compiling my own kernel for my Pixel XL with a couple patches. Prior to Android 9.0, all I had to use for the cross compiler was aarch64-linux-android-4.9, but with Android 9.0 it now tells me I also need an ARM32 toolchain for some part of the kernel (I don't remember what it said, but that's not that important).
Anyhow, over at XDA, nathanchance has a guide that I used to learn how to build the kernel and for the ARM32 toolchain he links to arm-eabi-4.8, and an old version of the "Building Kernels" on the AOSP site used to also say arm-eabi. The new version of the "Building Kernels" page doesn't mention getting the toolchain at all, but when I went to get arm-eabi-4.8 I noticed arm-linux-androideabi-4.9 also exists.
My question is, should I use arm-eabi-4.8 or arm-linux-androideabi-4.9? What's the difference? I was able to build the kernel with both (haven't tested either but I assume they'd both work fine) but I'm just curious as to which one I should actually be using (I'm pretty sure it's arm-linux-androideabi-4.9, because that's referenced in the build config of the kernel) and I'd like to know what the difference is.
Solution
When building a Kernel (or bare metal software)
The main difference (in respect to the kernel) is the version of gcc you use to build them.
The tripple format is the following:
arch-sys-abi
in both cases, arch is arm
(that is, ARM32). The Kernel is both system and abi agnostic in that case… so no difference here. The last remaining difference, in respect to the kernel is arm-eabi-4.8
is built against gcc-4.8, and arm-linux-androideabi-4.9
is built against gcc 4.9.
I would recommend to use Gcc 4.9 in that case, also, this version of gcc is the same as shipped in the android NDK (not that it would make a big difference though).
-- Edit --:
Regarding Userspace applications:
In that case, really boils down to the version of the toolchain, and which sysroot is included in that toolchain.
Specifically, arm-linux-anrdroideabi-4.9
seems (to me) like the Android NDK toolchain, so it is built on android sysroot (platform tools, and libraries). Which means that if you would be to build a user application with this, you would have access to all libraries that are shipped with it.
In the case of arm-eabi-4.8
since there is no system included, it is most likely an embedded target without any library. In the case of a userspace program, that means this toolchains does not come with no libraries at all. (Those toolchains are usually aimed at bare-metal development, rather than any real user space development).
disclaimer: I did not check those specific toolchains to make sure of what libraries were included.
As a conclusion, keep in mind that, since the kernel is not built on any userspace libraries (for obvious reasons), this difference does not apply to the kernel build.
Answered By - goutnet
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.