From c4fe9f0ff980ea1e12e8e1bea9565e4490356bc7 Mon Sep 17 00:00:00 2001 From: Steve Kondik Date: Wed, 24 Dec 2014 03:18:54 -0800 Subject: [PATCH 01/10] 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 Signed-off-by: Paul Beeler Conflicts: core/tasks/kernel.mk Fix mismerge on cherry-pick Change-Id: If756a66b46da81f9ecd9d05a56598d2e2a913d0e Signed-off-by: Paul Beeler --- core/tasks/kernel.mk | 149 +++++++++++++++++++++++++++++-------------- 1 file changed, 101 insertions(+), 48 deletions(-) diff --git a/core/tasks/kernel.mk b/core/tasks/kernel.mk index af1bf550692..9f40eec3a16 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) - -$(KERNEL_OUT)/piggy : $(TARGET_PREBUILT_INT_KERNEL) - $(hide) gunzip -c $(KERNEL_OUT)/arch/$(TARGET_ARCH)/boot/compressed/piggy.gzip > $(KERNEL_OUT)/piggy + $(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 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 + $(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,28 @@ $(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 + +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 From 93cf72080aa598e21c2a05fc7fb0cb5545518f8a Mon Sep 17 00:00:00 2001 From: Paul Beeler Date: Wed, 18 Feb 2015 22:30:02 -0700 Subject: [PATCH 02/10] git: ignore gedit backups Change-Id: Iabb681842e1a9cc9ea450cafa97cf4d6135fb2b5 --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index c9b568f7eac..50d7a764ae9 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ *.pyc *.swp +*~ From 4d1a38cf7c999357120882454ddd204907653480 Mon Sep 17 00:00:00 2001 From: Paul Beeler Date: Sat, 24 Jan 2015 15:41:02 -0700 Subject: [PATCH 03/10] Saberize: Added -O3 modular optimizations. To switch on use O3_OPTIMIZATIONS := true host gcc 4.8 is now default. seems silly to have 4.6 as default. To use host 4.6, set USE_LEGACY_GCC := true Add the updated version of graphite that works and set it on by default (top sabermod feature) cutomize arm neon to export flags to kernel Change-Id: I692f17c61029bc395910f4c976e4bc9bae7fdf50 Signed-off-by: Paul Beeler --- core/O3.mk | 45 +++++++++++++++++++++++++++++ core/binary.mk | 33 +++++++++++++++++++++ core/clang/HOST_x86_common.mk | 38 ++++++++++++++++++++++++ core/clang/arm.mk | 3 +- core/clang/arm64.mk | 3 +- core/combo/HOST_linux-x86.mk | 8 +++++ core/combo/HOST_linux-x86_64.mk | 8 +++++ core/combo/arch/arm/armv7-a-neon.mk | 43 +++++++++++++++++---------- core/graphite.mk | 35 ++++++++++++++++++++++ 9 files changed, 198 insertions(+), 18 deletions(-) create mode 100644 core/O3.mk create mode 100644 core/graphite.mk diff --git a/core/O3.mk b/core/O3.mk new file mode 100644 index 00000000000..1bd7fc74a37 --- /dev/null +++ b/core/O3.mk @@ -0,0 +1,45 @@ +# 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)))) + LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE)) + ifeq (arm,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) + arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm) + normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb) + + # Read the values from something like TARGET_arm_CFLAGS or + # TARGET_thumb_CFLAGS. HOST_(arm|thumb)_CFLAGS values aren't + # actually used (although they are usually empty). + arm_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(arm_objects_mode)_CFLAGS) + normal_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(normal_objects_mode)_CFLAGS) + else + arm_objects_mode := + normal_objects_mode := + arm_objects_cflags := + normal_objects_cflags := + endif + ifeq ($(filter $(LOCAL_DISABLE_O3_CFLAGS),$(arm_objects_cflags)$(normal_objects_cflags)),) + 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 +endif diff --git a/core/binary.mk b/core/binary.mk index 70fc23929e9..2fda72a8bc5 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -97,6 +97,39 @@ 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. +# + +# Include custom gcc flags. Seperate them so they can be easily managed. + +# O3 +ifeq ($(strip $(O3_OPTIMIZATIONS)),true) + include $(BUILD_SYSTEM)/O3.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 + +#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..9690a8fc705 100644 --- a/core/combo/arch/arm/armv7-a-neon.mk +++ b/core/combo/arch/arm/armv7-a-neon.mk @@ -2,40 +2,51 @@ # 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 + +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 cortex-a15 and armv8-a types, 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 +ifneq ($(filter $(CORTEX_A15_TYPE),$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),) +arch_variant_cflags += \ + -mfpu=neon-vfpv4 +endif + +# Export cflags and cpu variant to the kernel. +export kernel_arch_variant_cflags := $(arch_variant_cflags) 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 +##### From 37fb144363a4414d2e6b218a366c22deccfb77b6 Mon Sep 17 00:00:00 2001 From: Paul Beeler Date: Thu, 19 Feb 2015 10:37:27 -0700 Subject: [PATCH 04/10] Stop building VoiceDialer: Fails to build Change-Id: Icda2096e096114647f895c10a8d6108b48796187 Signed-off-by: Paul Beeler --- target/product/full_base_telephony.mk | 4 ---- 1 file changed, 4 deletions(-) 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 From bd6a606366c0b76d300225180427efd303cd6ab4 Mon Sep 17 00:00:00 2001 From: Paul Beeler Date: Thu, 19 Feb 2015 12:31:05 -0700 Subject: [PATCH 05/10] arm: compile all thumb with -mthumb-interwork and cleanup -O3 To enable this option use ENABLE_ARM_THUMB_INTERWORK := true This may slightly increase binary size but will include more arm instructions for increased performance. https://gcc.gnu.org/onlinedocs/gcc/ARM-Options.html Change-Id: I0ba0a2d34b84e34309c20ce0cbb85ea3ee6dda15 Signed-off-by: Paul Beeler --- core/O3.mk | 32 +++++++------------------------- core/binary.mk | 7 +++++++ core/thumb_interwork.mk | 41 +++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 25 deletions(-) create mode 100644 core/thumb_interwork.mk diff --git a/core/O3.mk b/core/O3.mk index 1bd7fc74a37..f9aa54f3f48 100644 --- a/core/O3.mk +++ b/core/O3.mk @@ -14,32 +14,14 @@ # ifneq (1,$(words $(filter $(LOCAL_DISABLE_O3),$(LOCAL_MODULE)))) - LOCAL_ARM_MODE := $(strip $(LOCAL_ARM_MODE)) - ifeq (arm,$(TARGET_$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) - arm_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),arm) - normal_objects_mode := $(if $(LOCAL_ARM_MODE),$(LOCAL_ARM_MODE),thumb) - - # Read the values from something like TARGET_arm_CFLAGS or - # TARGET_thumb_CFLAGS. HOST_(arm|thumb)_CFLAGS values aren't - # actually used (although they are usually empty). - arm_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(arm_objects_mode)_CFLAGS) - normal_objects_cflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)$(normal_objects_mode)_CFLAGS) + ifdef LOCAL_CONLYFLAGS + LOCAL_CONLYFLAGS += $(O3_FLAGS) else - arm_objects_mode := - normal_objects_mode := - arm_objects_cflags := - normal_objects_cflags := + LOCAL_CONLYFLAGS := $(O3_FLAGS) endif - ifeq ($(filter $(LOCAL_DISABLE_O3_CFLAGS),$(arm_objects_cflags)$(normal_objects_cflags)),) - 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 + 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 2fda72a8bc5..ce899bbe816 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -114,6 +114,13 @@ endif # Include custom gcc flags. Seperate them so they can be easily managed. +# arm thumb +ifeq ($(strip $(ENABLE_ARM_THUMB_INTERWORK)),true) + ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),true) + include $(BUILD_SYSTEM)/thumb_interwork.mk + endif +endif + # O3 ifeq ($(strip $(O3_OPTIMIZATIONS)),true) include $(BUILD_SYSTEM)/O3.mk 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 From 2bed7d21ce49a9fa8424526854aa5281c7bfddde Mon Sep 17 00:00:00 2001 From: Paul Beeler Date: Thu, 19 Feb 2015 11:24:45 -0500 Subject: [PATCH 06/10] Add Global posix thread aka pthread Support (1/2) this flag enables multithread support much like what I did in kitkat. https://github.com/SaberMod/android_build-OLD/commit/93d376380dffae1ec96eeb0ef00a7e663d107ca4 Change-Id: Id5559ec460b2ba84ed9cfe7a47b0ac59544e1d61 Signed-off-by: Paul Beeler --- core/binary.mk | 17 +++++++++-------- core/pthread.mk | 22 ++++++++++++++++++++++ 2 files changed, 31 insertions(+), 8 deletions(-) create mode 100644 core/pthread.mk diff --git a/core/binary.mk b/core/binary.mk index ce899bbe816..03aa0aa334d 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -97,6 +97,7 @@ else endif endif +########################################################################## # Copyright (C) 2014-2015 The SaberMod Project # # Licensed under the Apache License, Version 2.0 (the "License"); @@ -110,15 +111,11 @@ endif # 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. -# - -# Include custom gcc flags. Seperate them so they can be easily managed. +########################################################################## -# arm thumb -ifeq ($(strip $(ENABLE_ARM_THUMB_INTERWORK)),true) - ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),true) - include $(BUILD_SYSTEM)/thumb_interwork.mk - endif +# arm thumb, not used on the host compiler. +ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),true) + include $(BUILD_SYSTEM)/thumb_interwork.mk endif # O3 @@ -126,6 +123,9 @@ ifeq ($(strip $(O3_OPTIMIZATIONS)),true) include $(BUILD_SYSTEM)/O3.mk endif +# Add pthread support +include $(BUILD_SYSTEM)/pthread.mk + # Do not use graphite on host modules or the clang compiler. ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),true) ifneq ($(strip $(LOCAL_CLANG)),true) @@ -135,6 +135,7 @@ ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),true) endif endif + #end SaberMod # The following LOCAL_ variables will be modified in this file. 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 From 0f4079281eab2f08db2fc348124a333babcf02ae Mon Sep 17 00:00:00 2001 From: Paul Beeler Date: Sat, 21 Feb 2015 07:30:46 -0700 Subject: [PATCH 07/10] pthread: Make optional, disabled by default: This can cause high system RAM usage Change-Id: Ib038926b9c0b8ae150bc41f03afe20cb72b5d221 Signed-off-by: Paul Beeler --- core/binary.mk | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/binary.mk b/core/binary.mk index 03aa0aa334d..53f0f70d6fa 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -123,8 +123,10 @@ ifeq ($(strip $(O3_OPTIMIZATIONS)),true) include $(BUILD_SYSTEM)/O3.mk endif -# Add pthread support -include $(BUILD_SYSTEM)/pthread.mk +# 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) From cc39f5ec6af33939fe443d5724d09979de4697e5 Mon Sep 17 00:00:00 2001 From: Paul Beeler Date: Thu, 5 Mar 2015 00:03:45 -0700 Subject: [PATCH 08/10] Cleanup armv7-a-neon.mk for arm64 since AOSP has this hacked into armv7-a Change-Id: Icf85460fe2e508719ef996a35cb064a153f21305 Signed-off-by: Paul Beeler --- core/combo/arch/arm/armv7-a-neon.mk | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/core/combo/arch/arm/armv7-a-neon.mk b/core/combo/arch/arm/armv7-a-neon.mk index 9690a8fc705..f66bc0457ec 100644 --- a/core/combo/arch/arm/armv7-a-neon.mk +++ b/core/combo/arch/arm/armv7-a-neon.mk @@ -11,6 +11,11 @@ CORTEX_A15_TYPE := \ 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. @@ -40,13 +45,17 @@ arch_variant_cflags += \ -mfloat-abi=softfp \ -mfpu=neon -# For cortex-a15 and armv8-a types, override -mfpu=neon with -mfpu=neon-vfpv4 +# 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 -ifneq ($(filter $(CORTEX_A15_TYPE),$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),) +neon_vfpv4_type := \ + cortex-a15 \ + krait + +ifneq ($(filter $(neon_vfpv4_type),$(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),) arch_variant_cflags += \ -mfpu=neon-vfpv4 -endif - # Export cflags and cpu variant to the kernel. export kernel_arch_variant_cflags := $(arch_variant_cflags) +endif + From a0a11c26d83360a4cbe8e6fefdbe510f0e99f491 Mon Sep 17 00:00:00 2001 From: Paul Beeler Date: Thu, 5 Mar 2015 01:12:18 -0700 Subject: [PATCH 09/10] Install kernel headers the normal way. Change-Id: Idd7a48c4fc68069cd655360d15902f0d8b6433c2 Signed-off-by: Paul Beeler --- core/tasks/kernel.mk | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/core/tasks/kernel.mk b/core/tasks/kernel.mk index 9f40eec3a16..ee055f72ab9 100644 --- a/core/tasks/kernel.mk +++ b/core/tasks/kernel.mk @@ -205,7 +205,7 @@ $(KERNEL_CONFIG): $(KERNEL_OUT) echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \ $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi -TARGET_KERNEL_BINARIES: $(KERNEL_OUT) $(KERNEL_CONFIG) $(KERNEL_HEADERS_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 @@ -233,6 +233,9 @@ $(KERNEL_HEADERS_INSTALL): $(KERNEL_OUT) $(KERNEL_CONFIG) 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 From 410562171a606a8b3cb4df404acb63c1764b2b19 Mon Sep 17 00:00:00 2001 From: Paul Beeler Date: Sat, 7 Mar 2015 01:22:51 -0700 Subject: [PATCH 10/10] libtinycompress: use kernel headers when used as a shared lib Change-Id: Ib6ceff06cf8f9b2780523b673f46b6dba6f46320 Signed-off-by: Paul Beeler --- core/binary.mk | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/core/binary.mk b/core/binary.mk index 53f0f70d6fa..699a13277dc 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -137,6 +137,22 @@ ifneq ($(strip $(LOCAL_IS_HOST_MODULE)),true) 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