diff --git a/.gitignore b/.gitignore index c9b568f7eac..50d7a764ae9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pyc *.swp +*~ diff --git a/core/O3.mk b/core/O3.mk new file mode 100644 index 00000000000..f9aa54f3f48 --- /dev/null +++ b/core/O3.mk @@ -0,0 +1,27 @@ +# Copyright (C) 2014-2015 The SaberMod 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. +# + +ifneq (1,$(words $(filter $(LOCAL_DISABLE_O3),$(LOCAL_MODULE)))) + ifdef LOCAL_CONLYFLAGS + LOCAL_CONLYFLAGS += $(O3_FLAGS) + else + LOCAL_CONLYFLAGS := $(O3_FLAGS) + endif + ifdef LOCAL_CPPFLAGS + LOCAL_CPPFLAGS += $(O3_FLAGS) + else + LOCAL_CPPFLAGS := $(O3_FLAGS) + endif +endif diff --git a/core/binary.mk b/core/binary.mk index 70fc23929e9..699a13277dc 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -97,6 +97,65 @@ else endif endif +########################################################################## +# Copyright (C) 2014-2015 The SaberMod 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. +########################################################################## + +# arm thumb, not used on the host compiler. +ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),true) + include $(BUILD_SYSTEM)/thumb_interwork.mk +endif + +# O3 +ifeq ($(strip $(O3_OPTIMIZATIONS)),true) + include $(BUILD_SYSTEM)/O3.mk +endif + +# posix thread (pthread) support +ifeq ($(strip $(ENABLE_PTHREAD)),true) + include $(BUILD_SYSTEM)/pthread.mk +endif + +# Do not use graphite on host modules or the clang compiler. +ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),true) + ifneq ($(strip $(LOCAL_CLANG)),true) + + # If it gets this far enable graphite by default from here on out. + include $(BUILD_SYSTEM)/graphite.mk + endif +endif + +# Have anything that builds with libtinycompress as a shared lib use kernel headers. + +ifdef LOCAL_SHARED_LIBRARIES + ifeq (1,$(words $(filter libtinycompress, $(LOCAL_SHARED_LIBRARIES)))) + ifdef LOCAL_C_INCLUDES + LOCAL_C_INCLUDES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include + else + LOCAL_C_INCLUDES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include + endif + ifdef LOCAL_ADDITIONAL_DEPENDENCIES + LOCAL_ADDITIONAL_DEPENDENCIES += $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr + else + LOCAL_ADDITIONAL_DEPENDENCIES := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr + endif + endif +endif + +#end SaberMod + # The following LOCAL_ variables will be modified in this file. # Because the same LOCAL_ variables may be used to define modules for both 1st arch and 2nd arch, # we can't modify them in place. diff --git a/core/clang/HOST_x86_common.mk b/core/clang/HOST_x86_common.mk index 0241cb6636a..ced2ed1bb7f 100644 --- a/core/clang/HOST_x86_common.mk +++ b/core/clang/HOST_x86_common.mk @@ -15,6 +15,24 @@ CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CFLAGS := \ -no-integrated-as ifneq ($(strip $($(clang_2nd_arch_prefix)HOST_IS_64_BIT)),) +ifneq ($(strip $(USE_LEGACY_GCC)),true) +CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \ + --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \ + --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \ + -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8 \ + -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8/x86_64-linux \ + -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8/backward \ + -no-integrated-as + +CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \ + --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \ + --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \ + -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \ + -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8 \ + -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8 \ + -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib64/ \ + -no-integrated-as +else CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \ @@ -31,6 +49,25 @@ CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \ -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.6 \ -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib64/ \ -no-integrated-as +endif +else +ifneq ($(strip $(USE_LEGACY_GCC)),true) +CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \ + --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \ + --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \ + -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8 \ + -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8/x86_64-linux/32 \ + -isystem $($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/include/c++/4.8/backward \ + -no-integrated-as + +CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \ + --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \ + --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \ + -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \ + -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8/32 \ + -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/lib/gcc/x86_64-linux/4.8/32 \ + -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib32/ \ + -no-integrated-as else CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CPPFLAGS := \ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \ @@ -49,6 +86,7 @@ CLANG_CONFIG_x86_LINUX_HOST_EXTRA_LDFLAGS := \ -L$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/lib32/ \ -no-integrated-as endif +endif endif # Linux ifeq ($(HOST_OS),windows) diff --git a/core/clang/arm.mk b/core/clang/arm.mk index 22c73977a66..1c966daaa17 100644 --- a/core/clang/arm.mk +++ b/core/clang/arm.mk @@ -22,7 +22,8 @@ CLANG_CONFIG_arm_UNKNOWN_CFLAGS := \ -fno-builtin-sin \ -fno-strict-volatile-bitfields \ -fno-align-jumps \ - -Wa,--noexecstack + -Wa,--noexecstack \ + -mfpu=neon-vfpv4 define subst-clang-incompatible-arm-flags $(subst -march=armv5te,-march=armv5t,\ diff --git a/core/clang/arm64.mk b/core/clang/arm64.mk index 9fb36707ab3..47f25ed5e5d 100644 --- a/core/clang/arm64.mk +++ b/core/clang/arm64.mk @@ -16,7 +16,8 @@ CLANG_CONFIG_arm64_UNKNOWN_CFLAGS := \ -frename-registers \ -fno-strict-volatile-bitfields \ -fno-align-jumps \ - -Wa,--noexecstack + -Wa,--noexecstack \ + -mfpu=neon-vfpv4 # We don't have any arm64 flags to substitute yet. define subst-clang-incompatible-arm64-flags diff --git a/core/combo/HOST_linux-x86.mk b/core/combo/HOST_linux-x86.mk index 3ca7443e763..11e0c51adee 100644 --- a/core/combo/HOST_linux-x86.mk +++ b/core/combo/HOST_linux-x86.mk @@ -18,8 +18,12 @@ # Included by combo/select.mk ifeq ($(strip $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)),) +ifneq ($(strip $(USE_LEGACY_GCC)),true) +$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/bin/x86_64-linux- +else $(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/x86_64-linux- endif +endif # Don't do anything if the toolchain is not there ifneq (,$(strip $(wildcard $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)gcc))) $(combo_2nd_arch_prefix)HOST_CC := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)gcc @@ -28,7 +32,11 @@ $(combo_2nd_arch_prefix)HOST_AR := $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PRE endif # $($(combo_2nd_arch_prefix)HOST_TOOLCHAIN_PREFIX)gcc exists # gcc location for clang; to be updated when clang is updated +ifneq ($(strip $(USE_LEGACY_GCC)),true) +$(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/ +else $(combo_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/ +endif # We expect SSE3 floating point math. $(combo_2nd_arch_prefix)HOST_GLOBAL_CFLAGS += -mstackrealign -msse3 -mfpmath=sse -m32 -Wa,--noexecstack -march=prescott diff --git a/core/combo/HOST_linux-x86_64.mk b/core/combo/HOST_linux-x86_64.mk index 53a3ae8c2f0..4b29a806b4b 100644 --- a/core/combo/HOST_linux-x86_64.mk +++ b/core/combo/HOST_linux-x86_64.mk @@ -18,8 +18,12 @@ # Included by combo/select.mk ifeq ($(strip $(HOST_TOOLCHAIN_PREFIX)),) +ifneq ($(strip $(USE_LEGACY_GCC)),true) +HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/bin/x86_64-linux- +else HOST_TOOLCHAIN_PREFIX := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/bin/x86_64-linux- endif +endif # Don't do anything if the toolchain is not there ifneq (,$(strip $(wildcard $(HOST_TOOLCHAIN_PREFIX)gcc))) HOST_CC := $(HOST_TOOLCHAIN_PREFIX)gcc @@ -28,7 +32,11 @@ HOST_AR := $(HOST_TOOLCHAIN_PREFIX)ar endif # $(HOST_TOOLCHAIN_PREFIX)gcc exists # gcc location for clang; to be updated when clang is updated +ifneq ($(strip $(USE_LEGACY_GCC)),true) +HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.15-4.8/ +else HOST_TOOLCHAIN_FOR_CLANG := prebuilts/gcc/linux-x86/host/x86_64-linux-glibc2.11-4.6/ +endif HOST_GLOBAL_CFLAGS += -m64 -Wa,--noexecstack HOST_GLOBAL_LDFLAGS += -m64 -Wl,-z,noexecstack diff --git a/core/combo/arch/arm/armv7-a-neon.mk b/core/combo/arch/arm/armv7-a-neon.mk index a4196338174..f66bc0457ec 100644 --- a/core/combo/arch/arm/armv7-a-neon.mk +++ b/core/combo/arch/arm/armv7-a-neon.mk @@ -2,40 +2,60 @@ # Generating binaries for the ARMv7-a architecture and higher with NEON # ARCH_ARM_HAVE_ARMV7A := true -ARCH_ARM_HAVE_TLS_REGISTER := true ARCH_ARM_HAVE_VFP := true ARCH_ARM_HAVE_VFP_D32 := true ARCH_ARM_HAVE_NEON := true -ifneq (,$(filter cortex-a15 krait denver,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT))) +CORTEX_A15_TYPE := \ + cortex-a15 \ + krait \ + denver + +# arm64 doesn't like cortex-a15 +ifeq (denver,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)) +# Export cflags and cpu variant to the kernel. + export kernel_arch_variant_cflags := -march=armv8-a +endif +ifneq (,$(filter $(CORTEX_A15_TYPE),$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT))) + # NOTE: krait is not a cortex-a15, we set the variant to cortex-a15 so that + # hardware divide operations are generated. arch_variant_cflags := -mcpu=cortex-a15 + + # Fake an ARM compiler flag as these processors support LPAE which GCC/clang + # don't advertise. + arch_variant_cflags += -D__ARM_FEATURE_LPAE=1 +else +ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a9) + arch_variant_cflags := -mcpu=cortex-a9 else -ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a8) +ifneq (,$(filter cortex-a8 scorpion,$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT))) arch_variant_cflags := -mcpu=cortex-a8 + arch_variant_ldflags := -Wl,--fix-cortex-a8 else ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a7) arch_variant_cflags := -mcpu=cortex-a7 -else -ifeq ($(strip $(TARGET_CPU_VARIANT)),cortex-a5) - arch_variant_cflags := -mcpu=cortex-a5 -else -ifeq ($(strip $(TARGET_CPU_VARIANT)),krait) - arch_variant_cflags := -mcpu=cortex-a9 -else -ifeq ($(strip $(TARGET_CPU_VARIANT)),scorpion) - arch_variant_cflags := -mcpu=cortex-a8 else arch_variant_cflags := -march=armv7-a endif endif endif endif -endif -endif arch_variant_cflags += \ -mfloat-abi=softfp \ -mfpu=neon -arch_variant_ldflags := \ - -Wl,--fix-cortex-a8 +# For neon vfpv4 type, override -mfpu=neon with -mfpu=neon-vfpv4 +# Have the clang compiler ignore unknow flag option -mfpu=neon-vfpv4 +# Once ignored by clang, clang will default back to -mfpu=neon +neon_vfpv4_type := \ + cortex-a15 \ + krait + +ifneq ($(filter $(neon_vfpv4_type),$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),) +arch_variant_cflags += \ + -mfpu=neon-vfpv4 +# Export cflags and cpu variant to the kernel. +export kernel_arch_variant_cflags := $(arch_variant_cflags) +endif + diff --git a/core/graphite.mk b/core/graphite.mk new file mode 100644 index 00000000000..00f7d271740 --- /dev/null +++ b/core/graphite.mk @@ -0,0 +1,35 @@ +# Copyright (C) 2014-2015 The SaberMod 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. +# + +ifneq (1,$(words $(filter $(LOCAL_DISABLE_GRAPHITE),$(LOCAL_MODULE)))) + ifdef LOCAL_CONLYFLAGS + LOCAL_CONLYFLAGS += $(GRAPHITE_FLAGS) + else + LOCAL_CONLYFLAGS := $(GRAPHITE_FLAGS) + endif + + ifdef LOCAL_CPPFLAGS + LOCAL_CPPFLAGS += $(GRAPHITE_FLAGS) + else + LOCAL_CPPFLAGS := $(GRAPHITE_FLAGS) + endif + + ifndef LOCAL_LDFLAGS + LOCAL_LDFLAGS := $(GRAPHITE_FLAGS) + else + LOCAL_LDFLAGS += $(GRAPHITE_FLAGS) + endif +endif +##### diff --git a/core/pthread.mk b/core/pthread.mk new file mode 100644 index 00000000000..a5bb8973981 --- /dev/null +++ b/core/pthread.mk @@ -0,0 +1,22 @@ +# Copyright (C) 2015 The SaberMod 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. +# +# Add pthread flags globally +ifneq (1,$(words $(filter $(LOCAL_DISABLE_PTHREAD),$(LOCAL_MODULE)))) + ifdef LOCAL_CFLAGS + LOCAL_CFLAGS += -pthread + else + LOCAL_CFLAGS := -pthread + endif +endif diff --git a/core/tasks/kernel.mk b/core/tasks/kernel.mk index af1bf550692..ee055f72ab9 100644 --- a/core/tasks/kernel.mk +++ b/core/tasks/kernel.mk @@ -14,8 +14,6 @@ # Android makefile to build kernel as a part of Android Build --include vendor/omni/config/branding.mk - TARGET_AUTO_KDIR := $(shell echo $(TARGET_DEVICE_DIR) | sed -e 's/^device/kernel/g') ## Externally influenced variables @@ -31,14 +29,50 @@ SELINUX_DEFCONFIG := $(TARGET_KERNEL_SELINUX_CONFIG) KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ KERNEL_CONFIG := $(KERNEL_OUT)/.config +TARGET_KERNEL_ARCH := $(strip $(TARGET_KERNEL_ARCH)) +ifeq ($(TARGET_KERNEL_ARCH),) +KERNEL_ARCH := $(TARGET_ARCH) +else +KERNEL_ARCH := $(TARGET_KERNEL_ARCH) +endif + +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) - TARGET_PREBUILT_INT_KERNEL := $(KERNEL_OUT)/arch/$(TARGET_ARCH)/boot/$(TARGET_PREBUILT_INT_KERNEL_TYPE) + TARGET_PREBUILT_INT_KERNEL_TYPE := $(BOARD_KERNEL_IMAGE_NAME) else - TARGET_PREBUILT_INT_KERNEL := $(KERNEL_OUT)/arch/$(TARGET_ARCH)/boot/zImage - TARGET_PREBUILT_INT_KERNEL_TYPE := zImage + ifeq ($(TARGET_USES_UNCOMPRESSED_KERNEL),true) + TARGET_PREBUILT_INT_KERNEL_TYPE := Image + else + TARGET_PREBUILT_INT_KERNEL_TYPE := zImage + 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 + ## Do be discontinued in a future version. Notify builder about target ## kernel format requirement ifeq ($(BOARD_KERNEL_IMAGE_NAME),) @@ -67,7 +101,7 @@ ifeq "$(wildcard $(KERNEL_SRC) )" "" $(warning * THIS IS DEPRECATED, AND WILL BE DISCONTINUED *) $(warning * Please configure your device to download the kernel *) $(warning * source repository to $(KERNEL_SRC)) - $(warning * See $(URL_INTEGRATED_KERNEL_BUILD)) + $(warning * See http://wiki.cyanogenmod.org/w/Doc:_integrated_kernel_building) $(warning * for more information *) $(warning ***************************************************************) FULL_KERNEL_BUILD := false @@ -99,12 +133,7 @@ else else #$(info Kernel source found, building it) FULL_KERNEL_BUILD := true - ifeq ($(TARGET_USES_UNCOMPRESSED_KERNEL),true) - $(info Using uncompressed kernel) - KERNEL_BIN := $(KERNEL_OUT)/piggy - else - KERNEL_BIN := $(TARGET_PREBUILT_INT_KERNEL) - endif + KERNEL_BIN := $(TARGET_PREBUILT_INT_KERNEL) endif endif @@ -114,12 +143,38 @@ KERNEL_HEADERS_INSTALL := $(KERNEL_OUT)/usr KERNEL_MODULES_INSTALL := system KERNEL_MODULES_OUT := $(TARGET_OUT)/lib/modules +TARGET_KERNEL_CROSS_COMPILE_PREFIX := $(strip $(TARGET_KERNEL_CROSS_COMPILE_PREFIX)) +ifeq ($(TARGET_KERNEL_CROSS_COMPILE_PREFIX),) +ifeq ($(KERNEL_TOOLCHAIN_PREFIX),) +KERNEL_TOOLCHAIN_PREFIX := arm-eabi- +endif +else +KERNEL_TOOLCHAIN_PREFIX := $(TARGET_KERNEL_CROSS_COMPILE_PREFIX) +endif + +ifeq ($(KERNEL_TOOLCHAIN),) +KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN_PREFIX) +else +ifneq ($(KERNEL_TOOLCHAIN_PREFIX),) +KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN)/$(KERNEL_TOOLCHAIN_PREFIX) +endif +endif + +ifneq ($(USE_CCACHE),) + ccache := $(ANDROID_BUILD_TOP)/prebuilts/misc/$(HOST_PREBUILT_TAG)/ccache/ccache + # Check that the executable is here. + ccache := $(strip $(wildcard $(ccache))) +endif + +KERNEL_CROSS_COMPILE := CROSS_COMPILE="$(ccache) $(KERNEL_TOOLCHAIN_PATH)" +ccache = + define mv-modules mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.order`;\ if [ "$$mdpath" != "" ];then\ mpath=`dirname $$mdpath`;\ ko=`find $$mpath/kernel -type f -name *.ko`;\ - for i in $$ko; do $(ARM_EABI_TOOLCHAIN)/arm-eabi-strip --strip-unneeded $$i;\ + for i in $$ko; do $(KERNEL_TOOLCHAIN_PATH)strip --strip-unneeded $$i;\ mv $$i $(KERNEL_MODULES_OUT)/; done;\ fi endef @@ -131,32 +186,8 @@ define clean-module-folder fi endef -ifeq ($(TARGET_ARCH),arm) - ifneq ($(USE_CCACHE),) - # search executable - ccache = - ifneq ($(strip $(wildcard $(ANDROID_BUILD_TOP)/prebuilts/misc/$(HOST_PREBUILT_EXTRA_TAG)/ccache/ccache)),) - ccache := $(ANDROID_BUILD_TOP)/prebuilts/misc/$(HOST_PREBUILT_EXTRA_TAG)/ccache/ccache - else - ifneq ($(strip $(wildcard $(ANDROID_BUILD_TOP)/prebuilts/misc/$(HOST_PREBUILT_TAG)/ccache/ccache)),) - ccache := $(ANDROID_BUILD_TOP)/prebuilts/misc/$(HOST_PREBUILT_TAG)/ccache/ccache - endif - endif - endif - ifneq ($(TARGET_KERNEL_CUSTOM_TOOLCHAIN),) - ifeq ($(HOST_OS),darwin) - ARM_CROSS_COMPILE:=CROSS_COMPILE="$(ccache) $(ANDROID_BUILD_TOP)/prebuilts/gcc/darwin-x86/arm/$(TARGET_KERNEL_CUSTOM_TOOLCHAIN)/bin/arm-eabi-" - else - ARM_CROSS_COMPILE:=CROSS_COMPILE="$(ccache) $(ANDROID_BUILD_TOP)/prebuilts/gcc/linux-x86/arm/$(TARGET_KERNEL_CUSTOM_TOOLCHAIN)/bin/arm-eabi-" - endif - else - ARM_CROSS_COMPILE:=CROSS_COMPILE="$(ccache) $(ARM_EABI_TOOLCHAIN)/arm-eabi-" - endif - ccache = -endif - ifeq ($(HOST_OS),darwin) - MAKE_FLAGS := C_INCLUDE_PATH=$(ANDROID_BUILD_TOP)/external/elfutils/libelf + MAKE_FLAGS += C_INCLUDE_PATH=$(ANDROID_BUILD_TOP)/external/elfutils/0.153/libelf/ endif ifeq ($(TARGET_KERNEL_MODULES),) @@ -168,16 +199,17 @@ $(KERNEL_OUT): mkdir -p $(KERNEL_MODULES_OUT) $(KERNEL_CONFIG): $(KERNEL_OUT) - $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE) VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) $(KERNEL_DEFCONFIG) + $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) $(KERNEL_DEFCONFIG) + $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \ + echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \ + echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi -$(KERNEL_OUT)/piggy : $(TARGET_PREBUILT_INT_KERNEL) - $(hide) gunzip -c $(KERNEL_OUT)/arch/$(TARGET_ARCH)/boot/compressed/piggy.gzip > $(KERNEL_OUT)/piggy - -TARGET_KERNEL_BINARIES: $(KERNEL_OUT) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL) - $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE) $(TARGET_PREBUILT_INT_KERNEL_TYPE) - -$(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE) dtbs - -$(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE) modules - -$(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) INSTALL_MOD_PATH=../../$(KERNEL_MODULES_INSTALL) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE) modules_install +TARGET_KERNEL_BINARIES: $(KERNEL_OUT) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL) $(KERNEL_HEADERS_INSTALL_ROOT) + $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(TARGET_PREBUILT_INT_KERNEL_TYPE) + -$(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) dtbs + -$(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) modules + -$(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) INSTALL_MOD_PATH=../../$(KERNEL_MODULES_INSTALL) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) modules_install $(mv-modules) $(clean-module-folder) @@ -188,7 +220,31 @@ $(TARGET_PREBUILT_INT_KERNEL): $(TARGET_KERNEL_MODULES) $(clean-module-folder) $(KERNEL_HEADERS_INSTALL): $(KERNEL_OUT) $(KERNEL_CONFIG) - $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(TARGET_ARCH) $(ARM_CROSS_COMPILE) headers_install + $(hide) if [ ! -z "$(KERNEL_HEADER_DEFCONFIG)" ]; then \ + $(hide) rm -f ../$(KERNEL_CONFIG); \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_HEADER_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNEL_HEADER_DEFCONFIG); \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_HEADER_ARCH) $(KERNEL_CROSS_COMPILE) headers_install; fi + $(hide) if [ "$(KERNEL_HEADER_DEFCONFIG)" != "$(KERNEL_DEFCONFIG)" ]; then \ + echo "Used a different defconfig for header generation"; \ + $(hide) rm -f ../$(KERNEL_CONFIG); \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(KERNEL_DEFCONFIG); fi + $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \ + echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \ + echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi + +KERNEL_HEADERS_INSTALL_ROOT: $(KERNEL_OUT) $(KERNEL_CONFIG) + -$(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_HEADER_ARCH) $(KERNEL_CROSS_COMPILE) headers_install + +kerneltags: $(KERNEL_OUT) $(KERNEL_CONFIG) + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) tags + +kernelconfig: $(KERNEL_OUT) $(KERNEL_CONFIG) + env KCONFIG_NOTIMESTAMP=true \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) menuconfig + env KCONFIG_NOTIMESTAMP=true \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) savedefconfig + cp $(KERNEL_OUT)/defconfig kernel/arch/$(KERNEL_ARCH)/configs/$(KERNEL_DEFCONFIG) endif # FULL_KERNEL_BUILD diff --git a/core/thumb_interwork.mk b/core/thumb_interwork.mk new file mode 100644 index 00000000000..1008033922e --- /dev/null +++ b/core/thumb_interwork.mk @@ -0,0 +1,41 @@ +# Copyright (C) 2014-2015 The SaberMod 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. +# + +# Copyright (C) 2014-2015 The SaberMod 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. +# + +ifeq ($(strip (TARGET_ARCH)),arm) + ifneq (1,$(words $(filter $(LOCAL_DISABLE_THUMB_INTERWORK),$(LOCAL_MODULE)))) + ifdef LOCAL_CFLAGS + LOCAL_CFLAGS += \ + -mthumb-interwork + else + LOCAL_CFLAGS := \ + -mthumb-interwork + endif + endif +endif diff --git a/target/product/full_base_telephony.mk b/target/product/full_base_telephony.mk index 04132300832..1ee72f9449b 100644 --- a/target/product/full_base_telephony.mk +++ b/target/product/full_base_telephony.mk @@ -19,10 +19,6 @@ # build quite specifically for the emulator, and might not be # entirely appropriate to inherit from for on-device configurations. -PRODUCT_PACKAGES := \ - VoiceDialer \ - libsrec_jni - PRODUCT_PROPERTY_OVERRIDES := \ keyguard.no_require_sim=true \ ro.com.android.dataroaming=true