diff --git a/CleanSpec.mk b/CleanSpec.mk index e706b9c9e5e..e9d44557677 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -314,6 +314,9 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/*) $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/APPS/*) +# Added new build props +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/build.prop) + # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/core/Makefile b/core/Makefile index 15c7f02a6e3..753727e27a2 100644 --- a/core/Makefile +++ b/core/Makefile @@ -4,6 +4,44 @@ # intermedites-dir-for LOCAL_PATH := $(BUILD_SYSTEM) +# Build system colors + +ifneq ($(BUILD_WITH_COLORS),0) +# Define colors + CL_RST="\033[0m" + CL_BLK="\033[30m" + CL_RED="\033[31m" + CL_GRN="\033[32m" + CL_YLW="\033[33m" + CL_BLU="\033[34m" + CL_MAG="\033[35m" + CL_CYN="\033[36m" + CL_WHT="\033[37m" + CL_BLD_BLK="\033[1m\033[30m" + CL_BLD_RED="\033[1m\033[31m" + CL_BLD_GRN="\033[1m\033[32m" + CL_BLD_YLW="\033[1m\033[33m" + CL_BLD_BLU="\033[1m\033[34m" + CL_BLD_MAG="\033[1m\033[35m" + CL_BLD_CYN="\033[1m\033[36m" + CL_BLD_WHT="\033[1m\033[37m" +# Map colors + # host + PRT_HST := $(CL_YLW) + # target + PRT_TGT := $(CL_CYN) + # install/copy + PRT_INS := $(CL_GRN) + # FS/images + PRT_IMG := $(CL_GRN) + # import/export/includes/notice + PRT_IMP := $(CL_GRN) + # delete + PRT_DEL := $(CL_RED) + # complete msg + PRT_CPL := $(CL_BLD_GRN) +endif + # Pick a reasonable string to use to identify files. ifneq "" "$(filter eng.%,$(BUILD_NUMBER))" # BUILD_NUMBER has a timestamp in it, which means that @@ -34,7 +72,6 @@ unique_product_copy_files_destinations := $(foreach cf,$(unique_product_copy_files_pairs), \ $(eval _src := $(call word-colon,1,$(cf))) \ $(eval _dest := $(call word-colon,2,$(cf))) \ - $(call check-product-copy-files,$(cf)) \ $(if $(filter $(unique_product_copy_files_destinations),$(_dest)), \ $(info PRODUCT_COPY_FILES $(cf) ignored.), \ $(eval _fulldest := $(call append-path,$(PRODUCT_OUT),$(_dest))) \ @@ -202,6 +239,7 @@ endif $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \ TARGET_BUILD_FLAVOR="$(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT)" \ TARGET_DEVICE="$(TARGET_DEVICE)" \ + OMNI_DEVICE="$(TARGET_DEVICE)" \ PRODUCT_NAME="$(TARGET_PRODUCT)" \ PRODUCT_BRAND="$(PRODUCT_BRAND)" \ PRODUCT_DEFAULT_LANGUAGE="$(call default-locale-language,$(PRODUCT_LOCALES))" \ @@ -214,6 +252,8 @@ endif BUILD_DISPLAY_ID="$(BUILD_DISPLAY_ID)" \ BUILD_NUMBER="$(BUILD_NUMBER)" \ PLATFORM_VERSION="$(PLATFORM_VERSION)" \ + PLATFORM_SECURITY_PATCH="$(PLATFORM_SECURITY_PATCH)" \ + PLATFORM_BASE_OS="$(PLATFORM_BASE_OS)" \ PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \ PLATFORM_VERSION_CODENAME="$(PLATFORM_VERSION_CODENAME)" \ PLATFORM_VERSION_ALL_CODENAMES="$(PLATFORM_VERSION_ALL_CODENAMES)" \ @@ -228,6 +268,9 @@ endif TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \ TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \ TARGET_AAPT_CHARACTERISTICS="$(TARGET_AAPT_CHARACTERISTICS)" \ + TARGET_UNIFIED_DEVICE="$(TARGET_UNIFIED_DEVICE)" \ + TARGET_SETS_FSTAB="$(TARGET_SETS_FSTAB)" \ + $(PRODUCT_BUILD_PROP_OVERRIDES) \ bash $(BUILDINFO_SH) >> $@ $(hide) $(foreach file,$(system_prop_file), \ if [ -f "$(file)" ]; then \ @@ -638,7 +681,7 @@ endif # TARGET_BUILD_APPS $(kernel_notice_file): \ prebuilts/qemu-kernel/arm/LINUX_KERNEL_COPYING \ | $(ACP) - @echo Copying: $@ + @echo -e ${PRT_INS}"Copying:"${CL_RST}" $@" $(hide) mkdir -p $(dir $@) $(hide) $(ACP) $< $@ @@ -744,9 +787,18 @@ ifeq (,$(filter true, $(TARGET_NO_KERNEL) $(TARGET_NO_RECOVERY))) INSTALLED_RECOVERYIMAGE_TARGET := $(PRODUCT_OUT)/recovery.img -recovery_initrc := $(call include-path-for, recovery)/etc/init.rc +ifneq ($(TARGET_RECOVERY_INITRC),) + recovery_initrc := $(TARGET_RECOVERY_INITRC) # Use target specific init.rc +else + recovery_initrc := $(call include-path-for, recovery)/etc/init.rc +endif +ifneq ($(TARGET_PREBUILT_RECOVERY_KERNEL),) + recovery_kernel := $(TARGET_PREBUILT_RECOVERY_KERNEL) # Use prebuilt recovery kernel +else + recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system +endif +recovery_uncompressed_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.cpio recovery_sepolicy := $(call intermediates-dir-for,ETC,sepolicy.recovery)/sepolicy.recovery -recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img recovery_build_prop := $(INSTALLED_BUILD_PROP_TARGET) recovery_binary := $(call intermediates-dir-for,EXECUTABLES,recovery)/recovery @@ -779,6 +831,16 @@ else recovery_font := $(call include-path-for, recovery)/fonts/12x22.png endif +ifneq ($(TARGET_RECOVERY_DEVICE_DIRS),) +recovery_root_private := $(strip \ + $(foreach d,$(TARGET_RECOVERY_DEVICE_DIRS), $(wildcard $(d)/recovery/root))) +else +recovery_root_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/root)) +endif +ifneq ($(recovery_root_private),) +recovery_root_deps := $(shell find $(recovery_root_private) -type f) +endif + recovery_resources_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)) recovery_resource_deps := $(shell find $(recovery_resources_common) \ $(recovery_resources_private) -type f) @@ -815,6 +877,10 @@ ifdef BOARD_KERNEL_PAGESIZE INTERNAL_RECOVERYIMAGE_ARGS += --pagesize $(BOARD_KERNEL_PAGESIZE) endif +INTERNAL_RECOVERY_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \ + $(foreach module, $(ALL_MODULES), $(ALL_MODULES.$(module).INSTALLED)) \ + $(ALL_DEFAULT_INSTALLED_MODULES)) + # Keys authorized to sign OTA packages this build will accept. The # build always uses dev-keys for this; release packaging tools will # substitute other keys for this one. @@ -828,51 +894,75 @@ DUMPKEY_JAR := $(HOST_OUT_JAVA_LIBRARIES)/dumpkey.jar $(RECOVERY_INSTALL_OTA_KEYS): PRIVATE_OTA_PUBLIC_KEYS := $(OTA_PUBLIC_KEYS) $(RECOVERY_INSTALL_OTA_KEYS): extra_keys := $(patsubst %,%.x509.pem,$(PRODUCT_EXTRA_RECOVERY_KEYS)) $(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) $(extra_keys) - @echo "DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys)" + @echo -e ${PRT_INS}"DumpPublicKey: $@ <= $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys)"${CL_RST} @rm -rf $@ @mkdir -p $(dir $@) java -jar $(DUMPKEY_JAR) $(PRIVATE_OTA_PUBLIC_KEYS) $(extra_keys) > $@ -$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) \ +TARGET_RECOVERY_ROOT_TIMESTAMP := $(TARGET_RECOVERY_OUT)/root.ts + +$(TARGET_RECOVERY_ROOT_TIMESTAMP): $(INTERNAL_RECOVERY_FILES) \ $(INSTALLED_RAMDISK_TARGET) \ $(INSTALLED_BOOTIMAGE_TARGET) \ $(recovery_binary) \ $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \ $(INSTALLED_2NDBOOTLOADER_TARGET) \ - $(recovery_build_prop) $(recovery_resource_deps) \ + $(recovery_build_prop) $(recovery_resource_deps) $(recovery_root_deps) \ $(recovery_fstab) \ $(RECOVERY_INSTALL_OTA_KEYS) - @echo ----- Making recovery image ------ - $(hide) rm -rf $(TARGET_RECOVERY_OUT) + @echo -e ${PRT_IMG}"----- Making recovery filesystem ------"${CL_RST} $(hide) mkdir -p $(TARGET_RECOVERY_OUT) $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc $(TARGET_RECOVERY_ROOT_OUT)/tmp - @echo Copying baseline ramdisk... + @echo -e ${PRT_IMG}"Copying baseline ramdisk..."${CL_RST} $(hide) cp -R $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT) - @echo Modifying ramdisk contents... + @echo -e ${PRT_IMG}"Modifying ramdisk contents..."${CL_RST} $(hide) rm -f $(TARGET_RECOVERY_ROOT_OUT)/init*.rc $(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/ $(hide) rm -f $(TARGET_RECOVERY_ROOT_OUT)/sepolicy $(hide) cp -f $(recovery_sepolicy) $(TARGET_RECOVERY_ROOT_OUT)/sepolicy $(hide) -cp $(TARGET_ROOT_OUT)/init.recovery.*.rc $(TARGET_RECOVERY_ROOT_OUT)/ $(hide) cp -f $(recovery_binary) $(TARGET_RECOVERY_ROOT_OUT)/sbin/ + $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system/bin $(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res - $(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/* $(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res $(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png + $(hide) $(foreach item,$(recovery_root_private), \ + cp -rf $(item) $(TARGET_RECOVERY_OUT)/;) $(hide) $(foreach item,$(recovery_resources_private), \ - cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/) + cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/;) $(hide) $(foreach item,$(recovery_fstab), \ - cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.fstab) + cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.fstab;) $(hide) cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys $(hide) cat $(INSTALLED_DEFAULT_PROP_TARGET) $(recovery_build_prop) \ > $(TARGET_RECOVERY_ROOT_OUT)/default.prop - $(hide) $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk) + $(SED_INPLACE) 's/ro.build.date.utc=.*/ro.build.date.utc=0/g' $(TARGET_RECOVERY_ROOT_OUT)/default.prop + $(SED_INPLACE) 's/ro.adb.secure=1/ro.adb.secure=0/g' $(TARGET_RECOVERY_ROOT_OUT)/default.prop + @echo -e ${PRT_IMG}"----- Made recovery filesystem -------- $(TARGET_RECOVERY_ROOT_OUT)"${CL_RST} + @touch $(TARGET_RECOVERY_ROOT_TIMESTAMP) + +$(recovery_uncompressed_ramdisk): $(MINIGZIP) \ + $(TARGET_RECOVERY_ROOT_TIMESTAMP) + @echo -e ${PRT_IMG}"----- Making uncompressed recovery ramdisk ------"${CL_RST} + $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) > $@ + +$(recovery_ramdisk): $(MKBOOTFS) \ + $(recovery_uncompressed_ramdisk) + @echo -e ${PRT_IMG}"----- Making recovery ramdisk ------"${CL_RST} + $(MINIGZIP) < $(recovery_uncompressed_ramdisk) > $@ + +ifndef BOARD_CUSTOM_BOOTIMG_MK +$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) \ + $(recovery_ramdisk) \ + $(recovery_kernel) + @echo -e ${PRT_IMG}"----- Making recovery image ------"${CL_RST} $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@ + $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)) + @echo -e ${PRT_IMG}"----- Made recovery image: $@ --------"${CL_RST} +endif + ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VERITY)) $(BOOT_SIGNER) /recovery $@ $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VERITY_SIGNING_KEY).x509.pem $@ endif - $(hide) $(call assert-max-image-size,$@,$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)) - @echo ----- Made recovery image: $@ -------- $(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) $(hide) mkdir -p $(dir $@) @@ -899,6 +989,10 @@ else BOARD_NAND_SPARE_SIZE := 64 endif +ifdef BOARD_CUSTOM_BOOTIMG_MK +include $(BOARD_CUSTOM_BOOTIMG_MK) +endif + # ----------------------------------------------------------------- # system image # @@ -955,7 +1049,7 @@ endif # $(1): output file define build-systemimage-target - @echo "Target system fs image: $(1)" + @echo -e ${PRT_IMG}"Target system fs image: $(1)"${CL_RST} $(call create-system-vendor-symlink) @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, \ @@ -983,19 +1077,23 @@ SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT) # image size check calculation. ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch) +ifndef BOARD_CUSTOM_BOOTIMG_MK RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p +else +RECOVERY_FROM_BOOT_PATCH := +endif $(RECOVERY_FROM_BOOT_PATCH): $(INSTALLED_RECOVERYIMAGE_TARGET) \ $(INSTALLED_BOOTIMAGE_TARGET) \ $(HOST_OUT_EXECUTABLES)/imgdiff \ $(HOST_OUT_EXECUTABLES)/bsdiff - @echo "Construct recovery from boot" + @echo -e ${PRT_IMG}"Construct recovery from boot"${CL_RST} mkdir -p $(dir $@) PATH=$(HOST_OUT_EXECUTABLES):$$PATH $(HOST_OUT_EXECUTABLES)/imgdiff $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@ endif $(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH) | $(ACP) - @echo "Install system fs image: $@" + @echo -e ${PRT_IMG}"Install system fs image: $@"${CL_RST} $(copy-file-to-target) $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)) @@ -1004,7 +1102,7 @@ systemimage: $(INSTALLED_SYSTEMIMAGE) .PHONY: systemimage-nodeps snod systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \ | $(INTERNAL_USERIMAGES_DEPS) - @echo "make $@: ignoring dependencies" + @echo -e ${PRT_IMG}"make $@: ignoring dependencies"${CL_RST} $(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE)) $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)) @@ -1275,6 +1373,7 @@ OTATOOLS := $(DISTTOOLS) \ .PHONY: otatools otatools: $(OTATOOLS) + # ----------------------------------------------------------------- # A zip of the directories that map to the target filesystem. # This zip can be used to create an OTA package or filesystem image @@ -1336,7 +1435,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \ $(APKCERTS_FILE) \ $(HOST_OUT_EXECUTABLES)/fs_config \ | $(ACP) - @echo "Package target files: $@" + @echo -e ${PRT_HST}"Package target files: $@"${CL_RST} $(hide) rm -rf $@ $(zip_root) $(hide) mkdir -p $(dir $@) $(zip_root) @# Components of the recovery image @@ -1425,8 +1524,10 @@ endif ifdef PRODUCT_EXTRA_RECOVERY_KEYS $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt endif - $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $(zip_root)/META/misc_info.txt + $(hide) echo "mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)" >> $(zip_root)/META/misc_info.txt +ifneq ($(SKIP_SET_METADATA),true) $(hide) echo "use_set_metadata=1" >> $(zip_root)/META/misc_info.txt +endif $(hide) echo "multistage_support=1" >> $(zip_root)/META/misc_info.txt $(hide) echo "update_rename_support=1" >> $(zip_root)/META/misc_info.txt $(hide) echo "blockimgdiff_versions=1,2" >> $(zip_root)/META/misc_info.txt @@ -1435,7 +1536,7 @@ ifneq ($(OEM_THUMBPRINT_PROPERTIES),) $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt endif $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt) - $(hide) ./build/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root) +# $(hide) ./build/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root) @# Zip everything up, preserving symlinks $(hide) (cd $(zip_root) && zip -qry ../$(notdir $@) .) @# Run fs_config on all the system, vendor, boot ramdisk, @@ -1472,18 +1573,68 @@ INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip $(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR) +ifneq ($(CUSTOM_BUILD),) + $(INTERNAL_OTA_PACKAGE_TARGET): backuptool := true +else + $(INTERNAL_OTA_PACKAGE_TARGET): backuptool := false +endif + +ifeq ($(TARGET_OTA_ASSERT_DEVICE),) + $(INTERNAL_OTA_PACKAGE_TARGET): override_device := auto +else + $(INTERNAL_OTA_PACKAGE_TARGET): override_device := $(TARGET_OTA_ASSERT_DEVICE) +endif + +ifeq ($(TARGET_RELEASETOOL_OTA_FROM_TARGET_SCRIPT),) + OTA_FROM_TARGET_SCRIPT := ./build/tools/releasetools/ota_from_target_files +else + OTA_FROM_TARGET_SCRIPT := $(TARGET_RELEASETOOL_OTA_FROM_TARGET_SCRIPT) +endif + +ifeq ($(TARGET_UNIFIED_DEVICE),) + $(INTERNAL_OTA_PACKAGE_TARGET): override_prop := false +else + $(INTERNAL_OTA_PACKAGE_TARGET): override_prop := true + ifeq ($(TARGET_OTA_ASSERT_DEVICE),) + $(INTERNAL_OTA_PACKAGE_TARGET): override_device := $(TARGET_DEVICE) + endif +endif + +ifneq ($(TARGET_SETS_FSTAB),) + $(INTERNAL_OTA_PACKAGE_TARGET): mount_by_label := true +else + $(INTERNAL_OTA_PACKAGE_TARGET): mount_by_label := false +endif + $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(DISTTOOLS) - @echo "Package OTA: $@" - $(hide) MKBOOTIMG=$(MKBOOTIMG) \ - ./build/tools/releasetools/ota_from_target_files -v \ - --block \ + @echo -e ${PRT_HST}"Package OTA: $@"${CL_RST} + MKBOOTIMG=$(BOARD_CUSTOM_BOOTIMG_MK) \ + $(OTA_FROM_TARGET_SCRIPT) -v \ + $(if $(CUSTOM_BUILD),, --block) \ -p $(HOST_OUT) \ -k $(KEY_CERT_PAIR) \ + --backup=$(backuptool) \ + --override_device=$(override_device) \ + --override_prop=$(override_prop) \ + --mount_by_label=$(mount_by_label) \ $(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \ + $(TARGET_RELEASETOOL_OTA_FROM_TARGET_ADDITIONAL_ARGS) \ $(BUILT_TARGET_FILES_PACKAGE) $@ -.PHONY: otapackage +CUSTOM_TARGET_PACKAGE := $(PRODUCT_OUT)/omni-$(ROM_VERSION).zip + +.PHONY: otapackage bacon otapackage: $(INTERNAL_OTA_PACKAGE_TARGET) +bacon: otapackage + $(hide) ln -f $(INTERNAL_OTA_PACKAGE_TARGET) $(CUSTOM_TARGET_PACKAGE) + $(hide) $(MD5SUM) $(CUSTOM_TARGET_PACKAGE) > $(CUSTOM_TARGET_PACKAGE).md5sum +ifeq ($(USE_PREBUILT_CHROMIUM),1) +ifneq ($(PRODUCT_PREBUILT_WEBVIEWCHROMIUM),yes) + @echo "Running Chromium prebuilt setup script..." + $(hide) . $(TOPDIR)vendor/omni/utils/chromium_prebuilt.sh $(TOP) +endif +endif + @echo -e ${PRT_CPL}"Package complete: $(CUSTOM_TARGET_PACKAGE)"${CL_RST} endif # recovery_fstab is defined endif # TARGET_NO_KERNEL != true @@ -1501,10 +1652,24 @@ name := $(name)-img-$(FILE_NAME_TAG) INTERNAL_UPDATE_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip +ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),) +# default to common dir for device vendor +$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_DEVICE_DIR)/../common +else +$(INTERNAL_UPDATE_PACKAGE_TARGET): extensions := $(TARGET_RELEASETOOLS_EXTENSIONS) +endif + +ifeq ($(TARGET_RELEASETOOL_IMG_FROM_TARGET_SCRIPT),) + IMG_FROM_TARGET_SCRIPT := ./build/tools/releasetools/img_from_target_files +else + IMG_FROM_TARGET_SCRIPT := $(TARGET_RELEASETOOL_IMG_FROM_TARGET_SCRIPT) +endif + $(INTERNAL_UPDATE_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(DISTTOOLS) - @echo "Package: $@" - $(hide) MKBOOTIMG=$(MKBOOTIMG) \ - ./build/tools/releasetools/img_from_target_files -v \ + @echo -e ${PRT_HST}"Package:"${CL_RST}" $@" + $(hide) MKBOOTIMG=$(BOARD_CUSTOM_BOOTIMG_MK) \ + $(IMG_FROM_TARGET_SCRIPT) -v \ + -s $(extensions) \ -p $(HOST_OUT) \ $(BUILT_TARGET_FILES_PACKAGE) $@ @@ -1544,7 +1709,7 @@ name := $(name)-apps-$(FILE_NAME_TAG) APPS_ZIP := $(PRODUCT_OUT)/$(name).zip $(APPS_ZIP): $(INSTALLED_SYSTEMIMAGE) - @echo "Package apps: $@" + @echo -e ${PRT_HST}"Package apps:"${CL_RST}" $@" $(hide) rm -rf $@ $(hide) mkdir -p $(dir $@) $(hide) zip -qj $@ $(TARGET_OUT_APPS)/*/*.apk $(TARGET_OUT_APPS_PRIVILEGED)/*/*.apk @@ -1558,7 +1723,7 @@ ifeq (true,$(EMMA_INSTRUMENT)) EMMA_META_ZIP := $(PRODUCT_OUT)/emma_meta.zip # the dependency will be set up later in build/core/main.mk. $(EMMA_META_ZIP) : - @echo "Collecting Emma coverage meta files." + @echo -e ${PRT_HST}"Collecting Emma coverage meta files."${CL_RST}" $@" $(hide) find $(TARGET_COMMON_OUT_ROOT) $(HOST_COMMON_OUT_ROOT) -name "coverage.em" | \ zip -@ -q $@ @@ -1606,7 +1771,7 @@ name := $(TARGET_PRODUCT)-emulator-$(FILE_NAME_TAG) INTERNAL_EMULATOR_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip $(INTERNAL_EMULATOR_PACKAGE_TARGET): $(INTERNAL_EMULATOR_PACKAGE_FILES) - @echo "Package: $@" + @echo -e ${PRT_HST}"Package:"${CL_RST}" $@" $(hide) zip -qj $@ $(INTERNAL_EMULATOR_PACKAGE_FILES) endif @@ -1708,7 +1873,7 @@ $(INTERNAL_SDK_TARGET): PRIVATE_INPUT_FILES := $(sdk_atree_files) #SDK_GNU_ERROR := true $(INTERNAL_SDK_TARGET): $(deps) - @echo "Package SDK: $@" + @echo -e ${PRT_HST}"Package SDK:"${CL_RST}" $@" $(hide) rm -rf $(PRIVATE_DIR) $@ $(hide) for f in $(target_gnu_MODULES); do \ if [ -f $$f ]; then \ diff --git a/core/base_rules.mk b/core/base_rules.mk index dfed3ea52c5..7efa5c99e22 100644 --- a/core/base_rules.mk +++ b/core/base_rules.mk @@ -487,7 +487,7 @@ $(cleantarget) : PRIVATE_CLEAN_FILES := \ $(LOCAL_INSTALLED_MODULE) \ $(intermediates) $(cleantarget):: - @echo "Clean: $(PRIVATE_MODULE)" + @echo -e ${PRT_TGT}"Clean:"${CL_RST}" $(PRIVATE_MODULE)" $(hide) rm -rf $(PRIVATE_CLEAN_FILES) ########################################################### @@ -549,12 +549,12 @@ ifndef LOCAL_UNINSTALLABLE_MODULE $(LOCAL_INSTALLED_MODULE): PRIVATE_POST_INSTALL_CMD := $(LOCAL_POST_INSTALL_CMD) ifneq ($(LOCAL_ACP_UNAVAILABLE),true) $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) | $(ACP) - @echo "Install: $@" + @echo -e ${PRT_INS}"Install: $@"${CL_RST} $(copy-file-to-new-target) $(PRIVATE_POST_INSTALL_CMD) else $(LOCAL_INSTALLED_MODULE): $(LOCAL_BUILT_MODULE) - @echo "Install: $@" + @echo -e ${PRT_INSPRT_INSPRT_INSPRT_INSPRT_INSPRT_INSPRT_INSPRT_INSPRT_INSPRT_INS}"Install: $@"${CL_RST} $(copy-file-to-target-with-cp) endif diff --git a/core/binary.mk b/core/binary.mk index 1e313ffe42c..b0e1ca3801d 100644 --- a/core/binary.mk +++ b/core/binary.mk @@ -787,7 +787,7 @@ import_includes_deps := $(strip \ $(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \ $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(LOCAL_IS_HOST_MODULE),,$(LOCAL_2ND_ARCH_VAR_PREFIX))/export_includes)) $(import_includes) : $(import_includes_deps) - @echo Import includes file: $@ + @echo -e ${PRT_IMP}Import includes file:${CL_RST} $@ $(hide) mkdir -p $(dir $@) && rm -f $@ ifdef import_includes_deps $(hide) for f in $^; do \ @@ -818,6 +818,11 @@ normal_objects := \ all_objects := $(normal_objects) $(gen_o_objects) +## Allow a device's own headers to take precedence over global ones +ifneq ($(TARGET_SPECIFIC_HEADER_PATH),) +my_c_includes += $(TOPDIR)$(TARGET_SPECIFIC_HEADER_PATH) +endif + my_c_includes += $(TOPDIR)$(LOCAL_PATH) $(intermediates) $(generated_sources_dir) ifndef LOCAL_SDK_VERSION @@ -982,7 +987,7 @@ export_includes := $(intermediates)/export_includes $(export_includes): PRIVATE_EXPORT_C_INCLUDE_DIRS := $(LOCAL_EXPORT_C_INCLUDE_DIRS) # Make sure .pb.h are already generated before any dependent source files get compiled. $(export_includes) : $(LOCAL_MODULE_MAKEFILE) $(proto_generated_headers) - @echo Export includes file: $< -- $@ + @echo -e ${PRT_IMP}Export includes file:${CL_RST} $< -- $@ $(hide) mkdir -p $(dir $@) && rm -f $@ ifdef LOCAL_EXPORT_C_INCLUDE_DIRS $(hide) for d in $(PRIVATE_EXPORT_C_INCLUDE_DIRS); do \ diff --git a/core/build_id.mk b/core/build_id.mk index 00a691f85bd..62bf93dae60 100644 --- a/core/build_id.mk +++ b/core/build_id.mk @@ -18,4 +18,4 @@ # (like "CRB01"). It must be a single word, and is # capitalized by convention. -export BUILD_ID=LMP +export BUILD_ID=LYZ28N diff --git a/core/clang/HOST_x86_common.mk b/core/clang/HOST_x86_common.mk index 0241cb6636a..77547b79c69 100644 --- a/core/clang/HOST_x86_common.mk +++ b/core/clang/HOST_x86_common.mk @@ -8,6 +8,7 @@ ifeq ($(HOST_OS),linux) CLANG_CONFIG_x86_LINUX_HOST_EXTRA_ASFLAGS := \ --gcc-toolchain=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG) \ --sysroot=$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/sysroot \ + -B$($(clang_2nd_arch_prefix)HOST_TOOLCHAIN_FOR_CLANG)/x86_64-linux/bin \ -no-integrated-as CLANG_CONFIG_x86_LINUX_HOST_EXTRA_CFLAGS := \ diff --git a/core/cleanbuild.mk b/core/cleanbuild.mk index cf980d8e024..b68f29bb7a1 100644 --- a/core/cleanbuild.mk +++ b/core/cleanbuild.mk @@ -193,6 +193,7 @@ installclean_files := \ $(PRODUCT_OUT)/*.txt \ $(PRODUCT_OUT)/*.xlb \ $(PRODUCT_OUT)/*.zip \ + $(PRODUCT_OUT)/*.md5sum \ $(PRODUCT_OUT)/kernel \ $(PRODUCT_OUT)/data \ $(PRODUCT_OUT)/skin \ @@ -232,13 +233,13 @@ endif dataclean: FILES := $(dataclean_files) dataclean: $(hide) rm -rf $(FILES) - @echo "Deleted emulator userdata images." + @echo -e ${PRT_DEL}"Deleted emulator userdata images."${CL_RST} .PHONY: installclean installclean: FILES := $(installclean_files) installclean: dataclean $(hide) rm -rf $(FILES) - @echo "Deleted images and staging directories." + @echo -e ${PRT_DEL}"Deleted images and staging directories."${CL_RST} ifeq "$(force_installclean)" "true" $(info *** Forcing "make installclean"...) diff --git a/core/combo/TARGET_linux-arm.mk b/core/combo/TARGET_linux-arm.mk index df81cd52a31..841580916cc 100644 --- a/core/combo/TARGET_linux-arm.mk +++ b/core/combo/TARGET_linux-arm.mk @@ -92,10 +92,18 @@ ifeq ($(FORCE_ARM_DEBUGGING),true) $(combo_2nd_arch_prefix)TARGET_thumb_CFLAGS += -marm -fno-omit-frame-pointer endif +ifeq ($(TARGET_DISABLE_ARM_PIE),true) + PIE_GLOBAL_CFLAGS := + PIE_EXECUTABLE_TRANSFORM := +else + PIE_GLOBAL_CFLAGS := -fPIE + PIE_EXECUTABLE_TRANSFORM := -fPIE -pie +endif + android_config_h := $(call select-android-config-h,linux-arm) $(combo_2nd_arch_prefix)TARGET_GLOBAL_CFLAGS += \ - -msoft-float \ + -msoft-float -fpic $(PIE_GLOBAL_CFLAGS) \ -ffunction-sections \ -fdata-sections \ -funwind-tables \ @@ -218,7 +226,7 @@ $(hide) $(PRIVATE_CXX) \ endef define $(combo_2nd_arch_prefix)transform-o-to-executable-inner -$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic -pie \ +$(hide) $(PRIVATE_CXX) -nostdlib -Bdynamic $(PIE_EXECUTABLE_TRANSFORM) \ -Wl,-dynamic-linker,/system/bin/linker \ -Wl,--gc-sections \ -Wl,-z,nocopyreloc \ diff --git a/core/combo/arch/arm/armv6-vfp.mk b/core/combo/arch/arm/armv6-vfp.mk new file mode 100644 index 00000000000..a00a2d17fa0 --- /dev/null +++ b/core/combo/arch/arm/armv6-vfp.mk @@ -0,0 +1,30 @@ +# Configuration for Linux on ARM. +# Generating binaries for the ARMv6-VFP architecture and higher +# +ARCH_ARM_HAVE_THUMB_SUPPORT := true +ARCH_ARM_HAVE_FAST_INTERWORKING := true +ARCH_ARM_HAVE_64BIT_DATA := true +ARCH_ARM_HAVE_HALFWORD_MULTIPLY := true +ARCH_ARM_HAVE_CLZ := true +ARCH_ARM_HAVE_FFS := true +ARCH_ARM_HAVE_VFP := true + +ifeq ($(strip $(TARGET_ARCH_VARIANT_FPU)),) +TARGET_ARCH_VARIANT_FPU := vfp +endif +ifeq ($(strip $(TARGET_ARCH_VARIANT_CPU)),) +TARGET_ARCH_VARIANT_CPU := arm1136jf-s +endif + +# Note: Hard coding the 'tune' value here is probably not ideal, +# and a better solution should be found in the future. +# +arch_variant_cflags := \ + -mcpu=$(TARGET_ARCH_VARIANT_CPU) \ + -mfloat-abi=softfp \ + -mfpu=$(TARGET_ARCH_VARIANT_FPU) \ + -D__ARM_ARCH_5__ \ + -D__ARM_ARCH_5T__ \ + -D__ARM_ARCH_5E__ \ + -D__ARM_ARCH_5TE__ + diff --git a/core/combo/arch/arm/armv6j.mk b/core/combo/arch/arm/armv6j.mk new file mode 100644 index 00000000000..beca884b99e --- /dev/null +++ b/core/combo/arch/arm/armv6j.mk @@ -0,0 +1,22 @@ +# Configuration for Linux on ARM. +# Generating binaries for the ARMv6J architecture and higher +# +ARCH_ARM_HAVE_THUMB_SUPPORT := true +ARCH_ARM_HAVE_FAST_INTERWORKING := true +ARCH_ARM_HAVE_64BIT_DATA := true +ARCH_ARM_HAVE_HALFWORD_MULTIPLY := true +ARCH_ARM_HAVE_CLZ := true +ARCH_ARM_HAVE_FFS := true + +# Note: Hard coding the 'tune' value here is probably not ideal, +# and a better solution should be found in the future. +# +arch_variant_cflags := \ + -march=armv6j \ + -mtune=arm1136jf-s \ + -pipe \ + -fomit-frame-pointer \ + -D__ARM_ARCH_5__ \ + -D__ARM_ARCH_5T__ \ + -D__ARM_ARCH_5E__ \ + -D__ARM_ARCH_5TE__ diff --git a/core/combo/arch/arm/armv7-a-neon.mk b/core/combo/arch/arm/armv7-a-neon.mk index c6603db4042..a4196338174 100644 --- a/core/combo/arch/arm/armv7-a-neon.mk +++ b/core/combo/arch/arm/armv7-a-neon.mk @@ -2,6 +2,7 @@ # Generating binaries for the ARMv7-a architecture and higher with NEON # ARCH_ARM_HAVE_ARMV7A := true +ARCH_ARM_HAVE_TLS_REGISTER := true ARCH_ARM_HAVE_VFP := true ARCH_ARM_HAVE_VFP_D32 := true ARCH_ARM_HAVE_NEON := true @@ -14,11 +15,23 @@ ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a8) else ifeq ($(strip $(TARGET_$(combo_2nd_arch_prefix)CPU_VARIANT)),cortex-a7) arch_variant_cflags := -mcpu=cortex-a7 +else +ifeq ($(strip $(TARGET_CPU_VARIANT)),cortex-a5) + arch_variant_cflags := -mcpu=cortex-a5 +else +ifeq ($(strip $(TARGET_CPU_VARIANT)),krait) + arch_variant_cflags := -mcpu=cortex-a9 +else +ifeq ($(strip $(TARGET_CPU_VARIANT)),scorpion) + arch_variant_cflags := -mcpu=cortex-a8 else arch_variant_cflags := -march=armv7-a endif endif endif +endif +endif +endif arch_variant_cflags += \ -mfloat-abi=softfp \ diff --git a/core/combo/arch/arm/armv7-a.mk b/core/combo/arch/arm/armv7-a.mk index 4a519770f5a..2ed1a237c62 100644 --- a/core/combo/arch/arm/armv7-a.mk +++ b/core/combo/arch/arm/armv7-a.mk @@ -2,6 +2,7 @@ # Generating binaries for the ARMv7-a architecture and higher # ARCH_ARM_HAVE_ARMV7A := true +ARCH_ARM_HAVE_TLS_REGISTER := true ARCH_ARM_HAVE_VFP := true # Note: Hard coding the 'tune' value here is probably not ideal, diff --git a/core/combo/select.mk b/core/combo/select.mk index d495c6ff1dd..d66156c16cd 100644 --- a/core/combo/select.mk +++ b/core/combo/select.mk @@ -80,7 +80,9 @@ ifneq ($(USE_CCACHE),) # We don't really use system headers much so the rootdir is # fine; ensures these paths are relative for all Android trees # on a workstation. - export CCACHE_BASEDIR := / + ifeq ($(CCACHE_BASEDIR),) + export CCACHE_BASEDIR := $(ANDROID_BUILD_TOP) + endif # Workaround for ccache with clang. # See http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html diff --git a/core/config.mk b/core/config.mk index bfa5610ddb1..23305796899 100644 --- a/core/config.mk +++ b/core/config.mk @@ -44,8 +44,8 @@ SRC_HEADERS := \ $(TOPDIR)libnativehelper/include \ $(TOPDIR)frameworks/native/include \ $(TOPDIR)frameworks/native/opengl/include \ - $(TOPDIR)frameworks/av/include \ $(TOPDIR)frameworks/base/include + SRC_HOST_HEADERS:=$(TOPDIR)tools/include SRC_LIBRARIES:= $(TOPDIR)libs SRC_SERVERS:= $(TOPDIR)servers @@ -383,7 +383,11 @@ AIDL := $(HOST_OUT_EXECUTABLES)/aidl$(HOST_EXECUTABLE_SUFFIX) PROTOC := $(HOST_OUT_EXECUTABLES)/aprotoc$(HOST_EXECUTABLE_SUFFIX) SIGNAPK_JAR := $(HOST_OUT_JAVA_LIBRARIES)/signapk$(COMMON_JAVA_PACKAGE_SUFFIX) MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX) +ifeq ($(BOARD_NEEDS_LZMA_MINIGZIP),true) +MINIGZIP := /usr/bin/lzma +else MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX) +endif ifeq (,$(strip $(BOARD_CUSTOM_MKBOOTIMG))) MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX) else @@ -468,6 +472,18 @@ else MD5SUM:=md5sum endif +# In-place sed is done different in linux than OS X +ifeq ($(HOST_OS),darwin) +GSED:=$(shell which gsed) +ifeq ($(GSED),) +SED_INPLACE:=sed -i '' +else +SED_INPLACE:=gsed -i +endif +else +SED_INPLACE:=sed -i +endif + APICHECK_CLASSPATH := $(HOST_JDK_TOOLS_JAR) APICHECK_CLASSPATH := $(APICHECK_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX) APICHECK_CLASSPATH := $(APICHECK_CLASSPATH):$(HOST_OUT_JAVA_LIBRARIES)/jsilver$(COMMON_JAVA_PACKAGE_SUFFIX) @@ -500,9 +516,19 @@ HOST_GLOBAL_LD_DIRS += -L$(HOST_OUT_INTERMEDIATE_LIBRARIES) TARGET_GLOBAL_LD_DIRS += -L$(TARGET_OUT_INTERMEDIATE_LIBRARIES) HOST_PROJECT_INCLUDES:= $(SRC_HEADERS) $(SRC_HOST_HEADERS) $(HOST_OUT_HEADERS) + +ifeq ($(BOARD_USES_QCOM_HARDWARE),true) +TARGET_AV_HEADERS := \ + frameworks/av-caf/include +else +TARGET_AV_HEADERS := \ + frameworks/av/include +endif + TARGET_PROJECT_INCLUDES:= $(SRC_HEADERS) $(TARGET_OUT_HEADERS) \ $(TARGET_DEVICE_KERNEL_HEADERS) $(TARGET_BOARD_KERNEL_HEADERS) \ - $(TARGET_PRODUCT_KERNEL_HEADERS) + $(TARGET_PRODUCT_KERNEL_HEADERS) $(TARGET_AV_HEADERS) + # Many host compilers don't support these flags, so we have to make # sure to only specify them for the target compilers checked in to @@ -616,4 +642,13 @@ RS_PREBUILT_CLCORE := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/librsrt_$(TA RS_PREBUILT_LIBPATH := -L prebuilts/ndk/8/platforms/android-9/arch-$(TARGET_ARCH)/usr/lib RS_PREBUILT_COMPILER_RT := prebuilts/sdk/renderscript/lib/$(TARGET_ARCH)/libcompiler_rt.a +# Rules for QCOM targets +include $(BUILD_SYSTEM)/qcom_target.mk + +ifneq ($(CUSTOM_BUILD),) +## We need to be sure the global selinux policies are included +## last, to avoid accidental resetting by device configs +$(eval include vendor/omni/sepolicy/sepolicy.mk) +endif + include $(BUILD_SYSTEM)/dumpvar.mk diff --git a/core/definitions.mk b/core/definitions.mk index 57fc434c21d..01817fce624 100644 --- a/core/definitions.mk +++ b/core/definitions.mk @@ -971,7 +971,7 @@ endef define transform-cpp-to-o @mkdir -p $(dir $@) -@echo "target $(PRIVATE_ARM_MODE) C++: $(PRIVATE_MODULE) <= $<" +@echo -e ${PRT_TGT}"target $(PRIVATE_ARM_MODE) C++:"${CL_RST}" $(PRIVATE_MODULE) <= $<" $(hide) $(PRIVATE_CXX) \ $(addprefix -I , $(PRIVATE_C_INCLUDES)) \ $(shell cat $(PRIVATE_IMPORT_INCLUDES)) \ @@ -1020,12 +1020,12 @@ $(hide) $(PRIVATE_CC) \ endef define transform-c-to-o-no-deps -@echo "target $(PRIVATE_ARM_MODE) C: $(PRIVATE_MODULE) <= $<" +@echo -e ${PRT_TGT}"target $(PRIVATE_ARM_MODE) C:"${CL_RST}" $(PRIVATE_MODULE) <= $<" $(call transform-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_CONLYFLAGS) $(PRIVATE_DEBUG_CFLAGS)) endef define transform-s-to-o-no-deps -@echo "target asm: $(PRIVATE_MODULE) <= $<" +@echo -e ${PRT_TGT}"target asm:"${CL_RST}" $(PRIVATE_MODULE) <= $<" $(call transform-c-or-s-to-o-no-deps, $(PRIVATE_ASFLAGS)) endef @@ -1056,7 +1056,7 @@ endef ########################################################### define transform-m-to-o-no-deps -@echo "target ObjC: $(PRIVATE_MODULE) <= $<" +@echo -e ${PRT_TGT}"target ObjC:"${CL_RST}" $(PRIVATE_MODULE) <= $<" $(call transform-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_DEBUG_CFLAGS)) endef @@ -1071,7 +1071,7 @@ endef define transform-host-cpp-to-o @mkdir -p $(dir $@) -@echo "host C++: $(PRIVATE_MODULE) <= $<" +@echo -e ${PRT_HST}"host C++:"${CL_RST}" $(PRIVATE_MODULE) <= $<" $(hide) $(PRIVATE_CXX) \ $(addprefix -I , $(PRIVATE_C_INCLUDES)) \ $(shell cat $(PRIVATE_IMPORT_INCLUDES)) \ @@ -1117,12 +1117,12 @@ $(hide) $(PRIVATE_CC) \ endef define transform-host-c-to-o-no-deps -@echo "host C: $(PRIVATE_MODULE) <= $<" +@echo -e ${PRT_HST}"host C:"${CL_RST}" $(PRIVATE_MODULE) <= $<" $(call transform-host-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_CONLYFLAGS) $(PRIVATE_DEBUG_CFLAGS)) endef define transform-host-s-to-o-no-deps -@echo "host asm: $(PRIVATE_MODULE) <= $<" +@echo -e ${PRT_HST}"host asm:"${CL_RST}" $(PRIVATE_MODULE) <= $<" $(call transform-host-c-or-s-to-o-no-deps, $(PRIVATE_ASFLAGS)) endef @@ -1141,7 +1141,7 @@ endef ########################################################### define transform-host-m-to-o-no-deps -@echo "host ObjC: $(PRIVATE_MODULE) <= $<" +@echo -e ${PRT_HST}"host ObjC:"${CL_RST}" $(PRIVATE_MODULE) <= $<" $(call transform-host-c-or-s-to-o-no-deps, $(PRIVATE_CFLAGS) $(PRIVATE_DEBUG_CFLAGS)) endef @@ -1176,7 +1176,7 @@ endef # $(1): the full path of the source static library. define _extract-and-include-single-target-whole-static-lib -@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(1)]" +@echo -e ${PRT_HST}"preparing StaticLib:"${CL_RST}" $(PRIVATE_MODULE) [including $(1)]" $(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;\ rm -rf $$ldir; \ mkdir -p $$ldir; \ @@ -1201,7 +1201,7 @@ define transform-o-to-static-lib @mkdir -p $(dir $@) @rm -f $@ $(extract-and-include-target-whole-static-libs) -@echo "target StaticLib: $(PRIVATE_MODULE) ($@)" +@echo -e ${PRT_TGT}"target StaticLib:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(call split-long-arguments,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_AR) \ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)TARGET_GLOBAL_ARFLAGS) \ $(PRIVATE_ARFLAGS) $@,$(filter %.o, $^)) @@ -1213,7 +1213,7 @@ endef # $(1): the full path of the source static library. define _extract-and-include-single-host-whole-static-lib -@echo "preparing StaticLib: $(PRIVATE_MODULE) [including $(1)]" +@echo -e ${PRT_HST}"preparing StaticLib:"${CL_RST}" $(PRIVATE_MODULE) [including $(1)]" $(hide) ldir=$(PRIVATE_INTERMEDIATES_DIR)/WHOLE/$(basename $(notdir $(1)))_objs;\ rm -rf $$ldir; \ mkdir -p $$ldir; \ @@ -1238,7 +1238,7 @@ define transform-host-o-to-static-lib @mkdir -p $(dir $@) @rm -f $@ $(extract-and-include-host-whole-static-libs) -@echo "host StaticLib: $(PRIVATE_MODULE) ($@)" +@echo -e ${PRT_HST}"host StaticLib:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(call split-long-arguments,$($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_AR) \ $($(PRIVATE_2ND_ARCH_VAR_PREFIX)HOST_GLOBAL_ARFLAGS) \ $(PRIVATE_ARFLAGS) $@,$(filter %.o, $^)) @@ -1277,13 +1277,13 @@ endif define transform-host-o-to-shared-lib @mkdir -p $(dir $@) -@echo "host SharedLib: $(PRIVATE_MODULE) ($@)" +@echo -e ${PRT_HST}"host SharedLib:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(transform-host-o-to-shared-lib-inner) endef define transform-host-o-to-package @mkdir -p $(dir $@) -@echo "host Package: $(PRIVATE_MODULE) ($@)" +@echo -e ${PRT_HST}"host Package:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(transform-host-o-to-shared-lib-inner) endef @@ -1327,7 +1327,7 @@ endif define transform-o-to-shared-lib @mkdir -p $(dir $@) -@echo "target SharedLib: $(PRIVATE_MODULE) ($@)" +@echo -e ${PRT_TGT}"target SharedLib:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $($(PRIVATE_2ND_ARCH_VAR_PREFIX)transform-o-to-shared-lib-inner) endef @@ -1343,13 +1343,13 @@ endif define transform-to-stripped @mkdir -p $(dir $@) -@echo "target Strip: $(PRIVATE_MODULE) ($@)" +@echo -e ${PRT_TGT}"target Strip:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(hide) $(PRIVATE_STRIP) --strip-all $< -o $@ $(TARGET_STRIP_EXTRA) endef define transform-to-stripped-keep-symbols @mkdir -p $(dir $@) -@echo "target Strip (keep symbols): $(PRIVATE_MODULE) ($@)" +@echo -e ${PRT_TGT}"target Strip (keep symbols):"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(hide) $(PRIVATE_OBJCOPY) \ `$(PRIVATE_READELF) -S $< | awk '/.debug_/ {print "-R " $$2}' | xargs` \ $(TARGET_STRIP_KEEP_SYMBOLS_EXTRA) $< $@ @@ -1383,7 +1383,7 @@ endif define transform-o-to-executable @mkdir -p $(dir $@) -@echo "target Executable: $(PRIVATE_MODULE) ($@)" +@echo -e ${PRT_TGT}"target Executable:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $($(PRIVATE_2ND_ARCH_VAR_PREFIX)transform-o-to-executable-inner) endef @@ -1402,7 +1402,7 @@ endif define transform-o-to-static-executable @mkdir -p $(dir $@) -@echo "target StaticExecutable: $(PRIVATE_MODULE) ($@)" +@echo -e ${PRT_TGT}"target StaticExecutable:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $($(PRIVATE_2ND_ARCH_VAR_PREFIX)transform-o-to-static-executable-inner) endef @@ -1446,7 +1446,7 @@ endif define transform-host-o-to-executable @mkdir -p $(dir $@) -@echo "host Executable: $(PRIVATE_MODULE) ($@)" +@echo -e ${PRT_HST}"host Executable:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(transform-host-o-to-executable-inner) endef @@ -1587,7 +1587,11 @@ $(hide) if [ -s $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq ] ; the -extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) \ $(PRIVATE_JAVACFLAGS) \ \@$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq \ - || ( rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR) ; exit 41 ) \ + 2>$(PRIVATE_CLASS_INTERMEDIATES_DIR)/stderr \ + && rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/stderr \ + || ( if [ -e $(PRIVATE_CLASS_INTERMEDIATES_DIR)/stderr ]; then \ + echo -e ${CL_RED}"`cat $(PRIVATE_CLASS_INTERMEDIATES_DIR)/stderr`"${CL_RST} 1>&2; \ + fi; rm -rf $(PRIVATE_CLASS_INTERMEDIATES_DIR); exit 41 ) \ fi $(if $(PRIVATE_JAVA_LAYERS_FILE), $(hide) build/tools/java-layers.py \ $(PRIVATE_JAVA_LAYERS_FILE) \@$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq,) @@ -1615,7 +1619,7 @@ $(if $(PRIVATE_JAR_MANIFEST), \ endef define transform-java-to-classes.jar -@echo "target Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))" +@echo -e ${PRT_TGT}"target Java:"${CL_RST}" $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))" $(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH)) endef @@ -1635,7 +1639,7 @@ $(hide) if [ -e $(PRIVATE_CLASS_INTERMEDIATES_DIR)/stamp ] ; then \ fi $(hide) tr ' ' '\n' < $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list \ | sort -u > $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq -@echo "(Incremental) build source files:" +@echo -e ${PRT_HST}"(Incremental) build source files:"${CL_RST}" @cat $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq $(hide) if [ -s $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq ] ; then \ $(1) -encoding UTF-8 \ @@ -1648,7 +1652,11 @@ $(hide) if [ -s $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq ] ; the -extdirs "" -d $(PRIVATE_CLASS_INTERMEDIATES_DIR) \ $(PRIVATE_JAVACFLAGS) \ \@$(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq \ - || ( exit 41 ) \ + 2>$(PRIVATE_CLASS_INTERMEDIATES_DIR)/stderr \ + && rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/stderr \ + || ( if [ -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/stderr ]; then \ + echo -e ${CL_RED}"`cat $(PRIVATE_CLASS_INTERMEDIATES_DIR)/stderr`"${CL_RST} 1>&2; \ + fi; exit 41 ) \ fi $(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list $(hide) rm -f $(PRIVATE_CLASS_INTERMEDIATES_DIR)/java-source-list-uniq @@ -1676,7 +1684,7 @@ $(hide) mv $(PRIVATE_CLASS_INTERMEDIATES_DIR)/newstamp $(PRIVATE_CLASS_INTERMEDI endef define transform-java-to-classes.jar -@echo "target Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))" +@echo -e ${PRT_TGT}"target Java:"${CL_RST}" $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))" $(call compile-java,$(TARGET_JAVAC),$(PRIVATE_BOOTCLASSPATH)) endef endif # ENABLE_INCREMENTALJAVAC @@ -1691,7 +1699,7 @@ endef # only core.jar and framework.jar need a heap this big. # Avoid the memory arguments on Windows, dx fails to load for some reason with them. define transform-classes.jar-to-dex -@echo "target Dex: $(PRIVATE_MODULE)" +@echo -e ${PRT_TGT}"target Dex:"${CL_RST}" $(PRIVATE_MODULE)" @mkdir -p $(dir $@) $(hide) rm -f $(dir $@)classes*.dex $(hide) $(DX) \ @@ -1829,7 +1837,7 @@ endef # Note: we intentionally don't clean PRIVATE_CLASS_INTERMEDIATES_DIR # in transform-java-to-classes for the sake of vm-tests. define transform-host-java-to-package -@echo "host Java: $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))" +@echo -e ${PRT_HST}"host Java:"${CL_RST}" $(PRIVATE_MODULE) ($(PRIVATE_CLASS_INTERMEDIATES_DIR))" $(call compile-java,$(HOST_JAVAC),$(PRIVATE_BOOTCLASSPATH)) $(if $(PRIVATE_EXTRA_JAR_ARGS), $(call add-java-resources-to-package)) endef @@ -1843,7 +1851,7 @@ endef # $(2): destination header define copy-one-header $(2): $(1) - @echo "Header: $$@" + @echo -e ${PRT_INS}"Header:"${CL_RST}" $$@" $$(copy-file-to-new-target-with-cp) endef @@ -1852,7 +1860,7 @@ endef # $(2): destination file define copy-one-file $(2): $(1) | $(ACP) - @echo "Copy: $$@" + @echo -e ${PRT_INS}"Copy:"${CL_RST}" $$@" $$(copy-file-to-target) endef @@ -1873,7 +1881,7 @@ endef # $(2): destination file, must end with .xml. define copy-xml-file-checked $(2): $(1) | $(ACP) - @echo "Copy xml: $$@" + @echo -e ${PRT_INS}"Copy xml:"${CL_RST}" $$@" $(hide) xmllint $$< >/dev/null # Don't print the xml file to stdout. $$(copy-file-to-target) endef @@ -1931,19 +1939,19 @@ endef # Copy a prebuilt file to a target location. define transform-prebuilt-to-target -@echo "$(if $(PRIVATE_IS_HOST_MODULE),host,target) Prebuilt: $(PRIVATE_MODULE) ($@)" +@echo -e "$(if $(PRIVATE_IS_HOST_MODULE),host,target) "${PRT_INS}"Prebuilt:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(copy-file-to-target) endef # Copy a prebuilt file to a target location, using zipalign on it. define transform-prebuilt-to-target-with-zipalign -@echo "$(if $(PRIVATE_IS_HOST_MODULE),host,target) Prebuilt APK: $(PRIVATE_MODULE) ($@)" +@echo "$(if $(PRIVATE_IS_HOST_MODULE),host,target) "${PRT_INS}"Prebuilt APK:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(copy-file-to-target-with-zipalign) endef # Copy a prebuilt file to a target location, stripping "# comment" comments. define transform-prebuilt-to-target-strip-comments -@echo "$(if $(PRIVATE_IS_HOST_MODULE),host,target) Prebuilt: $(PRIVATE_MODULE) ($@)" +@echo "$(if $(PRIVATE_IS_HOST_MODULE),host,target) "${PRT_INS}"Prebuilt:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(copy-file-to-target-strip-comments) endef @@ -1978,7 +1986,7 @@ endif ## Commands to call Proguard ########################################################### define transform-jar-to-proguard -@echo Proguard: $@ +@echo -e ${CL_GRN}"Proguard:"${CL_RST}" $@" $(hide) $(PROGUARD) -injars $< -outjars $@ $(PRIVATE_PROGUARD_FLAGS) \ $(addprefix -injars , $(PRIVATE_EXTRA_INPUT_JAR)) endef @@ -1988,7 +1996,7 @@ endef ########################################################### define transform-generated-source -@echo "target Generated: $(PRIVATE_MODULE) <= $<" +@echo -e ${PRT_TGT}"target Generated:"${CL_RST}" $(PRIVATE_MODULE) <= $<" @mkdir -p $(dir $@) $(hide) $(PRIVATE_CUSTOM_TOOL) endef diff --git a/core/distdir.mk b/core/distdir.mk index 51ec46efeff..6c12751182e 100644 --- a/core/distdir.mk +++ b/core/distdir.mk @@ -37,7 +37,7 @@ ifdef dist_goal define copy-one-dist-file $(3): $(2) $(2): $(1) - @echo "Dist: $$@" + @echo -e ${PRT_HST}"Dist:"${CL_RST}" $$@" $$(copy-file-to-new-target-with-cp) endef diff --git a/core/droiddoc.mk b/core/droiddoc.mk index d3e61d57c5b..a6513aff516 100644 --- a/core/droiddoc.mk +++ b/core/droiddoc.mk @@ -155,11 +155,14 @@ endif $(full_target): PRIVATE_LOCAL_PATH := $(LOCAL_PATH) $(full_target): $(full_src_files) $(droiddoc_templates) $(droiddoc) $(html_dir_files) $(full_java_lib_deps) $(LOCAL_ADDITIONAL_DEPENDENCIES) - @echo Docs droiddoc: $(PRIVATE_OUT_DIR) + @echo -e ${PRT_HST}"Docs droiddoc:"${CL_RST}" $(PRIVATE_OUT_DIR)" $(hide) mkdir -p $(dir $@) $(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \ $(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR)) $(hide) ( \ + head -1 $(PRIVATE_SRC_LIST_FILE) | tr " " "\n" | sort | uniq | tr "\n" " " > $(PRIVATE_SRC_LIST_FILE)_temp; \ + cat $(PRIVATE_SRC_LIST_FILE) | sed '1 d' >> $(PRIVATE_SRC_LIST_FILE)_temp; \ + mv $(PRIVATE_SRC_LIST_FILE)_temp $(PRIVATE_SRC_LIST_FILE); \ javadoc \ -encoding UTF-8 \ \@$(PRIVATE_SRC_LIST_FILE) \ @@ -190,11 +193,14 @@ else ## ## $(full_target): $(full_src_files) $(full_java_lib_deps) - @echo Docs javadoc: $(PRIVATE_OUT_DIR) + @echo -e ${PRT_HST}"Docs javadoc:"${CL_RST}" $(PRIVATE_OUT_DIR)" @mkdir -p $(dir $@) $(call prepare-doc-source-list,$(PRIVATE_SRC_LIST_FILE),$(PRIVATE_JAVA_FILES), \ $(PRIVATE_SOURCE_INTERMEDIATES_DIR) $(PRIVATE_ADDITIONAL_JAVA_DIR)) $(hide) ( \ + head -1 $(PRIVATE_SRC_LIST_FILE) | tr " " "\n" | sort | uniq | tr "\n" " " > $(PRIVATE_SRC_LIST_FILE)_temp; \ + cat $(PRIVATE_SRC_LIST_FILE) | sed '1 d' >> $(PRIVATE_SRC_LIST_FILE)_temp; \ + mv $(PRIVATE_SRC_LIST_FILE)_temp $(PRIVATE_SRC_LIST_FILE); \ javadoc \ -encoding UTF-8 \ $(PRIVATE_DROIDDOC_OPTIONS) \ @@ -230,7 +236,7 @@ ifeq ($(strip $(LOCAL_UNINSTALLABLE_MODULE)),) out_zip := $(OUT_DOCS)/$(LOCAL_MODULE)-docs.zip $(out_zip): PRIVATE_DOCS_DIR := $(out_dir) $(out_zip): $(full_target) - @echo Package docs: $@ + @echo -e ${PRT_HST}"Package docs:"${CL_RST}" $@" @rm -f $@ @mkdir -p $(dir $@) $(hide) ( F=$$(pwd)/$@ ; cd $(PRIVATE_DOCS_DIR) && zip -rq $$F * ) diff --git a/core/dynamic_binary.mk b/core/dynamic_binary.mk index 08fb176008f..dbcd3434db3 100644 --- a/core/dynamic_binary.mk +++ b/core/dynamic_binary.mk @@ -55,7 +55,7 @@ compress_output := $(intermediates)/COMPRESSED-$(my_built_module_stem) #TODO: define a rule to build TARGET_SYMBOL_FILTER_FILE, and # make it depend on ALL_ORIGINAL_DYNAMIC_BINARIES. $(compress_output): $(compress_input) $(TARGET_SYMBOL_FILTER_FILE) | $(ACP) - @echo "target Compress Symbols: $(PRIVATE_MODULE) ($@)" + @echo -e ${PRT_TGT}"target Compress Symbols:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(copy-file-to-target) else # Skip this step. @@ -73,7 +73,7 @@ endif symbolic_input := $(compress_output) symbolic_output := $(my_unstripped_path)/$(my_installed_module_stem) $(symbolic_output) : $(symbolic_input) | $(ACP) - @echo "target Symbolic: $(PRIVATE_MODULE) ($@)" + @echo -e ${PRT_TGT}"target Symbolic:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(copy-file-to-target) @@ -119,11 +119,11 @@ else # use cp(1) instead. ifneq ($(LOCAL_ACP_UNAVAILABLE),true) $(strip_output): $(strip_input) | $(ACP) - @echo "target Unstripped: $(PRIVATE_MODULE) ($@)" + @echo -e ${PRT_TGT}"target Unstripped:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(copy-file-to-target) else $(strip_output): $(strip_input) - @echo "target Unstripped: $(PRIVATE_MODULE) ($@)" + @echo -e ${PRT_TGT}"target Unstripped:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(copy-file-to-target-with-cp) endif endif diff --git a/core/envsetup.mk b/core/envsetup.mk index ad78be333a7..6ada5efb913 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -200,8 +200,12 @@ endif ifeq (,$(strip $(OUT_DIR))) ifeq (,$(strip $(OUT_DIR_COMMON_BASE))) +ifneq ($(TOPDIR),) OUT_DIR := $(TOPDIR)out else +OUT_DIR := $(shell python -c 'import os,sys; print os.path.realpath(sys.argv[1])' .)/out +endif +else OUT_DIR := $(OUT_DIR_COMMON_BASE)/$(notdir $(PWD)) endif endif diff --git a/core/java.mk b/core/java.mk index a969254677a..07e5cf1203a 100644 --- a/core/java.mk +++ b/core/java.mk @@ -316,7 +316,7 @@ ifdef full_classes_jar # PRIVATE_ vars to be preserved. $(full_classes_stubs_jar): PRIVATE_SOURCE_FILE := $(full_classes_jar) $(full_classes_stubs_jar) : $(LOCAL_BUILT_MODULE) | $(ACP) - @echo Copying $(PRIVATE_SOURCE_FILE) + @echo -e ${PRT_TGT}"Copying"${CL_RST}" $(PRIVATE_SOURCE_FILE)" $(hide) $(ACP) -fp $(PRIVATE_SOURCE_FILE) $@ ALL_MODULES.$(LOCAL_MODULE).STUBS := $(full_classes_stubs_jar) @@ -351,11 +351,11 @@ $(full_classes_compiled_jar): PRIVATE_JAVAC_DEBUG_FLAGS := -g ifneq ($(strip $(LOCAL_JARJAR_RULES)),) $(full_classes_jarjar_jar): PRIVATE_JARJAR_RULES := $(LOCAL_JARJAR_RULES) $(full_classes_jarjar_jar): $(full_classes_compiled_jar) $(LOCAL_JARJAR_RULES) | $(JARJAR) - @echo JarJar: $@ + @echo -e ${PRT_TGT}"JarJar:"${CL_RST}" $@" $(hide) java -jar $(JARJAR) process $(PRIVATE_JARJAR_RULES) $< $@ else $(full_classes_jarjar_jar): $(full_classes_compiled_jar) | $(ACP) - @echo Copying: $@ + @echo -e ${PRT_TGT}"Copying:"${CL_RST}" $@" $(hide) $(ACP) -fp $< $@ endif @@ -378,13 +378,13 @@ $(full_classes_emma_jar): $(full_classes_jarjar_jar) | $(EMMA_JAR) else $(full_classes_emma_jar): $(full_classes_jarjar_jar) | $(ACP) - @echo Copying: $@ + @echo -e ${PRT_TGT}"Copying:"${CL_RST}" $@" $(copy-file-to-target) endif # Keep a copy of the jar just before proguard processing. $(full_classes_jar): $(full_classes_emma_jar) | $(ACP) - @echo Copying: $@ + @echo -e ${PRT_TGT}"Copying:"${CL_RST}" $@" $(hide) $(ACP) -fp $< $@ # Run proguard if necessary, otherwise just copy the file. @@ -483,7 +483,7 @@ endif $(built_dex_intermediate): $(full_classes_proguard_jar) $(DX) $(transform-classes.jar-to-dex) $(built_dex): $(built_dex_intermediate) | $(ACP) - @echo Copying: $@ + @echo -e ${PRT_TGT}"Copying:"${CL_RST}" $@" $(hide) mkdir -p $(dir $@) $(hide) rm -f $(dir $@)/classes*.dex $(hide) $(ACP) -fp $(dir $<)/classes*.dex $(dir $@) diff --git a/core/java_library.mk b/core/java_library.mk index dffc7d90aad..ac71308e25d 100644 --- a/core/java_library.mk +++ b/core/java_library.mk @@ -56,7 +56,7 @@ $(common_javalib.jar) : $(full_classes_proguard_jar) else $(common_javalib.jar) : $(full_classes_jar) endif - @echo "target Static Jar: $(PRIVATE_MODULE) ($@)" + @echo -e ${PRT_TGT}"target Static Jar:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(copy-file-to-target) ifneq ($(extra_jar_args),) $(add-java-resources-to-package) @@ -69,7 +69,7 @@ else # !LOCAL_IS_STATIC_JAVA_LIBRARY $(common_javalib.jar): PRIVATE_DEX_FILE := $(built_dex) $(common_javalib.jar) : $(built_dex) $(java_resource_sources) - @echo "target Jar: $(PRIVATE_MODULE) ($@)" + @echo -e ${PRT_TGT}"target Jar:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(create-empty-package) $(add-dex-to-package) $(add-carried-java-resources) @@ -95,7 +95,7 @@ else # ! boot jar $(built_odex): PRIVATE_MODULE := $(LOCAL_MODULE) # Use pattern rule - we may have multiple built odex files. $(built_odex) : $(dir $(LOCAL_BUILT_MODULE))% : $(common_javalib.jar) - @echo "Dexpreopt Jar: $(PRIVATE_MODULE) ($@)" + @echo -e ${PRT_TGT}"Dexpreopt Jar:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(call dexpreopt-one-file,$<,$@) $(LOCAL_BUILT_MODULE) : $(common_javalib.jar) | $(ACP) diff --git a/core/main.mk b/core/main.mk index 9d6e233d4c0..47ff2d4d2c4 100644 --- a/core/main.mk +++ b/core/main.mk @@ -142,10 +142,10 @@ javac_version_str := $(shell unset _JAVA_OPTIONS && javac -version 2>&1) # Check for the correct version of java, should be 1.7 by # default, and 1.6 if LEGACY_USE_JAVA6 is set. ifeq ($(LEGACY_USE_JAVA6),) -required_version := "1.7.x" -required_javac_version := "1.7" -java_version := $(shell echo '$(java_version_str)' | grep '^java .*[ "]1\.7[\. "$$]') -javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.7[\. "$$]') +required_version := "1.7.x/1.8.x" +required_javac_version := "1.7/1.8" +java_version := $(shell echo '$(java_version_str)' | grep -E '^(java|openjdk) .*[ "]1\.[78][\. "$$]') +javac_version := $(shell echo '$(javac_version_str)' | grep '[ "]1\.[78][\. "$$]') else # if LEGACY_USE_JAVA6 required_version := "1.6.x" required_javac_version := "1.6" @@ -163,8 +163,9 @@ $(info The required version is: $(required_version)) $(info $(space)) $(info Please follow the machine setup instructions at) $(info $(space)$(space)$(space)$(space)https://source.android.com/source/initializing.html) +$(info $(space)) +$(info Continue at your own peril!) $(info ************************************************************) -$(error stop) endif # Check for the current JDK. @@ -259,6 +260,9 @@ endif # Bring in standard build system definitions. include $(BUILD_SYSTEM)/definitions.mk +# Bring in Qualcomm helper macros +include $(BUILD_SYSTEM)/qcom_utils.mk + # Bring in dex_preopt.mk include $(BUILD_SYSTEM)/dex_preopt.mk @@ -515,7 +519,11 @@ ifneq ($(dont_bother),true) subdir_makefiles := \ $(shell build/tools/findleaves.py --prune=$(OUT_DIR) --prune=.repo --prune=.git $(subdirs) Android.mk) +ifneq ($(HIDE_MAKEFILE_INCLUDES),y) $(foreach mk, $(subdir_makefiles), $(info including $(mk) ...)$(eval include $(mk))) +else +$(foreach mk, $(subdir_makefiles), $(eval include $(mk))) +endif endif # dont_bother @@ -1039,7 +1047,7 @@ $(foreach module,$(sample_MODULES),$(eval $(call \ sample_ADDITIONAL_INSTALLED := \ $(filter-out $(modules_to_install) $(modules_to_check) $(ALL_PREBUILT),$(sample_MODULES)) samplecode: $(sample_APKS_COLLECTION) - @echo "Collect sample code apks: $^" + @echo -e ${PRT_TGT}"Collect sample code apks:"${CL_RST}" $^" # remove apks that are not intended to be installed. rm -f $(sample_ADDITIONAL_INSTALLED) endif # samplecode in $(MAKECMDGOALS) @@ -1050,7 +1058,7 @@ findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET) .PHONY: clean clean: @rm -rf $(OUT_DIR)/* - @echo "Entire build directory removed." + @echo -e ${PRT_TGT}"Entire build directory removed."${CL_RST} .PHONY: clobber clobber: clean @@ -1060,7 +1068,7 @@ clobber: clean #xxx scrape this from ALL_MODULE_NAME_TAGS .PHONY: modules modules: - @echo "Available sub-modules:" + @echo -e ${PRT_TGT}"Available sub-modules:"${CL_RST} @echo "$(call module-names-for-tag-list,$(ALL_MODULE_TAGS))" | \ tr -s ' ' '\n' | sort -u | $(COLUMN) diff --git a/core/notice_files.mk b/core/notice_files.mk index e63cd84b5f9..08906a710ed 100644 --- a/core/notice_files.mk +++ b/core/notice_files.mk @@ -62,7 +62,7 @@ installed_notice_file := $($(my_prefix)OUT_NOTICE_FILES)/src/$(module_installed_ $(installed_notice_file): PRIVATE_INSTALLED_MODULE := $(module_installed_filename) $(installed_notice_file): $(notice_file) - @echo Notice file: $< -- $@ + @echo -e ${PRT_IMP}Notice file:${CL_RST} $< -- $@ $(hide) mkdir -p $(dir $@) $(hide) cat $< > $@ diff --git a/core/pdk_config.mk b/core/pdk_config.mk index 838754fa821..16ba8c1c8cb 100644 --- a/core/pdk_config.mk +++ b/core/pdk_config.mk @@ -114,7 +114,7 @@ endif endif $(_pdk_fusion_stamp) : $(PDK_FUSION_PLATFORM_ZIP) - @echo "Unzip $(dir $@) <- $<" + @echo -e ${PRT_HST}"Unzip"${CL_RST}" $(dir $@) <- $<" $(hide) rm -rf $(dir $@) && mkdir -p $(dir $@) $(hide) unzip -qo $< -d $(dir $@) $(call split-long-arguments,-touch,$(_pdk_fusion_files)) diff --git a/core/product.mk b/core/product.mk index f0fc9210291..0918357a8e8 100644 --- a/core/product.mk +++ b/core/product.mk @@ -65,6 +65,7 @@ endef # _product_var_list := \ + PRODUCT_BUILD_PROP_OVERRIDES \ PRODUCT_NAME \ PRODUCT_MODEL \ PRODUCT_LOCALES \ diff --git a/core/product_config.mk b/core/product_config.mk index e7fa75ef531..f5c498ceb50 100644 --- a/core/product_config.mk +++ b/core/product_config.mk @@ -373,6 +373,9 @@ PRODUCT_PROPERTY_OVERRIDES := \ PRODUCT_DEFAULT_PROPERTY_OVERRIDES := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_DEFAULT_PROPERTY_OVERRIDES)) +PRODUCT_BUILD_PROP_OVERRIDES := \ + $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_BUILD_PROP_OVERRIDES)) + # Should we use the default resources or add any product specific overlays PRODUCT_PACKAGE_OVERLAYS := \ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGE_OVERLAYS)) diff --git a/core/qcom_target.mk b/core/qcom_target.mk new file mode 100644 index 00000000000..72140fda104 --- /dev/null +++ b/core/qcom_target.mk @@ -0,0 +1,21 @@ +# Target-specific configuration + +# Enable DirectTrack on QCOM legacy boards +ifeq ($(BOARD_USES_QCOM_HARDWARE),true) + + TARGET_GLOBAL_CFLAGS += -DQCOM_HARDWARE + TARGET_GLOBAL_CPPFLAGS += -DQCOM_HARDWARE + + ifeq ($(TARGET_USES_QCOM_BSP),true) + TARGET_GLOBAL_CFLAGS += -DQCOM_BSP + TARGET_GLOBAL_CPPFLAGS += -DQCOM_BSP + endif + + # Enable DirectTrack for legacy targets + ifneq ($(filter caf caf-bfam legacy,$(TARGET_QCOM_AUDIO_VARIANT)),) + ifeq ($(BOARD_USES_LEGACY_ALSA_AUDIO),true) + TARGET_GLOBAL_CFLAGS += -DQCOM_DIRECTTRACK + TARGET_GLOBAL_CPPFLAGS += -DQCOM_DIRECTTRACK + endif + endif +endif diff --git a/core/qcom_utils.mk b/core/qcom_utils.mk new file mode 100755 index 00000000000..03b3933ee37 --- /dev/null +++ b/core/qcom_utils.mk @@ -0,0 +1,225 @@ +# Board platforms lists to be used for +# TARGET_BOARD_PLATFORM specific featurization +QCOM_BOARD_PLATFORMS := msm7x27 +QCOM_BOARD_PLATFORMS += msm7x27a +QCOM_BOARD_PLATFORMS += msm7x30 +QCOM_BOARD_PLATFORMS += qsd8k +QCOM_BOARD_PLATFORMS += msm8226 +QCOM_BOARD_PLATFORMS += msm8660 +QCOM_BOARD_PLATFORMS += msm8909 +QCOM_BOARD_PLATFORMS += msm8916 +QCOM_BOARD_PLATFORMS += msm8952 +QCOM_BOARD_PLATFORMS += msm8960 +QCOM_BOARD_PLATFORMS += msm8974 +QCOM_BOARD_PLATFORMS += msm8992 +QCOM_BOARD_PLATFORMS += msm8994 + +MSM7K_BOARD_PLATFORMS := msm7x30 +MSM7K_BOARD_PLATFORMS += msm7x27 +MSM7K_BOARD_PLATFORMS += msm7x27a +MSM7K_BOARD_PLATFORMS += msm7k + +QSD8K_BOARD_PLATFORMS := qsd8k + + +# vars for use by utils +empty := +space := $(empty) $(empty) +colon := $(empty):$(empty) +underscore := $(empty)_$(empty) + +# $(call match-word,w1,w2) +# checks if w1 == w2 +# How it works +# if (w1-w2 not empty or w2-w1 not empty) then not_match else match +# +# returns true or empty +#$(warning :$(1): :$(2): :$(subst $(1),,$(2)):) \ +#$(warning :$(2): :$(1): :$(subst $(2),,$(1)):) \ +# +define match-word +$(strip \ + $(if $(or $(subst $(1),$(empty),$(2)),$(subst $(2),$(empty),$(1))),,true) \ +) +endef + +# $(call find-word-in-list,w,wlist) +# finds an exact match of word w in word list wlist +# +# How it works +# fill wlist spaces with colon +# wrap w with colon +# search word w in list wl, if found match m, return stripped word w +# +# returns stripped word or empty +define find-word-in-list +$(strip \ + $(eval wl:= $(colon)$(subst $(space),$(colon),$(strip $(2)))$(colon)) \ + $(eval w:= $(colon)$(strip $(1))$(colon)) \ + $(eval m:= $(findstring $(w),$(wl))) \ + $(if $(m),$(1),) \ +) +endef + +# $(call match-word-in-list,w,wlist) +# does an exact match of word w in word list wlist +# How it works +# if the input word is not empty +# return output of an exact match of word w in wordlist wlist +# else +# return empty +# returns true or empty +define match-word-in-list +$(strip \ + $(if $(strip $(1)), \ + $(call match-word,$(call find-word-in-list,$(1),$(2)),$(strip $(1))), \ + ) \ +) +endef + +# $(call match-prefix,p,delim,w/wlist) +# matches prefix p in wlist using delimiter delim +# +# How it works +# trim the words in wlist w +# if find-word-in-list returns not empty +# return true +# else +# return empty +# +define match-prefix +$(strip \ + $(eval w := $(strip $(1)$(strip $(2)))) \ + $(eval text := $(patsubst $(w)%,$(1),$(3))) \ + $(if $(call match-word-in-list,$(1),$(text)),true,) \ +) +endef + +# ---- +# The following utilities are meant for board platform specific +# featurisation + +# $(call get-vendor-board-platforms,v) +# returns list of board platforms for vendor v +define get-vendor-board-platforms +$($(1)_BOARD_PLATFORMS) +endef + +# $(call is-board-platform,bp) +# returns true or empty +define is-board-platform +$(call match-word,$(1),$(TARGET_BOARD_PLATFORM)) +endef + +# $(call is-not-board-platform,bp) +# returns true or empty +define is-not-board-platform +$(if $(call match-word,$(1),$(TARGET_BOARD_PLATFORM)),,true) +endef + +# $(call is-board-platform-in-list,bpl) +# returns true or empty +define is-board-platform-in-list +$(call match-word-in-list,$(TARGET_BOARD_PLATFORM),$(1)) +endef + +# $(call is-vendor-board-platform,vendor) +# returns true or empty +define is-vendor-board-platform +$(strip \ + $(call match-word-in-list,$(TARGET_BOARD_PLATFORM),\ + $(call get-vendor-board-platforms,$(1)) \ + ) \ +) +endef + +# $(call is-chipset-in-board-platform,chipset) +# does a prefix match of chipset in TARGET_BOARD_PLATFORM +# uses underscore as a delimiter +# +# returns true or empty +define is-chipset-in-board-platform +$(call match-prefix,$(1),$(underscore),$(TARGET_BOARD_PLATFORM)) +endef + +# $(call is-chipset-prefix-in-board-platform,prefix) +# does a chipset prefix match in TARGET_BOARD_PLATFORM +# assumes '_' and 'a' as the delimiter to the chipset prefix +# +# How it works +# if ($(prefix)_ or $(prefix)a match in board platform) +# return true +# else +# return empty +# +define is-chipset-prefix-in-board-platform +$(strip \ + $(eval delim_a := $(empty)a$(empty)) \ + $(if \ + $(or \ + $(call match-prefix,$(1),$(delim_a),$(TARGET_BOARD_PLATFORM)), \ + $(call match-prefix,$(1),$(underscore),$(TARGET_BOARD_PLATFORM)), \ + ), \ + true, \ + ) \ +) +endef + +#---- +# The following utilities are meant for Android Code Name +# specific featurisation +# +# refer http://source.android.com/source/build-numbers.html +# for code names and associated sdk versions +CUPCAKE_SDK_VERSIONS := 3 +DONUT_SDK_VERSIONS := 4 +ECLAIR_SDK_VERSIONS := 5 6 7 +FROYO_SDK_VERSIONS := 8 +GINGERBREAD_SDK_VERSIONS := 9 10 +HONEYCOMB_SDK_VERSIONS := 11 12 13 +ICECREAM_SANDWICH_SDK_VERSIONS := 14 15 +JELLY_BEAN_SDK_VERSIONS := 16 17 18 + +# $(call is-platform-sdk-version-at-least,version) +# version is a numeric SDK_VERSION defined above +define is-platform-sdk-version-at-least +$(strip \ + $(if $(filter 1,$(shell echo "$$(( $(PLATFORM_SDK_VERSION) >= $(1) ))" )), \ + true, \ + ) \ +) +endef + +# $(call is-android-codename,codename) +# codename is one of cupcake,donut,eclair,froyo,gingerbread,icecream +# please refer the $(codename)_SDK_VERSIONS declared above +define is-android-codename +$(strip \ + $(if \ + $(call match-word-in-list,$(PLATFORM_SDK_VERSION),$($(1)_SDK_VERSIONS)), \ + true, \ + ) \ +) +endef + +# $(call is-android-codename-in-list,cnlist) +# cnlist is combination/list of android codenames +define is-android-codename-in-list +$(strip \ + $(eval acn := $(empty)) \ + $(foreach \ + i,$(1),\ + $(eval acn += \ + $(if \ + $(call \ + match-word-in-list,\ + $(PLATFORM_SDK_VERSION),\ + $($(i)_SDK_VERSIONS)\ + ),\ + true,\ + )\ + )\ + ) \ + $(if $(strip $(acn)),true,) \ +) +endef diff --git a/core/raw_executable.mk b/core/raw_executable.mk index b64173a696a..ce1894e2c49 100644 --- a/core/raw_executable.mk +++ b/core/raw_executable.mk @@ -14,7 +14,7 @@ $(all_objects) : PRIVATE_TARGET_GLOBAL_CPPFLAGS := $(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries) @$(mkdir -p $(dir $@) - @echo "target Linking: $(PRIVATE_MODULE)" + @echo -e ${PRT_TGT}"target Linking:"${CL_RST}" $(PRIVATE_MODULE)" $(hide) $(TARGET_LD) \ $(addprefix --script ,$(PRIVATE_LINK_SCRIPT)) \ $(PRIVATE_RAW_EXECUTABLE_LDFLAGS) \ diff --git a/core/static_java_library.mk b/core/static_java_library.mk index 02078e01724..000e3e85849 100644 --- a/core/static_java_library.mk +++ b/core/static_java_library.mk @@ -109,7 +109,7 @@ $(R_file_stamp): PRIVATE_MANIFEST_PACKAGE_NAME := $(R_file_stamp): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(R_file_stamp) : $(all_resources) $(full_android_manifest) $(AAPT) $(framework_res_package_export_deps) - @echo "target R.java/Manifest.java: $(PRIVATE_MODULE) ($@)" + @echo -e ${PRT_HST}"target R.java/Manifest.java:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(create-resource-java-files) $(hide) find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name R.java | xargs cat > $@ diff --git a/core/tasks/apicheck.mk b/core/tasks/apicheck.mk index 683a075ff38..581a1fa4546 100644 --- a/core/tasks/apicheck.mk +++ b/core/tasks/apicheck.mk @@ -76,7 +76,7 @@ $(eval $(call check-api, \ .PHONY: update-public-api update-public-api: $(INTERNAL_PLATFORM_API_FILE) | $(ACP) - @echo Copying current.txt + @echo -e ${PRT_TGT}"Copying current.txt"${CL_RST} $(hide) $(ACP) $(INTERNAL_PLATFORM_API_FILE) frameworks/base/api/current.txt @echo Copying removed.txt $(hide) $(ACP) $(INTERNAL_PLATFORM_REMOVED_API_FILE) frameworks/base/api/removed.txt diff --git a/core/tasks/collect_gpl_sources.mk b/core/tasks/collect_gpl_sources.mk index 30ba62b6091..d6483329d0f 100644 --- a/core/tasks/collect_gpl_sources.mk +++ b/core/tasks/collect_gpl_sources.mk @@ -17,7 +17,7 @@ gpl_source_tgz := $(call intermediates-dir-for,PACKAGING,gpl_source,HOST,COMMON) # FORCE since we can't know whether any of the sources changed $(gpl_source_tgz): PRIVATE_PATHS := $(sort $(patsubst %/, %, $(dir $(ALL_GPL_MODULE_LICENSE_FILES)))) $(gpl_source_tgz) : $(ALL_GPL_MODULE_LICENSE_FILES) FORCE - @echo Package gpl sources: $@ + @echo -e ${PRT_TGT}"Package gpl sources:"${CL_RST}" $@" @rm -rf $(dir $@) && mkdir -p $(dir $@) $(hide) tar cfz $@ --exclude ".git*" $(PRIVATE_PATHS) diff --git a/core/tasks/kernel.mk b/core/tasks/kernel.mk new file mode 100644 index 00000000000..aa64f912b3f --- /dev/null +++ b/core/tasks/kernel.mk @@ -0,0 +1,274 @@ +# Copyright (C) 2012 The CyanogenMod Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Android makefile to build kernel as a part of Android Build + +-include vendor/omni/config/branding.mk + +TARGET_AUTO_KDIR := $(shell echo $(TARGET_DEVICE_DIR) | sed -e 's/^device/kernel/g') + +## Externally influenced variables +# kernel location - optional, defaults to kernel// +TARGET_KERNEL_SOURCE ?= $(TARGET_AUTO_KDIR) +KERNEL_SRC := $(TARGET_KERNEL_SOURCE) +# kernel configuration - mandatory +KERNEL_DEFCONFIG := $(TARGET_KERNEL_CONFIG) +VARIANT_DEFCONFIG := $(TARGET_KERNEL_VARIANT_CONFIG) +SELINUX_DEFCONFIG := $(TARGET_KERNEL_SELINUX_CONFIG) + +## Internal variables +KERNEL_OUT := $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ +KERNEL_CONFIG := $(KERNEL_OUT)/.config + +TARGET_KERNEL_ARCH := $(strip $(TARGET_KERNEL_ARCH)) +ifeq ($(TARGET_KERNEL_ARCH),) +KERNEL_ARCH := $(TARGET_ARCH) +else +KERNEL_ARCH := $(TARGET_KERNEL_ARCH) +endif + +TARGET_KERNEL_HEADER_ARCH := $(strip $(TARGET_KERNEL_HEADER_ARCH)) +ifeq ($(TARGET_KERNEL_HEADER_ARCH),) +KERNEL_HEADER_ARCH := $(KERNEL_ARCH) +else +KERNEL_HEADER_ARCH := $(TARGET_KERNEL_HEADER_ARCH) +endif + +KERNEL_HEADER_DEFCONFIG := $(strip $(KERNEL_HEADER_DEFCONFIG)) +ifeq ($(KERNEL_HEADER_DEFCONFIG),) +KERNEL_HEADER_DEFCONFIG := $(KERNEL_DEFCONFIG) +endif + + +ifneq ($(BOARD_KERNEL_IMAGE_NAME),) + TARGET_PREBUILT_INT_KERNEL_TYPE := $(BOARD_KERNEL_IMAGE_NAME) +else + ifeq ($(TARGET_USES_UNCOMPRESSED_KERNEL),true) + TARGET_PREBUILT_INT_KERNEL_TYPE := Image + else + TARGET_PREBUILT_INT_KERNEL_TYPE := zImage + endif +endif + +TARGET_PREBUILT_INT_KERNEL := $(KERNEL_OUT)/arch/$(KERNEL_ARCH)/boot/$(TARGET_PREBUILT_INT_KERNEL_TYPE) + +# Clear this first to prevent accidental poisoning from env +MAKE_FLAGS := + +ifeq ($(KERNEL_ARCH),arm64) + # Avoid "unsupported RELA relocation: 311" errors (R_AARCH64_ADR_GOT_PAGE) + MAKE_FLAGS += CFLAGS_MODULE="-fno-pic" + ifeq ($(TARGET_ARCH),arm) + KERNEL_CONFIG_OVERRIDE := CONFIG_ANDROID_BINDER_IPC_32BIT=y + endif +endif + +ifneq ($(TARGET_KERNEL_ADDITIONAL_CONFIG),) +KERNEL_ADDITIONAL_CONFIG := $(TARGET_KERNEL_ADDITIONAL_CONFIG) +endif + +## Do be discontinued in a future version. Notify builder about target +## kernel format requirement +ifeq ($(BOARD_KERNEL_IMAGE_NAME),) +ifeq ($(BOARD_USES_UBOOT),true) + $(error "Please set BOARD_KERNEL_IMAGE_NAME to uImage") +else ifeq ($(BOARD_USES_UNCOMPRESSED_BOOT),true) + $(error "Please set BOARD_KERNEL_IMAGE_NAME to Image") +endif +endif + +ifeq "$(wildcard $(KERNEL_SRC) )" "" + ifneq ($(TARGET_PREBUILT_KERNEL),) + HAS_PREBUILT_KERNEL := true + NEEDS_KERNEL_COPY := true + else + $(foreach cf,$(PRODUCT_COPY_FILES), \ + $(eval _src := $(call word-colon,1,$(cf))) \ + $(eval _dest := $(call word-colon,2,$(cf))) \ + $(ifeq kernel,$(_dest), \ + $(eval HAS_PREBUILT_KERNEL := true))) + endif + + ifneq ($(HAS_PREBUILT_KERNEL),) + $(warning ***************************************************************) + $(warning * Using prebuilt kernel binary instead of source *) + $(warning * THIS IS DEPRECATED, AND WILL BE DISCONTINUED *) + $(warning * Please configure your device to download the kernel *) + $(warning * source repository to $(KERNEL_SRC)) + $(warning * See $(URL_INTEGRATED_KERNEL_BUILD)) + $(warning * for more information *) + $(warning ***************************************************************) + FULL_KERNEL_BUILD := false + KERNEL_BIN := $(TARGET_PREBUILT_KERNEL) + else + $(warning ***************************************************************) + $(warning * *) + $(warning * No kernel source found, and no fallback prebuilt defined. *) + $(warning * Please make sure your device is properly configured to *) + $(warning * download the kernel repository to $(KERNEL_SRC)) + $(warning * and add the TARGET_KERNEL_CONFIG variable to BoardConfig.mk *) + $(warning * *) + $(warning * As an alternative, define the TARGET_PREBUILT_KERNEL *) + $(warning * variable with the path to the prebuilt binary kernel image *) + $(warning * in your BoardConfig.mk file *) + $(warning * *) + $(warning ***************************************************************) + $(error "NO KERNEL") + endif +else + NEEDS_KERNEL_COPY := true + ifeq ($(TARGET_KERNEL_CONFIG),) + $(warning **********************************************************) + $(warning * Kernel source found, but no configuration was defined *) + $(warning * Please add the TARGET_KERNEL_CONFIG variable to your *) + $(warning * BoardConfig.mk file *) + $(warning **********************************************************) + # $(error "NO KERNEL CONFIG") + else + #$(info Kernel source found, building it) + FULL_KERNEL_BUILD := true + KERNEL_BIN := $(TARGET_PREBUILT_INT_KERNEL) + endif +endif + +ifeq ($(FULL_KERNEL_BUILD),true) + +KERNEL_HEADERS_INSTALL := $(KERNEL_OUT)/usr +KERNEL_MODULES_INSTALL := system +KERNEL_MODULES_OUT := $(TARGET_OUT)/lib/modules + +TARGET_KERNEL_CROSS_COMPILE_PREFIX := $(strip $(TARGET_KERNEL_CROSS_COMPILE_PREFIX)) +ifeq ($(TARGET_KERNEL_CROSS_COMPILE_PREFIX),) +ifeq ($(KERNEL_TOOLCHAIN_PREFIX),) + ifeq ($(KERNEL_ARCH),arm64) + KERNEL_TOOLCHAIN_PREFIX := aarch64-linux-android- + else + KERNEL_TOOLCHAIN_PREFIX := arm-eabi- + endif +endif +else +KERNEL_TOOLCHAIN_PREFIX := $(TARGET_KERNEL_CROSS_COMPILE_PREFIX) +endif + +ifeq ($(KERNEL_TOOLCHAIN),) +KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN_PREFIX) +else +ifneq ($(KERNEL_TOOLCHAIN_PREFIX),) +KERNEL_TOOLCHAIN_PATH := $(KERNEL_TOOLCHAIN)/$(KERNEL_TOOLCHAIN_PREFIX) +endif +endif + +ifneq ($(USE_CCACHE),) + ccache := $(ANDROID_BUILD_TOP)/prebuilts/misc/$(HOST_PREBUILT_TAG)/ccache/ccache + # Check that the executable is here. + ccache := $(strip $(wildcard $(ccache))) +endif + +KERNEL_CROSS_COMPILE := CROSS_COMPILE="$(ccache) $(KERNEL_TOOLCHAIN_PATH)" +ccache = + +define mv-modules + mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.order`;\ + if [ "$$mdpath" != "" ];then\ + mpath=`dirname $$mdpath`;\ + ko=`find $$mpath/kernel -type f -name *.ko`;\ + for i in $$ko; do $(KERNEL_TOOLCHAIN_PATH)strip --strip-unneeded $$i;\ + mv $$i $(KERNEL_MODULES_OUT)/; done;\ + fi +endef + +define clean-module-folder + mdpath=`find $(KERNEL_MODULES_OUT) -type f -name modules.order`;\ + if [ "$$mdpath" != "" ];then\ + mpath=`dirname $$mdpath`; rm -rf $$mpath;\ + fi +endef + +ifeq ($(HOST_OS),darwin) + MAKE_FLAGS += C_INCLUDE_PATH=$(ANDROID_BUILD_TOP)/external/elfutils/0.153/libelf/ +endif + +ifeq ($(TARGET_KERNEL_MODULES),) + TARGET_KERNEL_MODULES := no-external-modules +endif + +$(KERNEL_OUT): + mkdir -p $(KERNEL_OUT) + mkdir -p $(KERNEL_MODULES_OUT) + +$(KERNEL_CONFIG): $(KERNEL_OUT) + $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) $(KERNEL_DEFCONFIG) + $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \ + echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \ + echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi + $(hide) if [ ! -z "$(KERNEL_ADDITIONAL_CONFIG)" ]; then \ + echo "Using additional config '$(KERNEL_ADDITIONAL_CONFIG)'"; \ + cat $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG) >> $(KERNEL_OUT)/.config; \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi + +TARGET_KERNEL_BINARIES: $(KERNEL_OUT) $(KERNEL_CONFIG) $(KERNEL_HEADERS_INSTALL) + $(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) $(TARGET_PREBUILT_INT_KERNEL_TYPE) + -$(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) dtbs + -$(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) modules + -$(MAKE) $(MAKE_FLAGS) -C $(KERNEL_SRC) O=$(KERNEL_OUT) INSTALL_MOD_PATH=../../$(KERNEL_MODULES_INSTALL) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) modules_install + $(mv-modules) + $(clean-module-folder) + +$(TARGET_KERNEL_MODULES): TARGET_KERNEL_BINARIES + +$(TARGET_PREBUILT_INT_KERNEL): $(TARGET_KERNEL_MODULES) + $(mv-modules) + $(clean-module-folder) + +$(KERNEL_HEADERS_INSTALL): $(KERNEL_OUT) $(KERNEL_CONFIG) + $(hide) if [ ! -z "$(KERNEL_HEADER_DEFCONFIG)" ]; then \ + rm -f ../$(KERNEL_CONFIG); \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_HEADER_ARCH) $(KERNEL_CROSS_COMPILE) VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) $(KERNEL_HEADER_DEFCONFIG); \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_HEADER_ARCH) $(KERNEL_CROSS_COMPILE) headers_install; fi + $(hide) if [ "$(KERNEL_HEADER_DEFCONFIG)" != "$(KERNEL_DEFCONFIG)" ]; then \ + echo "Used a different defconfig for header generation"; \ + rm -f ../$(KERNEL_CONFIG); \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) VARIANT_DEFCONFIG=$(VARIANT_DEFCONFIG) SELINUX_DEFCONFIG=$(SELINUX_DEFCONFIG) $(KERNEL_DEFCONFIG); fi + $(hide) if [ ! -z "$(KERNEL_CONFIG_OVERRIDE)" ]; then \ + echo "Overriding kernel config with '$(KERNEL_CONFIG_OVERRIDE)'"; \ + echo $(KERNEL_CONFIG_OVERRIDE) >> $(KERNEL_OUT)/.config; \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi + $(hide) if [ ! -z "$(KERNEL_ADDITIONAL_CONFIG)" ]; then \ + echo "Using additional config '$(KERNEL_ADDITIONAL_CONFIG)'"; \ + cat $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_ADDITIONAL_CONFIG) >> $(KERNEL_OUT)/.config; \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) oldconfig; fi + +kerneltags: $(KERNEL_OUT) $(KERNEL_CONFIG) + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) tags + +kernelconfig: $(KERNEL_OUT) $(KERNEL_CONFIG) + env KCONFIG_NOTIMESTAMP=true \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) menuconfig + env KCONFIG_NOTIMESTAMP=true \ + $(MAKE) -C $(KERNEL_SRC) O=$(KERNEL_OUT) ARCH=$(KERNEL_ARCH) $(KERNEL_CROSS_COMPILE) savedefconfig + cp $(KERNEL_OUT)/defconfig $(KERNEL_SRC)/arch/$(KERNEL_ARCH)/configs/$(KERNEL_DEFCONFIG) + +endif # FULL_KERNEL_BUILD + +## Install it + +ifeq ($(NEEDS_KERNEL_COPY),true) +file := $(INSTALLED_KERNEL_TARGET) +ALL_PREBUILT += $(file) +$(file) : $(KERNEL_BIN) | $(ACP) + $(transform-prebuilt-to-target) + +ALL_PREBUILT += $(INSTALLED_KERNEL_TARGET) +endif diff --git a/core/tasks/product-graph.mk b/core/tasks/product-graph.mk index fcec27775dc..f729064f9a1 100644 --- a/core/tasks/product-graph.mk +++ b/core/tasks/product-graph.mk @@ -136,7 +136,7 @@ $(foreach p,$(really_all_products), \ ) $(products_pdf): $(products_graph) - @echo Product graph PDF: $@ + @echo -e ${PRT_TGT}"Product graph PDF:"${CL_RST}" $@" dot -Tpdf -Nshape=box -o $@ $< $(products_svg): $(products_graph) $(product_debug_files) diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk index 5ac9b7d47b0..cbc17893739 100644 --- a/core/tasks/sdk-addon.mk +++ b/core/tasks/sdk-addon.mk @@ -105,7 +105,7 @@ $(full_target): PRIVATE_DOCS_DIRS := $(addprefix $(OUT_DOCS)/, $(doc_modules)) $(full_target): PRIVATE_STAGING_DIR := $(call append-path,$(staging),$(addon_dir_leaf)) $(full_target): $(sdk_addon_deps) | $(ACP) - @echo Packaging SDK Addon: $@ + @echo -e ${PRT_TGT}"Packaging SDK Addon:"${CL_RST}" $@" $(hide) mkdir -p $(PRIVATE_STAGING_DIR)/docs $(hide) for d in $(PRIVATE_DOCS_DIRS); do \ $(ACP) -r $$d $(PRIVATE_STAGING_DIR)/docs ;\ diff --git a/core/version_defaults.mk b/core/version_defaults.mk index cc63286b28f..e405b6d1d7b 100644 --- a/core/version_defaults.mk +++ b/core/version_defaults.mk @@ -24,6 +24,7 @@ # DEFAULT_APP_TARGET_SDK # BUILD_ID # BUILD_NUMBER +# SECURITY_PATCH # # Look for an optional file containing overrides of the defaults, @@ -67,6 +68,22 @@ ifeq "" "$(PLATFORM_VERSION_CODENAME)" PLATFORM_VERSION_ALL_CODENAMES := $(PLATFORM_VERSION_CODENAME) endif +ifeq "" "$(PLATFORM_SECURITY_PATCH)" + # Used to indicate the security patch that has been applied to the device. + # Can be an arbitrary string, but must be a single word. + # + # If there is no $PLATFORM_SECURITY_PATCH set, keep it empty. + PLATFORM_SECURITY_PATCH := 2015-11-01 +endif + +ifeq "" "$(PLATFORM_BASE_OS)" + # Used to indicate the base os applied to the device. + # Can be an arbitrary string, but must be a single word. + # + # If there is no $PLATFORM_BASE_OS set, keep it empty. + PLATFORM_BASE_OS := +endif + ifeq "" "$(DEFAULT_APP_TARGET_SDK)" # This is the default minSdkVersion and targetSdkVersion to use for # all .apks created by the build system. It can be overridden by explicitly diff --git a/envsetup.sh b/envsetup.sh index d80e95c39bb..849bad12ec2 100644 --- a/envsetup.sh +++ b/envsetup.sh @@ -16,6 +16,7 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y - resgrep: Greps on all local res/*.xml files. - sgrep: Greps on all local source files. - godir: Go to the directory containing a file. +- pushboot:Push a file from your OUT dir to your phone and reboots it, using absolute path. Look at the source to view more functions. The complete list is: EOF @@ -60,6 +61,15 @@ function check_product() echo "Couldn't locate the top of the tree. Try setting TOP." >&2 return fi + + if (echo -n $1 | grep -q -e "^omni_") ; then + CUSTOM_BUILD=$(echo -n $1 | sed -e 's/^omni_//g') + else + CUSTOM_BUILD= + fi + export CUSTOM_BUILD + + CALLED_FROM_SETUP=true BUILD_SYSTEM=build/core \ TARGET_PRODUCT=$1 \ TARGET_BUILD_VARIANT= \ TARGET_BUILD_TYPE= \ @@ -478,6 +488,53 @@ function print_lunch_menu() echo } +function brunch() +{ + breakfast $* + if [ $? -eq 0 ]; then + time mka bacon + else + echo "No such item in brunch menu. Try 'breakfast'" + return 1 + fi + return $? +} + +function breakfast() +{ + target=$1 + local variant=$2 + CUSTOM_DEVICES_ONLY="true" + unset LUNCH_MENU_CHOICES + add_lunch_combo full-eng + for f in `/bin/ls vendor/omni/vendorsetup.sh 2> /dev/null` + do + echo "including $f" + . $f + done + unset f + + if [ $# -eq 0 ]; then + # No arguments, so let's have the full menu + lunch + else + echo "z$target" | grep -q "-" + if [ $? -eq 0 ]; then + # A buildtype was specified, assume a full device name + lunch $target + else + # This is probably just the omni model name + if [ -z "$variant" ]; then + variant="userdebug" + fi + lunch omni_$target-$variant + fi + fi + return $? +} + +alias bib=breakfast + function lunch() { local answer @@ -518,6 +575,20 @@ function lunch() local product=$(echo -n $selection | sed -e "s/-.*$//") check_product $product if [ $? -ne 0 ] + then + # if we can't find the product, try to grab it from our github + T=$(gettop) + pushd $T > /dev/null + build/tools/roomservice.py $product + popd > /dev/null + check_product $product + else + T=$(gettop) + pushd $T > /dev/null + build/tools/roomservice.py $product true + popd > /dev/null + fi + if [ $? -ne 0 ] then echo echo "** Don't have a product spec for: '$product'" @@ -547,8 +618,18 @@ function lunch() echo + if [[ $USE_PREBUILT_CHROMIUM -eq 1 ]]; then + chromium_prebuilt + else + # Unset flag in case user opts out later on + export PRODUCT_PREBUILT_WEBVIEWCHROMIUM="" + fi + + fixup_common_out_dir + set_stuff_for_environment printconfig + } # Tab completion for lunch. @@ -615,6 +696,21 @@ function tapas() printconfig } +function pushboot() { + if [ ! -f $OUT/$* ]; then + echo "File not found: $OUT/$*" + return 1 + fi + + adb root + sleep 1 + adb wait-for-device + adb remount + + adb push $OUT/$* /$* + adb reboot +} + function gettop { local TOPFILE=build/core/envsetup.mk @@ -1674,6 +1770,13 @@ function set_java_home() { fi } +function repopick() { + set_stuff_for_environment + T=$(gettop) + $T/build/tools/repopick.py $@ +} + + # Print colored exit condition function pez { "$@" @@ -1687,6 +1790,20 @@ function pez { return $retval } +function chromium_prebuilt() { + T=$(gettop) + export TARGET_DEVICE=$(get_build_var TARGET_DEVICE) + hash=$T/prebuilts/chromium/$TARGET_DEVICE/hash.txt + + if [ -r $hash ] && [ $(git --git-dir=$T/external/chromium_org/.git --work-tree=$T/external/chromium_org rev-parse --verify HEAD) == $(cat $hash) ]; then + export PRODUCT_PREBUILT_WEBVIEWCHROMIUM=yes + echo "** Prebuilt Chromium is up-to-date; Will be used for build **" + else + export PRODUCT_PREBUILT_WEBVIEWCHROMIUM=no + echo "** Prebuilt Chromium out-of-date/not found; Will build from source **" + fi +} + function get_make_command() { echo command make @@ -1720,6 +1837,35 @@ function make() return $ret } +# Make using all available CPUs +function mka() { + case `uname -s` in + Darwin) + make -j `sysctl hw.ncpu|cut -d" " -f2` "$@" + ;; + *) + schedtool -B -n 1 -e ionice -n 1 make -j `cat /proc/cpuinfo | grep "^processor" | wc -l` "$@" + ;; + esac +} + +function fixup_common_out_dir() { + common_out_dir=$(get_build_var OUT_DIR)/target/common + target_device=$(get_build_var TARGET_DEVICE) + if [ ! -z $ANDROID_FIXUP_COMMON_OUT ]; then + if [ -d ${common_out_dir} ] && [ ! -L ${common_out_dir} ]; then + mv ${common_out_dir} ${common_out_dir}-${target_device} + ln -s ${common_out_dir}-${target_device} ${common_out_dir} + else + [ -L ${common_out_dir} ] && rm ${common_out_dir} + mkdir -p ${common_out_dir}-${target_device} + ln -s ${common_out_dir}-${target_device} ${common_out_dir} + fi + else + [ -L ${common_out_dir} ] && rm ${common_out_dir} + mkdir -p ${common_out_dir} + fi +} if [ "x$SHELL" != "x/bin/bash" ]; then diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk index 3ae5860809d..119efdf103c 100644 --- a/target/board/generic/BoardConfig.mk +++ b/target/board/generic/BoardConfig.mk @@ -23,6 +23,7 @@ TARGET_ARCH_VARIANT := armv7-a TARGET_CPU_VARIANT := generic 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/product/core.mk b/target/product/core.mk index 519dbb8efe1..d1821831c91 100644 --- a/target/product/core.mk +++ b/target/product/core.mk @@ -47,7 +47,6 @@ PRODUCT_PACKAGES += \ libpac \ PrintSpooler \ ProxyHandler \ - QuickSearchBox \ Settings \ SharedStorageBackup \ Telecom \ diff --git a/target/product/core_base.mk b/target/product/core_base.mk index 6c294822720..f17b7fb4854 100644 --- a/target/product/core_base.mk +++ b/target/product/core_base.mk @@ -17,13 +17,12 @@ # that should not be in PDK should be added in lower level like core.mk. PRODUCT_PROPERTY_OVERRIDES := \ - ro.config.notification_sound=OnTheHunt.ogg \ - ro.config.alarm_alert=Alarm_Classic.ogg + ro.config.alarm_alert=Argon.ogg \ + ro.config.notification_sound=pixiedust.ogg PRODUCT_PACKAGES += \ ContactsProvider \ DefaultContainerService \ - Home \ TelephonyProvider \ UserDictionaryProvider \ atrace \ diff --git a/target/product/full_base.mk b/target/product/full_base.mk index caace76eb50..833cadf9b2a 100644 --- a/target/product/full_base.mk +++ b/target/product/full_base.mk @@ -21,27 +21,32 @@ PRODUCT_PACKAGES := \ libfwdlockengine \ - OpenWnn \ - libWnnEngDic \ - libWnnJpnDic \ - libwnndict \ WAPPushManager -PRODUCT_PACKAGES += \ - Galaxy4 \ - HoloSpiralWallpaper \ - LiveWallpapers \ - LiveWallpapersPicker \ - MagicSmokeWallpapers \ - NoiseField \ - PhaseBeam \ - VisualizationWallpapers \ - PhotoTable +ifneq ($(TARGET_LOW_RAM_DEVICE), true) + ifneq ($(TARGET_EXCLUDE_LIVEWALLPAPERS), true) + PRODUCT_PACKAGES += \ + Galaxy4 \ + HoloSpiralWallpaper \ + LiveWallpapers \ + LiveWallpapersPicker \ + MagicSmokeWallpapers \ + NoiseField \ + PhaseBeam \ + VisualizationWallpapers \ + PhotoTable + else + PRODUCT_PACKAGES += \ + LiveWallpapersPicker \ + PhotoTable + endif +endif # Additional settings used in all AOSP builds PRODUCT_PROPERTY_OVERRIDES := \ ro.com.android.dateformat=MM-dd-yyyy \ - ro.config.ringtone=Ring_Synth_04.ogg \ + ro.config.alarm_alert=Argon.ogg \ + ro.config.ringtone=Orion.ogg \ ro.config.notification_sound=pixiedust.ogg # Put en_US first in the list, so make it default. diff --git a/target/product/full_base_telephony.mk b/target/product/full_base_telephony.mk index 2fd2ce803ff..c4b85838471 100644 --- a/target/product/full_base_telephony.mk +++ b/target/product/full_base_telephony.mk @@ -19,15 +19,17 @@ # build quite specifically for the emulator, and might not be # entirely appropriate to inherit from for on-device configurations. +ifneq ($(TARGET_LOW_RAM_DEVICE), true) PRODUCT_PACKAGES := \ - VoiceDialer + VoiceDialer \ + libsrec_jni +endif PRODUCT_PROPERTY_OVERRIDES := \ keyguard.no_require_sim=true \ ro.com.android.dataroaming=true PRODUCT_COPY_FILES := \ - device/generic/goldfish/data/etc/apns-conf.xml:system/etc/apns-conf.xml \ frameworks/native/data/etc/handheld_core_hardware.xml:system/etc/permissions/handheld_core_hardware.xml $(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk) diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk index 7af62ce46ad..8aeb1624712 100644 --- a/target/product/generic_no_telephony.mk +++ b/target/product/generic_no_telephony.mk @@ -21,8 +21,10 @@ PRODUCT_PACKAGES := \ Bluetooth \ Camera2 \ Gallery2 \ - Music \ - MusicFX \ + InputDevices \ + Keyguard \ + LatinIME \ + Launcher3 \ OneTimeInitializer \ Provision \ SystemUI \ @@ -35,12 +37,7 @@ PRODUCT_PACKAGES += \ screenrecord PRODUCT_PACKAGES += \ - librs_jni \ - libvideoeditor_jni \ - libvideoeditor_core \ - libvideoeditor_osal \ - libvideoeditor_videofilters \ - libvideoeditorplayer \ + librs_jni PRODUCT_PACKAGES += \ audio.primary.default \ diff --git a/target/product/telephony.mk b/target/product/telephony.mk index da1497d099c..283875cac52 100644 --- a/target/product/telephony.mk +++ b/target/product/telephony.mk @@ -19,6 +19,7 @@ PRODUCT_PACKAGES := \ Dialer \ + InCallUI \ Mms \ rild diff --git a/tools/apicheck/Android.mk b/tools/apicheck/Android.mk index 1674a17e93d..4b1daff3eb1 100644 --- a/tools/apicheck/Android.mk +++ b/tools/apicheck/Android.mk @@ -32,7 +32,7 @@ include $(BUILD_SYSTEM)/base_rules.mk $(LOCAL_BUILT_MODULE): $(HOST_OUT_JAVA_LIBRARIES)/doclava$(COMMON_JAVA_PACKAGE_SUFFIX) $(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/etc/apicheck | $(ACP) - @echo "Copy: $(PRIVATE_MODULE) ($@)" + @echo -e ${PRT_INS}"Copy:"${CL_RST}" $(PRIVATE_MODULE) ($@)" $(copy-file-to-new-target) $(hide) chmod 755 $@ diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh index a80b2db47aa..a9aa77bcada 100755 --- a/tools/buildinfo.sh +++ b/tools/buildinfo.sh @@ -10,6 +10,8 @@ echo "ro.build.version.sdk=$PLATFORM_SDK_VERSION" echo "ro.build.version.codename=$PLATFORM_VERSION_CODENAME" echo "ro.build.version.all_codenames=$PLATFORM_VERSION_ALL_CODENAMES" echo "ro.build.version.release=$PLATFORM_VERSION" +echo "ro.build.version.security_patch=$PLATFORM_SECURITY_PATCH" +echo "ro.build.version.base_os=$PLATFORM_BASE_OS" echo "ro.build.date=`date`" echo "ro.build.date.utc=`date +%s`" echo "ro.build.type=$TARGET_BUILD_TYPE" @@ -17,10 +19,7 @@ echo "ro.build.user=$USER" echo "ro.build.host=`hostname`" echo "ro.build.tags=$BUILD_VERSION_TAGS" echo "ro.build.flavor=$TARGET_BUILD_FLAVOR" -echo "ro.product.model=$PRODUCT_MODEL" echo "ro.product.brand=$PRODUCT_BRAND" -echo "ro.product.name=$PRODUCT_NAME" -echo "ro.product.device=$TARGET_DEVICE" echo "ro.product.board=$TARGET_BOOTLOADER_BOARD_NAME" # These values are deprecated, use "ro.product.cpu.abilist" @@ -45,15 +44,22 @@ fi echo "ro.wifi.channels=$PRODUCT_DEFAULT_WIFI_CHANNELS" echo "ro.board.platform=$TARGET_BOARD_PLATFORM" -echo "# ro.build.product is obsolete; use ro.product.device" -echo "ro.build.product=$TARGET_DEVICE" - -echo "# Do not try to parse description, fingerprint, or thumbprint" -echo "ro.build.description=$PRIVATE_BUILD_DESC" -echo "ro.build.fingerprint=$BUILD_FINGERPRINT" -if [ -n "$BUILD_THUMBPRINT" ] ; then - echo "ro.build.thumbprint=$BUILD_THUMBPRINT" +if [ "$TARGET_UNIFIED_DEVICE" == "" ] ; then + echo "# ro.build.product is obsolete; use ro.product.device" + echo "ro.build.product=$TARGET_DEVICE" + echo "ro.product.model=$PRODUCT_MODEL" + echo "ro.product.name=$PRODUCT_NAME" + echo "ro.product.device=$TARGET_DEVICE" + echo "# Do not try to parse description, fingerprint, or thumbprint" + echo "ro.build.description=$PRIVATE_BUILD_DESC" + echo "ro.build.fingerprint=$BUILD_FINGERPRINT" + if [ -n "$BUILD_THUMBPRINT" ] ; then + echo "ro.build.thumbprint=$BUILD_THUMBPRINT" + fi fi echo "ro.build.characteristics=$TARGET_AAPT_CHARACTERISTICS" +# Omni properties +echo "ro.omni.device=$OMNI_DEVICE" + echo "# end build properties" diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index a596c261684..55bcbc94d29 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -208,7 +208,7 @@ class Partition(object): line = line.strip() if not line or line.startswith("#"): continue pieces = line.split() - if not (3 <= len(pieces) <= 4): + if not (3 <= len(pieces) <= 7): raise ValueError("malformed recovery.fstab line: \"%s\"" % (line,)) p = Partition() @@ -217,7 +217,7 @@ class Partition(object): p.device = pieces[2] p.length = 0 options = None - if len(pieces) >= 4: + if len(pieces) >= 4 and pieces[3] != 'NULL': if pieces[3].startswith("/"): p.device2 = pieces[3] if len(pieces) >= 5: @@ -369,7 +369,13 @@ def GetBootableImage(name, prebuilt_name, unpack_dir, tree_subdir, otherwise construct it from the source files in 'unpack_dir'/'tree_subdir'.""" - prebuilt_path = os.path.join(unpack_dir, "BOOTABLE_IMAGES", prebuilt_name) + prebuilt_dir = os.path.join(unpack_dir, "BOOTABLE_IMAGES") + prebuilt_path = os.path.join(prebuilt_dir, prebuilt_name) + custom_bootimg_mk = os.getenv('MKBOOTIMG') + if custom_bootimg_mk: + bootimage_path = os.path.join(os.getenv('OUT'), "boot.img") + os.mkdir(prebuilt_dir) + shutil.copyfile(bootimage_path, prebuilt_path) if os.path.exists(prebuilt_path): print "using prebuilt %s from BOOTABLE_IMAGES..." % (prebuilt_name,) return File.FromLocalFile(name, prebuilt_path) @@ -1115,9 +1121,15 @@ def _CheckFirstBlock(self, script): # map recovery.fstab's fs_types to mount/format "partition types" -PARTITION_TYPES = { "yaffs2": "MTD", "mtd": "MTD", - "ext4": "EMMC", "emmc": "EMMC", - "f2fs": "EMMC" } +PARTITION_TYPES = { "bml": "BML", + "ext2": "EMMC", + "ext3": "EMMC", + "ext4": "EMMC", + "emmc": "EMMC", + "mtd": "MTD", + "f2fs": "EMMC", + "yaffs2": "MTD", + "vfat": "EMMC" } def GetTypeAndDevice(mount_point, info): fstab = info["fstab"] diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py index e52c2641561..439811cd7f2 100644 --- a/tools/releasetools/edify_generator.py +++ b/tools/releasetools/edify_generator.py @@ -116,11 +116,13 @@ def AssertOlderBuild(self, timestamp, timestamp_text): def AssertDevice(self, device): """Assert that the device identifier is the given string.""" - cmd = ('getprop("ro.product.device") == "%s" || ' - 'abort("This package is for \\"%s\\" devices; ' + cmd = ('(' + + ' || \0'.join(['getprop("ro.product.device") == "%s" || getprop("ro.build.product") == "%s"' + % (i, i) for i in device.split(",")]) + + ') || abort("This package is for \\"%s\\" devices\n' 'this is a \\"" + getprop("ro.product.device") + "\\".");' - ) % (device, device) - self.script.append(cmd) + ) % (device) + self.script.append(self._WordWrap(cmd)) def AssertSomeBootloader(self, *bootloaders): """Asert that the bootloader version is one of *bootloaders.""" @@ -130,6 +132,14 @@ def AssertSomeBootloader(self, *bootloaders): ");") self.script.append(self._WordWrap(cmd)) + def RunBackup(self, command): + self.script.append('package_extract_file("system/bin/backuptool.sh", "/system/bin/backuptool.sh");') + self.script.append('package_extract_file("system/bin/backuptool.functions", "/tmp/backuptool.functions");') + self.SetPermissions("/system/bin/backuptool.sh", 0, 0, 0755, None, None) + self.script.append(('run_program("/system/bin/backuptool.sh", "%s");' % command)) + if command == "restore": + self.DeleteFiles(["/tmp/backuptool.functions"]) + def ShowProgress(self, frac, dur): """Update the progress bar, advancing it over 'frac' over the next 'dur' seconds. 'dur' may be zero to advance it via SetProgress @@ -164,7 +174,7 @@ def CacheFreeSpaceCheck(self, amount): self.script.append(('apply_patch_space(%d) || abort("Not enough free space ' 'on /system to apply patches.");') % (amount,)) - def Mount(self, mount_point, mount_options_by_format=""): + def Mount(self, mount_point, mount_by_label = False, mount_options_by_format=""): """Mount the partition with the given mount_point. mount_options_by_format: [fs_type=option[,option]...[|fs_type=option[,option]...]...] @@ -174,17 +184,26 @@ def Mount(self, mount_point, mount_options_by_format=""): fstab = self.info.get("fstab", None) if fstab: p = fstab[mount_point] - mount_dict = {} - if mount_options_by_format is not None: - for option in mount_options_by_format.split("|"): - if "=" in option: - key, value = option.split("=", 1) - mount_dict[key] = value - self.script.append('mount("%s", "%s", "%s", "%s", "%s");' % + if mount_by_label: + self.script.append('run_program("/sbin/mount", "%s");' % (mount_point,)) + else: + mount_dict = {} + if mount_options_by_format is not None: + for option in mount_options_by_format.split("|"): + if "=" in option: + key, value = option.split("=", 1) + mount_dict[key] = value + self.script.append('mount("%s", "%s", "%s", "%s", "%s");' % (p.fs_type, common.PARTITION_TYPES[p.fs_type], p.device, p.mount_point, mount_dict.get(p.fs_type, ""))) self.mounts.add(p.mount_point) + def Unmount(self, mount_point): + """Unmount the partiiton with the given mount_point.""" + if mount_point in self.mounts: + self.mounts.remove(mount_point) + self.script.append('unmount("%s");' % (mount_point,)) + def UnpackPackageDir(self, src, dst): """Unpack a given directory from the OTA package into the given destination directory.""" @@ -212,7 +231,7 @@ def TunePartition(self, partition, *options): '"%s") || abort("Failed to tune partition %s");' % ( p.device,partition)); - def FormatPartition(self, partition): + def FormatPartition(self, partition, mount_by_label = False): """Format the given partition, specified by its mount point (eg, "/system").""" @@ -220,9 +239,14 @@ def FormatPartition(self, partition): fstab = self.info.get("fstab", None) if fstab: p = fstab[partition] - self.script.append('format("%s", "%s", "%s", "%s", "%s");' % - (p.fs_type, common.PARTITION_TYPES[p.fs_type], - p.device, p.length, p.mount_point)) + if mount_by_label: + if not p.mount_point in self.mounts: + self.script.mount(p.mount_point) + self.script.append('run_program("/sbin/rm", "-rf", "%s");' % (p.mount_point,)) + else: + self.script.append('format("%s", "%s", "%s", "%s", "%s");' % + (p.fs_type, common.PARTITION_TYPES[p.fs_type], + p.device, p.length, p.mount_point)) def WipeBlockDevice(self, partition): if partition not in ("/system", "/vendor"): @@ -288,6 +312,11 @@ def WriteRawImage(self, mount_point, fn, mapfn=None): else: self.script.append( 'package_extract_file("%(fn)s", "%(device)s");' % args) + elif partition_type == "BML": + self.script.append( + ('assert(package_extract_file("%(fn)s", "/tmp/%(device)s.img"),\n' + ' write_raw_image("/tmp/%(device)s.img", "%(device)s"),\n' + ' delete("/tmp/%(device)s.img"));') % args) else: raise ValueError("don't know how to write \"%s\" partitions" % (p.fs_type,)) diff --git a/tools/releasetools/ota_from_target_files b/tools/releasetools/ota_from_target_files index 25309a49ce6..75b1e99f16b 100755 --- a/tools/releasetools/ota_from_target_files +++ b/tools/releasetools/ota_from_target_files @@ -60,6 +60,25 @@ Usage: ota_from_target_files [flags] input_target_files output_ota_package -a (--aslr_mode) Specify whether to turn on ASLR for the package (on by default). + --backup + Enable or disable the execution of backuptool.sh. + Disabled by default. + + --override_device + Override device-specific asserts. Can be a comma-separated list. + + --override_prop + Override build.prop items with custom vendor init. + Enabled when TARGET_UNIFIED_DEVICE is defined in BoardConfig + + --override_boot_partition + Override the partition where the boot image is installed. + Used for devices with a staging partition (Asus Transformer). + + --mount_by_label + Force the OTA package to mount and format System by label + Can be enabled by defining TARGET_SETS_FSTAB. Defaults to false. + -2 (--two_step) Generate a 'two-step' OTA package, where recovery is updated first, so that any changes made to the system partition are done @@ -119,6 +138,11 @@ OPTIONS.aslr_mode = True OPTIONS.worker_threads = multiprocessing.cpu_count() // 2 if OPTIONS.worker_threads == 0: OPTIONS.worker_threads = 1 +OPTIONS.backuptool = False +OPTIONS.override_device = 'auto' +OPTIONS.override_prop = False +OPTIONS.override_boot_partition = '' +OPTIONS.mount_by_label = False OPTIONS.two_step = False OPTIONS.no_signing = False OPTIONS.block_based = False @@ -138,7 +162,7 @@ def MostPopularKey(d, default): def IsSymlink(info): """Return true if the zipfile.ZipInfo object passed in represents a symlink.""" - return (info.external_attr >> 16) == 0120777 + return (info.external_attr >> 16 & 0770000) == 0120000 def IsRegular(info): """Return true if the zipfile.ZipInfo object passed in represents a @@ -385,7 +409,10 @@ def SignOutput(temp_zip_name, output_zip_name): def AppendAssertions(script, info_dict, oem_dict = None): oem_props = info_dict.get("oem_fingerprint_properties") if oem_props is None or len(oem_props) == 0: - device = GetBuildProp("ro.product.device", info_dict) + if OPTIONS.override_device == "auto": + device = GetBuildProp("ro.product.device", info_dict) + else: + device = OPTIONS.override_device script.AssertDevice(device) else: if oem_dict is None: @@ -475,13 +502,18 @@ def WriteFullOTAPackage(input_zip, output_zip): script.Mount("/oem", recovery_mount_options) oem_dict = common.LoadDictionaryFromLines(open(OPTIONS.oem_source).readlines()) - metadata = {"post-build": CalculateFingerprint( - oem_props, oem_dict, OPTIONS.info_dict), - "pre-device": GetOemProperty("ro.product.device", oem_props, oem_dict, - OPTIONS.info_dict), - "post-timestamp": GetBuildProp("ro.build.date.utc", + if OPTIONS.override_prop: + metadata = {"post-timestamp": GetBuildProp("ro.build.date.utc", + OPTIONS.info_dict), + } + else: + metadata = {"post-build": CalculateFingerprint( + oem_props, oem_dict, OPTIONS.info_dict), + "pre-device": GetOemProperty("ro.product.device", oem_props, oem_dict, + OPTIONS.info_dict), + "post-timestamp": GetBuildProp("ro.build.date.utc", OPTIONS.info_dict), - } + } device_specific = common.DeviceSpecificParams( input_zip=input_zip, @@ -495,10 +527,10 @@ def WriteFullOTAPackage(input_zip, output_zip): has_recovery_patch = HasRecoveryPatch(input_zip) block_based = OPTIONS.block_based and has_recovery_patch - if not OPTIONS.omit_prereq: - ts = GetBuildProp("ro.build.date.utc", OPTIONS.info_dict) - ts_text = GetBuildProp("ro.build.date", OPTIONS.info_dict) - script.AssertOlderBuild(ts, ts_text) +# if not OPTIONS.omit_prereq: +# ts = GetBuildProp("ro.build.date.utc", OPTIONS.info_dict) +# ts_text = GetBuildProp("ro.build.date", OPTIONS.info_dict) +# script.AssertOlderBuild(ts, ts_text) AppendAssertions(script, OPTIONS.info_dict, oem_dict) device_specific.FullOTA_Assertions() @@ -522,8 +554,8 @@ def WriteFullOTAPackage(input_zip, output_zip): # set up system to update recovery partition on first boot # complete script normally (allow recovery to mark itself finished and reboot) - recovery_img = common.GetBootableImage("recovery.img", "recovery.img", - OPTIONS.input_tmp, "RECOVERY") +# recovery_img = common.GetBootableImage("recovery.img", "recovery.img", +# OPTIONS.input_tmp, "RECOVERY") if OPTIONS.two_step: if not OPTIONS.info_dict.get("multistage_support", None): assert False, "two-step packages not supported by this build" @@ -542,8 +574,32 @@ reboot_now("%(bcb_dev)s", "recovery"); else if get_stage("%(bcb_dev)s") == "3/3" then """ % bcb_dev) + script.AppendExtra("ifelse(is_mounted(\"/system\"), unmount(\"/system\"));") device_specific.FullOTA_InstallBegin() + if OPTIONS.backuptool: + script.Mount("/system", OPTIONS.mount_by_label) + script.RunBackup("backup") + if not OPTIONS.mount_by_label: + script.Unmount("/system") + + script.ShowProgress(0.5, 0) + + if OPTIONS.wipe_user_data: + script.Print("Formatting /data") + script.FormatPartition("/data", OPTIONS.mount_by_label) + + script.Print("#######################################"); + script.Print("# _____ __ __ ______ #"); + script.Print("#/\ __`\ /'\_/`\/\ \/\ \/\__ _\ #"); + script.Print("#\ \ \/\ \/\ `` \ \ ` \ \/_/\ \/ #"); + script.Print("# \ \ \ \ \ \ \__\ \ \ . ` \ \ \ \ #"); + script.Print("# \ \ \_\ \ \ \_/\ \ \ \`\ \ \_\ \__ #"); + script.Print("# \ \_____\ \_\, \_\ \_\ \_\/\_____\#"); + script.Print("# \/_____/\/_/ \/_/\/_/\/_/\/_____/#"); + script.Print("# #"); + script.Print("#######################################"); + system_progress = 0.75 if OPTIONS.wipe_user_data: @@ -569,13 +625,18 @@ else if get_stage("%(bcb_dev)s") == "3/3" then system_diff = common.BlockDifference("system", system_tgt, src=None) system_diff.WriteScript(script, output_zip) else: + script.Print("Formatting /system") script.FormatPartition("/system") - script.Mount("/system", recovery_mount_options) - if not has_recovery_patch: - script.UnpackPackageDir("recovery", "/system") + if not OPTIONS.mount_by_label: + script.Mount("/system", recovery_mount_options) +# if not has_recovery_patch: +# script.UnpackPackageDir("recovery", "/system") + + script.Print("Extracting /system") script.UnpackPackageDir("system", "/system") symlinks = CopyPartitionFiles(system_items, input_zip, output_zip) + script.Print("Symlinking") script.MakeSymlinks(symlinks) boot_img = common.GetBootableImage("boot.img", "boot.img", @@ -586,8 +647,8 @@ else if get_stage("%(bcb_dev)s") == "3/3" then common.ZipWriteStr(output_zip, "recovery/" + fn, data) system_items.Get("system/" + fn, dir=False) - common.MakeRecoveryPatch(OPTIONS.input_tmp, output_sink, - recovery_img, boot_img) +# common.MakeRecoveryPatch(OPTIONS.input_tmp, output_sink, +# recovery_img, boot_img) system_items.GetMetadata(input_zip) system_items.Get("system").SetPermissions(script) @@ -615,10 +676,17 @@ else if get_stage("%(bcb_dev)s") == "3/3" then common.CheckSize(boot_img.data, "boot.img", OPTIONS.info_dict) common.ZipWriteStr(output_zip, "boot.img", boot_img.data) - script.ShowProgress(0.05, 5) - script.WriteRawImage("/boot", "boot.img") + if OPTIONS.backuptool: + script.ShowProgress(0.2, 10) + script.RunBackup("restore") script.ShowProgress(0.2, 10) + script.Print("Flashing boot.img") + bootpartition = "/boot" if OPTIONS.override_boot_partition == "" else OPTIONS.override_boot_partition + script.WriteRawImage(bootpartition, "boot.img") + + script.ShowProgress(0.1, 0) + script.Print("Enjoy OMNI ROM!"); device_specific.FullOTA_InstallEnd() if OPTIONS.extra_script is not None: @@ -702,11 +770,12 @@ def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_zip): script = edify_generator.EdifyGenerator(source_version, OPTIONS.target_info_dict) - metadata = {"pre-device": GetBuildProp("ro.product.device", - OPTIONS.source_info_dict), - "post-timestamp": GetBuildProp("ro.build.date.utc", - OPTIONS.target_info_dict), - } + metadata = {} + metadata["post-timestamp"] = GetBuildProp("ro.build.date.utc", + OPTIONS.info_dict) + if not OPTIONS.override_prop: + metadata["pre-device"] = GetBuildProp("ro.product.device", + OPTIONS.info_dict) device_specific = common.DeviceSpecificParams( source_zip=source_zip, @@ -718,10 +787,14 @@ def WriteBlockIncrementalOTAPackage(target_zip, source_zip, output_zip): metadata=metadata, info_dict=OPTIONS.info_dict) - source_fp = GetBuildProp("ro.build.fingerprint", OPTIONS.source_info_dict) - target_fp = GetBuildProp("ro.build.fingerprint", OPTIONS.target_info_dict) - metadata["pre-build"] = source_fp - metadata["post-build"] = target_fp + if not OPTIONS.override_prop: + source_fp = GetBuildProp("ro.build.fingerprint", OPTIONS.source_info_dict) + target_fp = GetBuildProp("ro.build.fingerprint", OPTIONS.target_info_dict) + metadata["pre-build"] = source_fp + metadata["post-build"] = target_fp + + script.Mount("/system", OPTIONS.mount_by_label) + script.AssertSomeFingerprint(source_fp, target_fp) source_boot = common.GetBootableImage( "/tmp/boot.img", "boot.img", OPTIONS.source_tmp, "BOOT", @@ -1130,11 +1203,11 @@ def WriteIncrementalOTAPackage(target_zip, source_zip, output_zip): updating_boot = (not OPTIONS.two_step and (source_boot.data != target_boot.data)) - source_recovery = common.GetBootableImage( - "/tmp/recovery.img", "recovery.img", OPTIONS.source_tmp, "RECOVERY", - OPTIONS.source_info_dict) - target_recovery = common.GetBootableImage( - "/tmp/recovery.img", "recovery.img", OPTIONS.target_tmp, "RECOVERY") +# source_recovery = common.GetBootableImage( +# "/tmp/recovery.img", "recovery.img", OPTIONS.source_tmp, "RECOVERY", +# OPTIONS.source_info_dict) +# target_recovery = common.GetBootableImage( +# "/tmp/recovery.img", "recovery.img", OPTIONS.target_tmp, "RECOVERY") updating_recovery = (source_recovery.data != target_recovery.data) # Here's how we divide up the progress bar: @@ -1237,6 +1310,10 @@ else script.WriteRawImage("/boot", "boot.img") print "writing full boot image (forced by two-step mode)" + if OPTIONS.wipe_user_data: + script.Print("Erasing user data...") + script.FormatPartition("/data", OPTIONS.mount_by_label) + script.Print("Removing unneeded files...") system_diff.RemoveUnneededFiles(script, ("/system/recovery.img",)) if vendor_diff: @@ -1339,9 +1416,9 @@ else script.Print("Unpacking new vendor files...") script.UnpackPackageDir("vendor", "/vendor") - if updating_recovery and not target_has_recovery_patch: - script.Print("Unpacking new recovery...") - script.UnpackPackageDir("recovery", "/system") +# if updating_recovery: +# script.Print("Unpacking new recovery...") +# script.UnpackPackageDir("recovery", "/system") system_diff.EmitRenames(script) if vendor_diff: @@ -1433,6 +1510,16 @@ def main(argv): else: raise ValueError("Cannot parse value %r for option %r - only " "integers are allowed." % (a, o)) + elif o in ("--backup"): + OPTIONS.backuptool = bool(a.lower() == 'true') + elif o in ("--override_device"): + OPTIONS.override_device = a + elif o in ("--override_prop"): + OPTIONS.override_prop = bool(a.lower() == 'true') + elif o in ("--override_boot_partition"): + OPTIONS.override_boot_partition = a + elif o in ("--mount_by_label"): + OPTIONS.mount_by_label = bool(a.lower() == 'true') elif o in ("-2", "--two_step"): OPTIONS.two_step = True elif o == "--no_signing": @@ -1459,7 +1546,12 @@ def main(argv): "extra_script=", "worker_threads=", "aslr_mode=", + "backup=", + "override_device=", + "override_prop=", + "override_boot_partition=", "two_step", + "mount_by_label=", "no_signing", "block", "binary=", diff --git a/tools/repopick.py b/tools/repopick.py new file mode 100755 index 00000000000..8376744ca67 --- /dev/null +++ b/tools/repopick.py @@ -0,0 +1,276 @@ +#!/usr/bin/env python +# +# Copyright (C) 2013 The CyanogenMod Project +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +# +# Run repopick.py -h for a description of this utility. +# + +from __future__ import print_function + +import sys +import json +import os +import subprocess +import re +import argparse +import textwrap + +try: + # For python3 + import urllib.request +except ImportError: + # For python2 + import imp + import urllib2 + urllib = imp.new_module('urllib') + urllib.request = urllib2 + +# Parse the command line +parser = argparse.ArgumentParser(formatter_class=argparse.RawDescriptionHelpFormatter, description=textwrap.dedent('''\ + repopick.py is a utility to simplify the process of cherry picking + patches from OmniROM's Gerrit instance. + + Given a list of change numbers, repopick will cd into the project path + and cherry pick the latest patch available. + + With the --start-branch argument, the user can specify that a branch + should be created before cherry picking. This is useful for + cherry-picking many patches into a common branch which can be easily + abandoned later (good for testing other's changes.) + + The --abandon-first argument, when used in conjuction with the + --start-branch option, will cause repopick to abandon the specified + branch in all repos first before performing any cherry picks.''')) +parser.add_argument('change_number', nargs='+', help='change number to cherry pick') +parser.add_argument('-i', '--ignore-missing', action='store_true', help='do not error out if a patch applies to a missing directory') +parser.add_argument('-c', '--checkout', action='store_true', help='checkout instead of cherry pick') +parser.add_argument('-s', '--start-branch', nargs=1, help='start the specified branch before cherry picking') +parser.add_argument('-a', '--abandon-first', action='store_true', help='before cherry picking, abandon the branch specified in --start-branch') +parser.add_argument('-b', '--auto-branch', action='store_true', help='shortcut to "--start-branch auto --abandon-first --ignore-missing"') +parser.add_argument('-q', '--quiet', action='store_true', help='print as little as possible') +parser.add_argument('-v', '--verbose', action='store_true', help='print extra information to aid in debug') +args = parser.parse_args() +if args.start_branch == None and args.abandon_first: + parser.error('if --abandon-first is set, you must also give the branch name with --start-branch') +if args.auto_branch: + args.abandon_first = True + args.ignore_missing = True + if not args.start_branch: + args.start_branch = ['auto'] +if args.quiet and args.verbose: + parser.error('--quiet and --verbose cannot be specified together') + +# Helper function to determine whether a path is an executable file +def is_exe(fpath): + return os.path.isfile(fpath) and os.access(fpath, os.X_OK) + +# Implementation of Unix 'which' in Python +# +# From: http://stackoverflow.com/questions/377017/test-if-executable-exists-in-python +def which(program): + fpath, fname = os.path.split(program) + if fpath: + if is_exe(program): + return program + else: + for path in os.environ["PATH"].split(os.pathsep): + path = path.strip('"') + exe_file = os.path.join(path, program) + if is_exe(exe_file): + return exe_file + sys.stderr.write('ERROR: Could not find the %s program in $PATH\n' % program) + sys.exit(1) + +# Simple wrapper for os.system() that: +# - exits on error +# - prints out the command if --verbose +# - suppresses all output if --quiet +def execute_cmd(cmd, exit_on_fail=True): + if args.verbose: + print('Executing: %s' % cmd) + #if args.quiet: + # cmd = cmd.replace(' && ', ' &> /dev/null && ') + # cmd = cmd + " &> /dev/null" + ret = os.system(cmd) + if ret and exit_on_fail: + if not args.verbose: + sys.stderr.write('\nERROR: Command that failed:\n%s' % cmd) + sys.exit(1) + return ret + +# Verifies whether pathA is a subdirectory (or the same) as pathB +def is_pathA_subdir_of_pathB(pathA, pathB): + pathA = os.path.realpath(pathA) + '/' + pathB = os.path.realpath(pathB) + '/' + return(pathB == pathA[:len(pathB)]) + +# Find the necessary bins - repo +repo_bin = which('repo') + +# Find the necessary bins - git +git_bin = which('git') + +# Change current directory to the top of the tree +if os.environ.get('ANDROID_BUILD_TOP', None): + top = os.environ['ANDROID_BUILD_TOP'] + if not is_pathA_subdir_of_pathB(os.getcwd(), top): + sys.stderr.write('ERROR: You must run this tool from within $ANDROID_BUILD_TOP!\n') + sys.exit(1) + os.chdir(os.environ['ANDROID_BUILD_TOP']) +else: + sys.stderr.write('ERROR: $ANDROID_BUILD_TOP is not defined. please check build/envsetup.sh\n') + sys.exit(1) + +# Sanity check that we are being run from the top level of the tree +if not os.path.isdir('.repo'): + sys.stderr.write('ERROR: No .repo directory found. Please run this from the top of your tree.\n') + sys.exit(1) + +# If --abandon-first is given, abandon the branch before starting +if args.abandon_first: + # Determine if the branch already exists; skip the abandon if it does not + plist = subprocess.Popen([repo_bin,"info"], stdout=subprocess.PIPE) + needs_abandon = False + while(True): + pline = plist.stdout.readline().rstrip() + if not pline: + break + matchObj = re.match(r'Local Branches.*\[(.*)\]', pline.decode()) + if matchObj: + local_branches = re.split('\s*,\s*', matchObj.group(1)) + if any(args.start_branch[0] in s for s in local_branches): + needs_abandon = True + + if needs_abandon: + # Perform the abandon only if the branch already exists + if not args.quiet: + print('Abandoning branch: %s' % args.start_branch[0]) + cmd = '%s abandon %s' % (repo_bin, args.start_branch[0]) + execute_cmd(cmd) + if not args.quiet: + print('') + +# Get the list of projects that repo knows about +# - convert the project name to a project path +project_name_to_path = {} +plist = subprocess.Popen([repo_bin,"list"], stdout=subprocess.PIPE) +project_path = None +while(True): + pline = plist.stdout.readline().rstrip() + if not pline: + break + ppaths = re.split('\s*:\s*', pline.decode()) + project_name_to_path[ppaths[1]] = ppaths[0] + +# Iterate through the requested change numbers +for change in args.change_number: + if not args.quiet: + print('Applying change number %s ...' % change) + + # Fetch information about the change from Gerrit's REST API + # + # gerrit returns two lines, a magic string and then valid JSON: + # )]}' + # [ ... valid JSON ... ] + url = 'https://gerrit.omnirom.org/changes/?q=%s&o=CURRENT_REVISION&o=CURRENT_COMMIT&pp=0' % change + if args.verbose: + print('Fetching from: %s\n' % url) + f = urllib.request.urlopen(url) + d = f.read().decode("utf-8") + if args.verbose: + print('Result from request:\n' + d) + + # Clean up the result + d = d.split('\n')[1] + matchObj = re.match(r'\[\s*\]', d) + if matchObj: + sys.stderr.write('ERROR: Change number %s was not found on the server\n' % change) + sys.exit(1) + + # Parse the JSON + try: + data_array = json.loads(d) + except ValueError: + sys.stderr.write('ERROR: The response from the server could not be parsed properly\n') + if args.verbose: + sys.stderr.write('The malformed response was: %s\n' % d) + sys.exit(1) + # Enumerate through JSON response + for (i, data) in enumerate(data_array): + date_fluff = '.000000000' + project_name = data['project'] + change_number = data['_number'] + current_revision = data['revisions'][data['current_revision']] + patch_number = current_revision['_number'] + # Backwards compatibility + if 'http' in current_revision['fetch']: + fetch_url = current_revision['fetch']['http']['url'] + fetch_ref = current_revision['fetch']['http']['ref'] + else: + fetch_url = current_revision['fetch']['anonymous http']['url'] + fetch_ref = current_revision['fetch']['anonymous http']['ref'] + author_name = current_revision['commit']['author']['name'] + author_email = current_revision['commit']['author']['email'] + author_date = current_revision['commit']['author']['date'].replace(date_fluff, '') + committer_name = current_revision['commit']['committer']['name'] + committer_email = current_revision['commit']['committer']['email'] + committer_date = current_revision['commit']['committer']['date'].replace(date_fluff, '') + subject = current_revision['commit']['subject'] + + # Convert the project name to a project path + # - check that the project path exists + if project_name in project_name_to_path: + project_path = project_name_to_path[project_name]; + elif args.ignore_missing: + print('WARNING: Skipping %d since there is no project directory for: %s\n' % (change_number, project_name)) + continue; + else: + sys.stderr.write('ERROR: For %d, could not determine the project path for project %s\n' % (change_number, project_name)) + continue; + + # If --start-branch is given, create the branch (more than once per path is okay; repo ignores gracefully) + if args.start_branch: + cmd = '%s start %s %s' % (repo_bin, args.start_branch[0], project_path) + execute_cmd(cmd) + + # Print out some useful info + if not args.quiet: + print('--> Subject: "%s"' % subject) + print('--> Project path: %s' % project_path) + print('--> Change number: %d (Patch Set %d)' % (change_number, patch_number)) + print('--> Author: %s <%s> %s' % (author_name, author_email, author_date)) + print('--> Committer: %s <%s> %s' % (committer_name, committer_email, committer_date)) + + if args.verbose: + print('Trying to fetch the change %d (Patch Set %d) from Gerrit') + cmd = 'cd %s && git fetch %s %s' % (project_path, fetch_url, fetch_ref) + execute_cmd(cmd) + # Check if it worked + FETCH_HEAD = '%s/.git/FETCH_HEAD' % project_path + if os.stat(FETCH_HEAD).st_size == 0: + # That didn't work, print error and exit + sys.stderr.write('ERROR: Fetching change from Gerrit failed. Exiting...') + continue; + # Perform the cherry-pick or checkout + if args.checkout: + cmd = 'cd %s && git checkout FETCH_HEAD' % (project_path) + else: + cmd = 'cd %s && git cherry-pick FETCH_HEAD' % (project_path) + + execute_cmd(cmd) + if not args.quiet: + print('Change #%d (Patch Set %d) %s into %s' % (change_number, patch_number, 'checked out' if args.checkout else 'cherry-picked', project_path)) diff --git a/tools/roomservice.py b/tools/roomservice.py new file mode 100755 index 00000000000..619c18d66fc --- /dev/null +++ b/tools/roomservice.py @@ -0,0 +1,297 @@ +#!/usr/bin/env python + +# Copyright (C) 2013 Cybojenix +# Copyright (C) 2013 The OmniROM Project +# +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see . + +from __future__ import print_function +import json +import sys +import os +import os.path +import re +from xml.etree import ElementTree as ES +# Use the urllib importer from the Cyanogenmod roomservice +try: + # For python3 + import urllib.request +except ImportError: + # For python2 + import imp + import urllib2 + urllib = imp.new_module('urllib') + urllib.request = urllib2 + +# Config +# set this to the default remote to use in repo +default_rem = "omnirom" +# set this to the default revision to use (branch/tag name) +default_rev = "android-5.1" +# set this to the remote that you use for projects from your team repos +# example fetch="https://github.com/omnirom" +default_team_rem = "omnirom" +# this shouldn't change unless google makes changes +local_manifest_dir = ".repo/local_manifests" +# change this to your name on github (or equivalent hosting) +android_team = "omnirom" +# url to gerrit repository +gerrit_url = "gerrit.omnirom.org" + + +def check_repo_exists(git_data, device): + re_match = "^android_device_.*_{device}$".format(device=device) + matches = filter(lambda x: re.match(re_match, x), git_data) + if len(matches) != 1: + raise Exception("{device} not found," + "exiting roomservice".format(device=device)) + + return git_data[matches[0]] + + +def search_gerrit_for_device(device): + # TODO: In next gerrit release regex search with r= should be supported! + git_search_url = "https://{gerrit_url}/projects/?m={device}".format( + gerrit_url=gerrit_url, + device=device + ) + git_req = urllib.request.Request(git_search_url) + try: + response = urllib.request.urlopen(git_req) + except urllib.request.HTTPError: + raise Exception("There was an issue connecting to gerrit." + " Please try again in a minute") + # Skip silly gerrit "header" + response.readline() + git_data = json.load(response) + device_data = check_repo_exists(git_data, device) + print("found the {} device repo".format(device)) + return device_data + + +def parse_device_directory(device_url, device): + pattern = "^android_device_(?P.+)_{}$".format(device) + match = re.match(pattern, device_url) + + if match is None: + raise Exception("Invalid project name {}".format(device_url)) + return "device/{vendor}/{device}".format( + vendor=match.group('vendor'), + device=device, + ) + + +# Thank you RaYmAn +def iterate_manifests(): + files = [] + for file in os.listdir(local_manifest_dir): + if file.endswith(".xml"): + files.append(os.path.join(local_manifest_dir, file)) + files.append('.repo/manifest.xml') + for file in files: + try: + man = ES.parse(file) + man = man.getroot() + except IOError, ES.ParseError: + print("WARNING: error while parsing %s" % file) + else: + for project in man.findall("project"): + yield project + + +def check_project_exists(url, revision, path): + for project in iterate_manifests(): + if project.get("name") == url and project.get("revision") == revision and project.get("path") == path: + return True + return False + + +def check_target_exists(directory): + return os.path.isdir(directory) + + +# Use the indent function from http://stackoverflow.com/a/4590052 +def indent(elem, level=0): + i = ''.join(["\n", level*" "]) + if len(elem): + if not elem.text or not elem.text.strip(): + elem.text = ''.join([i, " "]) + if not elem.tail or not elem.tail.strip(): + elem.tail = i + for elem in elem: + indent(elem, level+1) + if not elem.tail or not elem.tail.strip(): + elem.tail = i + else: + if level and (not elem.tail or not elem.tail.strip()): + elem.tail = i + + +def create_manifest_project(url, directory, + remote=default_rem, + revision=default_rev): + project_exists = check_project_exists(url, revision, directory) + + if project_exists: + return None + + project = ES.Element("project", + attrib={ + "path": directory, + "name": url, + "remote": remote, + "revision": revision + }) + return project + + +def append_to_manifest(project): + try: + lm = ES.parse('/'.join([local_manifest_dir, "roomservice.xml"])) + lm = lm.getroot() + except IOError, ES.ParseError: + lm = ES.Element("manifest") + lm.append(project) + return lm + + +def write_to_manifest(manifest): + indent(manifest) + raw_xml = ES.tostring(manifest).decode() + raw_xml = ''.join(['\n' + '\n', + raw_xml]) + + with open('/'.join([local_manifest_dir, "roomservice.xml"]), 'w') as f: + f.write(raw_xml) + print("wrote the new roomservice manifest") + + +def parse_device_from_manifest(device): + for project in iterate_manifests(): + name = project.get('name') + if name.startswith("android_device_") and name.endswith(device): + return project.get('path') + return None + + +def parse_device_from_folder(device): + search = [] + for sub_folder in os.listdir("device"): + if os.path.isdir("device/%s/%s" % (sub_folder, device)): + search.append("device/%s/%s" % (sub_folder, device)) + if len(search) > 1: + print("multiple devices under the name %s. " + "defaulting to checking the manifest" % device) + location = parse_device_from_manifest(device) + elif len(search) == 1: + location = search[0] + else: + print("Your device can't be found in device sources..") + location = parse_device_from_manifest(device) + return location + + +def parse_dependency_file(location): + dep_file = "omni.dependencies" + dep_location = '/'.join([location, dep_file]) + if not os.path.isfile(dep_location): + print("WARNING: %s file not found" % dep_location) + sys.exit() + try: + with open(dep_location, 'r') as f: + dependencies = json.loads(f.read()) + except ValueError: + raise Exception("ERROR: malformed dependency file") + return dependencies + + +def create_dependency_manifest(dependencies): + projects = [] + for dependency in dependencies: + repository = dependency.get("repository") + target_path = dependency.get("target_path") + revision = dependency.get("revision", default_rev) + remote = dependency.get("remote", default_rem) + + # not adding an organization should default to android_team + # only apply this to github + if remote == "github": + if "/" not in repository: + repository = '/'.join([android_team, repository]) + project = create_manifest_project(repository, + target_path, + remote=remote, + revision=revision) + if project is not None: + manifest = append_to_manifest(project) + write_to_manifest(manifest) + projects.append(target_path) + if len(projects) > 0: + os.system("repo sync -f --no-clone-bundle %s" % " ".join(projects)) + + +def fetch_dependencies(device): + location = parse_device_from_folder(device) + if location is None or not os.path.isdir(location): + raise Exception("ERROR: could not find your device " + "folder location, bailing out") + dependencies = parse_dependency_file(location) + create_dependency_manifest(dependencies) + + +def check_device_exists(device): + location = parse_device_from_folder(device) + if location is None: + return False + return os.path.isdir(location) + + +def fetch_device(device): + if check_device_exists(device): + print("WARNING: Trying to fetch a device that's already there") + return + git_data = search_gerrit_for_device(device) + device_url = git_data['id'] + device_dir = parse_device_directory(device_url, device) + project = create_manifest_project(device_url, + device_dir, + remote=default_team_rem) + if project is not None: + manifest = append_to_manifest(project) + write_to_manifest(manifest) + # In case a project was written to manifest, but never synced + if project is not None or not check_target_exists(device_dir): + print("syncing the device config") + os.system('repo sync -f --no-clone-bundle %s' % device_dir) + + +if __name__ == '__main__': + if not os.path.isdir(local_manifest_dir): + os.mkdir(local_manifest_dir) + + product = sys.argv[1] + try: + device = product[product.index("_") + 1:] + except ValueError: + device = product + + if len(sys.argv) > 2: + deps_only = sys.argv[2] + else: + deps_only = False + + if not deps_only: + fetch_device(device) + fetch_dependencies(device)