For instructions to build and test various ARM kernels see the following:
- Installed ARM cross compiler (/opt/arm-2011.03 assumed)
- ARM EABI build now supported
- Missing aeabi_* functions added to lib/string.c
- Versatile express compiles and runs under QEMU using the arm-none-gnueabi triplet
- Versatile express kernel requires patch to stub out call to poison_init_mem() or boot hangs
- Versatile express boots with initramfs, or SD card image under QEMU
- MSM builds successfully with no code stubbed out. Ready to try it on actual HW.
- Two ARM patches are required to clang for properly handling 64-bit types (hack, not upstreamed)
- Kernel requires patch for posix functions and incompatible __kernel_size_t vs size_t definitions
- -mabi-linux not supported, causes incorrect structure member offsets when structs contain enums
- no drivers using VLAIS are supported
- -Wno-unused-value set for Clang build to avoid thousands of warnings for unused return values. It can be reenabled with W=1.
- Additional __refdata, __initdata, etc annotations needed for Clang built kernel
Kernel Compilation Gotchas
Using the triplet arm or armv7 will work but will not generate an ARM EABI compatible build. Using the triplet arm-none-gnueabi led to failure for __aeabi_memcpy and __aeabi_memset being undefined at link time. Implementations of these were added to lib/string.c in a patch.
ARM Userspace Cross Compilation Gotchas
Using "-ccc-host-triple arm" seems to work except that you end up with the wrong setting for __USER_LABEL_PREFIX__. It is set to "_" instead of "" as required for Linux.
Using "-ccc-host-triple arm-none-linux" does not work as it will not find the code sourcery compiler (/opt/arm-2011.03). You have to add "--sysroot=/opt/arm-2011.03/arm-none-linux-gnueabi/libc" and export COMPILER_PATH=/opt/arm-2011.03. The problem is that clang defaults to using armv4t as a target.
Using "-ccc-host-triple armv7-none-linux", "--sysroot=/opt/arm-2011.03/arm-none-linux-gnueabi/libc", and "export COMPILER_PATH=/opt/arm-2011.03", sets the correct compilation settings for an armv7 target, but still does not work as it will not find the code sourcery compiler (/opt/arm-2011.03/bin/arm-none-linux-*) as clang is looking for /opt/arm-2011.03/bin/armv7-none-linux-* and will default to using the native compiler (x86-64) which fails. You either have to create simlinks armv7-none-linux-* in /opt/arm-2011.03/bin or patch clang.
Using "-ccc-host-triple arm-none-linux", "--sysroot=/opt/arm-2011.03/arm-none-linux-gnueabi/libc" and "export COMPILER_PATH=/opt/arm-2011.03" with "-march=armv7-a -mfpu=neon" finally gets finds the code sourcery cross compiler and sets in the optimization flags for armv7-a and neon.
Using "-ccc-host-triple arm-none-gnueabi", "-ccc-gcc-name arm-none-linux-gnueabi-gcc" and "export COMPILER_PATH=/opt/arm-2011.03" with "-march=armv7-a -mfpu=neon" finds the code sourcery cross compiler, supports EABI, and sets in the optimization flags for armv7-a and neon.