Merge "Tweak sgrep to add cc and aidl files." into lmp-dev
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 4e90c90..3918fce 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -283,6 +283,12 @@
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/default.prop)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system)
+
+# Adding dalvik.vm.dex2oat-filter
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/root/default.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/recovery/root/default.prop)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/Makefile b/core/Makefile
index 36d53e1..7b3dfe4 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -219,8 +219,6 @@
TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
- TARGET_2ND_CPU_ABI="$(TARGET_2ND_CPU_ABI)" \
- TARGET_2ND_CPU_ABI2="$(TARGET_2ND_CPU_ABI2)" \
TARGET_AAPT_CHARACTERISTICS="$(TARGET_AAPT_CHARACTERISTICS)" \
bash $(BUILDINFO_SH) >> $@
$(hide) $(foreach file,$(system_prop_file), \
@@ -942,7 +940,11 @@
skip_fsck=true)
$(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
./build/tools/releasetools/build_image.py \
- $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1)
+ $(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) \
+ || ( echo "Out of space? the tree size of $(TARGET_OUT) is (MB): " 1>&2 ;\
+ du -sm $(TARGET_OUT) 1>&2;\
+ echo "The max is $$(( $(BOARD_SYSTEMIMAGE_PARTITION_SIZE) / 1048576 )) MB." 1>&2 ;\
+ exit 1 )
endef
$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE)
@@ -1415,6 +1417,7 @@
$(hide) zipinfo -1 $@ | awk 'BEGIN { FS="BOOT/RAMDISK/" } /^BOOT\/RAMDISK\// {print $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -S $(SELINUX_FC) > $(zip_root)/META/boot_filesystem_config.txt
$(hide) zipinfo -1 $@ | awk 'BEGIN { FS="RECOVERY/RAMDISK/" } /^RECOVERY\/RAMDISK\// {print $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -S $(SELINUX_FC) > $(zip_root)/META/recovery_filesystem_config.txt
$(hide) (cd $(zip_root) && zip -q ../$(notdir $@) META/*filesystem_config.txt)
+ $(hide) ./build/tools/releasetools/add_img_to_target_files $@
.PHONY: target-files-package
target-files-package: $(BUILT_TARGET_FILES_PACKAGE)
@@ -1644,6 +1647,8 @@
sdk_atree_files += $(atree_dir)/sdk.atree
endif
+include $(BUILD_SYSTEM)/sdk_font.mk
+
deps := \
$(target_notice_file_txt) \
$(tools_notice_file_txt) \
@@ -1657,7 +1662,8 @@
$(ATREE_FILES) \
$(sdk_atree_files) \
$(HOST_OUT_EXECUTABLES)/atree \
- $(HOST_OUT_EXECUTABLES)/line_endings
+ $(HOST_OUT_EXECUTABLES)/line_endings \
+ $(SDK_FONT_DEPS)
INTERNAL_SDK_TARGET := $(sdk_dir)/$(sdk_name).zip
$(INTERNAL_SDK_TARGET): PRIVATE_NAME := $(sdk_name)
@@ -1665,10 +1671,6 @@
$(INTERNAL_SDK_TARGET): PRIVATE_DEP_FILE := $(sdk_dep_file)
$(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files)
-sdk_font_temp_dir := $(call intermediates-dir-for,PACKAGING,sdk-fonts)
-sdk_font_input_list := frameworks/base/data/fonts external/noto-fonts external/google-fonts external/naver-fonts
-sdk_font_rename_script := frameworks/base/tools/layoutlib/rename_font/build_font.py
-
# Set SDK_GNU_ERROR to non-empty to fail when a GNU target is built.
#
#SDK_GNU_ERROR := true
@@ -1684,9 +1686,7 @@
fi; \
done; \
if [ $$FAIL ]; then exit 1; fi
- $(hide) mkdir -p $(sdk_font_temp_dir)
- $(hide) PYTHONPATH=$$PYTHONPATH:external/fonttools/Lib $(sdk_font_rename_script) $(sdk_font_input_list) \
- $(sdk_font_temp_dir)
+ $(hide) echo $(notdir $(SDK_FONT_DEPS)) | tr " " "\n" > $(SDK_FONT_TEMP)/fontsInSdk.txt
$(hide) ( \
ATREE_STRIP="strip -x" \
$(HOST_OUT_EXECUTABLES)/atree \
@@ -1702,7 +1702,7 @@
-v "TARGET_ARCH=$(TARGET_ARCH)" \
-v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \
-v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \
- -v "FONT_OUT=$(sdk_font_temp_dir)" \
+ -v "FONT_OUT=$(SDK_FONT_TEMP)" \
-o $(PRIVATE_DIR) && \
cp -f $(target_notice_file_txt) \
$(PRIVATE_DIR)/system-images/android-$(PLATFORM_VERSION)/$(TARGET_CPU_ABI)/NOTICE.txt && \
diff --git a/core/binary.mk b/core/binary.mk
index f5dac69..6ba6bec 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -113,6 +113,17 @@
my_c_includes := $(LOCAL_C_INCLUDES)
my_generated_sources := $(LOCAL_GENERATED_SOURCES)
+# MinGW spits out warnings about -fPIC even for -fpie?!) being ignored because
+# all code is position independent, and then those warnings get promoted to
+# errors.
+ifeq ($(strip $(USE_MINGW)),)
+ifeq ($(LOCAL_MODULE_CLASS),EXECUTABLES)
+my_cflags += -fpie
+else
+my_cflags += -fPIC
+endif
+endif
+
my_src_files += $(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SRC_FILES_$(my_32_64_bit_suffix))
my_shared_libraries += $(LOCAL_SHARED_LIBRARIES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_SHARED_LIBRARIES_$(my_32_64_bit_suffix))
my_cflags += $(LOCAL_CFLAGS_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) $(LOCAL_CFLAGS_$(my_32_64_bit_suffix))
@@ -316,6 +327,7 @@
endif
endif
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CXX := $(my_cxx)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLANG := $(my_clang)
# TODO: support a mix of standard extensions so that this isn't necessary
LOCAL_CPP_EXTENSION := $(strip $(LOCAL_CPP_EXTENSION))
diff --git a/core/clang/TARGET_mips.mk b/core/clang/TARGET_mips.mk
index e70e254..0107519 100644
--- a/core/clang/TARGET_mips.mk
+++ b/core/clang/TARGET_mips.mk
@@ -3,7 +3,7 @@
CLANG_CONFIG_mips_TARGET_TRIPLE := mipsel-linux-android
CLANG_CONFIG_mips_TARGET_TOOLCHAIN_PREFIX := \
- $($(clang_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT)/$(CLANG_CONFIG_mips_TARGET_TRIPLE)/bin
+ $($(clang_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT)/mips64el-linux-android/bin
CLANG_CONFIG_mips_TARGET_EXTRA_ASFLAGS := \
$(CLANG_CONFIG_EXTRA_ASFLAGS) \
@@ -43,7 +43,7 @@
$(CLANG_CONFIG_mips_TARGET_EXTRA_CFLAGS)
$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_CPPFLAGS := \
- $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$(clang_2nd_arch_prefix)$(TARGET_GLOBAL_CPPFLAGS)) \
+ $(call $(clang_2nd_arch_prefix)convert-to-clang-flags,$($(clang_2nd_arch_prefix)TARGET_GLOBAL_CPPFLAGS)) \
$(CLANG_CONFIG_mips_TARGET_EXTRA_CPPFLAGS)
$(clang_2nd_arch_prefix)CLANG_TARGET_GLOBAL_LDFLAGS := \
diff --git a/core/clang/config.mk b/core/clang/config.mk
index 1de46f0..c1625f2 100644
--- a/core/clang/config.mk
+++ b/core/clang/config.mk
@@ -17,6 +17,17 @@
CLANG_TBLGEN := $(HOST_OUT_EXECUTABLES)/clang-tblgen$(BUILD_EXECUTABLE_SUFFIX)
LLVM_TBLGEN := $(HOST_OUT_EXECUTABLES)/llvm-tblgen$(BUILD_EXECUTABLE_SUFFIX)
+# The C/C++ compiler can be wrapped by setting the CC/CXX_WRAPPER vars.
+ifdef CC_WRAPPER
+ ifneq ($(CC_WRAPPER),$(firstword $(CLANG)))
+ CLANG := $(CC_WRAPPER) $(CLANG)
+ endif
+endif
+ifdef CXX_WRAPPER
+ ifneq ($(CXX_WRAPPER),$(firstword $(CLANG_CXX)))
+ CLANG_CXX := $(CXX_WRAPPER) $(CLANG_CXX)
+ endif
+endif
# Clang flags for all host or target rules
CLANG_CONFIG_EXTRA_ASFLAGS :=
diff --git a/core/clang/mips.mk b/core/clang/mips.mk
index cef7823..1624b6f 100644
--- a/core/clang/mips.mk
+++ b/core/clang/mips.mk
@@ -7,18 +7,18 @@
# Include common unknown flags
CLANG_CONFIG_mips_UNKNOWN_CFLAGS := \
$(CLANG_CONFIG_UNKNOWN_CFLAGS) \
- -EL \
-mips32 \
-mips32r2 \
- -mhard-float \
+ -mips32r6 \
+ -mfp32 \
+ -mfp64 \
+ -mfpxx \
+ -modd-spreg \
+ -mno-odd-spreg \
-fno-strict-volatile-bitfields \
-fgcse-after-reload \
-frerun-cse-after-loop \
-frename-registers \
- -march=mips32r2 \
- -mtune=mips32r2 \
- -march=mips32 \
- -mtune=mips32 \
-msynci \
-mno-fused-madd
diff --git a/core/clang/mips64.mk b/core/clang/mips64.mk
index 9d1117b..a76aa08 100644
--- a/core/clang/mips64.mk
+++ b/core/clang/mips64.mk
@@ -1,7 +1,5 @@
# Clang flags for mips64 arch, target or host.
-$(warning Untested mips64 clang flags, fix me!)
-
CLANG_CONFIG_mips64_EXTRA_ASFLAGS :=
CLANG_CONFIG_mips64_EXTRA_CFLAGS :=
CLANG_CONFIG_mips64_EXTRA_LDFLAGS :=
@@ -9,18 +7,11 @@
# Include common unknown flags
CLANG_CONFIG_mips64_UNKNOWN_CFLAGS := \
$(CLANG_CONFIG_UNKNOWN_CFLAGS) \
- -EL \
- -mips32 \
- -mips32r2 \
- -mhard-float \
+ -mips64r6 \
-fno-strict-volatile-bitfields \
-fgcse-after-reload \
-frerun-cse-after-loop \
-frename-registers \
- -march=mips32r2 \
- -mtune=mips32r2 \
- -march=mips32 \
- -mtune=mips32 \
-msynci \
-mno-fused-madd
diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk
index d11aaa8..df81cd5 100644
--- a/core/combo/TARGET_linux-arm.mk
+++ b/core/combo/TARGET_linux-arm.mk
@@ -95,7 +95,7 @@
android_config_h := $(call select-android-config-h,linux-arm)
$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += \
- -msoft-float -fpic -fPIE \
+ -msoft-float \
-ffunction-sections \
-fdata-sections \
-funwind-tables \
@@ -165,8 +165,6 @@
$($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) -print-libgcc-file-name)
$(combo_2nd_arch_prefix)TARGET_LIBATOMIC := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) \
$($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) -print-file-name=libatomic.a)
-target_libgcov := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
- -print-file-name=libgcov.a)
endif
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
@@ -198,7 +196,7 @@
$(hide) $(PRIVATE_CXX) \
-nostdlib -Wl,-soname,$(notdir $@) \
-Wl,--gc-sections \
- -shared \
+ $(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl,-shared) \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
$(PRIVATE_ALL_OBJECTS) \
@@ -209,7 +207,6 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
@@ -221,7 +218,7 @@
endef
define $(combo_2nd_arch_prefix)transform-o-to-executable-inner
-$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \
+$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -pie \
-Wl,-dynamic-linker,/system/bin/linker \
-Wl,--gc-sections \
-Wl,-z,nocopyreloc \
@@ -236,7 +233,6 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
@@ -263,7 +259,6 @@
-Wl,--start-group \
$(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
$(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(PRIVATE_TARGET_LIBATOMIC) \
$(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
-Wl,--end-group \
diff --git a/core/combo/TARGET_linux-arm64.mk b/core/combo/TARGET_linux-arm64.mk
index f43b1a0..07d3984 100644
--- a/core/combo/TARGET_linux-arm64.mk
+++ b/core/combo/TARGET_linux-arm64.mk
@@ -73,7 +73,6 @@
android_config_h := $(call select-android-config-h,linux-arm64)
TARGET_GLOBAL_CFLAGS += \
- -fpic -fPIE \
-fstack-protector \
-ffunction-sections \
-fdata-sections \
@@ -163,7 +162,7 @@
$(hide) $(PRIVATE_CXX) \
-nostdlib -Wl,-soname,$(notdir $@) \
-Wl,--gc-sections \
- -shared \
+ $(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl,-shared) \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
$(PRIVATE_ALL_OBJECTS) \
@@ -174,7 +173,6 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
@@ -186,7 +184,7 @@
endef
define transform-o-to-executable-inner
-$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \
+$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -pie \
-Wl,-dynamic-linker,/system/bin/linker64 \
-Wl,--gc-sections \
-Wl,-z,nocopyreloc \
@@ -201,7 +199,6 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
@@ -228,7 +225,6 @@
-Wl,--start-group \
$(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
$(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(PRIVATE_TARGET_LIBATOMIC) \
$(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
-Wl,--end-group \
diff --git a/core/combo/TARGET_linux-mips.mk b/core/combo/TARGET_linux-mips.mk
index 96ec210..995e63c 100644
--- a/core/combo/TARGET_linux-mips.mk
+++ b/core/combo/TARGET_linux-mips.mk
@@ -38,7 +38,7 @@
$(combo_2nd_arch_prefix)TARGET_NDK_GCC_VERSION := 4.8
ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
-$(combo_2nd_arch_prefix)TARGET_GCC_VERSION := 4.8
+$(combo_2nd_arch_prefix)TARGET_GCC_VERSION := 4.9
else
$(combo_2nd_arch_prefix)TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
endif
@@ -53,8 +53,8 @@
# You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else
ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)),)
-$(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/mips/mipsel-linux-android-$($(combo_2nd_arch_prefix)TARGET_GCC_VERSION)
-$(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX := $($(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT)/bin/mipsel-linux-android-
+$(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT := prebuilts/gcc/$(HOST_PREBUILT_TAG)/mips/mips64el-linux-android-$($(combo_2nd_arch_prefix)TARGET_GCC_VERSION)
+$(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX := $($(combo_2nd_arch_prefix)TARGET_TOOLCHAIN_ROOT)/bin/mips64el-linux-android-
endif
$(combo_2nd_arch_prefix)TARGET_CC := $($(combo_2nd_arch_prefix)TARGET_TOOLS_PREFIX)gcc$(HOST_EXECUTABLE_SUFFIX)
@@ -84,7 +84,6 @@
$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += \
$(TARGET_mips_CFLAGS) \
-U__unix -U__unix__ -Umips \
- -fpic -fPIE\
-ffunction-sections \
-fdata-sections \
-funwind-tables \
@@ -97,24 +96,6 @@
-include $(android_config_h) \
-I $(dir $(android_config_h))
-# This warning causes dalvik not to build with gcc 4.6+ and -Werror.
-# We cannot turn it off blindly since the option is not available
-# in gcc-4.4.x.
-ifneq ($(filter 4.6 4.6.% 4.7 4.7.% 4.8, $($(combo_2nd_arch_prefix)TARGET_GCC_VERSION)),)
-$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable \
- -fno-strict-volatile-bitfields
-endif
-
-# This is to avoid the dreaded warning compiler message:
-# note: the mangling of 'va_list' has changed in GCC 4.4
-#
-# The fact that the mangling changed does not affect the NDK ABI
-# very fortunately (since none of the exposed APIs used va_list
-# in their exported C++ functions). Also, GCC 4.5 has already
-# removed the warning from the compiler.
-#
-$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -Wno-psabi
-
ifneq ($(ARCH_MIPS_PAGE_SHIFT),)
$(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += -DPAGE_SHIFT=$(ARCH_MIPS_PAGE_SHIFT)
endif
@@ -156,8 +137,6 @@
ifneq ($(LIBGCC_EH),libgcc_eh.a)
$(combo_2nd_arch_prefix)TARGET_LIBGCC += $(LIBGCC_EH)
endif
-target_libgcov := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
- --print-file-name=libgcov.a)
endif
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
@@ -189,7 +168,7 @@
$(hide) $(PRIVATE_CXX) \
-nostdlib -Wl,-soname,$(notdir $@) \
-Wl,--gc-sections \
- -shared \
+ $(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl,-shared) \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
$(PRIVATE_ALL_OBJECTS) \
@@ -200,7 +179,6 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
@@ -212,7 +190,7 @@
endef
define $(combo_2nd_arch_prefix)transform-o-to-executable-inner
-$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \
+$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -pie \
-Wl,-dynamic-linker,/system/bin/linker \
-Wl,--gc-sections \
-Wl,-z,nocopyreloc \
@@ -227,7 +205,6 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
@@ -254,7 +231,6 @@
-Wl,--start-group \
$(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
$(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(PRIVATE_TARGET_LIBATOMIC) \
$(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
-Wl,--end-group \
diff --git a/core/combo/TARGET_linux-mips64.mk b/core/combo/TARGET_linux-mips64.mk
index 6dd3280..938b11c 100644
--- a/core/combo/TARGET_linux-mips64.mk
+++ b/core/combo/TARGET_linux-mips64.mk
@@ -38,7 +38,7 @@
TARGET_NDK_GCC_VERSION := 4.8
ifeq ($(strip $(TARGET_GCC_VERSION_EXP)),)
-TARGET_GCC_VERSION := 4.8
+TARGET_GCC_VERSION := 4.9
else
TARGET_GCC_VERSION := $(TARGET_GCC_VERSION_EXP)
endif
@@ -48,9 +48,6 @@
$(error Unknown MIPS architecture variant: $(TARGET_ARCH_VARIANT))
endif
-# TODO: Enable Clang when its mips64 prebuilt is added
-WITHOUT_TARGET_CLANG := true
-
include $(TARGET_ARCH_SPECIFIC_MAKEFILE)
include $(BUILD_SYSTEM)/combo/fdo.mk
@@ -87,7 +84,6 @@
TARGET_GLOBAL_CFLAGS += \
$(TARGET_mips_CFLAGS) \
-U__unix -U__unix__ -Umips \
- -fpic -fPIE\
-ffunction-sections \
-fdata-sections \
-funwind-tables \
@@ -100,24 +96,6 @@
-include $(android_config_h) \
-I $(dir $(android_config_h))
-# This warning causes dalvik not to build with gcc 4.6+ and -Werror.
-# We cannot turn it off blindly since the option is not available
-# in gcc-4.4.x.
-ifneq ($(filter 4.6 4.6.% 4.7 4.7.% 4.8, $(TARGET_GCC_VERSION)),)
-TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable \
- -fno-strict-volatile-bitfields
-endif
-
-# This is to avoid the dreaded warning compiler message:
-# note: the mangling of 'va_list' has changed in GCC 4.4
-#
-# The fact that the mangling changed does not affect the NDK ABI
-# very fortunately (since none of the exposed APIs used va_list
-# in their exported C++ functions). Also, GCC 4.5 has already
-# removed the warning from the compiler.
-#
-TARGET_GLOBAL_CFLAGS += -Wno-psabi
-
ifneq ($(ARCH_MIPS_PAGE_SHIFT),)
TARGET_GLOBAL_CFLAGS += -DPAGE_SHIFT=$(ARCH_MIPS_PAGE_SHIFT)
endif
@@ -160,8 +138,6 @@
ifneq ($(LIBGCC_EH),libgcc_eh.a)
TARGET_LIBGCC += $(LIBGCC_EH)
endif
-target_libgcov := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
- --print-file-name=libgcov.a)
endif
KERNEL_HEADERS_COMMON := $(libc_root)/kernel/uapi
@@ -196,7 +172,7 @@
$(hide) $(PRIVATE_CXX) \
-nostdlib -Wl,-soname,$(notdir $@) \
-Wl,--gc-sections \
- -shared \
+ $(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl,-shared) \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
$(PRIVATE_ALL_OBJECTS) \
@@ -207,7 +183,6 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
@@ -219,7 +194,7 @@
endef
define transform-o-to-executable-inner
-$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \
+$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -pie \
-Wl,-dynamic-linker,/system/bin/linker64 \
-Wl,--gc-sections \
-Wl,-z,nocopyreloc \
@@ -234,7 +209,6 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
@@ -261,7 +235,6 @@
-Wl,--start-group \
$(call normalize-target-libraries,$(filter %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
$(call normalize-target-libraries,$(filter %libc_nomalloc.a,$(PRIVATE_ALL_STATIC_LIBRARIES))) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(PRIVATE_TARGET_LIBATOMIC) \
$(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
-Wl,--end-group \
diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk
index 18331d5..0bb218f 100644
--- a/core/combo/TARGET_linux-x86.mk
+++ b/core/combo/TARGET_linux-x86.mk
@@ -62,8 +62,6 @@
$(shell $($(combo_2nd_arch_prefix)TARGET_CC) -m32 -print-file-name=libgcc.a)
$(combo_2nd_arch_prefix)TARGET_LIBATOMIC := \
$(shell $($(combo_2nd_arch_prefix)TARGET_CC) -m32 -print-file-name=libatomic.a)
-target_libgcov := $(shell $($(combo_2nd_arch_prefix)TARGET_CC) $($(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS) \
- -print-file-name=libgcov.a)
endif
$(combo_2nd_arch_prefix)TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
@@ -154,7 +152,7 @@
$(hide) $(PRIVATE_CXX) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
-nostdlib -Wl,-soname,$(notdir $@) \
- -shared \
+ $(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl,-shared) \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
$(PRIVATE_ALL_OBJECTS) \
@@ -165,7 +163,6 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_LDFLAGS) \
@@ -180,7 +177,7 @@
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
-nostdlib -Bdynamic \
-Wl,-z,nocopyreloc \
- -fPIE -pie \
+ -pie \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
-Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O)) \
@@ -192,7 +189,6 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_LDFLAGS) \
@@ -216,7 +212,6 @@
-Wl,--no-whole-archive \
-Wl,--start-group \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(PRIVATE_TARGET_LIBATOMIC) \
$(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
-Wl,--end-group \
diff --git a/core/combo/TARGET_linux-x86_64.mk b/core/combo/TARGET_linux-x86_64.mk
index 4482a17..14fa5ed 100644
--- a/core/combo/TARGET_linux-x86_64.mk
+++ b/core/combo/TARGET_linux-x86_64.mk
@@ -62,8 +62,6 @@
$(shell $(TARGET_CC) -m64 -print-file-name=libgcc.a)
TARGET_LIBATOMIC := \
$(shell $(TARGET_CC) -m64 -print-file-name=libatomic.a)
-target_libgcov := $(shell $(TARGET_CC) $(TARGET_GLOBAL_CFLAGS) \
- -print-file-name=libgcov.a)
endif
TARGET_NO_UNDEFINED_LDFLAGS := -Wl,--no-undefined
@@ -158,7 +156,7 @@
$(hide) $(PRIVATE_CXX) \
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
-nostdlib -Wl,-soname,$(notdir $@) \
- -shared \
+ $(if $(filter true,$(PRIVATE_CLANG)),-shared,-Wl,-shared) \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_SO_O)) \
$(PRIVATE_ALL_OBJECTS) \
@@ -169,7 +167,6 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_LDFLAGS) \
@@ -183,7 +180,7 @@
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
-nostdlib -Bdynamic \
-Wl,-z,nocopyreloc \
- -fPIE -pie \
+ -pie \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
-Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \
$(if $(filter true,$(PRIVATE_NO_CRT)),,$(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O)) \
@@ -195,7 +192,6 @@
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
$(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
$(if $(TARGET_BUILD_APPS),$(PRIVATE_TARGET_LIBGCC)) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(call normalize-target-libraries,$(PRIVATE_ALL_SHARED_LIBRARIES)) \
-o $@ \
$(PRIVATE_LDFLAGS) \
@@ -219,7 +215,6 @@
-Wl,--no-whole-archive \
-Wl,--start-group \
$(call normalize-target-libraries,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
- $(PRIVATE_TARGET_FDO_LIB) \
$(PRIVATE_TARGET_LIBATOMIC) \
$(if $(PRIVATE_LIBCXX),,$(PRIVATE_TARGET_LIBGCC)) \
-Wl,--end-group \
diff --git a/core/combo/arch/mips/mips32-fp.mk b/core/combo/arch/mips/mips32-fp.mk
index e60bdac..8320e93 100644
--- a/core/combo/arch/mips/mips32-fp.mk
+++ b/core/combo/arch/mips/mips32-fp.mk
@@ -4,11 +4,9 @@
ARCH_MIPS_HAS_FPU :=true
ARCH_HAVE_ALIGNED_DOUBLES :=true
arch_variant_cflags := \
- -EL \
- -march=mips32 \
- -mtune=mips32 \
-mips32 \
- -mhard-float
+ -mfp32 \
+ -modd-spreg \
arch_variant_ldflags := \
- -EL
+ -Wl,-melf32ltsmip
diff --git a/core/combo/arch/mips/mips32.mk b/core/combo/arch/mips/mips32.mk
deleted file mode 100644
index 35ef0d8..0000000
--- a/core/combo/arch/mips/mips32.mk
+++ /dev/null
@@ -1,12 +0,0 @@
-# Configuration for Android on MIPS.
-# Generating binaries for MIPS32/soft-float/little-endian
-
-arch_variant_cflags := \
- -EL \
- -march=mips32 \
- -mtune=mips32 \
- -mips32 \
- -msoft-float
-
-arch_variant_ldflags := \
- -EL
diff --git a/core/combo/arch/mips/mips32r2-fp-xburst.mk b/core/combo/arch/mips/mips32r2-fp-xburst.mk
index 8b0fef1..2b4f714 100644
--- a/core/combo/arch/mips/mips32r2-fp-xburst.mk
+++ b/core/combo/arch/mips/mips32r2-fp-xburst.mk
@@ -5,13 +5,11 @@
ARCH_MIPS_HAS_FPU :=true
ARCH_HAVE_ALIGNED_DOUBLES :=true
arch_variant_cflags := \
- -EL \
- -march=mips32r2 \
- -mtune=mips32r2 \
-mips32r2 \
- -mhard-float \
+ -mfp32 \
+ -modd-spreg \
-mno-fused-madd \
-Wa,-mmxu
arch_variant_ldflags := \
- -EL
+ -Wl,-melf32ltsmip
diff --git a/core/combo/arch/mips/mips32r2-fp.mk b/core/combo/arch/mips/mips32r2-fp.mk
index 08d91df..9acb018 100644
--- a/core/combo/arch/mips/mips32r2-fp.mk
+++ b/core/combo/arch/mips/mips32r2-fp.mk
@@ -4,12 +4,10 @@
ARCH_MIPS_HAS_FPU :=true
ARCH_HAVE_ALIGNED_DOUBLES :=true
arch_variant_cflags := \
- -EL \
- -march=mips32r2 \
- -mtune=mips32r2 \
-mips32r2 \
- -mhard-float \
+ -mfp32 \
+ -modd-spreg \
-msynci
arch_variant_ldflags := \
- -EL
+ -Wl,-melf32ltsmip
diff --git a/core/combo/arch/mips/mips32r2.mk b/core/combo/arch/mips/mips32r2.mk
deleted file mode 100644
index 16ce76f..0000000
--- a/core/combo/arch/mips/mips32r2.mk
+++ /dev/null
@@ -1,13 +0,0 @@
-# Configuration for Android on MIPS.
-# Generating binaries for MIPS32R2/soft-float/little-endian
-
-arch_variant_cflags := \
- -EL \
- -march=mips32r2 \
- -mtune=mips32r2 \
- -mips32r2 \
- -msoft-float \
- -msynci
-
-arch_variant_ldflags := \
- -EL
diff --git a/core/combo/arch/mips/mips32r2dsp-fp.mk b/core/combo/arch/mips/mips32r2dsp-fp.mk
index fe2b1fe..c4b49b6 100644
--- a/core/combo/arch/mips/mips32r2dsp-fp.mk
+++ b/core/combo/arch/mips/mips32r2dsp-fp.mk
@@ -6,13 +6,11 @@
ARCH_MIPS_HAS_FPU :=true
ARCH_HAVE_ALIGNED_DOUBLES :=true
arch_variant_cflags := \
- -EL \
- -march=mips32r2 \
- -mtune=mips32r2 \
-mips32r2 \
- -mhard-float \
+ -mfp32 \
+ -modd-spreg \
-mdsp \
-msynci
arch_variant_ldflags := \
- -EL
+ -Wl,-melf32ltsmip
diff --git a/core/combo/arch/mips/mips32r2dsp.mk b/core/combo/arch/mips/mips32r2dsp.mk
deleted file mode 100644
index 8a8976c..0000000
--- a/core/combo/arch/mips/mips32r2dsp.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-# Configuration for Android on MIPS.
-# Generating binaries for MIPS32R2/soft-float/little-endian/dsp
-
-ARCH_MIPS_HAS_DSP :=true
-ARCH_MIPS_DSP_REV :=1
-
-arch_variant_cflags := \
- -EL \
- -march=mips32r2 \
- -mtune=mips32r2 \
- -mips32r2 \
- -msoft-float \
- -mdsp \
- -msynci
-
-arch_variant_ldflags := \
- -EL
diff --git a/core/combo/arch/mips/mips32r2dspr2-fp.mk b/core/combo/arch/mips/mips32r2dspr2-fp.mk
index 7e882b3..8b05ffc 100644
--- a/core/combo/arch/mips/mips32r2dspr2-fp.mk
+++ b/core/combo/arch/mips/mips32r2dspr2-fp.mk
@@ -6,13 +6,11 @@
ARCH_MIPS_HAS_FPU :=true
ARCH_HAVE_ALIGNED_DOUBLES :=true
arch_variant_cflags := \
- -EL \
- -march=mips32r2 \
- -mtune=mips32r2 \
-mips32r2 \
- -mhard-float \
+ -mfp32 \
+ -modd-spreg \
-mdspr2 \
-msynci
arch_variant_ldflags := \
- -EL
+ -Wl,-melf32ltsmip
diff --git a/core/combo/arch/mips/mips32r2dspr2.mk b/core/combo/arch/mips/mips32r2dspr2.mk
deleted file mode 100644
index c311523..0000000
--- a/core/combo/arch/mips/mips32r2dspr2.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-# Configuration for Android on MIPS.
-# Generating binaries for MIPS32R2/soft-float/little-endian/dsp
-
-ARCH_MIPS_HAS_DSP :=true
-ARCH_MIPS_DSP_REV :=2
-
-arch_variant_cflags := \
- -EL \
- -march=mips32r2 \
- -mtune=mips32r2 \
- -mips32r2 \
- -msoft-float \
- -mdspr2 \
- -msynci
-
-arch_variant_ldflags := \
- -EL
diff --git a/core/combo/arch/mips/mips32r6.mk b/core/combo/arch/mips/mips32r6.mk
new file mode 100644
index 0000000..315aa60
--- /dev/null
+++ b/core/combo/arch/mips/mips32r6.mk
@@ -0,0 +1,12 @@
+# Configuration for Android on MIPS.
+# Generating binaries for MIPS32R6/hard-float/little-endian
+
+ARCH_MIPS_REV6 := true
+arch_variant_cflags := \
+ -mips32r6 \
+ -mfp64 \
+ -mno-odd-spreg \
+ -msynci
+
+arch_variant_ldflags := \
+ -Wl,-melf32ltsmip
diff --git a/core/combo/arch/mips64/mips64r2.mk b/core/combo/arch/mips64/mips64r2.mk
index 298aeaf..c5710d0 100644
--- a/core/combo/arch/mips64/mips64r2.mk
+++ b/core/combo/arch/mips64/mips64r2.mk
@@ -1,14 +1,10 @@
# Configuration for Android on mips64r2.
+# This target is for temporary use only, until mips64r6 is supported by Android's qemu.
+
ARCH_MIPS_HAS_FPU :=true
ARCH_HAVE_ALIGNED_DOUBLES :=true
arch_variant_cflags := \
- -EL \
- -march=mips64r2 \
- -mtune=mips64r2 \
-mips64r2 \
- -mhard-float \
-msynci
-arch_variant_ldflags := \
- -EL
diff --git a/core/combo/arch/mips64/mips64r6.mk b/core/combo/arch/mips64/mips64r6.mk
new file mode 100644
index 0000000..443de20
--- /dev/null
+++ b/core/combo/arch/mips64/mips64r6.mk
@@ -0,0 +1,7 @@
+# Configuration for Android on mips64r6.
+
+ARCH_MIPS_REV6 := true
+arch_variant_cflags := \
+ -mips64r6 \
+ -msynci
+
diff --git a/core/combo/fdo.mk b/core/combo/fdo.mk
index 26e842f..68959c3 100644
--- a/core/combo/fdo.mk
+++ b/core/combo/fdo.mk
@@ -17,23 +17,20 @@
# Setup FDO related flags.
$(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS:=
-$(combo_2nd_arch_prefix)TARGET_FDO_LIB:=
-ifneq ($(strip $(BUILD_FDO_INSTRUMENT)),)
+ifeq ($(strip $(BUILD_FDO_INSTRUMENT)), true)
# Set BUILD_FDO_INSTRUMENT=true to turn on FDO instrumentation.
- # The profile will be generated on /data/local/tmp/profile on the device.
- $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-generate=/data/local/tmp/fdo_profile -DANDROID_FDO
- $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov)
+ # The profile will be generated on /sdcard/fdo_profile on the device.
+ $(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-generate=/sdcard/fdo_profile -DANDROID_FDO
else
- ifneq ($(strip $(BUILD_FDO_OPTIMIZE)),)
+ ifeq ($(strip $(BUILD_FDO_OPTIMIZE)), true)
# Set TARGET_FDO_PROFILE_PATH to set a custom profile directory for your build.
ifeq ($(strip $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH)),)
- $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH := fdo_profiles
+ $(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH := vendor/google_data/fdo_profile
endif
ifneq ($(strip $(wildcard $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH))),)
$(combo_2nd_arch_prefix)TARGET_FDO_CFLAGS := -fprofile-use=$($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH) -DANDROID_FDO -fprofile-correction -Wcoverage-mismatch -Wno-error
- $(combo_2nd_arch_prefix)TARGET_FDO_LIB := $(target_libgcov)
else
$(warning Profile directory $($(combo_2nd_arch_prefix)TARGET_FDO_PROFILE_PATH) does not exist. Turn off FDO.)
endif
diff --git a/core/combo/select.mk b/core/combo/select.mk
index e18cb1b..d495c6f 100644
--- a/core/combo/select.mk
+++ b/core/combo/select.mk
@@ -82,6 +82,10 @@
# on a workstation.
export CCACHE_BASEDIR := /
+ # Workaround for ccache with clang.
+ # See http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
+ export CCACHE_CPP2 := true
+
CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
# If we are cross-compiling Windows binaries on Linux
# then use the linux ccache binary instead.
diff --git a/core/definitions.mk b/core/definitions.mk
index 6656591..13959aa 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -884,7 +884,7 @@
-Wl,-rpath,\$$ORIGIN/../lib \
$(dir $@)/$(notdir $(<:.bc=.o)) \
$(RS_PREBUILT_COMPILER_RT) \
- -o $@ -L prebuilts/gcc/ \
+ -o $@ $(TARGET_GLOBAL_LDFLAGS) -L prebuilts/gcc/ \
-L $(TARGET_OUT_INTERMEDIATE_LIBRARIES) $(RS_PREBUILT_LIBPATH) \
-lRSSupport -lm -lc
endef
@@ -1309,7 +1309,7 @@
$(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
-Wl,-rpath-link=$(PRIVATE_TARGET_OUT_INTERMEDIATE_LIBRARIES) \
-Wl,-rpath,\$$ORIGIN/../lib \
- -shared -Wl,-soname,$(notdir $@) \
+ -Wl,-shared -Wl,-soname,$(notdir $@) \
$(PRIVATE_LDFLAGS) \
$(PRIVATE_TARGET_GLOBAL_LD_DIRS) \
$(PRIVATE_ALL_OBJECTS) \
@@ -1413,7 +1413,7 @@
ifdef BUILD_HOST_static
HOST_FPIE_FLAGS :=
else
-HOST_FPIE_FLAGS := -fPIE -pie
+HOST_FPIE_FLAGS := -pie
endif
ifneq ($(HOST_CUSTOM_LD_COMMAND),true)
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 2d9c518..11b7406 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -90,5 +90,6 @@
--oat-file=$(2) \
--android-root=$(PRODUCT_OUT)/system \
--instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
- --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES)
+ --instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
+ --include-patch-information --runtime-arg -Xnorelocate
endef
diff --git a/core/dex_preopt_libart_boot.mk b/core/dex_preopt_libart_boot.mk
index 7eefc0b..5390a36 100644
--- a/core/dex_preopt_libart_boot.mk
+++ b/core/dex_preopt_libart_boot.mk
@@ -53,4 +53,4 @@
--image=$@ --base=$(LIBART_IMG_TARGET_BASE_ADDRESS) \
--instruction-set=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_ARCH) \
--instruction-set-features=$($(PRIVATE_2ND_ARCH_VAR_PREFIX)DEX2OAT_TARGET_INSTRUCTION_SET_FEATURES) \
- --android-root=$(PRODUCT_OUT)/system
+ --android-root=$(PRODUCT_OUT)/system --include-patch-information --runtime-arg -Xnorelocate
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index 613b058..10b41bd 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -32,6 +32,12 @@
ifneq (,$(filter $(LOCAL_MODULE),$(PRODUCT_DEX_PREOPT_PACKAGES_IN_DATA)))
LOCAL_DEX_PREOPT :=
endif
+# if WITH_DEXPREOPT_BOOT_IMG_ONLY=true and module is not in boot class path skip
+ifeq (true,$(WITH_DEXPREOPT_BOOT_IMG_ONLY))
+ifeq ($(filter $(DEXPREOPT_BOOT_JARS_MODULES),$(LOCAL_MODULE)),)
+LOCAL_DEX_PREOPT :=
+endif
+endif
built_odex :=
installed_odex :=
diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk
index 396199c..3d6ad4a 100644
--- a/core/dynamic_binary.mk
+++ b/core/dynamic_binary.mk
@@ -110,6 +110,15 @@
$(strip_output): PRIVATE_READELF := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_READELF)
$(strip_output): $(strip_input) | $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP)
$(transform-to-stripped-keep-symbols)
+
+# A product may be configured to strip everything in some build variants.
+# We do the stripping as a post-install command so that LOCAL_BUILT_MODULE
+# is still with the symbols and we don't need to clean it (and relink) when
+# you switch build variant.
+ifneq ($(filter $(STRIP_EVERYTHING_BUILD_VARIANTS),$(TARGET_BUILD_VARIANT)),)
+$(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := \
+ $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_STRIP) --strip-all $(LOCAL_INSTALLED_MODULE)
+endif
else
# Don't strip the binary, just copy it. We can't skip this step
# because a copy of the binary must appear at LOCAL_BUILT_MODULE.
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 96044b3..124a91b 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -260,7 +260,11 @@
# The default host library path.
# It always points to the path where we build libraries in the default bitness.
-HOST_LIBRARY_PATH := $(HOST_OUT)/lib
+ifeq ($(HOST_PREFER_32_BIT),true)
+HOST_LIBRARY_PATH := $($(HOST_2ND_ARCH_VAR_PREFIX)HOST_OUT_SHARED_LIBRARIES)
+else
+HOST_LIBRARY_PATH := $(HOST_OUT_SHARED_LIBRARIES)
+endif
TARGET_OUT_INTERMEDIATES := $(PRODUCT_OUT)/obj
TARGET_OUT_HEADERS := $(TARGET_OUT_INTERMEDIATES)/include
diff --git a/core/executable_internal.mk b/core/executable_internal.mk
index 2e380b6..ab4cf0e 100644
--- a/core/executable_internal.mk
+++ b/core/executable_internal.mk
@@ -28,7 +28,6 @@
# Define PRIVATE_ variables from global vars
my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS)
-my_target_fdo_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_LIB)
my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC)
my_target_libatomic := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBATOMIC)
my_target_crtbegin_dynamic_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_DYNAMIC_O)
@@ -48,7 +47,6 @@
endif
$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
-$(linked_module): PRIVATE_TARGET_FDO_LIB := $(my_target_fdo_lib)
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O := $(my_target_crtbegin_dynamic_o)
diff --git a/core/main.mk b/core/main.mk
index cdf3200..f33574b 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -374,9 +374,9 @@
ro.setupwizard.mode=OPTIONAL
endif
# Don't even verify the image on eng builds to speed startup
-ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.image-dex2oat-flags=--compiler-filter=verify-none
+ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.image-dex2oat-filter=verify-none
# Don't compile apps on eng builds to speed startup
-ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.dex2oat-flags=--compiler-filter=interpret-only
+ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.dex2oat-filter=interpret-only
endif
## sdk ##
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 3f8bdfe..0d6f9ea 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -370,8 +370,12 @@
$(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
else
$(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_CONFIG := $(PRODUCT_AAPT_CONFIG)
+ifdef LOCAL_PACKAGE_SPLITS
+ $(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG :=
+else
$(LOCAL_BUILT_MODULE): PRIVATE_PRODUCT_AAPT_PREF_CONFIG := $(PRODUCT_AAPT_PREF_CONFIG)
endif
+endif
$(LOCAL_BUILT_MODULE): $(all_res_assets) $(jni_shared_libraries) $(full_android_manifest)
@echo "target Package: $(PRIVATE_MODULE) ($@)"
$(create-empty-package)
diff --git a/core/pathmap.mk b/core/pathmap.mk
index 30b1ab7..0e10ac1 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -121,8 +121,8 @@
# A list of all source roots under frameworks/multidex.
#
FRAMEWORKS_MULTIDEX_SUBDIRS := \
- multidex \
- multidex/instrumentation
+ multidex/library/src \
+ multidex/instrumentation/src
#
# A version of FRAMEWORKS_SUPPORT_SUBDIRS that is expanded to full paths from
@@ -130,12 +130,13 @@
#
FRAMEWORKS_SUPPORT_JAVA_SRC_DIRS := \
$(addprefix frameworks/support/,$(FRAMEWORKS_SUPPORT_SUBDIRS)) \
- $(addsuffix /src,$(addprefix frameworks/,$(FRAMEWORKS_MULTIDEX_SUBDIRS)))
+ $(addprefix frameworks/,$(FRAMEWORKS_MULTIDEX_SUBDIRS))
#
# A list of support library modules.
#
FRAMEWORKS_SUPPORT_JAVA_LIBRARIES := \
$(foreach dir,$(FRAMEWORKS_SUPPORT_SUBDIRS),android-support-$(subst /,-,$(dir))) \
- $(foreach dir,$(FRAMEWORKS_MULTIDEX_SUBDIRS),android-support-$(subst /,-,$(dir)))
+ android-support-multidex \
+ android-support-multidex-instrumentation
diff --git a/core/product.mk b/core/product.mk
index 89d5982..c9e22eb 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -262,7 +262,8 @@
_product_stash_var_list += \
DEFAULT_SYSTEM_DEV_CERTIFICATE \
- WITH_DEXPREOPT
+ WITH_DEXPREOPT \
+ WITH_DEXPREOPT_BOOT_IMG_ONLY
#
# Stash values of the variables in _product_stash_var_list.
diff --git a/core/sdk_font.mk b/core/sdk_font.mk
new file mode 100644
index 0000000..aa6b94d
--- /dev/null
+++ b/core/sdk_font.mk
@@ -0,0 +1,61 @@
+###############################################################################
+# Fonts shipped with the SDK need to be renamed for Java to handle them
+# properly. Hence, a special script is used to rename the fonts. We bundle all
+# the fonts that are shipped on a newer non-space-constrained device. However,
+# OpenType fonts used on these devices are not supported by Java. Their
+# replacements are added separately.
+###############################################################################
+
+
+# The script that renames the font.
+sdk_font_rename_script := frameworks/base/tools/layoutlib/rename_font/build_font_single.py
+
+# Location of the fonttools library that the above script depends on.
+fonttools_lib := external/fonttools/Lib
+
+# A temporary location to store the renamed fonts. atree picks all files in
+# this directory and bundles it with the SDK.
+SDK_FONT_TEMP := $(call intermediates-dir-for,PACKAGING,sdk-fonts,HOST,COMMON)
+
+# The font configuration files - system_fonts.xml, fallback_fonts.xml etc.
+sdk_font_config := $(wildcard frameworks/base/data/fonts/*.xml)
+sdk_font_config := $(addprefix $(SDK_FONT_TEMP)/, $(notdir $(sdk_font_config)))
+
+$(sdk_font_config): $(SDK_FONT_TEMP)/%.xml: \
+ frameworks/base/data/fonts/%.xml
+ $(hide) mkdir -p $(dir $@)
+ $(hide) cp -vf $< $@
+
+# List of fonts on the device that we want to ship. This is all .ttf fonts.
+sdk_fonts_device := $(filter $(TARGET_OUT)/fonts/%.ttf, $(INTERNAL_SYSTEMIMAGE_FILES))
+sdk_fonts_device := $(addprefix $(SDK_FONT_TEMP)/, $(notdir $(sdk_fonts_device)))
+
+# Macro to rename the font.
+sdk_rename_font = PYTHONPATH=$$PYTHONPATH:$(fonttools_lib) $(sdk_font_rename_script) \
+ $1 $2
+
+# TODO: If the font file is a symlink, reuse the font renamed from the symlink
+# target.
+$(sdk_fonts_device): $(SDK_FONT_TEMP)/%.ttf: $(TARGET_OUT)/fonts/%.ttf \
+ $(sdk_font_rename_script)
+ $(hide) mkdir -p $(dir $@)
+ $(hide) $(call sdk_rename_font,$<,$@)
+
+# Extra fonts that are not part of the device build. These are used as a
+# replacement for the OpenType fonts.
+sdk_fonts_extra := NanumGothic.ttf DroidSansFallback.ttf
+sdk_fonts_extra := $(addprefix $(SDK_FONT_TEMP)/, $(sdk_fonts_extra))
+
+$(SDK_FONT_TEMP)/NanumGothic.ttf: external/naver-fonts/NanumGothic.ttf \
+ $(sdk_font_rename_script)
+ $(hide) mkdir -p $(dir $@)
+ $(hide) $(call sdk_rename_font,$<,$@)
+
+$(SDK_FONT_TEMP)/DroidSansFallback.ttf: frameworks/base/data/fonts/DroidSansFallbackFull.ttf \
+ $(sdk_font_rename_script)
+ $(hide) mkdir -p $(dir $@)
+ $(hide) $(call sdk_rename_font,$<,$@)
+
+# List of all dependencies - all fonts and configuration files.
+SDK_FONT_DEPS := $(sdk_fonts_device) $(sdk_fonts_extra) $(sdk_font_config)
+
diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk
index abef11f..c01be37 100644
--- a/core/shared_library_internal.mk
+++ b/core/shared_library_internal.mk
@@ -40,7 +40,6 @@
# Define PRIVATE_ variables from global vars
my_target_global_ld_dirs := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_LD_DIRS)
-my_target_fdo_lib := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_FDO_LIB)
my_target_libgcc := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBGCC)
my_target_libatomic := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_LIBATOMIC)
my_target_crtbegin_so_o := $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_CRTBEGIN_SO_O)
@@ -58,7 +57,6 @@
endif
$(linked_module): PRIVATE_TARGET_GLOBAL_LD_DIRS := $(my_target_global_ld_dirs)
$(linked_module): PRIVATE_TARGET_GLOBAL_LDFLAGS := $(my_target_global_ldflags)
-$(linked_module): PRIVATE_TARGET_FDO_LIB := $(my_target_fdo_lib)
$(linked_module): PRIVATE_TARGET_LIBGCC := $(my_target_libgcc)
$(linked_module): PRIVATE_TARGET_LIBATOMIC := $(my_target_libatomic)
$(linked_module): PRIVATE_TARGET_CRTBEGIN_SO_O := $(my_target_crtbegin_so_o)
diff --git a/core/tasks/vendor_module_check.mk b/core/tasks/vendor_module_check.mk
index 793dd16..d8e8ec7 100644
--- a/core/tasks/vendor_module_check.mk
+++ b/core/tasks/vendor_module_check.mk
@@ -18,6 +18,7 @@
_vendor_owner_whitelist := \
asus \
audience \
+ atmel \
broadcom \
csr \
elan \
@@ -28,6 +29,7 @@
intel \
lge \
moto \
+ mtk \
nvidia \
nxp \
nxpsw \
@@ -35,6 +37,7 @@
qti \
samsung \
samsung_arm \
+ sony \
synaptics \
ti \
trusted_logic \
diff --git a/envsetup.sh b/envsetup.sh
index da7b6b3..42ac007 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -138,9 +138,7 @@
arm64) toolchaindir=aarch64/aarch64-linux-android-$targetgccversion/bin;
toolchaindir2=arm/arm-linux-androideabi-$targetgccversion2/bin
;;
- mips) toolchaindir=mips/mipsel-linux-android-$targetgccversion/bin
- ;;
- mips64) toolchaindir=mips/mips64el-linux-android-$targetgccversion/bin
+ mips|mips64) toolchaindir=mips/mips64el-linux-android-$targetgccversion/bin
;;
*)
echo "Can't find toolchain for unknown architecture: $ARCH"
@@ -1003,8 +1001,7 @@
case "$ARCH" in
arm) GDB=arm-linux-androideabi-gdb;;
arm64) GDB=arm-linux-androideabi-gdb; GDB64=aarch64-linux-android-gdb;;
- mips) GDB=mipsel-linux-android-gdb;;
- mips64) GDB=mipsel-linux-android-gdb;;
+ mips|mips64) GDB=mips64el-linux-android-gdb;;
x86) GDB=x86_64-linux-android-gdb;;
x86_64) GDB=x86_64-linux-android-gdb;;
*) echo "Unknown arch $ARCH"; return 1;;
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index 62303d6..3ae5860 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -87,3 +87,8 @@
shell.te \
surfaceflinger.te \
system_server.te
+
+ifeq ($(TARGET_PRODUCT),sdk)
+ # include an expanded selection of fonts for the SDK.
+ EXTENDED_FONT_FOOTPRINT := true
+endif
diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index 1493bd9..f335aef 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -22,8 +22,8 @@
TARGET_CPU_ABI := arm64-v8a
TARGET_2ND_ARCH := arm
-TARGET_2ND_ARCH_VARIANT := armv7-a-neon
-TARGET_2ND_CPU_VARIANT := cortex-a15
+TARGET_2ND_ARCH_VARIANT := armv7-a
+TARGET_2ND_CPU_VARIANT := generic
TARGET_2ND_CPU_ABI := armeabi-v7a
TARGET_2ND_CPU_ABI2 := armeabi
diff --git a/target/board/generic_mips/Android.mk b/target/board/generic_mips/Android.mk
deleted file mode 100644
index abf8d57..0000000
--- a/target/board/generic_mips/Android.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Copyright (C) 2011 The Android Open Source 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.
-#
-
-LOCAL_PATH := $(call my-dir)
diff --git a/target/board/generic_mips64/BoardConfig.mk b/target/board/generic_mips64/BoardConfig.mk
index 7452978..5dc943a 100644
--- a/target/board/generic_mips64/BoardConfig.mk
+++ b/target/board/generic_mips64/BoardConfig.mk
@@ -30,9 +30,13 @@
TARGET_2ND_ARCH := mips
ifeq (,$(TARGET_2ND_ARCH_VARIANT))
+ifeq ($(TARGET_ARCH_VARIANT),mips64r6)
+TARGET_2ND_ARCH_VARIANT := mips32r6
+else
TARGET_2ND_ARCH_VARIANT := mips32r2-fp
endif
-TARGET_CPU_ABI := mips
+endif
+TARGET_2ND_CPU_ABI := mips
# The emulator (qemu) uses the Goldfish devices
HAVE_HTC_AUDIO_DRIVER := true
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index 0c453dd..880a0fd 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -36,6 +36,8 @@
com.android.location.provider.xml \
com.android.media.remotedisplay \
com.android.media.remotedisplay.xml \
+ com.android.mediadrm.signer \
+ com.android.mediadrm.signer.xml \
drmserver \
ethernet-service \
framework-res \
@@ -92,7 +94,6 @@
services \
apache-xml \
ethernet-service \
- webviewchromium \
wifi-service
PRODUCT_RUNTIMES := runtime_libart_default
diff --git a/target/product/runtime_libart.mk b/target/product/runtime_libart.mk
index 6cb8818..8f5f24d 100644
--- a/target/product/runtime_libart.mk
+++ b/target/product/runtime_libart.mk
@@ -20,7 +20,8 @@
core-libart \
libart \
dex2oat \
- oatdump
+ oatdump \
+ patchoat
PRODUCT_DEFAULT_PROPERTY_OVERRIDES += \
dalvik.vm.image-dex2oat-Xms=64m \
diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh
index 2767496..593e5b5 100755
--- a/tools/buildinfo.sh
+++ b/tools/buildinfo.sh
@@ -26,16 +26,9 @@
# instead (see below).
echo "# ro.product.cpu.abi and ro.product.cpu.abi2 are obsolete,"
echo "# use ro.product.cpu.abilist instead."
-if [ "$TARGET_2ND_CPU_ABI" = "armeabi-v7a" ] ; then
- echo "ro.product.cpu.abi=$TARGET_2ND_CPU_ABI"
- if [ -n "$TARGET_2ND_CPU_ABI2" ] ; then
- echo "ro.product.cpu.abi2=$TARGET_2ND_CPU_ABI2"
- fi
-else
- echo "ro.product.cpu.abi=$TARGET_CPU_ABI"
- if [ -n "$TARGET_CPU_ABI2" ] ; then
- echo "ro.product.cpu.abi2=$TARGET_CPU_ABI2"
- fi
+echo "ro.product.cpu.abi=$TARGET_CPU_ABI"
+if [ -n "$TARGET_CPU_ABI2" ] ; then
+ echo "ro.product.cpu.abi2=$TARGET_CPU_ABI2"
fi
echo "ro.product.cpu.abilist=$TARGET_CPU_ABI_LIST"
echo "ro.product.cpu.abilist32=$TARGET_CPU_ABI_LIST_32_BIT"
diff --git a/tools/post_process_props.py b/tools/post_process_props.py
index e43ca59..030826d 100755
--- a/tools/post_process_props.py
+++ b/tools/post_process_props.py
@@ -19,9 +19,10 @@
# Usage: post_process_props.py file.prop [blacklist_key, ...]
# Blacklisted keys are removed from the property file, if present
-# See PROP_VALUE_MAX system_properties.h.
-# PROP_VALUE_MAX in system_properties.h includes the termination NUL,
-# so we decrease it by 1 here.
+# See PROP_NAME_MAX and PROP_VALUE_MAX system_properties.h.
+# The constants in system_properties.h includes the termination NUL,
+# so we decrease the values by 1 here.
+PROP_NAME_MAX = 31
PROP_VALUE_MAX = 91
# Put the modifications that you need to make into the /system/build.prop into this
@@ -59,6 +60,11 @@
"").startswith("eng")
for key, value in buildprops.iteritems():
# Check build properties' length.
+ if len(key) > PROP_NAME_MAX:
+ check_pass = False
+ sys.stderr.write("error: %s cannot exceed %d bytes: " %
+ (key, PROP_NAME_MAX))
+ sys.stderr.write("%s (%d)\n" % (key, len(key)))
if len(value) > PROP_VALUE_MAX:
# If dev build, show a warning message, otherwise fail the
# build with error message
diff --git a/tools/releasetools/add_img_to_target_files b/tools/releasetools/add_img_to_target_files
new file mode 120000
index 0000000..04323bd
--- /dev/null
+++ b/tools/releasetools/add_img_to_target_files
@@ -0,0 +1 @@
+add_img_to_target_files.py
\ No newline at end of file
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
new file mode 100755
index 0000000..568a3f1
--- /dev/null
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -0,0 +1,300 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2014 The Android Open Source 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.
+
+"""
+Given a target-files zipfile that does not contain images (ie, does
+not have an IMAGES/ top-level subdirectory), produce the images and
+add them to the zipfile.
+
+Usage: add_img_to_target_files target_files
+"""
+
+import sys
+
+if sys.hexversion < 0x02070000:
+ print >> sys.stderr, "Python 2.7 or newer is required."
+ sys.exit(1)
+
+import errno
+import os
+import re
+import shutil
+import subprocess
+import tempfile
+import zipfile
+
+# missing in Python 2.4 and before
+if not hasattr(os, "SEEK_SET"):
+ os.SEEK_SET = 0
+
+import build_image
+import common
+
+OPTIONS = common.OPTIONS
+
+
+def AddSystem(output_zip, sparse=True, prefix="IMAGES/"):
+ """Turn the contents of SYSTEM into a system image and store it in
+ output_zip."""
+ block_list = tempfile.NamedTemporaryFile()
+ data = BuildSystem(OPTIONS.input_tmp, OPTIONS.info_dict, sparse=sparse,
+ block_list=block_list.name)
+ common.ZipWriteStr(output_zip, prefix + "system.img", data)
+ with open(block_list.name, "rb") as f:
+ block_list_data = f.read()
+ common.ZipWriteStr(output_zip, prefix + "system.map", block_list_data)
+ block_list.close()
+
+def BuildSystem(input_dir, info_dict, sparse=True, map_file=None,
+ block_list=None):
+ return CreateImage(input_dir, info_dict, "system",
+ sparse=sparse, map_file=map_file, block_list=block_list)
+
+def AddVendor(output_zip, sparse=True, prefix="IMAGES/"):
+ block_list = tempfile.NamedTemporaryFile()
+ data = BuildVendor(OPTIONS.input_tmp, OPTIONS.info_dict, sparse=sparse,
+ block_list=block_list.name)
+ common.ZipWriteStr(output_zip, prefix + "vendor.img", data)
+ with open(block_list.name, "rb") as f:
+ block_list_data = f.read()
+ common.ZipWriteStr(output_zip, prefix + "vendor.map", block_list_data)
+ block_list.close()
+
+def BuildVendor(input_dir, info_dict, sparse=True, map_file=None,
+ block_list=None):
+ return CreateImage(input_dir, info_dict, "vendor",
+ sparse=sparse, map_file=map_file, block_list=block_list)
+
+
+def CreateImage(input_dir, info_dict, what, sparse=True, map_file=None,
+ block_list=None):
+ print "creating " + what + ".img..."
+
+ img = tempfile.NamedTemporaryFile()
+
+ # The name of the directory it is making an image out of matters to
+ # mkyaffs2image. It wants "system" but we have a directory named
+ # "SYSTEM", so create a symlink.
+ try:
+ os.symlink(os.path.join(input_dir, what.upper()),
+ os.path.join(input_dir, what))
+ except OSError, e:
+ # bogus error on my mac version?
+ # File "./build/tools/releasetools/img_from_target_files", line 86, in AddSystem
+ # os.path.join(OPTIONS.input_tmp, "system"))
+ # OSError: [Errno 17] File exists
+ if (e.errno == errno.EEXIST):
+ pass
+
+ image_props = build_image.ImagePropFromGlobalDict(info_dict, what)
+ fstab = info_dict["fstab"]
+ if fstab:
+ image_props["fs_type" ] = fstab["/" + what].fs_type
+
+ if what == "system":
+ fs_config_prefix = ""
+ else:
+ fs_config_prefix = what + "_"
+
+ fs_config = os.path.join(
+ input_dir, "META/" + fs_config_prefix + "filesystem_config.txt")
+ if not os.path.exists(fs_config): fs_config = None
+
+ fc_config = os.path.join(input_dir, "BOOT/RAMDISK/file_contexts")
+ if not os.path.exists(fc_config): fc_config = None
+
+ succ = build_image.BuildImage(os.path.join(input_dir, what),
+ image_props, img.name,
+ fs_config=fs_config,
+ fc_config=fc_config,
+ block_list=block_list)
+ assert succ, "build " + what + ".img image failed"
+
+ mapdata = None
+
+ if sparse:
+ data = open(img.name).read()
+ img.close()
+ else:
+ success, name = build_image.UnsparseImage(img.name, replace=False)
+ if not success:
+ assert False, "unsparsing " + what + ".img failed"
+
+ if map_file:
+ mmap = tempfile.NamedTemporaryFile()
+ mimg = tempfile.NamedTemporaryFile(delete=False)
+ success = build_image.MappedUnsparseImage(
+ img.name, name, mmap.name, mimg.name)
+ if not success:
+ assert False, "creating sparse map failed"
+ os.unlink(name)
+ name = mimg.name
+
+ with open(mmap.name) as f:
+ mapdata = f.read()
+
+ try:
+ with open(name) as f:
+ data = f.read()
+ finally:
+ os.unlink(name)
+
+ if mapdata is None:
+ return data
+ else:
+ return mapdata, data
+
+
+def AddUserdata(output_zip, prefix="IMAGES/"):
+ """Create an empty userdata image and store it in output_zip."""
+
+ image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict,
+ "data")
+ # We only allow yaffs to have a 0/missing partition_size.
+ # Extfs, f2fs must have a size. Skip userdata.img if no size.
+ if (not image_props.get("fs_type", "").startswith("yaffs") and
+ not image_props.get("partition_size")):
+ return
+
+ print "creating userdata.img..."
+
+ # The name of the directory it is making an image out of matters to
+ # mkyaffs2image. So we create a temp dir, and within it we create an
+ # empty dir named "data", and build the image from that.
+ temp_dir = tempfile.mkdtemp()
+ user_dir = os.path.join(temp_dir, "data")
+ os.mkdir(user_dir)
+ img = tempfile.NamedTemporaryFile()
+
+ fstab = OPTIONS.info_dict["fstab"]
+ if fstab:
+ image_props["fs_type" ] = fstab["/data"].fs_type
+ succ = build_image.BuildImage(user_dir, image_props, img.name)
+ assert succ, "build userdata.img image failed"
+
+ common.CheckSize(img.name, "userdata.img", OPTIONS.info_dict)
+ output_zip.write(img.name, prefix + "userdata.img")
+ img.close()
+ os.rmdir(user_dir)
+ os.rmdir(temp_dir)
+
+
+def AddCache(output_zip, prefix="IMAGES/"):
+ """Create an empty cache image and store it in output_zip."""
+
+ image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict,
+ "cache")
+ # The build system has to explicitly request for cache.img.
+ if "fs_type" not in image_props:
+ return
+
+ print "creating cache.img..."
+
+ # The name of the directory it is making an image out of matters to
+ # mkyaffs2image. So we create a temp dir, and within it we create an
+ # empty dir named "cache", and build the image from that.
+ temp_dir = tempfile.mkdtemp()
+ user_dir = os.path.join(temp_dir, "cache")
+ os.mkdir(user_dir)
+ img = tempfile.NamedTemporaryFile()
+
+ fstab = OPTIONS.info_dict["fstab"]
+ if fstab:
+ image_props["fs_type" ] = fstab["/cache"].fs_type
+ succ = build_image.BuildImage(user_dir, image_props, img.name)
+ assert succ, "build cache.img image failed"
+
+ common.CheckSize(img.name, "cache.img", OPTIONS.info_dict)
+ output_zip.write(img.name, prefix + "cache.img")
+ img.close()
+ os.rmdir(user_dir)
+ os.rmdir(temp_dir)
+
+
+def AddImagesToTargetFiles(filename):
+ OPTIONS.input_tmp, input_zip = common.UnzipTemp(filename)
+ try:
+
+ for n in input_zip.namelist():
+ if n.startswith("IMAGES/"):
+ print "target_files appears to already contain images."
+ sys.exit(1)
+
+ try:
+ input_zip.getinfo("VENDOR/")
+ has_vendor = True
+ except KeyError:
+ has_vendor = False
+
+ OPTIONS.info_dict = common.LoadInfoDict(input_zip)
+ if "selinux_fc" in OPTIONS.info_dict:
+ OPTIONS.info_dict["selinux_fc"] = os.path.join(
+ OPTIONS.input_tmp, "BOOT", "RAMDISK", "file_contexts")
+
+ input_zip.close()
+ output_zip = zipfile.ZipFile(filename, "a",
+ compression=zipfile.ZIP_DEFLATED)
+
+ def banner(s):
+ print "\n\n++++ " + s + " ++++\n\n"
+
+ banner("boot")
+ boot_image = common.GetBootableImage(
+ "IMAGES/boot.img", "boot.img", OPTIONS.input_tmp, "BOOT")
+ if boot_image:
+ boot_image.AddToZip(output_zip)
+
+ banner("recovery")
+ recovery_image = common.GetBootableImage(
+ "IMAGES/recovery.img", "recovery.img", OPTIONS.input_tmp, "RECOVERY")
+ if recovery_image:
+ recovery_image.AddToZip(output_zip)
+
+ banner("system")
+ AddSystem(output_zip)
+ if has_vendor:
+ banner("vendor")
+ AddVendor(output_zip)
+ banner("userdata")
+ AddUserdata(output_zip)
+ banner("cache")
+ AddCache(output_zip)
+
+ output_zip.close()
+
+ finally:
+ shutil.rmtree(OPTIONS.input_tmp)
+
+
+def main(argv):
+ args = common.ParseOptions(argv, __doc__)
+
+ if len(args) != 1:
+ common.Usage(__doc__)
+ sys.exit(1)
+
+ AddImagesToTargetFiles(args[0])
+ print "done."
+
+if __name__ == '__main__':
+ try:
+ common.CloseInheritedPipes()
+ main(sys.argv[1:])
+ except common.ExternalError, e:
+ print
+ print " ERROR: %s" % (e,)
+ print
+ sys.exit(1)
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 712e0cd..5ae8d3c 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -209,7 +209,8 @@
def BuildImage(in_dir, prop_dict, out_file,
fs_config=None,
- fc_config=None):
+ fc_config=None,
+ block_list=None):
"""Build an image to out_file from in_dir with property prop_dict.
Args:
@@ -252,6 +253,8 @@
build_command.extend(["-T", str(prop_dict["timestamp"])])
if fs_config is not None:
build_command.extend(["-C", fs_config])
+ if block_list is not None:
+ build_command.extend(["-B", block_list])
if fc_config is not None:
build_command.append(fc_config)
elif "selinux_fc" in prop_dict:
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index f2f35f4..947a9e4 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -303,6 +303,11 @@
cmd = [mkbootimg, "--kernel", os.path.join(sourcedir, "kernel")]
+ fn = os.path.join(sourcedir, "second")
+ if os.access(fn, os.F_OK):
+ cmd.append("--second")
+ cmd.append(fn)
+
fn = os.path.join(sourcedir, "cmdline")
if os.access(fn, os.F_OK):
cmd.append("--cmdline")
@@ -900,10 +905,26 @@
cmd.append(ttemp.name)
cmd.append(ptemp.name)
p = Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- _, err = p.communicate()
+ err = []
+ def run():
+ _, e = p.communicate()
+ if e: err.append(e)
+ th = threading.Thread(target=run)
+ th.start()
+ th.join(timeout=300) # 5 mins
+ if th.is_alive():
+ print "WARNING: diff command timed out"
+ p.terminate()
+ th.join(5)
+ if th.is_alive():
+ p.kill()
+ th.join()
+
if err or p.returncode != 0:
- print "WARNING: failure running %s:\n%s\n" % (diff_program, err)
- return None
+ print "WARNING: failure running %s:\n%s\n" % (
+ diff_program, "".join(err))
+ self.patch = None
+ return None, None, None
diff = ptemp.read()
finally:
ptemp.close()
@@ -1049,8 +1070,14 @@
_, _, patch = d.ComputePatch()
output_sink("recovery-from-boot.p", patch)
- boot_type, boot_device = GetTypeAndDevice("/boot", info_dict)
- recovery_type, recovery_device = GetTypeAndDevice("/recovery", info_dict)
+ td_pair = GetTypeAndDevice("/boot", info_dict)
+ if not td_pair:
+ return
+ boot_type, boot_device = td_pair
+ td_pair = GetTypeAndDevice("/recovery", info_dict)
+ if not td_pair:
+ return
+ recovery_type, recovery_device = td_pair
sh = """#!/system/bin/sh
if ! applypatch -c %(recovery_type)s:%(recovery_device)s:%(recovery_size)d:%(recovery_sha1)s; then
diff --git a/tools/releasetools/img_from_target_files.py b/tools/releasetools/img_from_target_files.py
index 9aab41c..4b88e73 100755
--- a/tools/releasetools/img_from_target_files.py
+++ b/tools/releasetools/img_from_target_files.py
@@ -20,9 +20,6 @@
Usage: img_from_target_files [flags] input_target_files output_image_zip
- -b (--board_config) <file>
- Deprecated.
-
-z (--bootable_zip)
Include only the bootable images (eg 'boot' and 'recovery') in
the output.
@@ -47,174 +44,11 @@
if not hasattr(os, "SEEK_SET"):
os.SEEK_SET = 0
-import build_image
import common
OPTIONS = common.OPTIONS
-def AddSystem(output_zip, sparse=True):
- """Turn the contents of SYSTEM into a system image and store it in
- output_zip."""
- data = BuildSystem(OPTIONS.input_tmp, OPTIONS.info_dict, sparse=sparse)
- common.ZipWriteStr(output_zip, "system.img", data)
-
-def BuildSystem(input_dir, info_dict, sparse=True, map_file=None):
- return CreateImage(input_dir, info_dict, "system",
- sparse=sparse, map_file=map_file)
-
-def AddVendor(output_zip, sparse=True):
- data = BuildVendor(OPTIONS.input_tmp, OPTIONS.info_dict, sparse=sparse)
- common.ZipWriteStr(output_zip, "vendor.img", data)
-
-def BuildVendor(input_dir, info_dict, sparse=True, map_file=None):
- return CreateImage(input_dir, info_dict, "vendor",
- sparse=sparse, map_file=map_file)
-
-
-def CreateImage(input_dir, info_dict, what, sparse=True, map_file=None):
- print "creating " + what + ".img..."
-
- img = tempfile.NamedTemporaryFile()
-
- # The name of the directory it is making an image out of matters to
- # mkyaffs2image. It wants "system" but we have a directory named
- # "SYSTEM", so create a symlink.
- try:
- os.symlink(os.path.join(input_dir, what.upper()),
- os.path.join(input_dir, what))
- except OSError, e:
- # bogus error on my mac version?
- # File "./build/tools/releasetools/img_from_target_files", line 86, in AddSystem
- # os.path.join(OPTIONS.input_tmp, "system"))
- # OSError: [Errno 17] File exists
- if (e.errno == errno.EEXIST):
- pass
-
- image_props = build_image.ImagePropFromGlobalDict(info_dict, what)
- fstab = info_dict["fstab"]
- if fstab:
- image_props["fs_type" ] = fstab["/" + what].fs_type
-
- if what == "system":
- fs_config_prefix = ""
- else:
- fs_config_prefix = what + "_"
-
- fs_config = os.path.join(
- input_dir, "META/" + fs_config_prefix + "filesystem_config.txt")
- if not os.path.exists(fs_config): fs_config = None
-
- fc_config = os.path.join(input_dir, "BOOT/RAMDISK/file_contexts")
- if not os.path.exists(fc_config): fc_config = None
-
- succ = build_image.BuildImage(os.path.join(input_dir, what),
- image_props, img.name,
- fs_config=fs_config,
- fc_config=fc_config)
- assert succ, "build " + what + ".img image failed"
-
- mapdata = None
-
- if sparse:
- data = open(img.name).read()
- img.close()
- else:
- success, name = build_image.UnsparseImage(img.name, replace=False)
- if not success:
- assert False, "unsparsing " + what + ".img failed"
-
- if map_file:
- mmap = tempfile.NamedTemporaryFile()
- mimg = tempfile.NamedTemporaryFile(delete=False)
- success = build_image.MappedUnsparseImage(
- img.name, name, mmap.name, mimg.name)
- if not success:
- assert False, "creating sparse map failed"
- os.unlink(name)
- name = mimg.name
-
- with open(mmap.name) as f:
- mapdata = f.read()
-
- try:
- with open(name) as f:
- data = f.read()
- finally:
- os.unlink(name)
-
- if mapdata is None:
- return data
- else:
- return mapdata, data
-
-
-def AddUserdata(output_zip):
- """Create an empty userdata image and store it in output_zip."""
-
- image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict,
- "data")
- # We only allow yaffs to have a 0/missing partition_size.
- # Extfs, f2fs must have a size. Skip userdata.img if no size.
- if (not image_props.get("fs_type", "").startswith("yaffs") and
- not image_props.get("partition_size")):
- return
-
- print "creating userdata.img..."
-
- # The name of the directory it is making an image out of matters to
- # mkyaffs2image. So we create a temp dir, and within it we create an
- # empty dir named "data", and build the image from that.
- temp_dir = tempfile.mkdtemp()
- user_dir = os.path.join(temp_dir, "data")
- os.mkdir(user_dir)
- img = tempfile.NamedTemporaryFile()
-
- fstab = OPTIONS.info_dict["fstab"]
- if fstab:
- image_props["fs_type" ] = fstab["/data"].fs_type
- succ = build_image.BuildImage(user_dir, image_props, img.name)
- assert succ, "build userdata.img image failed"
-
- common.CheckSize(img.name, "userdata.img", OPTIONS.info_dict)
- output_zip.write(img.name, "userdata.img")
- img.close()
- os.rmdir(user_dir)
- os.rmdir(temp_dir)
-
-
-def AddCache(output_zip):
- """Create an empty cache image and store it in output_zip."""
-
- image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict,
- "cache")
- # The build system has to explicitly request for cache.img.
- if "fs_type" not in image_props:
- return
-
- print "creating cache.img..."
-
- # The name of the directory it is making an image out of matters to
- # mkyaffs2image. So we create a temp dir, and within it we create an
- # empty dir named "cache", and build the image from that.
- temp_dir = tempfile.mkdtemp()
- user_dir = os.path.join(temp_dir, "cache")
- os.mkdir(user_dir)
- img = tempfile.NamedTemporaryFile()
-
- fstab = OPTIONS.info_dict["fstab"]
- if fstab:
- image_props["fs_type" ] = fstab["/cache"].fs_type
- succ = build_image.BuildImage(user_dir, image_props, img.name)
- assert succ, "build cache.img image failed"
-
- common.CheckSize(img.name, "cache.img", OPTIONS.info_dict)
- output_zip.write(img.name, "cache.img")
- img.close()
- os.rmdir(user_dir)
- os.rmdir(temp_dir)
-
-
def CopyInfo(output_zip):
"""Copy the android-info.txt file from the input to the output."""
output_zip.write(os.path.join(OPTIONS.input_tmp, "OTA", "android-info.txt"),
@@ -225,8 +59,6 @@
bootable_only = [False]
def option_handler(o, a):
- if o in ("-b", "--board_config"):
- pass # deprecated
if o in ("-z", "--bootable_zip"):
bootable_only[0] = True
else:
@@ -234,9 +66,8 @@
return True
args = common.ParseOptions(argv, __doc__,
- extra_opts="b:z",
- extra_long_opts=["board_config=",
- "bootable_zip"],
+ extra_opts="z",
+ extra_long_opts=["bootable_zip"],
extra_option_handler=option_handler)
bootable_only = bootable_only[0]
@@ -246,48 +77,70 @@
sys.exit(1)
OPTIONS.input_tmp, input_zip = common.UnzipTemp(args[0])
- OPTIONS.info_dict = common.LoadInfoDict(input_zip)
-
- # If this image was originally labelled with SELinux contexts, make sure we
- # also apply the labels in our new image. During building, the "file_contexts"
- # is in the out/ directory tree, but for repacking from target-files.zip it's
- # in the root directory of the ramdisk.
- if "selinux_fc" in OPTIONS.info_dict:
- OPTIONS.info_dict["selinux_fc"] = os.path.join(OPTIONS.input_tmp, "BOOT", "RAMDISK",
- "file_contexts")
-
output_zip = zipfile.ZipFile(args[1], "w", compression=zipfile.ZIP_DEFLATED)
+ CopyInfo(output_zip)
- boot_image = common.GetBootableImage(
- "boot.img", "boot.img", OPTIONS.input_tmp, "BOOT")
- if boot_image:
- boot_image.AddToZip(output_zip)
- recovery_image = common.GetBootableImage(
- "recovery.img", "recovery.img", OPTIONS.input_tmp, "RECOVERY")
- if recovery_image:
- recovery_image.AddToZip(output_zip)
+ try:
+ done = False
+ images_path = os.path.join(OPTIONS.input_tmp, "IMAGES")
+ if os.path.exists(images_path):
+ # If this is a new target-files, it already contains the images,
+ # and all we have to do is copy them to the output zip.
+ images = os.listdir(images_path)
+ if images:
+ for i in images:
+ if bootable_only and i not in ("boot.img", "recovery.img"): continue
+ if not i.endswith(".img"): continue
+ with open(os.path.join(images_path, i), "r") as f:
+ common.ZipWriteStr(output_zip, i, f.read())
+ done = True
- def banner(s):
- print "\n\n++++ " + s + " ++++\n\n"
+ if not done:
+ # We have an old target-files that doesn't already contain the
+ # images, so build them.
+ import add_img_to_target_files
- if not bootable_only:
- banner("AddSystem")
- AddSystem(output_zip)
- try:
- input_zip.getinfo("VENDOR/")
- banner("AddVendor")
- AddVendor(output_zip)
- except KeyError:
- pass # no vendor partition for this device
- banner("AddUserdata")
- AddUserdata(output_zip)
- banner("AddCache")
- AddCache(output_zip)
- CopyInfo(output_zip)
+ OPTIONS.info_dict = common.LoadInfoDict(input_zip)
- print "cleaning up..."
- output_zip.close()
- shutil.rmtree(OPTIONS.input_tmp)
+ # If this image was originally labelled with SELinux contexts,
+ # make sure we also apply the labels in our new image. During
+ # building, the "file_contexts" is in the out/ directory tree,
+ # but for repacking from target-files.zip it's in the root
+ # directory of the ramdisk.
+ if "selinux_fc" in OPTIONS.info_dict:
+ OPTIONS.info_dict["selinux_fc"] = os.path.join(
+ OPTIONS.input_tmp, "BOOT", "RAMDISK", "file_contexts")
+
+ boot_image = common.GetBootableImage(
+ "boot.img", "boot.img", OPTIONS.input_tmp, "BOOT")
+ if boot_image:
+ boot_image.AddToZip(output_zip)
+ recovery_image = common.GetBootableImage(
+ "recovery.img", "recovery.img", OPTIONS.input_tmp, "RECOVERY")
+ if recovery_image:
+ recovery_image.AddToZip(output_zip)
+
+ def banner(s):
+ print "\n\n++++ " + s + " ++++\n\n"
+
+ if not bootable_only:
+ banner("AddSystem")
+ add_img_to_target_files.AddSystem(output_zip, prefix="")
+ try:
+ input_zip.getinfo("VENDOR/")
+ banner("AddVendor")
+ add_img_to_target_files.AddVendor(output_zip, prefix="")
+ except KeyError:
+ pass # no vendor partition for this device
+ banner("AddUserdata")
+ add_img_to_target_files.AddUserdata(output_zip, prefix="")
+ banner("AddCache")
+ add_img_to_target_files.AddCache(output_zip, prefix="")
+
+ finally:
+ print "cleaning up..."
+ output_zip.close()
+ shutil.rmtree(OPTIONS.input_tmp)
print "done."
diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files
index 5f2354c..9f70167 100755
--- a/tools/releasetools/ota_from_target_files
+++ b/tools/releasetools/ota_from_target_files
@@ -98,7 +98,6 @@
from sha import sha as sha1
import common
-import img_from_target_files
import edify_generator
import build_image
@@ -118,6 +117,7 @@
OPTIONS.block_based = False
OPTIONS.updater_binary = None
OPTIONS.oem_source = None
+OPTIONS.fallback_to_full = True
def MostPopularKey(d, default):
"""Given a dict, return the key corresponding to the largest
@@ -418,6 +418,63 @@
GetOemProperty("ro.product.device", oem_props, oem_dict, info_dict),
GetBuildProp("ro.build.thumbprint", info_dict))
+def GetImage(which, tmpdir, info_dict):
+ # Return (mapdata, data) for the given image. which should be
+ # "system" or "vendor".
+
+ assert which in ("system", "vendor")
+
+ path = os.path.join(tmpdir, "IMAGES", which + ".img")
+ if os.path.exists(path):
+ print "using %s.img from target-files" % (which,)
+
+ # This is a 'new' target-files, which already has the image in it.
+ # The image is a sparse image, though, so we need to unsparse it
+ # and extract the map data.
+
+ success, name = build_image.UnsparseImage(path, replace=False)
+ if not success:
+ assert False, "unsparsing " + which + ".img failed"
+
+ mmap = tempfile.NamedTemporaryFile()
+ mimg = tempfile.NamedTemporaryFile(delete=False)
+ success = build_image.MappedUnsparseImage(
+ path, name, mmap.name, mimg.name)
+ if not success:
+ assert False, "creating sparse map failed"
+ os.unlink(name)
+ name = mimg.name
+
+ with open(mmap.name) as f:
+ mapdata = f.read()
+
+ try:
+ with open(name) as f:
+ data = f.read()
+ finally:
+ os.unlink(name)
+
+ print "unsparsed data sha1 is " + sha1(data).hexdigest()
+ return mapdata, data
+
+ else:
+ print "building %s.img from target-files" % (which,)
+
+ # This is an 'old' target-files, which does not contain images
+ # already built. Build them.
+
+ import add_img_to_target_files
+ if which == "system":
+ mapdata, data = add_img_to_target_files.BuildSystem(
+ tmpdir, info_dict, sparse=False, map_file=True)
+ elif which == "vendor":
+ mapdata, data = add_img_to_target_files.BuildVendor(
+ tmpdir, info_dict, sparse=False, map_file=True)
+
+ print "built data sha1 is " + sha1(data).hexdigest()
+ return mapdata, data
+
+
def WriteFullOTAPackage(input_zip, output_zip):
# TODO: how to determine this? We don't know what version it will
# be installed on top of. For now, we expect the API just won't
@@ -514,9 +571,7 @@
system_items = ItemSet("system", "META/filesystem_config.txt")
script.ShowProgress(system_progress, 0)
if block_based:
- mapdata, data = img_from_target_files.BuildSystem(
- OPTIONS.input_tmp, OPTIONS.info_dict,
- sparse=False, map_file=True)
+ mapdata, data = GetImage("system", OPTIONS.input_tmp, OPTIONS.info_dict)
common.ZipWriteStr(output_zip, "system.map", mapdata)
common.ZipWriteStr(output_zip, "system.muimg", data)
@@ -551,9 +606,7 @@
script.ShowProgress(0.1, 0)
if block_based:
- mapdata, data = img_from_target_files.BuildVendor(
- OPTIONS.input_tmp, OPTIONS.info_dict,
- sparse=False, map_file=True)
+ mapdata, data = GetImage("vendor", OPTIONS.input_tmp, OPTIONS.info_dict)
common.ZipWriteStr(output_zip, "vendor.map", mapdata)
common.ZipWriteStr(output_zip, "vendor.muimg", data)
@@ -647,14 +700,14 @@
dirs.pop()
class BlockDifference:
- def __init__(self, partition, builder, output_zip):
+ def __init__(self, partition, output_zip):
with tempfile.NamedTemporaryFile() as src_file:
with tempfile.NamedTemporaryFile() as tgt_file:
print "building source " + partition + " image..."
src_file = tempfile.NamedTemporaryFile()
- src_mapdata, src_data = builder(OPTIONS.source_tmp,
- OPTIONS.source_info_dict,
- sparse=False, map_file=True)
+ src_mapdata, src_data = GetImage(partition,
+ OPTIONS.source_tmp,
+ OPTIONS.source_info_dict)
self.src_sha1 = sha1(src_data).hexdigest()
print "source " + partition + " sha1:", self.src_sha1
@@ -662,9 +715,9 @@
print "building target " + partition + " image..."
tgt_file = tempfile.NamedTemporaryFile()
- tgt_mapdata, tgt_data = builder(OPTIONS.target_tmp,
- OPTIONS.target_info_dict,
- sparse=False, map_file=True)
+ tgt_mapdata, tgt_data = GetImage(partition,
+ OPTIONS.target_tmp,
+ OPTIONS.target_info_dict)
self.tgt_sha1 = sha1(tgt_data).hexdigest()
print "target " + partition + " sha1:", self.tgt_sha1
tgt_len = len(tgt_data)
@@ -731,13 +784,11 @@
"/tmp/recovery.img", "recovery.img", OPTIONS.target_tmp, "RECOVERY")
updating_recovery = (source_recovery.data != target_recovery.data)
- system_diff = BlockDifference("system", img_from_target_files.BuildSystem,
- output_zip)
+ system_diff = BlockDifference("system", output_zip)
if HasVendorPartition(target_zip):
if not HasVendorPartition(source_zip):
raise RuntimeError("can't generate incremental that adds /vendor")
- vendor_diff = BlockDifference("vendor", img_from_target_files.BuildVendor,
- output_zip)
+ vendor_diff = BlockDifference("vendor", output_zip)
oem_props = OPTIONS.target_info_dict.get("oem_fingerprint_properties")
oem_dict = None
@@ -802,19 +853,24 @@
GetBuildProp("ro.build.thumbprint", OPTIONS.source_info_dict))
if updating_boot:
+ boot_type, boot_device = common.GetTypeAndDevice("/boot", OPTIONS.info_dict)
d = common.Difference(target_boot, source_boot)
_, _, d = d.ComputePatch()
- print "boot target: %d source: %d diff: %d" % (
- target_boot.size, source_boot.size, len(d))
+ if d is None:
+ include_full_boot = True
+ common.ZipWriteStr(output_zip, "boot.img", target_boot.data)
+ else:
+ include_full_boot = False
- common.ZipWriteStr(output_zip, "patch/boot.img.p", d)
+ print "boot target: %d source: %d diff: %d" % (
+ target_boot.size, source_boot.size, len(d))
- boot_type, boot_device = common.GetTypeAndDevice("/boot", OPTIONS.info_dict)
+ common.ZipWriteStr(output_zip, "patch/boot.img.p", d)
- script.PatchCheck("%s:%s:%d:%s:%d:%s" %
- (boot_type, boot_device,
- source_boot.size, source_boot.sha1,
- target_boot.size, target_boot.sha1))
+ script.PatchCheck("%s:%s:%d:%s:%d:%s" %
+ (boot_type, boot_device,
+ source_boot.size, source_boot.sha1,
+ target_boot.size, target_boot.sha1))
device_specific.IncrementalOTA_VerifyEnd()
@@ -855,19 +911,24 @@
if not OPTIONS.two_step:
if updating_boot:
- # Produce the boot image by applying a patch to the current
- # contents of the boot partition, and write it back to the
- # partition.
- script.Print("Patching boot image...")
- script.ShowProgress(0.1, 10)
- script.ApplyPatch("%s:%s:%d:%s:%d:%s"
- % (boot_type, boot_device,
- source_boot.size, source_boot.sha1,
- target_boot.size, target_boot.sha1),
- "-",
- target_boot.size, target_boot.sha1,
- source_boot.sha1, "patch/boot.img.p")
- print "boot image changed; including."
+ if include_full_boot:
+ print "boot image changed; including full."
+ script.Print("Installing boot image...")
+ script.WriteRawImage("/boot", "boot.img")
+ else:
+ # Produce the boot image by applying a patch to the current
+ # contents of the boot partition, and write it back to the
+ # partition.
+ print "boot image changed; including patch."
+ script.Print("Patching boot image...")
+ script.ShowProgress(0.1, 10)
+ script.ApplyPatch("%s:%s:%d:%s:%d:%s"
+ % (boot_type, boot_device,
+ source_boot.size, source_boot.sha1,
+ target_boot.size, target_boot.sha1),
+ "-",
+ target_boot.size, target_boot.sha1,
+ source_boot.sha1, "patch/boot.img.p")
else:
print "boot image unchanged; skipping."
@@ -1439,6 +1500,8 @@
OPTIONS.block_based = True
elif o in ("-b", "--binary"):
OPTIONS.updater_binary = a
+ elif o in ("--no_fallback_to_full",):
+ OPTIONS.fallback_to_full = False
else:
return False
return True
@@ -1458,6 +1521,7 @@
"block",
"binary=",
"oem_settings=",
+ "no_fallback_to_full",
],
extra_option_handler=option_handler)
@@ -1504,35 +1568,47 @@
if OPTIONS.device_specific is not None:
OPTIONS.device_specific = os.path.abspath(OPTIONS.device_specific)
- if OPTIONS.no_signing:
- output_zip = zipfile.ZipFile(args[1], "w", compression=zipfile.ZIP_DEFLATED)
- else:
- temp_zip_file = tempfile.NamedTemporaryFile()
- output_zip = zipfile.ZipFile(temp_zip_file, "w",
- compression=zipfile.ZIP_DEFLATED)
+ while True:
- if OPTIONS.incremental_source is None:
- WriteFullOTAPackage(input_zip, output_zip)
- if OPTIONS.package_key is None:
- OPTIONS.package_key = OPTIONS.info_dict.get(
- "default_system_dev_certificate",
- "build/target/product/security/testkey")
- else:
- print "unzipping source target-files..."
- OPTIONS.source_tmp, source_zip = common.UnzipTemp(OPTIONS.incremental_source)
- OPTIONS.target_info_dict = OPTIONS.info_dict
- OPTIONS.source_info_dict = common.LoadInfoDict(source_zip)
- if "selinux_fc" in OPTIONS.source_info_dict:
- OPTIONS.source_info_dict["selinux_fc"] = os.path.join(OPTIONS.source_tmp, "BOOT", "RAMDISK",
- "file_contexts")
- if OPTIONS.package_key is None:
- OPTIONS.package_key = OPTIONS.source_info_dict.get(
- "default_system_dev_certificate",
- "build/target/product/security/testkey")
- if OPTIONS.verbose:
- print "--- source info ---"
- common.DumpInfoDict(OPTIONS.source_info_dict)
- WriteIncrementalOTAPackage(input_zip, source_zip, output_zip)
+ if OPTIONS.no_signing:
+ if os.path.exists(args[1]): os.unlink(args[1])
+ output_zip = zipfile.ZipFile(args[1], "w", compression=zipfile.ZIP_DEFLATED)
+ else:
+ temp_zip_file = tempfile.NamedTemporaryFile()
+ output_zip = zipfile.ZipFile(temp_zip_file, "w",
+ compression=zipfile.ZIP_DEFLATED)
+
+ if OPTIONS.incremental_source is None:
+ WriteFullOTAPackage(input_zip, output_zip)
+ if OPTIONS.package_key is None:
+ OPTIONS.package_key = OPTIONS.info_dict.get(
+ "default_system_dev_certificate",
+ "build/target/product/security/testkey")
+ break
+
+ else:
+ print "unzipping source target-files..."
+ OPTIONS.source_tmp, source_zip = common.UnzipTemp(OPTIONS.incremental_source)
+ OPTIONS.target_info_dict = OPTIONS.info_dict
+ OPTIONS.source_info_dict = common.LoadInfoDict(source_zip)
+ if "selinux_fc" in OPTIONS.source_info_dict:
+ OPTIONS.source_info_dict["selinux_fc"] = os.path.join(OPTIONS.source_tmp, "BOOT", "RAMDISK",
+ "file_contexts")
+ if OPTIONS.package_key is None:
+ OPTIONS.package_key = OPTIONS.source_info_dict.get(
+ "default_system_dev_certificate",
+ "build/target/product/security/testkey")
+ if OPTIONS.verbose:
+ print "--- source info ---"
+ common.DumpInfoDict(OPTIONS.source_info_dict)
+ try:
+ WriteIncrementalOTAPackage(input_zip, source_zip, output_zip)
+ break
+ except ValueError:
+ if not OPTIONS.fallback_to_full: raise
+ print "--- failed to build incremental; falling back to full ---"
+ OPTIONS.incremental_source = None
+ output_zip.close()
output_zip.close()
diff --git a/tools/releasetools/sign_target_files_apks b/tools/releasetools/sign_target_files_apks
index 0ecb906..cba0668 100755
--- a/tools/releasetools/sign_target_files_apks
+++ b/tools/releasetools/sign_target_files_apks
@@ -82,6 +82,7 @@
import tempfile
import zipfile
+import add_img_to_target_files
import common
OPTIONS = common.OPTIONS
@@ -166,6 +167,8 @@
f.write(data)
for info in input_tf_zip.infolist():
+ if info.filename.startswith("IMAGES/"): continue
+
data = input_tf_zip.read(info.filename)
out_info = copy.copy(info)
@@ -448,6 +451,8 @@
input_zip.close()
output_zip.close()
+ add_img_to_target_files.AddImagesToTargetFiles(args[1])
+
print "done."