Changes on kernel cross compiling

October 28, 2009

[Warning: This post is a backup recovery from my previous Wordpress blog. All content was automatically converted accessing a MySQL database using a Python script (details). Mostly are in Portuguese but if you are interest I can translate to English. If you found any problem dont’t hesitate to contact me in comments.]

Probably if you compile - many times - Linux for embedded hardware you change Makefile to your specific architecture and compiler. An example:

# Set the ARCH and CROSS_COMPILE default values
ARCH            ?= arm
CROSS_COMPILE   ?= arm-unknown-linux-gnu-

Latest Linux (~2.6.31) turns it deprecated (commit 575543347b5baed0ca927cb90ba8807396fe9cc9). Now the settings are saved in two files named:

include/generated/kernel.arch include/generated/kernel.cross What changes? Using the new way you don't edit Makefile anymore, just need set once your definitions for cross compiling:

$ make ARCH=arm CROSS_COMPILE=arm-unknown-linux-gnu-
And for next builds just run make
$ make
This works both for plain builds and for O=... builds.