build/core: Add linaro_compilerchecks.mk

Add linaro_compilerchecks.mk, allowing to run some checks on the
compiler version and supported flags before setting them

Change-Id: I96e1277e74c0ea3457677bef39644aaece01f653
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
build/core: Include linaro_compilerchecks.mk

Include linaro_compilerchecks.mk in core/config.mk to allow the macros
to be used in board configs

Change-Id: I3a0dfd0a3a1c09961e43ef8c2f3cbe50b8c00e20
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
build: Add support for TARGET_EXTRA_C{,PP}FLAGS

Add support for setting TARGET_EXTRA_C{,PP}FLAGS in board configs.
This can be used to set compiler flags for a board that break other
boards, such as -march=cortex-a9 or -DUSE_CUSTOM_EXTENSIONS_FOR_XYZ

Change-Id: I0efd4e37578bf6d239bf56dfeeaaed44840ee3af
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
build/core: Use better default compiler flags

Use -O3 for the compiler, -O2 for the linker

Change-Id: I11436ffdab1351107a25259b97c88267014a026f
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
build: Don't work around cortex-a8 issues when targeting a9 only

Don't work around cortex-a8 issues when other compiler flags
show we want to target cortex-a9 only

Change-Id: If5a077243fc15298fbcbe2ffc857b5e961dd29da
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
build/core: Don't use -fno-strict-aliasing

Don't use -fno-strict-aliasing: It's no longer needed.

Change-Id: I8d5a8a67c55d60a0dcc6ae18e42ea718ff06c1e3
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
build: Don't add -fno-strict-aliasing to HOST compiler flags

Change-Id: I07eef86f11ec3761e0922855cb6ff881c2773966
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
build: Explicitly disable -Werror=strict-alising for HOST builds

Change-Id: Ib1e834951196ab3ea6acbe47c27eebe5633f55d2
Signed-off-by: Bernhard Rosenkraenzer <Bernhard.Rosenkranzer@linaro.org>
build: Add option to disable strict-aliasing optimizations

This is useful for builds that pull in unmodified AOSP repositories
that can't be compiled with strict-aliasing compliance enabled

Change-Id: Ie89e311977039830854cb0c42f1c8e22d854859c
Signed-off-by: Amit Pundir <amit.pundir@linaro.org>
Allow javac 1.7 to be used for building

Change-Id: I6034488ec5b391899afed08beec279954a0aa6cb
Signed-off-by: Vishal Bhoj <vishal.bhoj@linaro.org>
Allow building with make 4.0

Change-Id: I1f20d9ab675114e99ff808251e78cc0af38fe9ff
Signed-off-by: Bernhard Rosenkränzer <Bernhard.Rosenkranzer@linaro.org>
build: Inline kernel building as a buildtime task

Kernel image integration is now done in the build system. The
"one true way" of doing this is to download the kernel source
into kernel/TARGET_BOOTLOADER_NAME (by usage of the cm.dependencies
mechanism or otherwise), and defining the TARGET_KERNEL_CONFIG
variable in the device's BoardConfig makefile

If the kernel's location doesn't match the automagic location
(multi-device kernel source, for instance), TARGET_KERNEL_SOURCE
can be used to specify a kernel path (i.e.,
"TARGET_KERNEL_SOURCE := kernel/shared-whatever")

If the device requires out-of-kernel-tree modules to be built,
the TARGET_KERNEL_MODULES variable can be used, pointing to a
_make target_ that will build and install such modules. Definition
of such a target is the device author's responsibility, the only
restriction is that it is a normal makefile recipe (example
below)

Optionally (or as an alternative), a prebuilt binary can also be
defined at BoardConfig, by usage of the TARGET_PREBUILT_KERNEL
variable. This binary will be used if the kernel source is absent
(or undefined).

A minimal BoardConfig.mk should look something like this:

TARGET_KERNEL_CONFIG := cyanogenmod_<device>_defconfig
TARGET_PREBUILT_KERNEL := device/<vendor>/<device>/kernel

To include, for example, the TI WLAN modules, this can be used:

-----------------------------
TIWLAN_MODULES:
       make -C hardware/ti/wlan/wl1283/platforms/os/linux/ KERNEL_DIR=$(KERNEL_OUT) ARCH="arm" CROSS_COMPILE="arm-eabi-" TNETW=1273 RANDOM_MAC=n REPORT_LOG=n
       mv hardware/ti/wlan/wl1283/platforms/os/linux/tiwlan_drv.ko $(KERNEL_MODULES_OUT)
       make -C hardware/ti/wlan/wl1283_softAP/platforms/os/linux/ KERNEL_DIR=$(KERNEL_OUT) ARCH="arm" CROSS_COMPILE="arm-eabi-" TNETW=1273 REPORT_LOG=n
       mv hardware/ti/wlan/wl1283_softAP/platforms/os/linux/tiap_drv.ko $(KERNEL_MODULES_OUT)

TARGET_KERNEL_MODULES := TIWLAN_MODULES
---------------------------

Change-Id: I8634fa4c788a42dc6f62e62ca170825b66db126a
build: Fix kernel module building on Darwin/OSX

Darwin/OSX build host does not have module-init-tools which is
required to generated modules.dep file. Switch to modules.order
file marker which is always generated instead.

Change-Id: I20c0fccd905fa668202c3e7284a8778db3728a65
kernel: Change path to kernel/<vendor>/<device>

Derive the kernel path from the device's own path (just replace "device"
with "kernel")

Change-Id: Idd44a0489e1ce280adf5ec4d9cfe2385c75dd115
kernel: Improve support for non-arm architectures

Remove hardwired references to the ARM arch and toolchains, and replace
them with the respective android build variables

Change-Id: Iae3eb548ca1d58ac808b5fa430d415283a809106
kernel: Fix ARM building

The default android ARM compiler, arm-androideabi-, does NOT work
for the Linux kernel. Special-case the ARM architecture to target
the ARM_EABI_TOOLCHAIN path directly

Change-Id: Ib672c99f114cb89d5fda3343d4dc68810d042d35
kernel: allow TARGET_KERNEL_MODULES to overwrite kernel modules

This is necessary to use compat-wireless since it needs to build a newer
version of cfg80211 (and sometimes mac80211) than the kernel sources version.
There are probably other instances of this type of need.

Change-Id: Ib5bf818286bc20987d8b9f9480a43f3e7690e239
kernel.mk: make use of ccache when requested

Change-Id: I9b6e28711bd5f590a76ac2b62a50b1d2de014e3e
kernel: Fix ccache inclusion logic

Builds were broken when CCACHE was missing from the environment
Change-Id: Ie8d6048f4600f1dc9c298593a50e37af04b96438
build: show accurate information on inline kernel warnings/errors

Having the variables on AndroidBoard as suggested causes errors
with mm/mmm, whereas having them on BoardConfig doesn't. Adjust
the warnings to reflect this.

Change-Id: I554c1f1073df678d36521f73bc236a1f4b02212e