vendor: import kernel build task from android-7.1

build: Inline kernel building as a buildtime task
By arcee

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.mk typos

Change-Id: I5980d6a30dd66741a561a95e0dfba60a3ad0ef5d

envsetup: set OUT_DIR to an absolute path always

OUT_DIR was set to $(TOPDIR)out previously,
but $(TOPDIR) was null, so it was a relative path.
This broke releasetools, inline kernel building, etc
since they require absolute paths.
Fix it so that it is set to $(shell readlink -f .)/out
if $(TOPDIR) is null.

Also remove hacks which checked if (OUT_DIR) was out
and changed it to $(ANDROID_BUILD_TOP)/out to workaround
the aforementioned problem.

Change-Id: I459a3b1325a1bbea0565cd73f6acf160d4ed9b39

Conflicts:
	core/base_rules.mk
	core/tasks/kernel.mk

Change-Id: I52a7a6024f0f2b708c230e53c0152ed138726cc1

build: change custom -> omni in a few more places

* these weren't changed when the transtition occured - fix them now

Change-Id: I47bedb96ad63a41959baa98e1a265cb616d17918

kernel.mk: Use standard toolchain paths

Change-Id: I1225fd05dcedcff03a1cf1102841cbd010b609cf

Make the kernel image format parametric instead of a chain of if/elses

Change-Id: I54bfcdecb8647f7bcf744e72b2de19fcf4e4e7ac

build: Add "dtbs" target when building the kernel

 * This is needed for 3.10

Change-Id: I4044ea9e67017452efc25097a3327141a6627c24

Squashed commit of updates to kernel.mk from CM

PS2: Add default toolchain prefix for KERNEL_ARCH=arm64

Allow specifying kernel toolchain and prefix

Change-Id: Ib75cfe772e073f2196455f3e3dfba247f6b3feff

core: More flexible kernel configuration

 * Allow various combinations of kernel vs. userspace architectures
 * Get rid of various assumptions about everything being ARM or 32-bit
 * This adds the following target flags:
     TARGET_KERNEL_ARCH
     TARGET_KERNEL_HEADER_ARCH
     KERNEL_HEADER_DEFCONFIG
     TARGET_KERNEL_CROSS_COMPILE_PREFIX

Change-Id: If0bc202abd35c216ba3ea5707ffdb602526d8ed3

Fix kernel.mk if SELINUX or VARIANT_DEFCONFIG is defined

KERNEL_HEADER_DEFCONFIG was ignoring SELINUX_DEFCONFIG thus breaking
all selinux support

Change-Id: Idc3367d6b4b85343078e63e87dca6d6d052e7f53

build: kernel: Fix stray "@"

Nested "$(hide)"s (makefile @) don't work. There was one at the
beginning of the script, remove the inner one to prevent it from
being interpreted as a shell command

Change-Id: I08a829ee56b212366a0f5a3812f7a614667a9c2b

build: Add support for additional kernel config snippet

 * Add support for TARGET_KERNEL_ADDITIONAL_CONFIG which will append a
   config snippet from arch/$ARCH/configs/ to the main defconfig.
 * This can be used for various things, such as including DIAG support
   into debuggable builds.

Change-Id: Ifa48688a3f951dd8ecc9a13a27de3a476e7bf633

kernel: Fix kernelconfig build

* Copy the generated defconfig to the correct directory

Change-Id: Ia8e259946d67501675dd5a3433165d54df6c13c5

build: check kernel config for make modules and make dtbs

from CM

Change-Id: Iabb36a222d47d1481800fb2983b60f70621b5278

build: use the system's ccache by default

* ccache gets updated semi-frequently and some builders would like
  to be able to take advantage of new features without having to
  rely on the prebuilt version getting updated

* If a build system has ccache installed already, use that version
  instead of the prebuilt

* @nathanchance edit: Replace which with command -v for portability,
  print which binary is being used, and apply the same logic to
  inline kernel compilation

Change-Id: I8988c8a25fab3694d84633f957c2b92ce84cf69e

build: kernel: build arm kernel modules with -fno-pic

With androidkernel (androideabi) toolchains, -fpic is enabled by default.
At least on my 3.4 arm kernel, this causes an issue with kernel modules:
"Unknown symbol _GLOBAL_OFFSET_TABLE_".

On traditional armeabi toolchains, -fpic is not enabled, resulting in working
kernel modules; let's follow that here.

Change-Id: I3058b5213b34bdde9bb9d744563c7d55cd42d2a5
1 file changed
tree: b6174b04a0bdf5976e4b1e1e584d721290765279
  1. build/
  2. charger/
  3. config/
  4. overlay/
  5. prebuilt/
  6. sepolicy/
  7. utils/
  8. Android.mk