Commit 3952f6cb authored by Michael Bestas's avatar Michael Bestas Committed by Gerrit Code Review
Browse files

Import CM build additions

Change-Id: Id1eb902129754e61dfcc2b5d95c3a75172ff0c5e
parent 61536d44
ifeq ($(BOARD_USES_MTK_HARDWARE),true)
mtk_flags := -DMTK_HARDWARE
TARGET_GLOBAL_CFLAGS += $(mtk_flags)
TARGET_GLOBAL_CPPFLAGS += $(mtk_flags)
CLANG_TARGET_GLOBAL_CFLAGS += $(mtk_flags)
CLANG_TARGET_GLOBAL_CPPFLAGS += $(mtk_flags)
2ND_TARGET_GLOBAL_CFLAGS += $(mtk_flags)
2ND_TARGET_GLOBAL_CPPFLAGS += $(mtk_flags)
2ND_CLANG_TARGET_GLOBAL_CFLAGS += $(mtk_flags)
2ND_CLANG_TARGET_GLOBAL_CPPFLAGS += $(mtk_flags)
endif
# Board platforms lists to be used for
# TARGET_BOARD_PLATFORM specific featurization
MTK_BOARD_PLATFORMS := mt6592
MTK_BOARD_PLATFORMS += mt6582
MTK_BOARD_PLATFORMS += mt6572
# Target-specific configuration
# Populate the qcom hardware variants in the project pathmap.
define ril-set-path-variant
$(call project-set-path-variant,ril,TARGET_RIL_VARIANT,hardware/$(1))
endef
define wlan-set-path-variant
$(call project-set-path-variant,wlan,TARGET_WLAN_VARIANT,hardware/qcom/$(1))
endef
define bt-vendor-set-path-variant
$(call project-set-path-variant,bt-vendor,TARGET_BT_VENDOR_VARIANT,hardware/qcom/$(1))
endef
# Set device-specific HALs into project pathmap
define set-device-specific-path
$(if $(USE_DEVICE_SPECIFIC_$(1)), \
$(if $(DEVICE_SPECIFIC_$(1)_PATH), \
$(eval path := $(DEVICE_SPECIFIC_$(1)_PATH)), \
$(eval path := $(TARGET_DEVICE_DIR)/$(2))), \
$(eval path := $(3))) \
$(call project-set-path,qcom-$(2),$(strip $(path)))
endef
ifeq ($(BOARD_USES_QCOM_HARDWARE),true)
qcom_flags := -DQCOM_HARDWARE
qcom_flags += -DQCOM_BSP
qcom_flags += -DQTI_BSP
TARGET_USES_QCOM_BSP := true
# Tell HALs that we're compiling an AOSP build with an in-line kernel
TARGET_COMPILE_WITH_MSM_KERNEL := true
ifneq ($(filter msm7x27a msm7x30 msm8660 msm8960,$(TARGET_BOARD_PLATFORM)),)
# Enable legacy graphics functions
qcom_flags += -DQCOM_BSP_LEGACY
# Enable legacy audio functions
ifeq ($(BOARD_USES_LEGACY_ALSA_AUDIO),true)
USE_CUSTOM_AUDIO_POLICY := 1
qcom_flags += -DLEGACY_ALSA_AUDIO
endif
endif
# Enable extra offloading for post-805 targets
ifneq ($(filter msm8992 msm8994,$(TARGET_BOARD_PLATFORM)),)
qcom_flags += -DHAS_EXTRA_FLAC_METADATA
endif
TARGET_GLOBAL_CFLAGS += $(qcom_flags)
TARGET_GLOBAL_CPPFLAGS += $(qcom_flags)
CLANG_TARGET_GLOBAL_CFLAGS += $(qcom_flags)
CLANG_TARGET_GLOBAL_CPPFLAGS += $(qcom_flags)
# Multiarch needs these too..
2ND_TARGET_GLOBAL_CFLAGS += $(qcom_flags)
2ND_TARGET_GLOBAL_CPPFLAGS += $(qcom_flags)
2ND_CLANG_TARGET_GLOBAL_CFLAGS += $(qcom_flags)
2ND_CLANG_TARGET_GLOBAL_CPPFLAGS += $(qcom_flags)
ifeq ($(QCOM_HARDWARE_VARIANT),)
ifneq ($(filter msm8610 msm8226 msm8974,$(TARGET_BOARD_PLATFORM)),)
QCOM_HARDWARE_VARIANT := msm8974
else
ifneq ($(filter msm8909 msm8916,$(TARGET_BOARD_PLATFORM)),)
QCOM_HARDWARE_VARIANT := msm8916
else
ifneq ($(filter msm8953 msm8937,$(TARGET_BOARD_PLATFORM)),)
QCOM_HARDWARE_VARIANT := msm8937
else
ifneq ($(filter msm8992 msm8994,$(TARGET_BOARD_PLATFORM)),)
QCOM_HARDWARE_VARIANT := msm8994
else
QCOM_HARDWARE_VARIANT := $(TARGET_BOARD_PLATFORM)
endif
endif
endif
endif
endif
# HACK: check to see if build uses standard QC HAL paths by checking for CM path structure
AOSP_VARIANT_MAKEFILE := $(wildcard hardware/qcom/audio/default/Android.mk)
ifeq ("$(AOSP_VARIANT_MAKEFILE)","")
$(call project-set-path,qcom-audio,hardware/qcom/audio)
$(call project-set-path,qcom-display,hardware/qcom/display)
$(call project-set-path,qcom-media,hardware/qcom/media)
$(call set-device-specific-path,CAMERA,camera,hardware/qcom/camera)
$(call set-device-specific-path,GPS,gps,hardware/qcom/gps)
$(call set-device-specific-path,SENSORS,sensors,hardware/qcom/sensors)
$(call set-device-specific-path,LOC_API,loc-api,vendor/qcom/opensource/location)
$(call set-device-specific-path,DATASERVICES,dataservices,vendor/qcom/opensource/dataservices)
$(call project-set-path,ril,hardware/ril)
$(call project-set-path,wlan,hardware/qcom/wlan)
$(call project-set-path,bt-vendor,hardware/qcom/bt)
else
$(call project-set-path,qcom-audio,hardware/qcom/audio-caf/$(QCOM_HARDWARE_VARIANT))
ifeq ($(SONY_BF64_KERNEL_VARIANT),true)
$(call project-set-path,qcom-display,hardware/qcom/display-caf/sony)
$(call project-set-path,qcom-media,hardware/qcom/media-caf/sony)
else
$(call project-set-path,qcom-display,hardware/qcom/display-caf/$(QCOM_HARDWARE_VARIANT))
$(call project-set-path,qcom-media,hardware/qcom/media-caf/$(QCOM_HARDWARE_VARIANT))
endif
$(call set-device-specific-path,CAMERA,camera,hardware/qcom/camera)
$(call set-device-specific-path,GPS,gps,hardware/qcom/gps)
$(call set-device-specific-path,SENSORS,sensors,hardware/qcom/sensors)
$(call set-device-specific-path,LOC_API,loc-api,vendor/qcom/opensource/location)
$(call set-device-specific-path,DATASERVICES,dataservices,vendor/qcom/opensource/dataservices)
$(call ril-set-path-variant,ril)
$(call wlan-set-path-variant,wlan-caf)
$(call bt-vendor-set-path-variant,bt-caf)
endif # AOSP_VARIANT_MAKEFILE
else
$(call project-set-path,qcom-audio,hardware/qcom/audio/default)
$(call project-set-path,qcom-display,hardware/qcom/display/$(TARGET_BOARD_PLATFORM))
$(call project-set-path,qcom-media,hardware/qcom/media)
$(call project-set-path,qcom-camera,hardware/qcom/camera)
$(call project-set-path,qcom-gps,hardware/qcom/gps)
$(call project-set-path,qcom-sensors,hardware/qcom/sensors)
$(call project-set-path,qcom-loc-api,vendor/qcom/opensource/location)
$(call project-set-path,qcom-dataservices,$(TARGET_DEVICE_DIR)/dataservices)
$(call ril-set-path-variant,ril)
$(call wlan-set-path-variant,wlan)
$(call bt-vendor-set-path-variant,bt)
endif
# Board platforms lists to be used for
# TARGET_BOARD_PLATFORM specific featurization
QCOM_BOARD_PLATFORMS += msm7x27a
QCOM_BOARD_PLATFORMS += msm7x30
QCOM_BOARD_PLATFORMS += msm8226
QCOM_BOARD_PLATFORMS += msm8610
QCOM_BOARD_PLATFORMS += msm8660
QCOM_BOARD_PLATFORMS += msm8909
QCOM_BOARD_PLATFORMS += msm8916
QCOM_BOARD_PLATFORMS += msm8960
QCOM_BOARD_PLATFORMS += msm8974
QCOM_BOARD_PLATFORMS += mpq8092
QCOM_BOARD_PLATFORMS += msm8937
QCOM_BOARD_PLATFORMS += msm8952
QCOM_BOARD_PLATFORMS += msm8953
QCOM_BOARD_PLATFORMS += msm8992
QCOM_BOARD_PLATFORMS += msm8994
QCOM_BOARD_PLATFORMS += msm8996
QCOM_BOARD_PLATFORMS += msm_bronze
QCOM_BOARD_PLATFORMS += apq8084
MSM7K_BOARD_PLATFORMS := msm7x30
MSM7K_BOARD_PLATFORMS += msm7x27
MSM7K_BOARD_PLATFORMS += msm7x27a
MSM7K_BOARD_PLATFORMS += msm7k
QSD8K_BOARD_PLATFORMS := qsd8k
# vars for use by utils
empty :=
space := $(empty) $(empty)
colon := $(empty):$(empty)
underscore := $(empty)_$(empty)
# $(call match-word,w1,w2)
# checks if w1 == w2
# How it works
# if (w1-w2 not empty or w2-w1 not empty) then not_match else match
#
# returns true or empty
#$(warning :$(1): :$(2): :$(subst $(1),,$(2)):) \
#$(warning :$(2): :$(1): :$(subst $(2),,$(1)):) \
#
define match-word
$(strip \
$(if $(or $(subst $(1),$(empty),$(2)),$(subst $(2),$(empty),$(1))),,true) \
)
endef
# $(call find-word-in-list,w,wlist)
# finds an exact match of word w in word list wlist
#
# How it works
# fill wlist spaces with colon
# wrap w with colon
# search word w in list wl, if found match m, return stripped word w
#
# returns stripped word or empty
define find-word-in-list
$(strip \
$(eval wl:= $(colon)$(subst $(space),$(colon),$(strip $(2)))$(colon)) \
$(eval w:= $(colon)$(strip $(1))$(colon)) \
$(eval m:= $(findstring $(w),$(wl))) \
$(if $(m),$(1),) \
)
endef
# $(call match-word-in-list,w,wlist)
# does an exact match of word w in word list wlist
# How it works
# if the input word is not empty
# return output of an exact match of word w in wordlist wlist
# else
# return empty
# returns true or empty
define match-word-in-list
$(strip \
$(if $(strip $(1)), \
$(call match-word,$(call find-word-in-list,$(1),$(2)),$(strip $(1))), \
) \
)
endef
# $(call match-prefix,p,delim,w/wlist)
# matches prefix p in wlist using delimiter delim
#
# How it works
# trim the words in wlist w
# if find-word-in-list returns not empty
# return true
# else
# return empty
#
define match-prefix
$(strip \
$(eval w := $(strip $(1)$(strip $(2)))) \
$(eval text := $(patsubst $(w)%,$(1),$(3))) \
$(if $(call match-word-in-list,$(1),$(text)),true,) \
)
endef
# ----
# The following utilities are meant for board platform specific
# featurisation
# $(call get-vendor-board-platforms,v)
# returns list of board platforms for vendor v
define get-vendor-board-platforms
$(if $(call match-word,$(BOARD_USES_$(1)_HARDWARE),true),$($(1)_BOARD_PLATFORMS))
endef
# $(call is-board-platform,bp)
# returns true or empty
define is-board-platform
$(call match-word,$(1),$(TARGET_BOARD_PLATFORM))
endef
# $(call is-not-board-platform,bp)
# returns true or empty
define is-not-board-platform
$(if $(call match-word,$(1),$(TARGET_BOARD_PLATFORM)),,true)
endef
# $(call is-board-platform-in-list,bpl)
# returns true or empty
define is-board-platform-in-list
$(call match-word-in-list,$(TARGET_BOARD_PLATFORM),$(1))
endef
# $(call is-vendor-board-platform,vendor)
# returns true or empty
define is-vendor-board-platform
$(strip \
$(call match-word-in-list,$(TARGET_BOARD_PLATFORM),\
$(call get-vendor-board-platforms,$(1)) \
) \
)
endef
# $(call is-chipset-in-board-platform,chipset)
# does a prefix match of chipset in TARGET_BOARD_PLATFORM
# uses underscore as a delimiter
#
# returns true or empty
define is-chipset-in-board-platform
$(call match-prefix,$(1),$(underscore),$(TARGET_BOARD_PLATFORM))
endef
# $(call is-chipset-prefix-in-board-platform,prefix)
# does a chipset prefix match in TARGET_BOARD_PLATFORM
# assumes '_' and 'a' as the delimiter to the chipset prefix
#
# How it works
# if ($(prefix)_ or $(prefix)a match in board platform)
# return true
# else
# return empty
#
define is-chipset-prefix-in-board-platform
$(strip \
$(eval delim_a := $(empty)a$(empty)) \
$(if \
$(or \
$(call match-prefix,$(1),$(delim_a),$(TARGET_BOARD_PLATFORM)), \
$(call match-prefix,$(1),$(underscore),$(TARGET_BOARD_PLATFORM)), \
), \
true, \
) \
)
endef
#----
# The following utilities are meant for Android Code Name
# specific featurisation
#
# refer http://source.android.com/source/build-numbers.html
# for code names and associated sdk versions
CUPCAKE_SDK_VERSIONS := 3
DONUT_SDK_VERSIONS := 4
ECLAIR_SDK_VERSIONS := 5 6 7
FROYO_SDK_VERSIONS := 8
GINGERBREAD_SDK_VERSIONS := 9 10
HONEYCOMB_SDK_VERSIONS := 11 12 13
ICECREAM_SANDWICH_SDK_VERSIONS := 14 15
JELLY_BEAN_SDK_VERSIONS := 16 17 18
# $(call is-platform-sdk-version-at-least,version)
# version is a numeric SDK_VERSION defined above
define is-platform-sdk-version-at-least
$(strip \
$(if $(filter 1,$(shell echo "$$(( $(PLATFORM_SDK_VERSION) >= $(1) ))" )), \
true, \
) \
)
endef
# $(call is-android-codename,codename)
# codename is one of cupcake,donut,eclair,froyo,gingerbread,icecream
# please refer the $(codename)_SDK_VERSIONS declared above
define is-android-codename
$(strip \
$(if \
$(call match-word-in-list,$(PLATFORM_SDK_VERSION),$($(1)_SDK_VERSIONS)), \
true, \
) \
)
endef
# $(call is-android-codename-in-list,cnlist)
# cnlist is combination/list of android codenames
define is-android-codename-in-list
$(strip \
$(eval acn := $(empty)) \
$(foreach \
i,$(1),\
$(eval acn += \
$(if \
$(call \
match-word-in-list,\
$(PLATFORM_SDK_VERSION),\
$($(i)_SDK_VERSIONS)\
),\
true,\
)\
)\
) \
$(if $(strip $(acn)),true,) \
)
endef
This diff is collapsed.
-----BEGIN CERTIFICATE-----
MIID1TCCAr2gAwIBAgIJANO67t8hIti6MA0GCSqGSIb3DQEBBQUAMIGAMQswCQYD
VQQGEwJVUzETMBEGA1UECAwKV2FzaGluZ3RvbjEQMA4GA1UEBwwHU2VhdHRsZTEX
MBUGA1UECgwOQ3lhbm9nZW4sIEluYy4xGzAZBgNVBAsMElJlbGVhc2UgTWFuYWdl
bWVudDEUMBIGA1UEAwwLRGV2ZWxvcG1lbnQwHhcNMTQwNDI4MjAyODM3WhcNNDEw
OTEzMjAyODM3WjCBgDELMAkGA1UEBhMCVVMxEzARBgNVBAgMCldhc2hpbmd0b24x
EDAOBgNVBAcMB1NlYXR0bGUxFzAVBgNVBAoMDkN5YW5vZ2VuLCBJbmMuMRswGQYD
VQQLDBJSZWxlYXNlIE1hbmFnZW1lbnQxFDASBgNVBAMMC0RldmVsb3BtZW50MIIB
IjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz/V9RvYnr18fraPWNeQEZNeg
Kc0A3QskImQyGY22EGBZ63KUxa6zAfAug0OYSjofVJRaTtdvBXjO/C71XZRh4wun
xhOUAJt8zIJ0lRx8GMC0GHzePEnEVvoiu3zSAPHCNf5lmdhyhccMOtC18J+evPf4
EVBb3cis+F1m6ZoZKPgSFBR5A9CV5Tai8iiZluGGg15Wt12Rp2vmbmQxiOJZxBs4
Ps40XR5gjO1q4R3HiGnFyql9qeecwaTUWXAd76lhNiLUr7K8IRs+96i+t5vSKajB
M8O99BtYyBtf8ItMnHSZJxtsMw+TFXNLmMtaQarpsjp0LLGuHb/vsrjgBPvzsQID
AQABo1AwTjAdBgNVHQ4EFgQUTpNgXBqV7j+33bi8B80YLQq6EL8wHwYDVR0jBBgw
FoAUTpNgXBqV7j+33bi8B80YLQq6EL8wDAYDVR0TBAUwAwEB/zANBgkqhkiG9w0B
AQUFAAOCAQEAVlVBNksK+1C3J8uQ9kVemYMozfbboV9c4PLbtVzNSO8vwZ3X5E4T
2zfQPcFsfSMIa51a1tETBcDA6k+72xHZ+xEQJQNrX+o1F1RIIrXp0OKAz/k5cXyk
OS0+nd0EXP/A1EW0m8N/X6E9wpRkIhfqtEsqeCf8GH7O9Ua2qHZ9zkTBpbAVH0oe
ZWorHBdo3GdMJ5vcjFqnDdRs8F0BnZmjS+NrgXRLhLb6ZARS/bkUQyr5TX82dgG6
vzvKsdKyX34gsKAsjxwLWo7XXgehFfjY+SGjjilJtardr+y/KlHNEw9s9aLe+Xny
Qoa9j9Ut6/KwRaC6lSEQ7HZk6SdzFsdugA==
-----END CERTIFICATE-----
-----BEGIN CERTIFICATE-----
MIIDZDCCAkygAwIBAgIEUfbexjANBgkqhkiG9w0BAQUFADB0MQswCQYDVQQGEwJV
UzELMAkGA1UECBMCV0ExEDAOBgNVBAcTB1NlYXR0bGUxFjAUBgNVBAoTDUN5YW5v
Z2VuIEluYy4xFjAUBgNVBAsTDUN5YW5vZ2VuIEluYy4xFjAUBgNVBAMTDUN5YW5v
Z2VuIEluYy4wHhcNMTMwNzI5MjEyOTQyWhcNNDAxMjE0MjEyOTQyWjB0MQswCQYD
VQQGEwJVUzELMAkGA1UECBMCV0ExEDAOBgNVBAcTB1NlYXR0bGUxFjAUBgNVBAoT
DUN5YW5vZ2VuIEluYy4xFjAUBgNVBAsTDUN5YW5vZ2VuIEluYy4xFjAUBgNVBAMT
DUN5YW5vZ2VuIEluYy4wggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCP
+K2NPqdZ6UmexXQ8tsc2TkLXYhiuEsifO66qlpwsTTw1522HcbKPVoPRr/JBXqOv
E3K0HuZ/IsYYGsP/wJWWvpaWs+5xC+YkLkittK2uUzTqndpLFiDRAeICKpvDJI57
Z0DkzVYXBPn+yw+x8ttjT/vWcJ3PEVYuew8MYPUOgKpdZlQtUBeoEBDSL8JPGViq
e6jWOlSAWekhlgb+wb9RoXhu/v2HYzp89GG0sIrAgj7vZCior5XuFmm8eWhqUhTp
TUBv/nNI/ORYt3G8IQyI2pJN1GNPAAv1uA5i4y/deX1x4GCWyN9feiD9fOj2oc3z
Hwf5Frs9BjOb9XMXecbNAgMBAAEwDQYJKoZIhvcNAQEFBQADggEBAGudhFe9VnES
fWynTYO4kWNlMC++yB6qD3pHW6HtBiaANj9wxrLCTFzf+boHNPeZ8HDkW01zAaQK
fd9/fnGmHf4q/QvxrvGbnb3Fqhw+2hknbbMUoAa+Qp+2ouf9oJaNRquZ+rHEHX8g
Rx8wGyvjaWYfQrwyZRgXj/Jrc/NXxQCmSJeexHVNXgQD6aOLHJYrJ+s+U/hwVNiM
5L+psOh89itwt8DGGSLW16HjQKmPPbWbqxgnfRbOlxWrLDq3agcrskYpDP2aGGBA
5STq/bvh9yZkrNYvMGzrXDhcJ44QRS8e1Jw/ZtfFvJD192e7KKVdy7CJWmOckCNK
gl0KCQ3MBx4=
-----END CERTIFICATE-----
#----------------------------------------------------------------------
# Generate device tree image (dt.img)
#----------------------------------------------------------------------
ifeq ($(strip $(BOARD_CUSTOM_BOOTIMG_MK)),)
ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
ifneq ($(strip $(BOARD_KERNEL_PREBUILT_DT)),true)
ifeq ($(strip $(BUILD_TINY_ANDROID)),true)
include device/qcom/common/dtbtool/Android.mk
endif
ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),)
DTBTOOL_NAME := dtbToolCM
else
DTBTOOL_NAME := $(TARGET_CUSTOM_DTBTOOL)
endif
DTBTOOL := $(HOST_OUT_EXECUTABLES)/$(DTBTOOL_NAME)$(HOST_EXECUTABLE_SUFFIX)
INSTALLED_DTIMAGE_TARGET := $(PRODUCT_OUT)/dt.img
ifeq ($(strip $(TARGET_CUSTOM_DTBTOOL)),)
# dtbToolCM will search subdirectories
possible_dtb_dirs = $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/
else
# Most specific paths must come first in possible_dtb_dirs
possible_dtb_dirs = $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/dts/ $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/
endif
define build-dtimage-target
$(call pretty,"Target dt image: $@")
$(hide) for dir in $(possible_dtb_dirs); do \
if [ -d "$$dir" ]; then \
dtb_dir="$$dir"; \
break; \
fi; \
done; \
$(DTBTOOL) $(BOARD_DTBTOOL_ARGS) -o $@ -s $(BOARD_KERNEL_PAGESIZE) -p $(KERNEL_OUT)/scripts/dtc/ "$$dtb_dir";
$(hide) chmod a+r $@
endef
$(INSTALLED_DTIMAGE_TARGET): $(DTBTOOL) $(INSTALLED_KERNEL_TARGET)
$(build-dtimage-target)
@echo "Made DT image: $@"
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_DTIMAGE_TARGET)
ALL_MODULES.$(LOCAL_MODULE).INSTALLED += $(INSTALLED_DTIMAGE_TARGET)
.PHONY: dtimage
dtimage: $(INSTALLED_DTIMAGE_TARGET)
endif
endif
endif
# Copyright (C) 2012 The CyanogenMod Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Android makefile to build kernel as a part of Android Build
#
# Configuration
# =============
#
# These config vars are usually set in BoardConfig.mk:
#
# TARGET_KERNEL_SOURCE = Kernel source dir, optional, defaults
# to kernel/$(TARGET_DEVICE_DIR)
# TARGET_KERNEL_CONFIG = Kernel defconfig
# TARGET_KERNEL_VARIANT_CONFIG = Variant defconfig, optional
# TARGET_KERNEL_SELINUX_CONFIG = SELinux defconfig, optional
# TARGET_KERNEL_ADDITIONAL_CONFIG = Additional defconfig, optional
# TARGET_KERNEL_ARCH = Kernel Arch
# TARGET_KERNEL_HEADER_ARCH = Optional Arch for kernel headers if
# different from TARGET_KERNEL_ARCH
# TARGET_USES_UNCOMPRESSED_KERNEL = 'true' if Kernel is uncompressed,
# optional, defaults to false
# TARGET_KERNEL_CROSS_COMPILE_PREFIX = Compiler prefix (e.g. arm-eabi-)
# defaults to arm-linux-androideabi- for arm
# aarch64-linux-android- for arm64
# x86_64-linux-android- for x86
#
# BOARD_KERNEL_IMAGE_NAME = Built image name, optional,
# defaults to Image.gz on arm64
# defaults to Image if TARGET_USES_UNCOMPRESSED_KERNEL
# defaults to zImage otherwise
#
# KERNEL_TOOLCHAIN_PREFIX = Overrides TARGET_KERNEL_CROSS_COMPILE_PREFIX,
# Set this var in shell to override
# toolchain specified in BoardConfig.mk
# KERNEL_TOOLCHAIN = Path to toolchain, if unset, assumes
# TARGET_KERNEL_CROSS_COMPILE_PREFIX
# is in PATH
# USE_CCACHE = Enable ccache (global Android flag)
#
# NEED_KERNEL_MODULE_ROOT = Optional, if true, install kernel
# modules in root instead of system
TARGET_AUTO_KDIR := $(shell echo $(TARGET_DEVICE_DIR) | sed -e 's/^device/kernel/g')
## Externally influenced variables
# kernel location - optional, defaults to kernel/<vendor>/<device>
TARGET_KERNEL_SOURCE ?= $(TARGET_AUTO_KDIR)
KERNEL_SRC := $(TARGET_KERNEL_SOURCE)
# kernel configuration - mandatory
KERNEL_DEFCONFIG := $(TARGET_KERNEL_CONFIG)
VARIANT_DEFCONFIG := $(TARGET_KERNEL_VARIANT_CONFIG)
SELINUX_DEFCONFIG := $(TARGET_KERNEL_SELINUX_CONFIG)
## Internal variables
KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ
KERNEL_CONFIG := $(KERNEL_OUT)/.config
KERNEL_OUT_STAMP := $(KERNEL_OUT)/.mkdir_stamp
TARGET_KERNEL_ARCH := $(strip $(TARGET_KERNEL_ARCH))
ifeq ($(TARGET_KERNEL_ARCH),)
KERNEL_ARCH := $(TARGET_ARCH)
else
KERNEL_ARCH := $(TARGET_KERNEL_ARCH)
endif
ifeq ($(KERNEL_ARCH),x86_64)
KERNEL_DEFCONFIG_ARCH := x86
else
KERNEL_DEFCONFIG_ARCH := $(KERNEL_ARCH)
endif
KERNEL_DEFCONFIG_SRC := $(KERNEL_SRC)/arch/$(KERNEL_DEFCONFIG_ARCH)/configs/$(KERNEL_DEFCONFIG)
TARGET_KERNEL_HEADER_ARCH := $(strip $(TARGET_KERNEL_HEADER_ARCH))
ifeq ($(TARGET_KERNEL_HEADER_ARCH),)
KERNEL_HEADER_ARCH := $(KERNEL_ARCH)
else
KERNEL_HEADER_ARCH := $(TARGET_KERNEL_HEADER_ARCH)
endif
KERNEL_HEADER_DEFCONFIG := $(strip $(KERNEL_HEADER_DEFCONFIG))
ifeq ($(KERNEL_HEADER_DEFCONFIG),)
KERNEL_HEADER_DEFCONFIG := $(KERNEL_DEFCONFIG)
endif
ifneq ($(BOARD_KERNEL_IMAGE_NAME),)
TARGET_PREBUILT_INT_KERNEL_TYPE := $(BOARD_KERNEL_IMAGE_NAME)
else
ifeq ($(TARGET_USES_UNCOMPRESSED_KERNEL),true)
TARGET_PREBUILT_INT_KERNEL_TYPE := Image
else
ifeq ($(KERNEL_ARCH),arm64)
TARGET_PREBUILT_INT_KERNEL_TYPE := Image.gz
else
TARGET_PREBUILT_INT_KERNEL_TYPE := zImage
endif
endif
endif
TARGET_PREBUILT_INT_KERNEL := $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/$(TARGET_PREBUILT_INT_KERNEL_TYPE)
# Clear this first to prevent accidental poisoning from env
MAKE_FLAGS :=
ifeq ($(KERNEL_ARCH),arm64)
# Avoid "unsupported RELA relocation: 311" errors (R_AARCH64_ADR_GOT_PAGE)
MAKE_FLAGS += CFLAGS_MODULE="-fno-pic"
ifeq ($(TARGET_ARCH),arm)
KERNEL_CONFIG_OVERRIDE := CONFIG_ANDROID_BINDER_IPC_32BIT=y
endif
endif
ifneq ($(TARGET_KERNEL_ADDITIONAL_CONFIG),)
KERNEL_ADDITIONAL_CONFIG := $(TARGET_KERNEL_ADDITIONAL_CONFIG)
KERNEL_ADDITIONAL_CONFIG_SRC := $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG)
ifeq ("$(wildcard $(KERNEL_ADDITIONAL_CONFIG_SRC))","")
$(warning TARGET_KERNEL_ADDITIONAL_CONFIG '$(TARGET_KERNEL_ADDITIONAL_CONFIG)' doesn't exist)
KERNEL_ADDITIONAL_CONFIG_SRC := /dev/null
endif
else
KERNEL_ADDITIONAL_CONFIG_SRC := /dev/null
endif
## Do be discontinued in a future version. Notify builder about target
## kernel format requirement
ifeq ($(BOARD_KERNEL_IMAGE_NAME),)
ifeq ($(BOARD_USES_UBOOT),true)
$(error "Please set BOARD_KERNEL_IMAGE_NAME to uImage")
else ifeq ($(BOARD_USES_UNCOMPRESSED_BOOT),true)
$(error "Please set BOARD_KERNEL_IMAGE_NAME to Image")
endif
endif