From 653bea928abf0eafd6a1e76ac881abe8f9239c97 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 21 Mar 2017 15:47:37 -0700 Subject: [PATCH 1/2] Add missing dependencies of targets-files-package And move simple cases of $(ACP) to cp. That does change OTA/bin/updater from 0640 to 0700, but that's more consistent anyways. Test: m -j target-files-package; ensure it's the same before/after. Change-Id: I37b65eb9ddccd2f360aa007f929ece35c9e44f9b --- core/Makefile | 66 +++++++++++++++++++++++++++++++++------------------ 1 file changed, 43 insertions(+), 23 deletions(-) diff --git a/core/Makefile b/core/Makefile index cf0aa4a42..234e03a5f 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1891,14 +1891,18 @@ $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_FSTAB_VERSION := $(RECOVERY_FSTA ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),) # default to common dir for device vendor -$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_DEVICE_DIR)/../common +tool_extensions := $(TARGET_DEVICE_DIR)/../common else -$(BUILT_TARGET_FILES_PACKAGE): tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS) +tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS) endif +tool_extension := $(wildcard $(tool_extensions)/releasetools.py) +$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSIONS := $(tool_extensions) +$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_TOOL_EXTENSION := $(tool_extension) ifeq ($(AB_OTA_UPDATER),true) # Build zlib fingerprint if using the AB Updater. updater_dep := $(TARGET_OUT_COMMON_GEN)/zlib_fingerprint +updater_dep += system/update_engine/update_engine.conf else # Build OTA tools if not using the AB Updater. updater_dep := $(built_ota_tools) @@ -1912,6 +1916,18 @@ else $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY endif +ifeq ($(AB_OTA_UPDATER),true) + ifdef BRILLO_VENDOR_PARTITIONS + $(BUILT_TARGET_FILES_PACKAGE): $(foreach p,$(BRILLO_VENDOR_PARTITIONS),\ + $(call word-colon,1,$(p))/$(call word-colon,2,$(p))) + endif + ifdef OSRELEASED_DIRECTORY + $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id + $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version + $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version + endif +endif + # Run fs_config while creating the target files package # $1: root directory # $2: add prefix @@ -1931,6 +1947,10 @@ $(BUILT_TARGET_FILES_PACKAGE): \ $(INSTALLED_VENDORIMAGE_TARGET) \ $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) \ $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ + $(INSTALLED_KERNEL_TARGET) \ + $(INSTALLED_2NDBOOTLOADER_TARGET) \ + $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \ + $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \ $(SELINUX_FC) \ $(APKCERTS_FILE) \ $(SOONG_ZIP) \ @@ -1946,11 +1966,10 @@ ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_ $(hide) $(call package_files-copy-root, \ $(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK) ifdef INSTALLED_KERNEL_TARGET - $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel + $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel endif ifdef INSTALLED_2NDBOOTLOADER_TARGET - $(hide) $(ACP) \ - $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second + $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/second endif ifdef INTERNAL_KERNEL_CMDLINE $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/cmdline @@ -1975,11 +1994,10 @@ endif @# If we are using recovery as boot, this is already done when processing recovery. ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true) ifdef INSTALLED_KERNEL_TARGET - $(hide) $(ACP) $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel + $(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/BOOT/kernel endif ifdef INSTALLED_2NDBOOTLOADER_TARGET - $(hide) $(ACP) \ - $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second + $(hide) cp $(INSTALLED_2NDBOOTLOADER_TARGET) $(zip_root)/BOOT/second endif ifdef INTERNAL_KERNEL_CMDLINE $(hide) echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline @@ -1993,7 +2011,7 @@ endif endif # BOARD_USES_RECOVERY_AS_BOOT $(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\ mkdir -p $(zip_root)/RADIO; \ - $(ACP) $(t) $(zip_root)/RADIO/$(notdir $(t));) + cp $(t) $(zip_root)/RADIO/$(notdir $(t));) @# Contents of the system image $(hide) $(call package_files-copy-root, \ $(SYSTEMIMAGE_SOURCE_DIR),$(zip_root)/SYSTEM) @@ -2012,20 +2030,22 @@ ifdef INSTALLED_SYSTEMOTHERIMAGE_TARGET endif @# Extra contents of the OTA package $(hide) mkdir -p $(zip_root)/OTA - $(hide) $(ACP) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/ + $(hide) cp $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(zip_root)/OTA/ ifneq ($(AB_OTA_UPDATER),true) ifneq ($(built_ota_tools),) $(hide) mkdir -p $(zip_root)/OTA/bin - $(hide) $(ACP) $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/ + $(hide) cp $(PRIVATE_OTA_TOOLS) $(zip_root)/OTA/bin/ endif endif @# Files that do not end up in any images, but are necessary to @# build them. $(hide) mkdir -p $(zip_root)/META - $(hide) $(ACP) $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt - $(hide) if test -e $(tool_extensions)/releasetools.py; then $(ACP) $(tool_extensions)/releasetools.py $(zip_root)/META/; fi + $(hide) cp $(APKCERTS_FILE) $(zip_root)/META/apkcerts.txt +ifneq ($(tool_extension),) + $(hide) cp $(PRIVATE_TOOL_EXTENSION) $(zip_root)/META/ +endif $(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt - $(hide) $(ACP) $(SELINUX_FC) $(zip_root)/META/file_contexts.bin + $(hide) cp $(SELINUX_FC) $(zip_root)/META/file_contexts.bin $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt $(hide) echo "fstab_version=$(PRIVATE_RECOVERY_FSTAB_VERSION)" >> $(zip_root)/META/misc_info.txt ifdef BOARD_FLASH_BLOCK_SIZE @@ -2052,7 +2072,7 @@ ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS else $(hide) echo "recovery_mount_options=$(DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt endif - $(hide) echo "tool_extensions=$(tool_extensions)" >> $(zip_root)/META/misc_info.txt + $(hide) echo "tool_extensions=$(PRIVATE_TOOL_EXTENSIONS)" >> $(zip_root)/META/misc_info.txt $(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $(zip_root)/META/misc_info.txt ifdef PRODUCT_EXTRA_RECOVERY_KEYS $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $(zip_root)/META/misc_info.txt @@ -2066,11 +2086,11 @@ ifneq ($(OEM_THUMBPRINT_PROPERTIES),) $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt endif ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),) - $(hide) $(ACP) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \ + $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH) \ $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH)) endif ifneq ($(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),) - $(hide) $(ACP) $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \ + $(hide) cp $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH) \ $(zip_root)/META/$(notdir $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH)) endif ifneq ($(strip $(SANITIZE_TARGET)),) @@ -2104,8 +2124,8 @@ ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) endif ifeq ($(AB_OTA_UPDATER),true) @# When using the A/B updater, include the updater config files in the zip. - $(hide) $(ACP) $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt - $(hide) $(ACP) $(TARGET_OUT_COMMON_GEN)/zlib_fingerprint $(zip_root)/META/zlib_fingerprint.txt + $(hide) cp $(TOPDIR)system/update_engine/update_engine.conf $(zip_root)/META/update_engine_config.txt + $(hide) cp $(TARGET_OUT_COMMON_GEN)/zlib_fingerprint $(zip_root)/META/zlib_fingerprint.txt $(hide) for part in $(AB_OTA_PARTITIONS); do \ echo "$${part}" >> $(zip_root)/META/ab_partitions.txt; \ done @@ -2123,13 +2143,13 @@ ifdef BRILLO_VENDOR_PARTITIONS src=$${pair1}/$${pair2}; \ dest=$(zip_root)/VENDOR_IMAGES/$${pair2}; \ mkdir -p $$(dirname "$${dest}"); \ - $(ACP) $${src} $${dest}; \ + cp $${src} $${dest}; \ done; endif ifdef OSRELEASED_DIRECTORY - $(hide) $(ACP) $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt - $(hide) $(ACP) $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt - $(hide) $(ACP) $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version $(zip_root)/META/system_version.txt + $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt + $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt + $(hide) cp $(TARGET_OUT_ETC)/$(OSRELEASED_DIRECTORY)/system_version $(zip_root)/META/system_version.txt endif endif ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true) From aadd499bc3347fa264c03e2a6609878476d8e7b2 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Tue, 21 Mar 2017 16:01:02 -0700 Subject: [PATCH 2/2] Parallelize system*.img and target-files-package We don't actually need to build the system image before target-files-package, we just need to make sure everything is present in $(PRODUCT_OUT)/system. So switch the dependencies around. This can't be done as easily for the vendor image, since it may be a prebuilt, or we may need to install some kernel modules into $(PRODUCT_OUT)/vendor when building vendor.img. It tends to be smaller anyway, so the time savings isn't as big. Test: Make sure the build server outputs the same files Test: Ensure target-files-package is identical before/after. Change-Id: I84e4f878491ab2b71582f4f49418dbfbba75590f --- core/Makefile | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/core/Makefile b/core/Makefile index 234e03a5f..c75088305 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1941,11 +1941,11 @@ $(BUILT_TARGET_FILES_PACKAGE): \ $(INSTALLED_BOOTIMAGE_TARGET) \ $(INSTALLED_RADIOIMAGE_TARGET) \ $(INSTALLED_RECOVERYIMAGE_TARGET) \ - $(INSTALLED_SYSTEMIMAGE) \ + $(FULL_SYSTEMIMAGE_DEPS) \ $(INSTALLED_USERDATAIMAGE_TARGET) \ $(INSTALLED_CACHEIMAGE_TARGET) \ $(INSTALLED_VENDORIMAGE_TARGET) \ - $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) \ + $(INTERNAL_SYSTEMOTHERIMAGE_FILES) \ $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ $(INSTALLED_KERNEL_TARGET) \ $(INSTALLED_2NDBOOTLOADER_TARGET) \ @@ -1955,7 +1955,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \ $(APKCERTS_FILE) \ $(SOONG_ZIP) \ $(HOST_OUT_EXECUTABLES)/fs_config \ - build/tools/releasetools/add_img_to_target_files \ + $(BUILD_IMAGE_SRCS) \ | $(ACP) @echo "Package target files: $@" $(hide) rm -rf $@ $@.list $(zip_root)