Linux Kernel Cross-compilation
at Wednesday, August 06, 2008
Linux Kernel can be compiled in a machine for a different architecture. This is useful in fixing compilation issues for different architectures without actually using them.
Using ARCH option, the target architecture can be specified. It is also possible to specify the cross-compile toolchain through CROSS_COMPILE and specific compiler using CC options.
Example: To compile the kernel for a 64-bit Intel platform, # make ARCH=x86_64 defconfig
To compile with ARM toolchain at /usr/local/bin, # make ARCH=arm CROSS_COMPILE=/usr/local/bin/arm-linux-
It is useful even for a non-cross-compiled kernel to change what the build system uses for the compiler. Examples of this are using the distcc or ccache programs, both of which help greatly reduce the time it takes to build a kernel. To use the ccache program as part of the build system, enter:
Source: http://www.linuxtopia.org/online_books/linux_kernel/kernel_configuration/ch05s04.html
Using ARCH option, the target architecture can be specified. It is also possible to specify the cross-compile toolchain through CROSS_COMPILE and specific compiler using CC options.
Example: To compile the kernel for a 64-bit Intel platform, # make ARCH=x86_64 defconfig
To compile with ARM toolchain at /usr/local/bin, # make ARCH=arm CROSS_COMPILE=/usr/local/bin/arm-linux-
It is useful even for a non-cross-compiled kernel to change what the build system uses for the compiler. Examples of this are using the distcc or ccache programs, both of which help greatly reduce the time it takes to build a kernel. To use the ccache program as part of the build system, enter:
# make CC="ccache gcc"
Source: http://www.linuxtopia.org/online_books/linux_kernel/kernel_configuration/ch05s04.html




