Merge "Clean staging dirs in build_image.py" into main am: 548775d247
am: ab7ddf8f20
am: c3aed82fe9
am: 91f73ee575
Original change: https://android-review.googlesource.com/c/platform/build/+/2746998 Change-Id: I8e7ad33554a37a2829979ff5ff1475b5fbe3dd7f Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
commit
c664aa8d36
5 changed files with 162 additions and 59 deletions
14
Changes.md
14
Changes.md
|
@ -1,4 +1,15 @@
|
|||
# Build System Changes for Android.mk Writers
|
||||
# Build System Changes for Android.mk/Android.bp Writers
|
||||
|
||||
## Partitions are no longer affected by previous builds
|
||||
|
||||
Partition builds used to include everything in their staging directories, and building an
|
||||
individual module will install it to the staging directory. Thus, previously, `m mymodule` followed
|
||||
by `m` would cause `mymodule` to be presinstalled on the device, even if it wasn't listed in
|
||||
`PRODUCT_PACKAGES`.
|
||||
|
||||
This behavior has been changed, and now the partition images only include what they'd have if you
|
||||
did a clean build. This behavior can be disabled by setting the
|
||||
`BUILD_BROKEN_INCORRECT_PARTITION_IMAGES` environment variable or board config variable.
|
||||
|
||||
## Perform validation of Soong plugins
|
||||
|
||||
|
@ -29,6 +40,7 @@ overridden by setting the `BUILD_BROKEN_USES_SOONG_PYTHON2_MODULES` product conf
|
|||
variable to `true`.
|
||||
|
||||
Python 2 is slated for complete removal in V.
|
||||
|
||||
## Stop referencing sysprop_library directly from cc modules
|
||||
|
||||
For the migration to Bazel, we are no longer mapping sysprop_library targets
|
||||
|
|
|
@ -3425,14 +3425,22 @@ $(eval $(call declare-0p-target,$(INSTALLED_FILES_JSON)))
|
|||
.PHONY: installed-file-list
|
||||
installed-file-list: $(INSTALLED_FILES_FILE)
|
||||
|
||||
systemimage_intermediates := \
|
||||
$(call intermediates-dir-for,PACKAGING,systemimage)
|
||||
BUILT_SYSTEMIMAGE := $(systemimage_intermediates)/system.img
|
||||
systemimage_intermediates :=$= $(call intermediates-dir-for,PACKAGING,systemimage)
|
||||
BUILT_SYSTEMIMAGE :=$= $(systemimage_intermediates)/system.img
|
||||
|
||||
|
||||
# Used by the bazel sandwich to request the staging dir be built
|
||||
$(systemimage_intermediates)/staging_dir.stamp: $(FULL_SYSTEMIMAGE_DEPS)
|
||||
touch $@
|
||||
|
||||
define write-file-lines
|
||||
$(1):
|
||||
@echo Writing $$@
|
||||
rm -f $$@
|
||||
echo -n > $$@
|
||||
$$(foreach f,$(2),echo "$$(f)" >> $$@$$(newline))
|
||||
endef
|
||||
|
||||
# $(1): output file
|
||||
define build-systemimage-target
|
||||
@echo "Target system fs image: $(1)"
|
||||
|
@ -3441,16 +3449,19 @@ define build-systemimage-target
|
|||
skip_fsck=true)
|
||||
PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
|
||||
$(BUILD_IMAGE) \
|
||||
$(if $(BUILD_BROKEN_INCORRECT_PARTITION_IMAGES),,--input-directory-filter-file $(systemimage_intermediates)/file_list.txt) \
|
||||
$(TARGET_OUT) $(systemimage_intermediates)/system_image_info.txt $(1) $(TARGET_OUT) \
|
||||
|| ( mkdir -p $${DIST_DIR}; \
|
||||
cp $(INSTALLED_FILES_FILE) $${DIST_DIR}/installed-files-rescued.txt; \
|
||||
exit 1 )
|
||||
endef
|
||||
|
||||
$(eval $(call write-file-lines,$(systemimage_intermediates)/file_list.txt,$(subst $(TARGET_OUT)/,,$(filter $(TARGET_OUT)/%,$(FULL_SYSTEMIMAGE_DEPS)))))
|
||||
|
||||
ifeq ($(BOARD_AVB_ENABLE),true)
|
||||
$(BUILT_SYSTEMIMAGE): $(BOARD_AVB_SYSTEM_KEY_PATH)
|
||||
endif
|
||||
$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE)
|
||||
$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(systemimage_intermediates)/file_list.txt
|
||||
$(call build-systemimage-target,$@)
|
||||
|
||||
$(call declare-1p-container,$(BUILT_SYSTEMIMAGE),system/extras)
|
||||
|
@ -3506,7 +3517,7 @@ SYSTEM_NOTICE_DEPS += $(INSTALLED_SYSTEMIMAGE_TARGET)
|
|||
|
||||
.PHONY: systemimage-nodeps snod
|
||||
systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
|
||||
| $(INTERNAL_USERIMAGES_DEPS)
|
||||
| $(INTERNAL_USERIMAGES_DEPS) $(systemimage_intermediates)/file_list.txt
|
||||
@echo "make $@: ignoring dependencies"
|
||||
$(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE_TARGET))
|
||||
$(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
|
||||
|
@ -3547,6 +3558,7 @@ define build-userdataimage-target
|
|||
$(call generate-image-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt,userdata,skip_fsck=true)
|
||||
PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
|
||||
$(BUILD_IMAGE) \
|
||||
$(if $(BUILD_BROKEN_INCORRECT_PARTITION_IMAGES),,--input-directory-filter-file $(userdataimage_intermediates)/file_list.txt) \
|
||||
$(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt \
|
||||
$(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT)
|
||||
$(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
|
||||
|
@ -3557,7 +3569,10 @@ INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
|
|||
INSTALLED_USERDATAIMAGE_TARGET_DEPS := \
|
||||
$(INTERNAL_USERIMAGES_DEPS) \
|
||||
$(INTERNAL_USERDATAIMAGE_FILES)
|
||||
$(INSTALLED_USERDATAIMAGE_TARGET): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
|
||||
|
||||
$(eval $(call write-file-lines,$(userdataimage_intermediates)/file_list.txt,$(subst $(TARGET_OUT_DATA)/,,$(filter $(TARGET_OUT_DATA)/%,$(INSTALLED_USERDATAIMAGE_TARGET_DEPS)))))
|
||||
|
||||
$(INSTALLED_USERDATAIMAGE_TARGET): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS) $(userdataimage_intermediates)/file_list.txt
|
||||
$(build-userdataimage-target)
|
||||
|
||||
$(call declare-1p-container,$(INSTALLED_USERDATAIMAGE_TARGET),)
|
||||
|
@ -3566,7 +3581,7 @@ $(call declare-container-license-deps,$(INSTALLED_USERDATAIMAGE_TARGET),$(INSTAL
|
|||
UNMOUNTED_NOTICE_VENDOR_DEPS+= $(INSTALLED_USERDATAIMAGE_TARGET)
|
||||
|
||||
.PHONY: userdataimage-nodeps
|
||||
userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
|
||||
userdataimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS) $(userdataimage_intermediates)/file_list.txt
|
||||
$(build-userdataimage-target)
|
||||
|
||||
endif # BUILDING_USERDATA_IMAGE
|
||||
|
@ -3602,14 +3617,17 @@ define build-cacheimage-target
|
|||
$(call generate-image-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt,cache,skip_fsck=true)
|
||||
PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
|
||||
$(BUILD_IMAGE) \
|
||||
$(if $(BUILD_BROKEN_INCORRECT_PARTITION_IMAGES),,--input-directory-filter-file $(cacheimage_intermediates)/file_list.txt) \
|
||||
$(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt \
|
||||
$(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT)
|
||||
$(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE))
|
||||
endef
|
||||
|
||||
$(eval $(call write-file-lines,$(cacheimage_intermediates)/file_list.txt,$(subst $(TARGET_OUT_CACHE)/,,$(filter $(TARGET_OUT_CACHE)/%,$(INTERNAL_CACHEIMAGE_FILES)))))
|
||||
|
||||
# We just build this directly to the install location.
|
||||
INSTALLED_CACHEIMAGE_TARGET := $(BUILT_CACHEIMAGE_TARGET)
|
||||
$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES)
|
||||
$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES) $(cacheimage_intermediates)/file_list.txt
|
||||
$(build-cacheimage-target)
|
||||
|
||||
$(call declare-1p-container,$(INSTALLED_CACHEIMAGE_TARGET),)
|
||||
|
@ -3618,7 +3636,7 @@ $(call declare-container-license-deps,$(INSTALLED_CACHEIMAGE_TARGET),$(INTERNAL_
|
|||
UNMOUNTED_NOTICE_VENDOR_DEPS+= $(INSTALLED_CACHEIMAGE_TARGET)
|
||||
|
||||
.PHONY: cacheimage-nodeps
|
||||
cacheimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
|
||||
cacheimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS) $(cacheimage_intermediates)/file_list.txt
|
||||
$(build-cacheimage-target)
|
||||
|
||||
else # BUILDING_CACHE_IMAGE
|
||||
|
@ -3683,16 +3701,19 @@ define build-systemotherimage-target
|
|||
$(call generate-image-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt,system,skip_fsck=true)
|
||||
PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
|
||||
$(BUILD_IMAGE) \
|
||||
$(if $(BUILD_BROKEN_INCORRECT_PARTITION_IMAGES),,--input-directory-filter-file $(systemotherimage_intermediates)/file_list.txt) \
|
||||
$(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt \
|
||||
$(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)
|
||||
$(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
|
||||
endef
|
||||
|
||||
$(eval $(call write-file-lines,$(systemotherimage_intermediates)/file_list.txt,$(subst $(TARGET_OUT_SYSTEM_OTHER)/,,$(filter $(TARGET_OUT_SYSTEM_OTHER)/%,$(INTERNAL_SYSTEMOTHERIMAGE_FILES)))))
|
||||
|
||||
# We just build this directly to the install location.
|
||||
INSTALLED_SYSTEMOTHERIMAGE_TARGET := $(BUILT_SYSTEMOTHERIMAGE_TARGET)
|
||||
ifneq (true,$(SANITIZE_LITE))
|
||||
# Only create system_other when not building the second stage of a SANITIZE_LITE build.
|
||||
$(INSTALLED_SYSTEMOTHERIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEMOTHER)
|
||||
$(INSTALLED_SYSTEMOTHERIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEMOTHER) $(systemotherimage_intermediates)/file_list.txt
|
||||
$(build-systemotherimage-target)
|
||||
|
||||
$(call declare-1p-container,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),)
|
||||
|
@ -3702,7 +3723,7 @@ UNMOUNTED_NOTICE_DEPS += $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)
|
|||
endif
|
||||
|
||||
.PHONY: systemotherimage-nodeps
|
||||
systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS)
|
||||
systemotherimage-nodeps: | $(INTERNAL_USERIMAGES_DEPS) $(systemotherimage_intermediates)/file_list.txt
|
||||
$(build-systemotherimage-target)
|
||||
|
||||
endif # BUILDING_SYSTEM_OTHER_IMAGE
|
||||
|
@ -3783,18 +3804,22 @@ define build-vendorimage-target
|
|||
$(call generate-image-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt,vendor,skip_fsck=true)
|
||||
PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
|
||||
$(BUILD_IMAGE) \
|
||||
$(if $(BUILD_BROKEN_INCORRECT_PARTITION_IMAGES),,--input-directory-filter-file $(vendorimage_intermediates)/file_list.txt) \
|
||||
$(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt \
|
||||
$(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT)
|
||||
$(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET) $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_VENDORIMAGE_PARTITION_SIZE))
|
||||
endef
|
||||
|
||||
$(eval $(call write-file-lines,$(vendorimage_intermediates)/file_list.txt,$(subst $(TARGET_OUT_VENDOR)/,,$(filter $(TARGET_OUT_VENDOR)/%,$(INTERNAL_VENDORIMAGE_FILES)))))
|
||||
|
||||
# We just build this directly to the install location.
|
||||
INSTALLED_VENDORIMAGE_TARGET := $(BUILT_VENDORIMAGE_TARGET)
|
||||
$(INSTALLED_VENDORIMAGE_TARGET): \
|
||||
$(INTERNAL_USERIMAGES_DEPS) \
|
||||
$(INTERNAL_VENDORIMAGE_FILES) \
|
||||
$(INSTALLED_FILES_FILE_VENDOR) \
|
||||
$(RECOVERY_FROM_BOOT_PATCH)
|
||||
$(RECOVERY_FROM_BOOT_PATCH) \
|
||||
$(vendorimage_intermediates)/file_list.txt
|
||||
$(build-vendorimage-target)
|
||||
|
||||
VENDOR_NOTICE_DEPS += $(INSTALLED_VENDORIMAGE_TARGET)
|
||||
|
@ -3803,7 +3828,7 @@ $(call declare-container-license-metadata,$(INSTALLED_VENDORIMAGE_TARGET),legacy
|
|||
$(call declare-container-license-deps,$(INSTALLED_VENDORIMAGE_TARGET),$(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_VENDORIMAGE_FILES) $(RECOVERY_FROM_BOOT_PATH),$(PRODUCT_OUT)/:/)
|
||||
|
||||
.PHONY: vendorimage-nodeps vnod
|
||||
vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS)
|
||||
vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS) $(vendorimage_intermediates)/file_list.txt
|
||||
$(build-vendorimage-target)
|
||||
|
||||
.PHONY: sync_vendor
|
||||
|
@ -3849,17 +3874,21 @@ define build-productimage-target
|
|||
$(call generate-image-prop-dictionary, $(productimage_intermediates)/product_image_info.txt,product,skip_fsck=true)
|
||||
PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
|
||||
$(BUILD_IMAGE) \
|
||||
$(if $(BUILD_BROKEN_INCORRECT_PARTITION_IMAGES),,--input-directory-filter-file $(productimage_intermediates)/file_list.txt) \
|
||||
$(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt \
|
||||
$(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT)
|
||||
$(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),$(BOARD_PRODUCTIMAGE_PARTITION_SIZE))
|
||||
endef
|
||||
|
||||
$(eval $(call write-file-lines,$(productimage_intermediates)/file_list.txt,$(subst $(TARGET_OUT_PRODUCT)/,,$(filter $(TARGET_OUT_PRODUCT)/%,$(INTERNAL_PRODUCTIMAGE_FILES)))))
|
||||
|
||||
# We just build this directly to the install location.
|
||||
INSTALLED_PRODUCTIMAGE_TARGET := $(BUILT_PRODUCTIMAGE_TARGET)
|
||||
$(INSTALLED_PRODUCTIMAGE_TARGET): \
|
||||
$(INTERNAL_USERIMAGES_DEPS) \
|
||||
$(INTERNAL_PRODUCTIMAGE_FILES) \
|
||||
$(INSTALLED_FILES_FILE_PRODUCT)
|
||||
$(INSTALLED_FILES_FILE_PRODUCT) \
|
||||
$(productimage_intermediates)/file_list.txt
|
||||
$(build-productimage-target)
|
||||
|
||||
PRODUCT_NOTICE_DEPS += $(INSTALLED_PRODUCTIMAGE_TARGET)
|
||||
|
@ -3868,7 +3897,7 @@ $(call declare-1p-container,$(INSTALLED_PRODUCTIMAGE_TARGET),)
|
|||
$(call declare-container-license-deps,$(INSTALLED_PRODUCTIMAGE_TARGET),$(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCTIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT),$(PRODUCT_OUT)/:/)
|
||||
|
||||
.PHONY: productimage-nodeps pnod
|
||||
productimage-nodeps pnod: | $(INTERNAL_USERIMAGES_DEPS)
|
||||
productimage-nodeps pnod: | $(INTERNAL_USERIMAGES_DEPS) $(productimage_intermediates)/file_list.txt
|
||||
$(build-productimage-target)
|
||||
|
||||
.PHONY: sync_product
|
||||
|
@ -3910,6 +3939,7 @@ define build-system_extimage-target
|
|||
$(call generate-image-prop-dictionary, $(system_extimage_intermediates)/system_ext_image_info.txt,system_ext, skip_fsck=true)
|
||||
PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
|
||||
$(BUILD_IMAGE) \
|
||||
$(if $(BUILD_BROKEN_INCORRECT_PARTITION_IMAGES),,--input-directory-filter-file $(system_extimage_intermediates)/file_list.txt) \
|
||||
$(TARGET_OUT_SYSTEM_EXT) \
|
||||
$(system_extimage_intermediates)/system_ext_image_info.txt \
|
||||
$(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
|
||||
|
@ -3917,12 +3947,15 @@ define build-system_extimage-target
|
|||
$(call assert-max-image-size,$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET),$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE))
|
||||
endef
|
||||
|
||||
$(eval $(call write-file-lines,$(system_extimage_intermediates)/file_list.txt,$(subst $(TARGET_OUT_SYSTEM_EXT)/,,$(filter $(TARGET_OUT_SYSTEM_EXT)/%,$(INTERNAL_SYSTEM_EXTIMAGE_FILES)))))
|
||||
|
||||
# We just build this directly to the install location.
|
||||
INSTALLED_SYSTEM_EXTIMAGE_TARGET := $(BUILT_SYSTEM_EXTIMAGE_TARGET)
|
||||
$(INSTALLED_SYSTEM_EXTIMAGE_TARGET): \
|
||||
$(INTERNAL_USERIMAGES_DEPS) \
|
||||
$(INTERNAL_SYSTEM_EXTIMAGE_FILES) \
|
||||
$(INSTALLED_FILES_FILE_SYSTEM_EXT)
|
||||
$(INSTALLED_FILES_FILE_SYSTEM_EXT) \
|
||||
$(system_extimage_intermediates)/file_list.txt
|
||||
$(build-system_extimage-target)
|
||||
|
||||
SYSTEM_EXT_NOTICE_DEPS += $(INSTALLED_SYSTEM_EXTIMAGE_TARGET)
|
||||
|
@ -3931,7 +3964,7 @@ $(call declare-1p-container,$(INSTALLED_SYSTEM_EXTIMAGE_TARGET),)
|
|||
$(call declare-container-license-deps,$(INSTALLED_SYSTEM_EXTIMAGE_TARGET),$(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEM_EXTIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEM_EXT),$(PRODUCT_OUT)/:/)
|
||||
|
||||
.PHONY: systemextimage-nodeps senod
|
||||
systemextimage-nodeps senod: | $(INTERNAL_USERIMAGES_DEPS)
|
||||
systemextimage-nodeps senod: | $(INTERNAL_USERIMAGES_DEPS) $(system_extimage_intermediates)/file_list.txt
|
||||
$(build-system_extimage-target)
|
||||
|
||||
.PHONY: sync_system_ext
|
||||
|
@ -3994,17 +4027,21 @@ define build-odmimage-target
|
|||
skip_fsck=true)
|
||||
PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
|
||||
$(BUILD_IMAGE) \
|
||||
$(if $(BUILD_BROKEN_INCORRECT_PARTITION_IMAGES),,--input-directory-filter-file $(odmimage_intermediates)/file_list.txt) \
|
||||
$(TARGET_OUT_ODM) $(odmimage_intermediates)/odm_image_info.txt \
|
||||
$(INSTALLED_ODMIMAGE_TARGET) $(TARGET_OUT)
|
||||
$(call assert-max-image-size,$(INSTALLED_ODMIMAGE_TARGET),$(BOARD_ODMIMAGE_PARTITION_SIZE))
|
||||
endef
|
||||
|
||||
$(eval $(call write-file-lines,$(odmimage_intermediates)/file_list.txt,$(subst $(TARGET_OUT_ODM)/,,$(filter $(TARGET_OUT_ODM)/%,$(INTERNAL_ODMIMAGE_FILES)))))
|
||||
|
||||
# We just build this directly to the install location.
|
||||
INSTALLED_ODMIMAGE_TARGET := $(BUILT_ODMIMAGE_TARGET)
|
||||
$(INSTALLED_ODMIMAGE_TARGET): \
|
||||
$(INTERNAL_USERIMAGES_DEPS) \
|
||||
$(INTERNAL_ODMIMAGE_FILES) \
|
||||
$(INSTALLED_FILES_FILE_ODM)
|
||||
$(INSTALLED_FILES_FILE_ODM) \
|
||||
$(odmimage_intermediates)/file_list.txt
|
||||
$(build-odmimage-target)
|
||||
|
||||
ODM_NOTICE_DEPS += $(INSTALLED_ODMIMAGE_TARGET)
|
||||
|
@ -4013,7 +4050,7 @@ $(call declare-1p-container,$(INSTALLED_ODMIMAGE_TARGET),)
|
|||
$(call declare-container-license-deps,$(INSTALLED_ODMIMAGE_TARGET),$(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_ODMIMAGE_FILES) $(INSTALLED_FILES_FILE_ODM),$(PRODUCT_OUT)/:/)
|
||||
|
||||
.PHONY: odmimage-nodeps onod
|
||||
odmimage-nodeps onod: | $(INTERNAL_USERIMAGES_DEPS)
|
||||
odmimage-nodeps onod: | $(INTERNAL_USERIMAGES_DEPS) $(odmimage_intermediates)/file_list.txt
|
||||
$(build-odmimage-target)
|
||||
|
||||
.PHONY: sync_odm
|
||||
|
@ -4056,17 +4093,21 @@ define build-vendor_dlkmimage-target
|
|||
vendor_dlkm, skip_fsck=true)
|
||||
PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
|
||||
$(BUILD_IMAGE) \
|
||||
$(if $(BUILD_BROKEN_INCORRECT_PARTITION_IMAGES),,--input-directory-filter-file $(vendor_dlkmimage_intermediates)/file_list.txt) \
|
||||
$(TARGET_OUT_VENDOR_DLKM) $(vendor_dlkmimage_intermediates)/vendor_dlkm_image_info.txt \
|
||||
$(INSTALLED_VENDOR_DLKMIMAGE_TARGET) $(TARGET_OUT)
|
||||
$(call assert-max-image-size,$(INSTALLED_VENDOR_DLKMIMAGE_TARGET),$(BOARD_VENDOR_DLKMIMAGE_PARTITION_SIZE))
|
||||
endef
|
||||
|
||||
$(eval $(call write-file-lines,$(vendor_dlkmimage_intermediates)/file_list.txt,$(subst $(TARGET_OUT_VENDOR_DLKM)/,,$(filter $(TARGET_OUT_VENDOR_DLKM)/%,$(INTERNAL_VENDOR_DLKMIMAGE_FILES)))))
|
||||
|
||||
# We just build this directly to the install location.
|
||||
INSTALLED_VENDOR_DLKMIMAGE_TARGET := $(BUILT_VENDOR_DLKMIMAGE_TARGET)
|
||||
$(INSTALLED_VENDOR_DLKMIMAGE_TARGET): \
|
||||
$(INTERNAL_USERIMAGES_DEPS) \
|
||||
$(INTERNAL_VENDOR_DLKMIMAGE_FILES) \
|
||||
$(INSTALLED_FILES_FILE_VENDOR_DLKM)
|
||||
$(INSTALLED_FILES_FILE_VENDOR_DLKM) \
|
||||
$(vendor_dlkmimage_intermediates)/file_list.txt
|
||||
$(build-vendor_dlkmimage-target)
|
||||
|
||||
VENDOR_DLKM_NOTICE_DEPS += $(INSTALLED_VENDOR_DLKMIMAGE_TARGET)
|
||||
|
@ -4075,7 +4116,7 @@ $(call declare-1p-container,$(INSTALLED_VENDOR_DLKMIMAGE_TARGET),)
|
|||
$(call declare-container-license-deps,$(INSTALLED_VENDOR_DLKMIMAGE_TARGET),$(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_VENDOR_DLKMIMAGE_FILES) $(INSTALLED_FILES_FILE_VENDOR_DLKM),$(PRODUCT_OUT)/:/)
|
||||
|
||||
.PHONY: vendor_dlkmimage-nodeps vdnod
|
||||
vendor_dlkmimage-nodeps vdnod: | $(INTERNAL_USERIMAGES_DEPS)
|
||||
vendor_dlkmimage-nodeps vdnod: | $(INTERNAL_USERIMAGES_DEPS) $(vendor_dlkmimage_intermediates)/file_list.txt
|
||||
$(build-vendor_dlkmimage-target)
|
||||
|
||||
.PHONY: sync_vendor_dlkm
|
||||
|
@ -4118,17 +4159,21 @@ define build-odm_dlkmimage-target
|
|||
odm_dlkm, skip_fsck=true)
|
||||
PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
|
||||
$(BUILD_IMAGE) \
|
||||
$(if $(BUILD_BROKEN_INCORRECT_PARTITION_IMAGES),,--input-directory-filter-file $(odm_dlkmimage_intermediates)/file_list.txt) \
|
||||
$(TARGET_OUT_ODM_DLKM) $(odm_dlkmimage_intermediates)/odm_dlkm_image_info.txt \
|
||||
$(INSTALLED_ODM_DLKMIMAGE_TARGET) $(TARGET_OUT)
|
||||
$(call assert-max-image-size,$(INSTALLED_ODM_DLKMIMAGE_TARGET),$(BOARD_ODM_DLKMIMAGE_PARTITION_SIZE))
|
||||
endef
|
||||
|
||||
$(eval $(call write-file-lines,$(odm_dlkmimage_intermediates)/file_list.txt,$(subst $(TARGET_OUT_ODM_DLKM)/,,$(filter $(TARGET_OUT_ODM_DLKM)/%,$(INTERNAL_ODM_DLKMIMAGE_FILES)))))
|
||||
|
||||
# We just build this directly to the install location.
|
||||
INSTALLED_ODM_DLKMIMAGE_TARGET := $(BUILT_ODM_DLKMIMAGE_TARGET)
|
||||
$(INSTALLED_ODM_DLKMIMAGE_TARGET): \
|
||||
$(INTERNAL_USERIMAGES_DEPS) \
|
||||
$(INTERNAL_ODM_DLKMIMAGE_FILES) \
|
||||
$(INSTALLED_FILES_FILE_ODM_DLKM)
|
||||
$(INSTALLED_FILES_FILE_ODM_DLKM) \
|
||||
$(odm_dlkmimage_intermediates)/file_list.txt
|
||||
$(build-odm_dlkmimage-target)
|
||||
|
||||
ODM_DLKM_NOTICE_DEPS += $(INSTALLED_ODM_DLKMIMAGE_TARGET)
|
||||
|
@ -4137,7 +4182,7 @@ $(call declare-1p-container,$(INSTALLED_ODM_DLKMIMAGE_TARGET),)
|
|||
$(call declare-container-license-deps,$(INSTALLED_ODM_DLKMIMAGE_TARGET),$(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_ODM_DLKMIMAGE_FILES) $(INSTALLED_FILES_FILE_ODM_DLKM),$(PRODUCT_OUT)/:/)
|
||||
|
||||
.PHONY: odm_dlkmimage-nodeps odnod
|
||||
odm_dlkmimage-nodeps odnod: | $(INTERNAL_USERIMAGES_DEPS)
|
||||
odm_dlkmimage-nodeps odnod: | $(INTERNAL_USERIMAGES_DEPS) $(odm_dlkmimage_intermediates)/file_list.txt
|
||||
$(build-odm_dlkmimage-target)
|
||||
|
||||
.PHONY: sync_odm_dlkm
|
||||
|
@ -4182,17 +4227,21 @@ define build-system_dlkmimage-target
|
|||
system_dlkm, skip_fsck=true)
|
||||
PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
|
||||
$(BUILD_IMAGE) \
|
||||
$(if $(BUILD_BROKEN_INCORRECT_PARTITION_IMAGES),,--input-directory-filter-file $(system_dlkmimage_intermediates)/file_list.txt) \
|
||||
$(TARGET_OUT_SYSTEM_DLKM) $(system_dlkmimage_intermediates)/system_dlkm_image_info.txt \
|
||||
$(INSTALLED_SYSTEM_DLKMIMAGE_TARGET) $(TARGET_OUT)
|
||||
$(call assert-max-image-size,$(INSTALLED_SYSTEM_DLKMIMAGE_TARGET),$(BOARD_SYSTEM_DLKMIMAGE_PARTITION_SIZE))
|
||||
endef
|
||||
|
||||
$(eval $(call write-file-lines,$(system_dlkmimage_intermediates)/file_list.txt,$(subst $(TARGET_OUT_SYSTEM_DLKM)/,,$(filter $(TARGET_OUT_SYSTEM_DLKM)/%,$(INTERNAL_SYSTEM_DLKMIMAGE_FILES)))))
|
||||
|
||||
# We just build this directly to the install location.
|
||||
INSTALLED_SYSTEM_DLKMIMAGE_TARGET := $(BUILT_SYSTEM_DLKMIMAGE_TARGET)
|
||||
$(INSTALLED_SYSTEM_DLKMIMAGE_TARGET): \
|
||||
$(INTERNAL_USERIMAGES_DEPS) \
|
||||
$(INTERNAL_SYSTEM_DLKMIMAGE_FILES) \
|
||||
$(INSTALLED_FILES_FILE_SYSTEM_DLKM)
|
||||
$(INSTALLED_FILES_FILE_SYSTEM_DLKM) \
|
||||
$(system_dlkmimage_intermediates)/file_list.txt
|
||||
$(build-system_dlkmimage-target)
|
||||
|
||||
SYSTEM_DLKM_NOTICE_DEPS += $(INSTALLED_SYSTEM_DLKMIMAGE_TARGET)
|
||||
|
@ -4201,7 +4250,7 @@ $(call declare-1p-container,$(INSTALLED_SYSTEM_DLKMIMAGE_TARGET),)
|
|||
$(call declare-container-license-deps,$(INSTALLED_SYSTEM_DLKMIMAGE_TARGET),$(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_SYSTEM_DLKMIMAGE_FILES) $(INSTALLED_FILES_FILE_SYSTEM_DLKM),$(PRODUCT_OUT)/:/)
|
||||
|
||||
.PHONY: system_dlkmimage-nodeps sdnod
|
||||
system_dlkmimage-nodeps sdnod: | $(INTERNAL_USERIMAGES_DEPS)
|
||||
system_dlkmimage-nodeps sdnod: | $(INTERNAL_USERIMAGES_DEPS) $(system_dlkmimage_intermediates)/file_list.txt
|
||||
$(build-system_dlkmimage-target)
|
||||
|
||||
.PHONY: sync_system_dlkm
|
||||
|
|
|
@ -187,6 +187,7 @@ _build_broken_var_list := \
|
|||
BUILD_BROKEN_USES_NETWORK \
|
||||
BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE \
|
||||
BUILD_BROKEN_VINTF_PRODUCT_COPY_FILES \
|
||||
BUILD_BROKEN_INCORRECT_PARTITION_IMAGES \
|
||||
|
||||
_build_broken_var_list += \
|
||||
$(foreach m,$(AVAILABLE_BUILD_MODULE_TYPES) \
|
||||
|
|
|
@ -275,16 +275,17 @@ $(call add_json_str, PrebuiltHiddenApiDir, $(BOARD_PREBUILT_HIDDENAPI_DIR))
|
|||
|
||||
$(call add_json_str, ShippingApiLevel, $(PRODUCT_SHIPPING_API_LEVEL))
|
||||
|
||||
$(call add_json_list, BuildBrokenPluginValidation, $(BUILD_BROKEN_PLUGIN_VALIDATION))
|
||||
$(call add_json_bool, BuildBrokenClangProperty, $(filter true,$(BUILD_BROKEN_CLANG_PROPERTY)))
|
||||
$(call add_json_bool, BuildBrokenClangAsFlags, $(filter true,$(BUILD_BROKEN_CLANG_ASFLAGS)))
|
||||
$(call add_json_bool, BuildBrokenClangCFlags, $(filter true,$(BUILD_BROKEN_CLANG_CFLAGS)))
|
||||
$(call add_json_bool, GenruleSandboxing, $(filter true,$(GENRULE_SANDBOXING)))
|
||||
$(call add_json_bool, BuildBrokenEnforceSyspropOwner, $(filter true,$(BUILD_BROKEN_ENFORCE_SYSPROP_OWNER)))
|
||||
$(call add_json_bool, BuildBrokenTrebleSyspropNeverallow, $(filter true,$(BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW)))
|
||||
$(call add_json_bool, BuildBrokenUsesSoongPython2Modules, $(filter true,$(BUILD_BROKEN_USES_SOONG_PYTHON2_MODULES)))
|
||||
$(call add_json_bool, BuildBrokenVendorPropertyNamespace, $(filter true,$(BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE)))
|
||||
$(call add_json_list, BuildBrokenInputDirModules, $(BUILD_BROKEN_INPUT_DIR_MODULES))
|
||||
$(call add_json_list, BuildBrokenPluginValidation, $(BUILD_BROKEN_PLUGIN_VALIDATION))
|
||||
$(call add_json_bool, BuildBrokenClangProperty, $(filter true,$(BUILD_BROKEN_CLANG_PROPERTY)))
|
||||
$(call add_json_bool, BuildBrokenClangAsFlags, $(filter true,$(BUILD_BROKEN_CLANG_ASFLAGS)))
|
||||
$(call add_json_bool, BuildBrokenClangCFlags, $(filter true,$(BUILD_BROKEN_CLANG_CFLAGS)))
|
||||
$(call add_json_bool, GenruleSandboxing, $(filter true,$(GENRULE_SANDBOXING)))
|
||||
$(call add_json_bool, BuildBrokenEnforceSyspropOwner, $(filter true,$(BUILD_BROKEN_ENFORCE_SYSPROP_OWNER)))
|
||||
$(call add_json_bool, BuildBrokenTrebleSyspropNeverallow, $(filter true,$(BUILD_BROKEN_TREBLE_SYSPROP_NEVERALLOW)))
|
||||
$(call add_json_bool, BuildBrokenUsesSoongPython2Modules, $(filter true,$(BUILD_BROKEN_USES_SOONG_PYTHON2_MODULES)))
|
||||
$(call add_json_bool, BuildBrokenVendorPropertyNamespace, $(filter true,$(BUILD_BROKEN_VENDOR_PROPERTY_NAMESPACE)))
|
||||
$(call add_json_bool, BuildBrokenIncorrectPartitionImages, $(filter true,$(BUILD_BROKEN_INCORRECT_PARTITION_IMAGES)))
|
||||
$(call add_json_list, BuildBrokenInputDirModules, $(BUILD_BROKEN_INPUT_DIR_MODULES))
|
||||
|
||||
$(call add_json_list, BuildWarningBadOptionalUsesLibsAllowlist, $(BUILD_WARNING_BAD_OPTIONAL_USES_LIBS_ALLOWLIST))
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
#!/usr/bin/env python
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# Copyright (C) 2011 The Android Open Source Project
|
||||
#
|
||||
|
@ -22,9 +22,9 @@ Usage: build_image input_directory properties_file output_image \\
|
|||
target_output_directory
|
||||
"""
|
||||
|
||||
from __future__ import print_function
|
||||
import datetime
|
||||
|
||||
import argparse
|
||||
import glob
|
||||
import logging
|
||||
import os
|
||||
|
@ -34,6 +34,7 @@ import shlex
|
|||
import shutil
|
||||
import sys
|
||||
import uuid
|
||||
import tempfile
|
||||
|
||||
import common
|
||||
import verity_utils
|
||||
|
@ -919,27 +920,69 @@ def BuildVBMeta(in_dir, glob_dict, output_path):
|
|||
common.BuildVBMeta(output_path, partitions, name, vbmeta_partitions)
|
||||
|
||||
|
||||
def main(argv):
|
||||
args = common.ParseOptions(argv, __doc__)
|
||||
def BuildImageOrVBMeta(input_directory, target_out, glob_dict, image_properties, out_file):
|
||||
try:
|
||||
if "vbmeta" in os.path.basename(out_file):
|
||||
OPTIONS.info_dict = glob_dict
|
||||
BuildVBMeta(input_directory, glob_dict, out_file)
|
||||
else:
|
||||
BuildImage(input_directory, image_properties, out_file, target_out)
|
||||
except:
|
||||
logger.error("Failed to build %s from %s", out_file, input_directory)
|
||||
raise
|
||||
|
||||
if len(args) != 4:
|
||||
print(__doc__)
|
||||
sys.exit(1)
|
||||
|
||||
def CopyInputDirectory(src, dst, filter_file):
|
||||
with open(filter_file, 'r') as f:
|
||||
for line in f:
|
||||
line = line.strip()
|
||||
if not line:
|
||||
return
|
||||
if line != os.path.normpath(line):
|
||||
sys.exit(f"{line}: not normalized")
|
||||
if line.startswith("../") or line.startswith('/'):
|
||||
sys.exit(f"{line}: escapes staging directory by starting with ../ or /")
|
||||
full_src = os.path.join(src, line)
|
||||
full_dst = os.path.join(dst, line)
|
||||
if os.path.isdir(full_src):
|
||||
os.makedirs(full_dst, exist_ok=True)
|
||||
else:
|
||||
os.makedirs(os.path.dirname(full_dst), exist_ok=True)
|
||||
os.link(full_src, full_dst, follow_symlinks=False)
|
||||
|
||||
|
||||
def main(argv):
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Builds output_image from the given input_directory and properties_file, and "
|
||||
"writes the image to target_output_directory.")
|
||||
parser.add_argument("--input-directory-filter-file",
|
||||
help="the path to a file that contains a list of all files in the input_directory. If this "
|
||||
"option is provided, all files under the input_directory that are not listed in this file will "
|
||||
"be deleted before building the image. This is to work around the fact that building a module "
|
||||
"will install in by default, so there could be files in the input_directory that are not "
|
||||
"actually supposed to be part of the partition. The paths in this file must be relative to "
|
||||
"input_directory.")
|
||||
parser.add_argument("input_directory",
|
||||
help="the staging directory to be converted to an image file")
|
||||
parser.add_argument("properties_file",
|
||||
help="a file containing the 'global dictionary' of properties that affect how the image is "
|
||||
"built")
|
||||
parser.add_argument("out_file",
|
||||
help="the output file to write")
|
||||
parser.add_argument("target_out",
|
||||
help="the path to $(TARGET_OUT). Certain tools will use this to look through multiple staging "
|
||||
"directories for fs config files.")
|
||||
args = parser.parse_args()
|
||||
|
||||
common.InitLogging()
|
||||
|
||||
in_dir = args[0]
|
||||
glob_dict_file = args[1]
|
||||
out_file = args[2]
|
||||
target_out = args[3]
|
||||
|
||||
glob_dict = LoadGlobalDict(glob_dict_file)
|
||||
glob_dict = LoadGlobalDict(args.properties_file)
|
||||
if "mount_point" in glob_dict:
|
||||
# The caller knows the mount point and provides a dictionary needed by
|
||||
# BuildImage().
|
||||
image_properties = glob_dict
|
||||
else:
|
||||
image_filename = os.path.basename(out_file)
|
||||
image_filename = os.path.basename(args.out_file)
|
||||
mount_point = ""
|
||||
if image_filename == "system.img":
|
||||
mount_point = "system"
|
||||
|
@ -974,15 +1017,12 @@ def main(argv):
|
|||
if "vbmeta" != mount_point:
|
||||
image_properties = ImagePropFromGlobalDict(glob_dict, mount_point)
|
||||
|
||||
try:
|
||||
if "vbmeta" in os.path.basename(out_file):
|
||||
OPTIONS.info_dict = glob_dict
|
||||
BuildVBMeta(in_dir, glob_dict, out_file)
|
||||
else:
|
||||
BuildImage(in_dir, image_properties, out_file, target_out)
|
||||
except:
|
||||
logger.error("Failed to build %s from %s", out_file, in_dir)
|
||||
raise
|
||||
if args.input_directory_filter_file and not os.environ.get("BUILD_BROKEN_INCORRECT_PARTITION_IMAGES"):
|
||||
with tempfile.TemporaryDirectory(dir=os.path.dirname(args.input_directory)) as new_input_directory:
|
||||
CopyInputDirectory(args.input_directory, new_input_directory, args.input_directory_filter_file)
|
||||
BuildImageOrVBMeta(new_input_directory, args.target_out, glob_dict, image_properties, args.out_file)
|
||||
else:
|
||||
BuildImageOrVBMeta(args.input_directory, args.target_out, glob_dict, image_properties, args.out_file)
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
|
Loading…
Reference in a new issue