From 6c3e79b8e3a5c617e9ab8afacec6262f01c06356 Mon Sep 17 00:00:00 2001 From: Dan Willemsen Date: Fri, 17 Jun 2016 14:07:37 -0700 Subject: [PATCH] Clean up vendor image handling Standardize symlinking /system/vendor -> /vendor for aosp_* devices, since some /vendor binaries still use /system/vendor/... paths. Support using a prebuilt vendor image and including it into all the normal packaging steps. Bug: 28987532 Change-Id: I27040e8a8d1df0777e16cd1e3c3a9f1b28695e96 --- core/Makefile | 13 ++++++++++--- core/envsetup.mk | 13 +++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/core/Makefile b/core/Makefile index 064af661c..37bad8af8 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1124,7 +1124,7 @@ systemimage_intermediates := \ BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img # Create symlink /system/vendor to /vendor if necessary. -ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE +ifdef BOARD_USES_VENDORIMAGE define create-system-vendor-symlink $(hide) if [ -d $(TARGET_OUT)/vendor ] && [ ! -h $(TARGET_OUT)/vendor ]; then \ echo 'Non-symlink $(TARGET_OUT)/vendor detected!' 1>&2; \ @@ -1519,7 +1519,10 @@ $(INSTALLED_VENDORIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_VENDORIM vendorimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS) $(build-vendorimage-target) -endif # BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE +else ifdef BOARD_PREBUILT_VENDORIMAGE +INSTALLED_VENDORIMAGE_TARGET := $(PRODUCT_OUT)/vendor.img +$(eval $(call copy-one-file,$(BOARD_PREBUILT_VENDORIMAGE),$(INSTALLED_VENDORIMAGE_TARGET))) +endif # ----------------------------------------------------------------- # bring in the installer image generation defines if necessary @@ -1901,6 +1904,10 @@ endif ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true) @# If breakpad symbols have been generated, add them to the zip. $(hide) $(ACP) -r $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD +endif +ifdef BOARD_PREBUILT_VENDORIMAGE + $(hide) mkdir -p $(zip_root)/IMAGES + $(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/ endif @# Zip everything up, preserving symlinks and placing META/ files first to @# help early validation of the .zip file while uploading it. @@ -1920,7 +1927,7 @@ ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) endif $(hide) (cd $(zip_root) && zip -qX ../$(notdir $@) META/*filesystem_config.txt) $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \ - ./build/tools/releasetools/add_img_to_target_files -v -p $(HOST_OUT) $@ + ./build/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $@ .PHONY: target-files-package target-files-package: $(BUILT_TARGET_FILES_PACKAGE) diff --git a/core/envsetup.mk b/core/envsetup.mk index 0a7472af3..49ca154b1 100644 --- a/core/envsetup.mk +++ b/core/envsetup.mk @@ -173,6 +173,19 @@ else ifeq ($(filter vendor system/vendor,$(TARGET_COPY_OUT_VENDOR)),) $(error TARGET_COPY_OUT_VENDOR must be either 'vendor' or 'system/vendor', seeing '$(TARGET_COPY_OUT_VENDOR)'.) endif PRODUCT_COPY_FILES := $(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),$(PRODUCT_COPY_FILES)) + +BOARD_USES_VENDORIMAGE := +ifdef BOARD_PREBUILT_VENDORIMAGE +BOARD_USES_VENDORIMAGE := true +endif +ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE +BOARD_USES_VENDORIMAGE := true +endif +ifeq ($(TARGET_COPY_OUT_VENDOR),vendor) +BOARD_USES_VENDORIMAGE := true +else ifdef BOARD_USES_VENDORIMAGE +$(error TARGET_COPY_OUT_VENDOR must be set to 'vendor' to use a vendor image) +endif ###########################################