diff options
31 files changed, 551 insertions, 188 deletions
diff --git a/CleanSpec.mk b/CleanSpec.mk index d103aa6..5446ce7 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -107,7 +107,12 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libbcinfo_intermediates) + +# ICS MR2!!!!!!!!!!!! +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libbcinfo_intermediates) # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST diff --git a/core/Makefile b/core/Makefile index a81c981..bff9ec0 100644 --- a/core/Makefile +++ b/core/Makefile @@ -603,21 +603,21 @@ endif ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true) INTERNAL_USERIMAGES_DEPS := $(MKEXTUSERIMG) $(MAKE_EXT4FS) -INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS))) - -# $(1): src directory -# $(2): output file -# $(3): mount point -# $(4): ext variant (ext2, ext3, ext4) -# $(5): size of the partition -define build-userimage-ext-target - @mkdir -p $(dir $(2)) - $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \ - $(MKEXTUSERIMG) $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG) $(1) $(2) $(4) $(3) $(5) -endef else INTERNAL_USERIMAGES_DEPS := $(MKYAFFS2) endif +INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS))) + +# $(1): the path of the output dictionary file +define generate-userimage-prop-dictionary +$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1)) +$(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1)) +$(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1)) +$(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1)) +$(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1)) +$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1)) +$(if $(mkyaffs2_extra_flags),$(hide) echo "mkyaffs2_extra_flags=$(mkyaffs2_extra_flags)" >> $(1)) +endef # ----------------------------------------------------------------- # Recovery image @@ -769,27 +769,18 @@ $(call dist-for-goals, sdk_addon, $(INSTALLED_FILES_FILE)) endif systemimage_intermediates := \ - $(call intermediates-dir-for,PACKAGING,systemimage) + $(call intermediates-dir-for,PACKAGING,systemimage) BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img -ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true) -## generate an ext image # $(1): output file define build-systemimage-target - @echo "Target system fs image: $(1)" - $(call build-userimage-ext-target,$(TARGET_OUT),$(1),system,$(INTERNAL_USERIMAGES_EXT_VARIANT),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)) -endef - -else # INTERNAL_USERIMAGES_USE_EXT != true - -## generate a yaffs2 image -# $(1): output file -define build-systemimage-target - @echo "Target system fs image: $(1)" - @mkdir -p $(dir $(1)) - $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT) $(1) + @echo "Target system fs image: $(1)" + @mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt + $(call generate-userimage-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt) + $(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) endef -endif # INTERNAL_USERIMAGES_USE_EXT $(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(call build-systemimage-target,$@) @@ -888,29 +879,22 @@ boottarball-nodeps btnod: $(FS_GET_STATS) \ # ----------------------------------------------------------------- # data partition image INTERNAL_USERDATAIMAGE_FILES := \ - $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES)) - -ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true) -## Generate an ext2 image -define build-userdataimage-target - $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)") - @mkdir -p $(TARGET_OUT_DATA) - $(call build-userimage-ext-target,$(TARGET_OUT_DATA),$(INSTALLED_USERDATAIMAGE_TARGET),data,$(INTERNAL_USERIMAGES_EXT_VARIANT),$(BOARD_USERDATAIMAGE_PARTITION_SIZE)) - $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs) -endef + $(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES)) -else # INTERNAL_USERIMAGES_USE_EXT != true +userdataimage_intermediates := \ + $(call intermediates-dir-for,PACKAGING,userdata) +BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img -## Generate a yaffs2 image define build-userdataimage-target - $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)") - @mkdir -p $(TARGET_OUT_DATA) - $(hide) $(MKYAFFS2) -f $(mkyaffs2_extra_flags) $(TARGET_OUT_DATA) $(INSTALLED_USERDATAIMAGE_TARGET) - $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs) + $(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)") + @mkdir -p $(TARGET_OUT_DATA) + @mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt + $(call generate-userimage-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt) + $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \ + ./build/tools/releasetools/build_image.py \ + $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET) + $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE),yaffs) endef -endif # INTERNAL_USERIMAGES_USE_EXT - -BUILT_USERDATAIMAGE_TARGET := $(PRODUCT_OUT)/userdata.img # We just build this directly to the install location. INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET) @@ -944,6 +928,38 @@ userdatatarball-nodeps: $(FS_GET_STATS) # ----------------------------------------------------------------- +# cache partition image +ifdef BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE +INTERNAL_CACHEIMAGE_FILES := \ + $(filter $(TARGET_OUT_CACHE)/%,$(ALL_DEFAULT_INSTALLED_MODULES)) + +cacheimage_intermediates := \ + $(call intermediates-dir-for,PACKAGING,cache) +BUILT_CACHEIMAGE_TARGET := $(PRODUCT_OUT)/cache.img + +define build-cacheimage-target + $(call pretty,"Target cache fs image: $(INSTALLED_CACHEIMAGE_TARGET)") + @mkdir -p $(TARGET_OUT_CACHE) + @mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt + $(call generate-userimage-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt) + $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \ + ./build/tools/releasetools/build_image.py \ + $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET) + $(hide) $(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE),yaffs) +endef + +# We just build this directly to the install location. +INSTALLED_CACHEIMAGE_TARGET := $(BUILT_CACHEIMAGE_TARGET) +$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES) + $(build-cacheimage-target) + +.PHONY: cacheimage-nodeps +cacheimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS) + $(build-cacheimage-target) + +endif # BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE + +# ----------------------------------------------------------------- # bring in the installer image generation defines if necessary ifeq ($(TARGET_USE_DISKINSTALLER),true) include bootable/diskinstaller/config.mk @@ -1024,6 +1040,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \ $(INSTALLED_RECOVERYIMAGE_TARGET) \ $(INSTALLED_SYSTEMIMAGE) \ $(INSTALLED_USERDATAIMAGE_TARGET) \ + $(INSTALLED_CACHEIMAGE_TARGET) \ $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ $(built_ota_tools) \ $(APKCERTS_FILE) \ @@ -1100,23 +1117,12 @@ endif ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt endif -ifdef BOARD_SYSTEMIMAGE_PARTITION_SIZE - $(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt -endif -ifdef BOARD_USERDATAIMAGE_PARTITION_SIZE - $(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt -endif $(hide) echo "tool_extensions=$(tool_extensions)" >> $(zip_root)/META/misc_info.txt -ifdef mkyaffs2_extra_flags - $(hide) echo "mkyaffs2_extra_flags=$(mkyaffs2_extra_flags)" >> $(zip_root)/META/misc_info.txt -endif -ifdef INTERNAL_USERIMAGES_SPARSE_EXT_FLAG - $(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(zip_root)/META/misc_info.txt -endif $(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $(zip_root)/META/misc_info.txt ifdef PRODUCT_EXTRA_RECOVERY_KEYS $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt endif + $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt) @# Zip everything up, preserving symlinks $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .) @# Run fs_config on all the system, boot ramdisk, and recovery ramdisk files in the zip, and save the output @@ -1431,6 +1437,7 @@ $(INTERNAL_SDK_TARGET): $(deps) -I $(TARGET_COMMON_OUT_ROOT) \ -v "PLATFORM_NAME=android-$(PLATFORM_VERSION)" \ -v "OUT_DIR=$(OUT_DIR)" \ + -v "HOST_OUT=$(HOST_OUT)" \ -v "TARGET_ARCH=$(TARGET_ARCH)" \ -v "TARGET_CPU_ABI=$(TARGET_CPU_ABI)" \ -v "DLL_EXTENSION=$(HOST_SHLIB_SUFFIX)" \ diff --git a/core/base_rules.mk b/core/base_rules.mk index 242b53d..324c624 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -381,7 +381,7 @@ endif # java_resource_file_groups ## PRIVATE java vars ###################################### -ifneq ($(strip $(all_java_sources)$(all_res_assets)),) +ifneq ($(strip $(all_java_sources)$(all_res_assets))$(LOCAL_STATIC_JAVA_LIBRARIES),) full_static_java_libs := \ $(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \ @@ -587,6 +587,10 @@ ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS := \ $(ALL_MODULES.$(LOCAL_MODULE).EVENT_LOG_TAGS) $(event_log_tags) ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR := \ $(ALL_MODULES.$(LOCAL_MODULE).INTERMEDIATE_SOURCE_DIR) $(LOCAL_INTERMEDIATE_SOURCE_DIR) +ifdef LOCAL_MODULE_OWNER +ALL_MODULES.$(LOCAL_MODULE).OWNER := \ + $(strip $(ALL_MODULES.$(LOCAL_MODULE).OWNER) $(LOCAL_MODULE_OWNER)) +endif INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(LOCAL_MODULE) diff --git a/core/build_id.mk b/core/build_id.mk index e954794..40bb35d 100644 --- a/core/build_id.mk +++ b/core/build_id.mk @@ -23,7 +23,7 @@ # (like "TC1-RC5"). It must be a single word, and is # capitalized by convention. # -BUILD_ID := OPENMASTER +BUILD_ID := MASTER # DISPLAY_BUILD_NUMBER should only be set for development branches, # If set, the BUILD_NUMBER (cl) is appended to the BUILD_ID for diff --git a/core/clear_vars.mk b/core/clear_vars.mk index 66e6232..ae4bd38 100644 --- a/core/clear_vars.mk +++ b/core/clear_vars.mk @@ -107,6 +107,7 @@ LOCAL_MANIFEST_FILE:= LOCAL_RENDERSCRIPT_INCLUDES:= LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE:= LOCAL_RENDERSCRIPT_CC:= +LOCAL_RENDERSCRIPT_FLAGS:= LOCAL_RENDERSCRIPT_TARGET_API:= LOCAL_BUILD_HOST_DEX:= LOCAL_DEX_PREOPT:= # '',true,false,nostripping @@ -114,6 +115,7 @@ LOCAL_PROTOC_OPTIMIZE_TYPE:= # lite(default),micro,full LOCAL_PROTOC_FLAGS:= LOCAL_NO_CRT:= LOCAL_PROPRIETARY_MODULE:= +LOCAL_MODULE_OWNER:= LOCAL_CTS_TEST_PACKAGE:= # Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk index 8c89143..51192f8 100644 --- a/core/combo/TARGET_linux-arm.mk +++ b/core/combo/TARGET_linux-arm.mk @@ -102,7 +102,7 @@ android_config_h := $(call select-android-config-h,linux-arm) arch_include_dir := $(dir $(android_config_h)) TARGET_GLOBAL_CFLAGS += \ - -msoft-float -fpic \ + -msoft-float -fpic -fPIE \ -ffunction-sections \ -fdata-sections \ -funwind-tables \ @@ -114,11 +114,13 @@ TARGET_GLOBAL_CFLAGS += \ -include $(android_config_h) \ -I $(arch_include_dir) -# This warning causes dalvik not to build with gcc 4.6 and -Werror. +# This warning causes dalvik not to build with gcc 4.6.x and -Werror. # We cannot turn it off blindly since the option is not available -# in gcc-4.4.x -ifneq ($(filter 4.6.0%, $(shell $(TARGET_CC) --version)),) -TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable +# in gcc-4.4.x. We also want to disable sincos optimization globally +# by turning off the builtin sin function. +ifneq ($(filter 4.6.%, $(shell $(TARGET_CC) --version)),) +TARGET_GLOBAL_CFLAGS += -Wno-unused-but-set-variable -fno-builtin-sin \ + -fno-strict-volatile-bitfields endif # This is to avoid the dreaded warning compiler message: @@ -266,7 +268,7 @@ $(hide) $(PRIVATE_CXX) \ endef define transform-o-to-executable-inner -$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \ +$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -fPIE -pie \ -Wl,-dynamic-linker,/system/bin/linker \ -Wl,--gc-sections \ -Wl,-z,nocopyreloc \ @@ -287,7 +289,7 @@ $(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \ endef define transform-o-to-static-executable-inner -$(hide) $(PRIVATE_CXX) -nostdlib -Bstatic -Wl,-T,$(BUILD_SYSTEM)/armelf.x \ +$(hide) $(PRIVATE_CXX) -nostdlib -Bstatic \ -Wl,--gc-sections \ -o $@ \ $(TARGET_GLOBAL_LD_DIRS) \ diff --git a/core/combo/TARGET_linux-x86.mk b/core/combo/TARGET_linux-x86.mk index 3d09276..6efc6a4 100644 --- a/core/combo/TARGET_linux-x86.mk +++ b/core/combo/TARGET_linux-x86.mk @@ -22,6 +22,18 @@ ifeq ($(strip $(TARGET_ARCH_VARIANT)),) TARGET_ARCH_VARIANT := x86 endif +# Include the arch-variant-specific configuration file. +# Its role is to define various ARCH_X86_HAVE_XXX feature macros, +# plus initial values for TARGET_GLOBAL_CFLAGS +# +TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT).mk +ifeq ($(strip $(wildcard $(TARGET_ARCH_SPECIFIC_MAKEFILE))),) +$(error Unknown $(TARGET_ARCH) architecture version: $(TARGET_ARCH_VARIANT)) +endif + +include $(TARGET_ARCH_SPECIFIC_MAKEFILE) + + # You can set TARGET_TOOLS_PREFIX to get gcc from somewhere else ifeq ($(strip $(TARGET_TOOLS_PREFIX)),) TARGET_TOOLS_PREFIX := \ @@ -73,7 +85,7 @@ TARGET_GLOBAL_CFLAGS += \ -Wa,--noexecstack \ -Werror=format-security \ -Wstrict-aliasing=2 \ - -fPIC \ + -fPIC -fPIE \ -ffunction-sections \ -finline-functions \ -finline-limit=300 \ @@ -84,44 +96,48 @@ TARGET_GLOBAL_CFLAGS += \ -funwind-tables \ -include $(call select-android-config-h,target_linux-x86) -# Needs to be fixed later -#TARGET_GLOBAL_CFLAGS += \ -# -fstack-protector - -# Needs to be added for RELEASE -#TARGET_GLOBAL_CFLAGS += \ -# -DNDEBUG - +# XXX: Not sure this is still needed. Must check with our toolchains. TARGET_GLOBAL_CPPFLAGS += \ -fno-use-cxa-atexit -ifeq ($(TARGET_ARCH_VARIANT),x86-atom) - # Basic ATOM flags. - TARGET_GLOBAL_CFLAGS += -march=atom -mstackrealign -mfpmath=sse +# XXX: Our toolchain is normally configured to always set these flags by default +# however, there have been reports that this is sometimes not the case. So make +# them explicit here unless we have the time to carefully check it +# +TARGET_GLOBAL_CFLAGS += -mstackrealign -msse3 -mfpmath=sse - # There are various levels of ATOM processors out there. Different ones have different - # capabilities. This first define matches the NDK's minimum ABI requirements. - # Note: Not all of the flags set here are actually used in Android. They are provided - # to allow for the addition of corresponding optimizations. - TARGET_GLOBAL_CFLAGS += -DUSE_MMX -DUSE_SSE -DUSE_SSE2 -DUSE_SSE3 +# XXX: These flags should not be defined here anymore. Instead, the Android.mk +# of the modules that depend on these features should instead check the +# corresponding macros (e.g. ARCH_X86_HAVE_SSE2 and ARCH_X86_HAVE_SSSE3) +# Keep them here until this is all cleared up. +# +ifeq ($(ARCH_X86_HAVE_SSE2),true) +TARGET_GLOBAL_CFLAGS += -DUSE_SSE2 +endif - # If you wish to build a BSP that will only be used on hardware that has additional - # available instructions, enable them here. By default, this is commented off so that - # the default images can run on all processors that are NDK ABI compliant. - # TARGET_GLOBAL_CFLAGS += -DUSE_SSSE3 -else - # Plain 'x86' - lowest common denominator. This should run pretty much on any hardware. - # - # Note: The NDK's ABI (see the NDK ABI documentation) requires many of the more recent - # instruction set additions. You can build an "x86" BSP that will run on very old hardware, - # but it won't be able to run much of the x86 NDK compliant code. - TARGET_GLOBAL_CFLAGS += -march=i686 +ifeq ($(ARCH_X86_HAVE_SSSE3),true) # yes, really SSSE3, not SSE3! +TARGET_GLOBAL_CFLAGS += -DUSE_SSSE3 endif +# XXX: This flag is probably redundant. I believe our toolchain always sets +# it by default. Consider for removal. +# TARGET_GLOBAL_CFLAGS += -mbionic + +# XXX: This flag is probably redundant. The macro should be defined by our +# toolchain binaries automatically (as a compiler built-in). +# Check with: $BINPREFIX-gcc -dM -E < /dev/null +# +# Consider for removal. +# TARGET_GLOBAL_CFLAGS += -D__ANDROID__ +# XXX: This flag is probably redundant since our toolchain binaries already +# generate 32-bit machine code. It probably dates back to the old days +# where we were using the host toolchain on Linux to build the platform +# images. Consider it for removal. TARGET_GLOBAL_LDFLAGS += -m32 + TARGET_GLOBAL_LDFLAGS += -Wl,-z,noexecstack TARGET_GLOBAL_LDFLAGS += -Wl,--gc-sections @@ -175,6 +191,7 @@ $(hide) $(PRIVATE_CXX) \ -nostdlib -Bdynamic \ -Wl,-dynamic-linker,/system/bin/linker \ -Wl,-z,nocopyreloc \ + -fPIE -pie \ -o $@ \ $(TARGET_GLOBAL_LD_DIRS) \ -Wl,-rpath-link=$(TARGET_OUT_INTERMEDIATE_LIBRARIES) \ @@ -204,3 +221,21 @@ $(hide) $(PRIVATE_CXX) \ -Wl,--end-group \ $(if $(filter true,$(PRIVATE_NO_CRT)),,$(TARGET_CRTEND_O)) endef + +# Special check for x86 NDK ABI compatibility. +# The TARGET_CPU_ABI variable should be defined in BoardConfig.mk to 'x86' +# *only* if the platform image is compatible with the NDK x86 ABI. +# +# We perform a small check here to ensure that nothing bad can happen. +# +ifeq ($(TARGET_CPU_ABI),x86) + ifneq (true-true-true-true,$(ARCH_X86_HAVE_MMX)-$(ARCH_X86_HAVE_SSE)-$(ARCH_X86_HAVE_SSE2)-$(ARCH_X86_HAVE_SSE3)) + $(info ERROR: Your x86 platform image is not compatible with the NDK x86 ABI) + $(info As such, you should *not* define TARGET_CPU_ABI to 'x86' in your BoardConfig.mk) + $(info to ensure that your device will not be mistakenly listed as compatible by + $(info the Android Market. Also, it is likely that the image will fail the CTS tests) + $(info Please undefine TARGET_CPU_ABI in your BoardConfig.mk, or select the value 'none') + $(info The corresponding image will still be able to run Dalvik-based Android applications) + $(error Aborting build! Please fix your BoardConfig.mk) + endif +endif diff --git a/core/combo/arch/x86/x86-atom.mk b/core/combo/arch/x86/x86-atom.mk new file mode 100644 index 0000000..85998e7 --- /dev/null +++ b/core/combo/arch/x86/x86-atom.mk @@ -0,0 +1,18 @@ +# This file contains feature macro definitions specific to the +# 'x86-atom' arch variant. This is an extension of the 'x86' base variant +# that adds Atom-specific features. +# +# See build/core/combo/arch/x86/x86.mk for differences. +# +ARCH_X86_HAVE_MMX := true +ARCH_X86_HAVE_SSE := true +ARCH_X86_HAVE_SSE2 := true +ARCH_X86_HAVE_SSE3 := true + +ARCH_X86_HAVE_SSSE3 := true +ARCH_X86_HAVE_MOVBE := true +ARCH_X86_HAVE_POPCNT := false # popcnt is not supported by current Atom CPUs + +# This flag is used to enabled Atom-specific optimizations with our toolchain +# +TARGET_GLOBAL_CFLAGS += -march=atom diff --git a/core/combo/arch/x86/x86.mk b/core/combo/arch/x86/x86.mk new file mode 100644 index 0000000..476da45 --- /dev/null +++ b/core/combo/arch/x86/x86.mk @@ -0,0 +1,35 @@ +# This file contains feature macro definitions specific to the +# base 'x86' platform ABI. This one must *strictly* match the NDK x86 ABI +# which mandates specific CPU extensions to be available. +# +# It is also used to build full_x86-eng / sdk_x86-eng platform images that +# are run in the emulator under KVM emulation (i.e. running directly on +# the host development machine's CPU). +# + +# If your target device doesn't support the four following features, then +# it cannot be compatible with the NDK x86 ABI. You should define a new +# target arch variant (e.g. "x86-mydevice") and a corresponding file +# under build/core/combo/arch/x86/ +# +ARCH_X86_HAVE_MMX := true +ARCH_X86_HAVE_SSE := true +ARCH_X86_HAVE_SSE2 := true +ARCH_X86_HAVE_SSE3 := true + +# These features are optional and shall not be included in the base platform +# Otherwise, they sdk_x86-eng system images might fail to run on some +# developer machines. +# + +ARCH_X86_HAVE_SSSE3 := false +ARCH_X86_HAVE_MOVBE := false +ARCH_X86_HAVE_POPCNT := false + + +# XXX: This flag is probably redundant, because it should be set by default +# by our toolchain binaries. However, there have been reports that this may +# not always work as intended, so keep it unless we have the time to check +# everything properly. + +TARGET_GLOBAL_CFLAGS += -march=i686 diff --git a/core/config.mk b/core/config.mk index 41e60ea..27a9f4b 100644 --- a/core/config.mk +++ b/core/config.mk @@ -117,7 +117,10 @@ TARGET_SHELL := mksh # If this file doesn't exist, the environemnt variables will # be used, and if that doesn't work, then the default is an # arm build --include $(TOPDIR)buildspec.mk +ifndef ANDROID_BUILDSPEC +ANDROID_BUILDSPEC := $(TOPDIR)buildspec.mk +endif +-include $(ANDROID_BUILDSPEC) # --------------------------------------------------------------- # Define most of the global variables. These are the ones that @@ -336,8 +339,8 @@ PREBUILT_IS_PRESENT := $(if $(wildcard prebuilt/Android.mk),true) # For use with the LOCAL_SDK_VERSION variable for include $(BUILD_PACKAGE) # ############################################################### -HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilt/sdk -HISTORICAL_NDK_VERSIONS_ROOT := $(TOPDIR)prebuilt/ndk +HISTORICAL_SDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/sdk +HISTORICAL_NDK_VERSIONS_ROOT := $(TOPDIR)prebuilts/ndk # Historical SDK version N is stored in $(HISTORICAL_SDK_VERSIONS_ROOT)/N. # The 'current' version is whatever this source tree is. diff --git a/core/definitions.mk b/core/definitions.mk index 5410b11..e950d38 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -802,6 +802,7 @@ $(hide) $(PRIVATE_RS_CC) \ -d $(PRIVATE_RS_OUTPUT_DIR) \ -a $@ -MD \ $(addprefix -target-api , $(PRIVATE_RS_TARGET_API)) \ + $(PRIVATE_RS_FLAGS) \ $(foreach inc,$(PRIVATE_RS_INCLUDES),$(addprefix -I , $(inc))) \ $(PRIVATE_RS_SOURCE_FILES) #$(hide) $(LLVM_RS_LINK) \ @@ -1104,7 +1105,7 @@ $(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs; rm -rf $$ldir; \ mkdir -p $$ldir; \ filelist=; \ - for f in `$(HOST_AR) t $(1) | grep '\.o$$'`; do \ + for f in `$(HOST_AR) t $(1) | \grep '\.o$$'`; do \ $(HOST_AR) p $(1) $$f > $$ldir/$$f; \ filelist="$$filelist $$ldir/$$f"; \ done ; \ @@ -1444,7 +1445,8 @@ $(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \ fi $(hide) tr ' ' '\n' < $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list \ | sort -u > $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq -$(hide) $(1) -encoding UTF-8 \ +$(hide) if [ -s $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \ + $(1) -encoding UTF-8 \ $(strip $(PRIVATE_JAVAC_DEBUG_FLAGS)) \ $(if $(findstring true,$(LOCAL_WARNINGS_ENABLE)),$(xlint_unchecked),) \ $(2) \ @@ -1454,7 +1456,8 @@ $(hide) $(1) -encoding UTF-8 \ -extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) \ $(PRIVATE_JAVACFLAGS) \ \@$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq \ - || ( rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) ; exit 41 ) + || ( rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) ; exit 41 ) \ +fi $(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list $(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq $(hide) jar $(if $(strip $(PRIVATE_JAR_MANIFEST)),-cfm,-cf) \ @@ -1865,7 +1868,6 @@ $(if $(2), \ size=$$(for i in $(1); do $(call get-file-size,$$i); echo +; done; echo 0); \ total=$$(( $$( echo "$$size" ) )); \ printname=$$(echo -n "$(1)" | tr " " +); \ - echo "$$printname total size is $$total"; \ img_blocksize=$(call image-size-from-data-size,$(BOARD_FLASH_BLOCK_SIZE)); \ if [ "$(3)" == "yaffs" ]; then \ reservedblocks=8; \ @@ -1877,6 +1879,7 @@ $(if $(2), \ reserve=$$(((twoblocks > onepct ? twoblocks : onepct) + \ reservedblocks * img_blocksize)); \ maxsize=$$(($(2) - reserve)); \ + echo "$$printname maxsize=$$maxsize blocksize=$$img_blocksize total=$$total reserve=$$reserve"; \ if [ "$$total" -gt "$$maxsize" ]; then \ echo "error: $$printname too large ($$total > [$(2) - $$reserve])"; \ false; \ diff --git a/core/dumpvar.mk b/core/dumpvar.mk index 22c8daa..f91c08a 100644 --- a/core/dumpvar.mk +++ b/core/dumpvar.mk @@ -9,11 +9,17 @@ else ABP:=$(PWD)/$(HOST_OUT_EXECUTABLES) endif -# Add the toolchain bin dir if it actually exists +# Add the ARM toolchain bin dir if it actually exists ifneq ($(wildcard $(PWD)/prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-linux-androideabi-4.4.x/bin),) # this should be copied to HOST_OUT_EXECUTABLES instead ABP:=$(ABP):$(PWD)/prebuilt/$(HOST_PREBUILT_TAG)/toolchain/arm-linux-androideabi-4.4.x/bin endif + +# Add the x86 toolchain bin dir if it actually exists +ifneq ($(wildcard $(PWD)/prebuilt/$(HOST_PREBUILT_TAG)/toolchain/i686-android-linux-4.4.3/bin),) + # this should be copied to HOST_OUT_EXECUTABLES instead + ABP:=$(ABP):$(PWD)/prebuilt/$(HOST_PREBUILT_TAG)/toolchain/i686-android-linux-4.4.3/bin +endif ANDROID_BUILD_PATHS := $(ABP) ANDROID_PREBUILTS := prebuilt/$(HOST_PREBUILT_TAG) diff --git a/core/envsetup.mk b/core/envsetup.mk index e8c924e..3509a8c 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -102,6 +102,14 @@ else HOST_PREBUILT_TAG := $(HOST_OS)-$(HOST_ARCH) endif +# TARGET_COPY_OUT_* are all relative to the staging directory, ie PRODUCT_OUT. +# Define them here so they can be used in product config files. +TARGET_COPY_OUT_SYSTEM := system +TARGET_COPY_OUT_DATA := data +TARGET_COPY_OUT_VENDOR := system/vendor +TARGET_COPY_OUT_ROOT := root +TARGET_COPY_OUT_RECOVERY := recovery + # Read the product specs so we an get TARGET_DEVICE and other # variables that we need in order to locate the output files. include $(BUILD_SYSTEM)/product_config.mk @@ -186,7 +194,7 @@ TARGET_OUT_HEADERS:= $(TARGET_OUT_INTERMEDIATES)/include TARGET_OUT_INTERMEDIATE_LIBRARIES := $(TARGET_OUT_INTERMEDIATES)/lib TARGET_OUT_COMMON_INTERMEDIATES := $(TARGET_COMMON_OUT_ROOT)/obj -TARGET_OUT := $(PRODUCT_OUT)/system +TARGET_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM) TARGET_OUT_EXECUTABLES:= $(TARGET_OUT)/bin TARGET_OUT_OPTIONAL_EXECUTABLES:= $(TARGET_OUT)/xbin TARGET_OUT_SHARED_LIBRARIES:= $(TARGET_OUT)/lib @@ -199,7 +207,7 @@ TARGET_OUT_STATIC_LIBRARIES:= $(TARGET_OUT_INTERMEDIATES)/lib TARGET_OUT_NOTICE_FILES:=$(TARGET_OUT_INTERMEDIATES)/NOTICE_FILES TARGET_OUT_FAKE := $(PRODUCT_OUT)/fake_packages -TARGET_OUT_DATA := $(PRODUCT_OUT)/data +TARGET_OUT_DATA := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_DATA) TARGET_OUT_DATA_EXECUTABLES:= $(TARGET_OUT_EXECUTABLES) TARGET_OUT_DATA_SHARED_LIBRARIES:= $(TARGET_OUT_SHARED_LIBRARIES) TARGET_OUT_DATA_JAVA_LIBRARIES:= $(TARGET_OUT_JAVA_LIBRARIES) @@ -210,7 +218,9 @@ TARGET_OUT_DATA_ETC := $(TARGET_OUT_ETC) TARGET_OUT_DATA_STATIC_LIBRARIES:= $(TARGET_OUT_STATIC_LIBRARIES) TARGET_OUT_DATA_NATIVE_TESTS := $(TARGET_OUT_DATA)/nativetest -TARGET_OUT_VENDOR := $(PRODUCT_OUT)/system/vendor +TARGET_OUT_CACHE := $(PRODUCT_OUT)/cache + +TARGET_OUT_VENDOR := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_VENDOR) TARGET_OUT_VENDOR_EXECUTABLES:= $(TARGET_OUT_VENDOR)/bin TARGET_OUT_VENDOR_OPTIONAL_EXECUTABLES:= $(TARGET_OUT_VENDOR)/xbin TARGET_OUT_VENDOR_SHARED_LIBRARIES:= $(TARGET_OUT_VENDOR)/lib @@ -225,13 +235,13 @@ TARGET_ROOT_OUT_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED) TARGET_ROOT_OUT_SBIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/sbin TARGET_ROOT_OUT_BIN_UNSTRIPPED := $(TARGET_OUT_UNSTRIPPED)/bin -TARGET_ROOT_OUT := $(PRODUCT_OUT)/root +TARGET_ROOT_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ROOT) TARGET_ROOT_OUT_BIN := $(TARGET_ROOT_OUT)/bin TARGET_ROOT_OUT_SBIN := $(TARGET_ROOT_OUT)/sbin TARGET_ROOT_OUT_ETC := $(TARGET_ROOT_OUT)/etc TARGET_ROOT_OUT_USR := $(TARGET_ROOT_OUT)/usr -TARGET_RECOVERY_OUT := $(PRODUCT_OUT)/recovery +TARGET_RECOVERY_OUT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_RECOVERY) TARGET_RECOVERY_ROOT_OUT := $(TARGET_RECOVERY_OUT)/root TARGET_SYSLOADER_OUT := $(PRODUCT_OUT)/sysloader diff --git a/core/java.mk b/core/java.mk index 1cde62b..47f7b41 100644 --- a/core/java.mk +++ b/core/java.mk @@ -5,7 +5,7 @@ # Make sure there's something to build. # It's possible to build a package that doesn't contain any classes. -ifeq (,$(strip $(LOCAL_SRC_FILES)$(all_res_assets))) +ifeq (,$(strip $(LOCAL_SRC_FILES)$(all_res_assets)$(LOCAL_STATIC_JAVA_LIBRARIES))) $(error $(LOCAL_PATH): Target java module does not define any source or resource files) endif @@ -152,6 +152,11 @@ ifeq ($(LOCAL_RENDERSCRIPT_CC),) LOCAL_RENDERSCRIPT_CC := $(LLVM_RS_CC) endif +# Turn on all warnings and warnings as errors for RS compiles. +# This can be disabled with LOCAL_RENDERSCRIPT_FLAGS := -Wno-error +renderscript_flags := -Wall -Werror +renderscript_flags += $(LOCAL_RENDERSCRIPT_FLAGS) + # prepend the RenderScript system include path ifneq ($(filter-out current,$(LOCAL_SDK_VERSION)),) LOCAL_RENDERSCRIPT_INCLUDES := \ @@ -171,6 +176,7 @@ endif $(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES) $(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC) +$(RenderScript_file_stamp): PRIVATE_RS_FLAGS := $(renderscript_flags) $(RenderScript_file_stamp): PRIVATE_RS_SOURCE_FILES := $(renderscript_sources_fullpath) # By putting the generated java files into $(LOCAL_INTERMEDIATE_SOURCE_DIR), they will be # automatically found by the java compiling function transform-java-to-classes.jar. @@ -214,7 +220,7 @@ $(cleantarget): PRIVATE_CLEAN_FILES += $(intermediates.COMMON) # If the module includes java code (i.e., it's not framework-res), compile it. full_classes_jar := built_dex := -ifneq (,$(strip $(all_java_sources))) +ifneq (,$(strip $(all_java_sources)$(full_static_java_libs))) # If LOCAL_BUILT_MODULE_STEM wasn't overridden by our caller, # full_classes_jar will be the same module as LOCAL_BUILT_MODULE. diff --git a/core/main.mk b/core/main.mk index 569d4dc..97d3d7e 100644 --- a/core/main.mk +++ b/core/main.mk @@ -441,7 +441,6 @@ subdirs += \ sdk/ide_common \ sdk/jarutils \ sdk/layoutlib_api \ - sdk/layoutopt \ sdk/ninepatch \ sdk/rule_api \ sdk/lint \ @@ -744,6 +743,9 @@ endif .PHONY: userdatatarball userdatatarball: $(INSTALLED_USERDATATARBALL_TARGET) +.PHONY: cacheimage +cacheimage: $(INSTALLED_CACHEIMAGE_TARGET) + .PHONY: bootimage bootimage: $(INSTALLED_BOOTIMAGE_TARGET) @@ -758,6 +760,7 @@ droidcore: files \ $(INSTALLED_BOOTIMAGE_TARGET) \ $(INSTALLED_RECOVERYIMAGE_TARGET) \ $(INSTALLED_USERDATAIMAGE_TARGET) \ + $(INSTALLED_CACHEIMAGE_TARGET) \ $(INSTALLED_FILES_FILE) # dist_files only for putting your library into the dist directory with a full build. diff --git a/core/product.mk b/core/product.mk index f48d2be..561003d 100644 --- a/core/product.mk +++ b/core/product.mk @@ -84,6 +84,7 @@ _product_var_list := \ PRODUCT_SDK_ADDON_DOC_MODULES \ PRODUCT_DEFAULT_WIFI_CHANNELS \ PRODUCT_DEFAULT_DEV_CERTIFICATE \ + PRODUCT_RESTRICT_VENDOR_FILES \ define dump-product @@ -227,6 +228,8 @@ _product_stash_var_list += \ BOARD_RECOVERYIMAGE_PARTITION_SIZE \ BOARD_SYSTEMIMAGE_PARTITION_SIZE \ BOARD_USERDATAIMAGE_PARTITION_SIZE \ + BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE \ + BOARD_CACHEIMAGE_PARTITION_SIZE \ BOARD_FLASH_BLOCK_SIZE \ BOARD_SYSTEMIMAGE_PARTITION_SIZE \ BOARD_VENDOR_QCOM_GPS_LOC_API_HARDWARE \ diff --git a/core/tasks/module_owner_check.mk b/core/tasks/module_owner_check.mk new file mode 100644 index 0000000..e66b0fc --- /dev/null +++ b/core/tasks/module_owner_check.mk @@ -0,0 +1,54 @@ +# +# 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. +# + +# Restrict the vendor module owners here. + +_vendor_owner_whitelist := \ + + +ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES)) + +ifneq (,$(filter vendor/%, $(PRODUCT_PACKAGE_OVERLAYS) $(DEVICE_PACKAGE_OVERLAYS))) +$(error Error: Product "$(TARGET_PRODUCT)" can not have overlay in vendor tree: \ + $(filter vendor/%, $(PRODUCT_PACKAGE_OVERLAYS) $(DEVICE_PACKAGE_OVERLAYS))) +endif +ifneq (,$(filter vendor/%, $(PRODUCT_COPY_FILES))) +$(error Error: Product "$(TARGET_PRODUCT)" can not have PRODUCT_COPY_FILES from vendor tree: \ + $(filter vendor/%, $(PRODUCT_COPY_FILES))) +endif + +_owner_check_modules := $(sort $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGES)) + +# expand with the required modules +# $(1) the module name set to expand +define _expand_required_modules +$(eval _erm_new_modules:=)\ +$(foreach m, $(1), $(eval r:=$(ALL_MODULES.$(m).REQUIRED))\ + $(if $(r), $(if $(filter $(_owner_check_modules), $(r)),,\ + $(eval _owner_check_modules := $(_owner_check_modules) $(r))\ + $(eval _erm_new_modules := $(_erm_new_modules) $(r)))))\ +$(if $(_erm_new_modules), $(call _expand_required_modules, $(_erm_new_modules))) +endef + +$(call _expand_required_modules, $(_owner_check_modules)) + +$(foreach m, $(_owner_check_modules), \ + $(if $(filter vendor/%, $(ALL_MODULES.$(m).PATH)),\ + $(if $(filter $(_vendor_owner_whitelist), $(ALL_MODULES.$(m).OWNER)),,\ + $(error Error: vendor module "$(m)" in $(ALL_MODULES.$(m).PATH) with unknown owner \ + "$(ALL_MODULES.$(m).OWNER)" in product "$(TARGET_PRODUCT)")))) + +endif diff --git a/core/user_tags.mk b/core/user_tags.mk index 2e7017e..b88e541 100644 --- a/core/user_tags.mk +++ b/core/user_tags.mk @@ -171,7 +171,6 @@ GRANDFATHERED_USER_MODULES += \ layoutlib_api \ layoutlib_create \ layoutlib_utils \ - layoutopt \ liba2dp \ libabi \ libandroid \ @@ -494,7 +493,6 @@ GRANDFATHERED_USER_MODULES += \ traceview \ tune2fs \ tune2fs_host \ - uix \ usbtest \ vdc \ vm-tests \ diff --git a/core/version_defaults.mk b/core/version_defaults.mk index bc6f47a..8553982 100644 --- a/core/version_defaults.mk +++ b/core/version_defaults.mk @@ -41,7 +41,7 @@ ifeq "" "$(PLATFORM_VERSION)" # which is the version that we reveal to the end user. # Update this value when the platform version changes (rather # than overriding it somewhere else). Can be an arbitrary string. - PLATFORM_VERSION := 4.0.3.0.2.0.1.0 + PLATFORM_VERSION := IceCreamSandwichMR2 endif ifeq "" "$(PLATFORM_SDK_VERSION)" @@ -59,7 +59,7 @@ endif ifeq "" "$(PLATFORM_VERSION_CODENAME)" # This is the current development code-name, if the build is not a final # release build. If this is a final release build, it is simply "REL". - PLATFORM_VERSION_CODENAME := AOSP + PLATFORM_VERSION_CODENAME := IceCreamSandwichMR2 endif ifeq "" "$(DEFAULT_APP_TARGET_SDK)" diff --git a/envsetup.sh b/envsetup.sh index bab2d25..26784ad 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -146,6 +146,10 @@ function setpaths() unset ANDROID_HOST_OUT export ANDROID_HOST_OUT=$(get_abs_build_var HOST_OUT) + # needed for processing samples collected by perf counters + unset OPROFILE_EVENTS_DIR + export OPROFILE_EVENTS_DIR=$T/external/oprofile/events + # needed for building linux on MacOS # TODO: fix the path #export HOST_EXTRACFLAGS="-I "$T/system/kernel_headers/host_include @@ -502,8 +506,8 @@ complete -F _lunch lunch # Run tapas with one ore more app names (from LOCAL_PACKAGE_NAME) function tapas() { - local variant=$(echo -n $(echo $* | xargs -n 1 echo | grep -E '^(user|userdebug|eng)$')) - local apps=$(echo -n $(echo $* | xargs -n 1 echo | grep -E -v '^(user|userdebug|eng)$')) + local variant=$(echo -n $(echo $* | xargs -n 1 echo | \grep -E '^(user|userdebug|eng)$')) + local apps=$(echo -n $(echo $* | xargs -n 1 echo | \grep -E -v '^(user|userdebug|eng)$')) if [ $(echo $variant | wc -w) -gt 1 ]; then echo "tapas: Error: Multiple build variants supplied: $variant" @@ -611,12 +615,17 @@ function mmm() T=$(gettop) if [ "$T" ]; then local MAKEFILE= + local MODULES= local ARGS= local DIR TO_CHOP local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/') local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/') for DIR in $DIRS ; do - DIR=`echo $DIR | sed -e 's:/$::'` + MODULES=`echo $DIR | sed -n -e 's/.*:\(.*$\)/\1/p' | sed 's/,/ /'` + if [ "$MODULES" = "" ]; then + MODULES=all_modules + fi + DIR=`echo $DIR | sed -e 's/:.*//' -e 's:/$::'` if [ -f $DIR/Android.mk ]; then TO_CHOP=`(cd -P -- $T && pwd -P) | wc -c | tr -d ' '` TO_CHOP=`expr $TO_CHOP + 1` @@ -643,7 +652,7 @@ function mmm() fi fi done - ONE_SHOT_MAKEFILE="$MAKEFILE" make -C $T $DASH_ARGS all_modules $ARGS + ONE_SHOT_MAKEFILE="$MAKEFILE" make -C $T $DASH_ARGS $MODULES $ARGS else echo "Couldn't locate the top of the tree. Try setting TOP." fi @@ -704,6 +713,14 @@ function gdbclient() local OUT_SO_SYMBOLS=$(get_abs_build_var TARGET_OUT_SHARED_LIBRARIES_UNSTRIPPED) local OUT_EXE_SYMBOLS=$(get_abs_build_var TARGET_OUT_EXECUTABLES_UNSTRIPPED) local PREBUILTS=$(get_abs_build_var ANDROID_PREBUILTS) + local ARCH=$(get_build_var TARGET_ARCH) + local GDB + case "$ARCH" in + x86) GDB=i686-android-linux-gdb;; + arm) GDB=arm-linux-androideabi-gdb;; + *) echo "Unknown arch $ARCH"; return 1;; + esac + if [ "$OUT_ROOT" -a "$PREBUILTS" ]; then local EXE="$1" if [ "$EXE" ] ; then @@ -744,7 +761,7 @@ function gdbclient() echo >>"$OUT_ROOT/gdbclient.cmds" "target remote $PORT" echo >>"$OUT_ROOT/gdbclient.cmds" "" - arm-linux-androideabi-gdb -x "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE" + $GDB -x "$OUT_ROOT/gdbclient.cmds" "$OUT_EXE_SYMBOLS/$EXE" else echo "Unable to determine build system output dir." fi @@ -908,7 +925,7 @@ function runhat() echo "Running hat on $localFile" echo "View the output by pointing your browser at http://localhost:7000/" echo "" - hat $localFile + hat -JXmx512m $localFile } function getbugreports() @@ -1007,7 +1024,7 @@ function godir () { echo "" fi local lines - lines=($(grep "$1" $T/filelist | sed -e 's/\/[^/]*$//' | sort | uniq)) + lines=($(\grep "$1" $T/filelist | sed -e 's/\/[^/]*$//' | sort | uniq)) if [[ ${#lines[@]} = 0 ]]; then echo "Not found" return diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk index 57e60d3..bc999fa 100644 --- a/target/board/generic/BoardConfig.mk +++ b/target/board/generic/BoardConfig.mk @@ -21,6 +21,7 @@ TARGET_NO_KERNEL := true TARGET_ARCH_VARIANT := armv7-a TARGET_CPU_ABI := armeabi-v7a TARGET_CPU_ABI2 := armeabi +ARCH_ARM_HAVE_TLS_REGISTER := true HAVE_HTC_AUDIO_DRIVER := true BOARD_USES_GENERIC_AUDIO := true diff --git a/target/board/generic/device.mk b/target/board/generic/device.mk index 8b187d5..4edcc19 100644 --- a/target/board/generic/device.mk +++ b/target/board/generic/device.mk @@ -19,7 +19,8 @@ PRODUCT_PROPERTY_OVERRIDES := \ ro.ril.hsxpa=1 \ - ro.ril.gprsclass=10 + ro.ril.gprsclass=10 \ + ro.adb.qemud=1 PRODUCT_COPY_FILES := \ development/data/etc/apns-conf.xml:system/etc/apns-conf.xml \ diff --git a/target/board/generic_x86/device.mk b/target/board/generic_x86/device.mk index 1055cba..0dd2bc0 100644 --- a/target/board/generic_x86/device.mk +++ b/target/board/generic_x86/device.mk @@ -19,7 +19,8 @@ PRODUCT_PROPERTY_OVERRIDES := \ ro.ril.hsxpa=1 \ - ro.ril.gprsclass=10 + ro.ril.gprsclass=10 \ + ro.adb.qemud=1 PRODUCT_COPY_FILES := \ development/data/etc/apns-conf.xml:system/etc/apns-conf.xml \ diff --git a/target/board/vbox_x86/device.mk b/target/board/vbox_x86/device.mk index a76d8fa..66a6e84 100644 --- a/target/board/vbox_x86/device.mk +++ b/target/board/vbox_x86/device.mk @@ -21,7 +21,8 @@ LOCAL_PATH := $(call my-dir) PRODUCT_PROPERTY_OVERRIDES := \ ro.ril.hsxpa=1 \ - ro.ril.gprsclass=10 + ro.ril.gprsclass=10 \ + ro.adb.qemud=1 LOCAL_KERNEL := prebuilt/android-x86/kernel/kernel-vbox diff --git a/target/product/sdk.mk b/target/product/sdk.mk index ceb1898..d2f4c09 100644 --- a/target/product/sdk.mk +++ b/target/product/sdk.mk @@ -77,7 +77,6 @@ PRODUCT_PACKAGES += \ ddms \ hierarchyviewer \ draw9patch \ - layoutopt \ traceview \ android \ dexdump \ @@ -95,8 +94,6 @@ PRODUCT_PACKAGES += \ ddmuilib \ draw9patch \ hierarchyviewer \ - layoutopt \ - uix \ traceview \ anttasks \ sdklib \ diff --git a/tools/java-event-log-tags.py b/tools/java-event-log-tags.py index c63fa20..846d9cf 100755 --- a/tools/java-event-log-tags.py +++ b/tools/java-event-log-tags.py @@ -26,6 +26,7 @@ tags in the given input file. import cStringIO import getopt import os +import os.path import re import sys @@ -144,4 +145,8 @@ for t in tagfile.tags: buffer.write("}\n"); +output_dir = os.path.dirname(output_file) +if not os.path.exists(output_dir): + os.makedirs(output_dir) + event_log_tags.WriteOutput(output_file, buffer) diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py new file mode 100755 index 0000000..15acddc --- /dev/null +++ b/tools/releasetools/build_image.py @@ -0,0 +1,139 @@ +#!/usr/bin/env python +# +# 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. + +""" +Build image output_image_file from input_directory and properties_file. + +Usage: build_image input_directory properties_file output_image_file + +""" +import os +import subprocess +import sys + + +def BuildImage(in_dir, prop_dict, out_file): + """Build an image to out_file from in_dir with property prop_dict. + + Args: + in_dir: path of input directory. + prop_dict: property dictionary. + out_file: path of the output image file. + + Returns: + True iff the image is built successfully. + """ + build_command = [] + fs_type = prop_dict.get("fs_type", "") + if fs_type.startswith("ext"): + build_command = ["mkuserimg.sh"] + if "extfs_sparse_flag" in prop_dict: + build_command.append(prop_dict["extfs_sparse_flag"]) + build_command.extend([in_dir, out_file, fs_type, + prop_dict["mount_point"]]) + if "partition_size" in prop_dict: + build_command.append(prop_dict["partition_size"]) + else: + build_command = ["mkyaffs2image", "-f"] + if prop_dict.get("mkyaffs2_extra_flags", None): + build_command.extend(prop_dict["mkyaffs2_extra_flags"].split()) + build_command.append(in_dir) + build_command.append(out_file) + + print "Running: ", " ".join(build_command) + p = subprocess.Popen(build_command); + p.communicate() + return p.returncode == 0 + + +def ImagePropFromGlobalDict(glob_dict, mount_point): + """Build an image property dictionary from the global dictionary. + + Args: + glob_dict: the global dictionary from the build system. + mount_point: such as "system", "data" etc. + """ + d = {} + + def copy_prop(src_p, dest_p): + if src_p in glob_dict: + d[dest_p] = str(glob_dict[src_p]) + + common_props = ( + "extfs_sparse_flag", + "mkyaffs2_extra_flags", + ) + for p in common_props: + copy_prop(p, p) + + d["mount_point"] = mount_point + if mount_point == "system": + copy_prop("fs_type", "fs_type") + copy_prop("system_size", "partition_size") + elif mount_point == "data": + copy_prop("fs_type", "fs_type") + copy_prop("userdata_size", "partition_size") + elif mount_point == "cache": + copy_prop("cache_fs_type", "fs_type") + copy_prop("cache_size", "partition_size") + + return d + + +def LoadGlobalDict(filename): + """Load "name=value" pairs from filename""" + d = {} + f = open(filename) + for line in f: + line = line.strip() + if not line or line.startswith("#"): + continue + k, v = line.split("=", 1) + d[k] = v + f.close() + return d + + +def main(argv): + if len(argv) != 3: + print __doc__ + sys.exit(1) + + in_dir = argv[0] + glob_dict_file = argv[1] + out_file = argv[2] + + glob_dict = LoadGlobalDict(glob_dict_file) + image_filename = os.path.basename(out_file) + mount_point = "" + if image_filename == "system.img": + mount_point = "system" + elif image_filename == "userdata.img": + mount_point = "data" + elif image_filename == "cache.img": + mount_point = "cache" + else: + print >> sys.stderr, "error: unknown image file name ", image_filename + exit(1) + + image_properties = ImagePropFromGlobalDict(glob_dict, mount_point) + if not BuildImage(in_dir, image_properties, out_file): + print >> sys.stderr, "error: failed to build %s from %s" % (out_file, in_dir) + exit(1) + + +if __name__ == '__main__': + main(sys.argv[1:]) diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index 4957354..1049591 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -138,6 +138,7 @@ def LoadInfoDict(zip): makeint("blocksize") makeint("system_size") makeint("userdata_size") + makeint("cache_size") makeint("recovery_size") makeint("boot_size") diff --git a/tools/releasetools/img_from_target_files b/tools/releasetools/img_from_target_files index c5b9886..002e6e6 100755 --- a/tools/releasetools/img_from_target_files +++ b/tools/releasetools/img_from_target_files @@ -47,6 +47,7 @@ import zipfile if not hasattr(os, "SEEK_SET"): os.SEEK_SET = 0 +import build_image import common OPTIONS = common.OPTIONS @@ -64,27 +65,13 @@ def AddUserdata(output_zip): os.mkdir(user_dir) img = tempfile.NamedTemporaryFile() - build_command = [] + image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict, + "data") fstab = OPTIONS.info_dict["fstab"] - if fstab and fstab["/data"].fs_type.startswith("ext"): - build_command = ["mkuserimg.sh"] - if "extfs_sparse_flag" in OPTIONS.info_dict: - build_command.append(OPTIONS.info_dict["extfs_sparse_flag"]) - build_command.extend([user_dir, img.name, - fstab["/data"].fs_type, "data"]) - if "userdata_size" in OPTIONS.info_dict: - build_command.append(str(OPTIONS.info_dict["userdata_size"])) - else: - build_command = ["mkyaffs2image", "-f"] - extra = OPTIONS.info_dict.get("mkyaffs2_extra_flags", None) - if extra: - build_command.extend(extra.split()) - build_command.append(user_dir) - build_command.append(img.name) - - p = common.Run(build_command); - p.communicate() - assert p.returncode == 0, "build userdata.img image failed" + 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") @@ -93,6 +80,38 @@ def AddUserdata(output_zip): 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 AddSystem(output_zip): """Turn the contents of SYSTEM into a system image and store it in output_zip.""" @@ -115,28 +134,14 @@ def AddSystem(output_zip): if (e.errno == errno.EEXIST): pass - build_command = [] + image_props = build_image.ImagePropFromGlobalDict(OPTIONS.info_dict, + "system") fstab = OPTIONS.info_dict["fstab"] - if fstab and fstab["/system"].fs_type.startswith("ext"): - - build_command = ["mkuserimg.sh"] - if "extfs_sparse_flag" in OPTIONS.info_dict: - build_command.append(OPTIONS.info_dict["extfs_sparse_flag"]) - build_command.extend([os.path.join(OPTIONS.input_tmp, "system"), img.name, - fstab["/system"].fs_type, "system"]) - if "system_size" in OPTIONS.info_dict: - build_command.append(str(OPTIONS.info_dict["system_size"])) - else: - build_command = ["mkyaffs2image", "-f"] - extra = OPTIONS.info_dict.get("mkyaffs2_extra_flags", None) - if extra: - build_command.extend(extra.split()) - build_command.append(os.path.join(OPTIONS.input_tmp, "system")) - build_command.append(img.name) - - p = common.Run(build_command) - p.communicate() - assert p.returncode == 0, "build system.img image failed" + if fstab: + image_props["fs_type" ] = fstab["/system"].fs_type + succ = build_image.BuildImage(os.path.join(OPTIONS.input_tmp, "system"), + image_props, img.name) + assert succ, "build system.img image failed" img.seek(os.SEEK_SET, 0) data = img.read() @@ -190,6 +195,7 @@ def main(argv): if not bootable_only: AddSystem(output_zip) AddUserdata(output_zip) + AddCache(output_zip) CopyInfo(output_zip) print "cleaning up..." diff --git a/tools/zipalign/ZipEntry.cpp b/tools/zipalign/ZipEntry.cpp index bed0333..cd9e332 100644 --- a/tools/zipalign/ZipEntry.cpp +++ b/tools/zipalign/ZipEntry.cpp @@ -42,7 +42,7 @@ status_t ZipEntry::initFromCDE(FILE* fp) long posn; bool hasDD; - //LOGV("initFromCDE ---\n"); + //ALOGV("initFromCDE ---\n"); /* read the CDE */ result = mCDE.read(fp); @@ -280,50 +280,50 @@ void ZipEntry::setDataInfo(long uncompLen, long compLen, unsigned long crc32, bool ZipEntry::compareHeaders(void) const { if (mCDE.mVersionToExtract != mLFH.mVersionToExtract) { - LOGV("cmp: VersionToExtract\n"); + ALOGV("cmp: VersionToExtract\n"); return false; } if (mCDE.mGPBitFlag != mLFH.mGPBitFlag) { - LOGV("cmp: GPBitFlag\n"); + ALOGV("cmp: GPBitFlag\n"); return false; } if (mCDE.mCompressionMethod != mLFH.mCompressionMethod) { - LOGV("cmp: CompressionMethod\n"); + ALOGV("cmp: CompressionMethod\n"); return false; } if (mCDE.mLastModFileTime != mLFH.mLastModFileTime) { - LOGV("cmp: LastModFileTime\n"); + ALOGV("cmp: LastModFileTime\n"); return false; } if (mCDE.mLastModFileDate != mLFH.mLastModFileDate) { - LOGV("cmp: LastModFileDate\n"); + ALOGV("cmp: LastModFileDate\n"); return false; } if (mCDE.mCRC32 != mLFH.mCRC32) { - LOGV("cmp: CRC32\n"); + ALOGV("cmp: CRC32\n"); return false; } if (mCDE.mCompressedSize != mLFH.mCompressedSize) { - LOGV("cmp: CompressedSize\n"); + ALOGV("cmp: CompressedSize\n"); return false; } if (mCDE.mUncompressedSize != mLFH.mUncompressedSize) { - LOGV("cmp: UncompressedSize\n"); + ALOGV("cmp: UncompressedSize\n"); return false; } if (mCDE.mFileNameLength != mLFH.mFileNameLength) { - LOGV("cmp: FileNameLength\n"); + ALOGV("cmp: FileNameLength\n"); return false; } #if 0 // this seems to be used for padding, not real data if (mCDE.mExtraFieldLength != mLFH.mExtraFieldLength) { - LOGV("cmp: ExtraFieldLength\n"); + ALOGV("cmp: ExtraFieldLength\n"); return false; } #endif if (mCDE.mFileName != NULL) { if (strcmp((char*) mCDE.mFileName, (char*) mLFH.mFileName) != 0) { - LOGV("cmp: FileName\n"); + ALOGV("cmp: FileName\n"); return false; } } diff --git a/tools/zipalign/ZipFile.cpp b/tools/zipalign/ZipFile.cpp index 62c9383..9e5ee42 100644 --- a/tools/zipalign/ZipFile.cpp +++ b/tools/zipalign/ZipFile.cpp @@ -253,7 +253,7 @@ status_t ZipFile::readCentralDir(void) if (buf[i] == 0x50 && ZipEntry::getLongLE(&buf[i]) == EndOfCentralDir::kSignature) { - LOGV("+++ Found EOCD at buf+%d\n", i); + ALOGV("+++ Found EOCD at buf+%d\n", i); break; } } @@ -303,7 +303,7 @@ status_t ZipFile::readCentralDir(void) /* * Loop through and read the central dir entries. */ - LOGV("Scanning %d entries...\n", mEOCD.mTotalNumEntries); + ALOGV("Scanning %d entries...\n", mEOCD.mTotalNumEntries); int entry; for (entry = 0; entry < mEOCD.mTotalNumEntries; entry++) { ZipEntry* pEntry = new ZipEntry; @@ -334,7 +334,7 @@ status_t ZipFile::readCentralDir(void) result = UNKNOWN_ERROR; goto bail; } - LOGV("+++ EOCD read check passed\n"); + ALOGV("+++ EOCD read check passed\n"); } bail: @@ -799,7 +799,7 @@ status_t ZipFile::compressFpToFp(FILE* dstFp, FILE* srcFp, /* only read if the input buffer is empty */ if (zstream.avail_in == 0 && !atEof) { - LOGV("+++ reading %d bytes\n", (int)kBufSize); + ALOGV("+++ reading %d bytes\n", (int)kBufSize); if (data) { getSize = size > kBufSize ? kBufSize : size; memcpy(inBuf, data, getSize); @@ -813,7 +813,7 @@ status_t ZipFile::compressFpToFp(FILE* dstFp, FILE* srcFp, } } if (getSize < kBufSize) { - LOGV("+++ got %d bytes, EOF reached\n", + ALOGV("+++ got %d bytes, EOF reached\n", (int)getSize); atEof = true; } @@ -840,7 +840,7 @@ status_t ZipFile::compressFpToFp(FILE* dstFp, FILE* srcFp, if (zstream.avail_out == 0 || (zerr == Z_STREAM_END && zstream.avail_out != (uInt) kBufSize)) { - LOGV("+++ writing %d bytes\n", (int) (zstream.next_out - outBuf)); + ALOGV("+++ writing %d bytes\n", (int) (zstream.next_out - outBuf)); if (fwrite(outBuf, 1, zstream.next_out - outBuf, dstFp) != (size_t)(zstream.next_out - outBuf)) { |