Merge "Add "arm64-v8a-hwasan" to the supported ABI list in SANITIZE_TARGET=hwaddress builds."
diff --git a/Changes.md b/Changes.md
index be2a271..461de97 100644
--- a/Changes.md
+++ b/Changes.md
@@ -1,5 +1,23 @@
# Build System Changes for Android.mk Writers
+## PRODUCT_STATIC_BOOT_CONTROL_HAL is obsolete {#PRODUCT_STATIC_BOOT_CONTROL_HAL}
+
+`PRODUCT_STATIC_BOOT_CONTROL_HAL` was the workaround to allow sideloading with
+statically linked boot control HAL, before shared library HALs were supported
+under recovery. Android Q has added such support (HALs will be loaded in
+passthrough mode), and the workarounds are being removed. Targets should build
+and install the recovery variant of boot control HAL modules into recovery
+image, similar to the ones installed for normal boot. See the change to
+crosshatch for example of this:
+
+* [device/google/crosshatch/bootctrl/Android.bp] for `bootctrl.sdm845` building
+ rules
+* [device/google/crosshatch/device.mk] for installing `bootctrl.sdm845.recovery`
+ and `android.hardware.boot@1.0-impl.recovery` into recovery image
+
+[device/google/crosshatch/bootctrl/Android.bp]: https://android.googlesource.com/device/google/crosshatch/+/master/bootctrl/Android.bp
+[device/google/crosshatch/device.mk]: https://android.googlesource.com/device/google/crosshatch/+/master/device.mk
+
## Deprecation of `BUILD_*` module types
See [build/make/Deprecation.md](Deprecation.md) for the current status.
@@ -49,9 +67,9 @@
Modules that build for Windows (our only `HOST_CROSS` OS currently) must now be
defined in `Android.bp` files.
-## `LOCAL_MODULE_TAGS := eng debug` deprecation {#LOCAL_MODULE_TAGS}
+## `LOCAL_MODULE_TAGS := eng debug` are obsolete {#LOCAL_MODULE_TAGS}
-`LOCAL_MODULE_TAGS` value `eng` and `debug` are being deprecated. They allowed
+`LOCAL_MODULE_TAGS` value `eng` and `debug` are now obsolete. They allowed
modules to specify that they should always be installed on `-eng`, or `-eng`
and `-userdebug` builds. This conflicted with the ability for products to
specify which modules should be installed, effectively making it impossible to
@@ -194,11 +212,9 @@
## `export` and `unexport` deprecation {#export_keyword}
-The `export` and `unexport` keywords have been deprecated, and will throw
-warnings or errors depending on where they are used.
+The `export` and `unexport` keywords are obsolete, and will throw errors when
+used.
-Early in the make system, during product configuration and BoardConfig.mk
-reading: these will throw a warnings, and will be an error in the future.
Device specific configuration should not be able to affect common core build
steps -- we're looking at triggering build steps to be invalidated if the set
of environment variables they can access changes. If device specific
@@ -206,10 +222,9 @@
output directory could become significantly more expensive than it already can
be.
-Later, during Android.mk files, and later tasks: these will throw errors, since
-it is increasingly likely that they are being used incorrectly, attempting to
-change the environment for a single build step, and instead setting it for
-hundreds of thousands.
+If used during Android.mk files, and later tasks, it is increasingly likely
+that they are being used incorrectly. Attempting to change the environment for
+a single build step, and instead setting it for hundreds of thousands.
It is not recommended to just move the environment variable setting outside of
the build (in vendorsetup.sh, or some other configuration script or wrapper).
@@ -373,7 +388,7 @@
| instead of | use |
|--------------------------------------------------------------|----------------------|
-| OUT {#OUT} | OUT_DIR |
+| OUT {#OUT} | PRODUCT_OUT |
| ANDROID_HOST_OUT {#ANDROID_HOST_OUT} | HOST_OUT |
| ANDROID_PRODUCT_OUT {#ANDROID_PRODUCT_OUT} | PRODUCT_OUT |
| ANDROID_HOST_OUT_TESTCASES {#ANDROID_HOST_OUT_TESTCASES} | HOST_OUT_TESTCASES |
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 1d0685d..a84e793 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -634,6 +634,27 @@
$(call add-clean-step, rm -rf $(HOST_OUT_EXECUTABLES)/build_verity_metadata.py)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib*/libc_malloc*)
+
+# Move odm build.prop to /odm/etc/.
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/odm/build.prop)
+$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/odm/build.prop)
+
+# Move product and system_ext to root for emulators
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/generic*/*/product)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/generic*/*/system_ext)
+
+# link_type and jni_link_type files are no longer needed
+$(call add-clean-step, find $(OUT_DIR) -type f -name "*link_type" -print0 | xargs -0 rm -f)
+
+# import_includes and export_includes files are no longer needed
+$(call add-clean-step, find $(OUT_DIR) -type f -name "import_includes" -o -name "export_includes" -print0 | xargs -0 rm -f)
+
+# Recreate product and system_ext partitions for emulator
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/generic*/*product*)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/generic*/*system_ext*)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/generic*/*/product)
+$(call add-clean-step, rm -rf $(OUT_DIR)/target/product/generic*/*/system_ext)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/Deprecation.md b/Deprecation.md
index 0d925cb..9378e1a 100644
--- a/Deprecation.md
+++ b/Deprecation.md
@@ -14,16 +14,17 @@
| Module type | State |
| -------------------------------- | --------- |
-| `BUILD_AUX_EXECUTABLE` | Warning |
-| `BUILD_AUX_STATIC_LIBRARY` | Warning |
-| `BUILD_HOST_FUZZ_TEST` | Warning |
-| `BUILD_HOST_NATIVE_TEST` | Warning |
+| `BUILD_AUX_EXECUTABLE` | Error |
+| `BUILD_AUX_STATIC_LIBRARY` | Error |
+| `BUILD_HOST_FUZZ_TEST` | Error |
+| `BUILD_HOST_NATIVE_TEST` | Error |
| `BUILD_HOST_SHARED_TEST_LIBRARY` | Error |
-| `BUILD_HOST_STATIC_TEST_LIBRARY` | Warning |
+| `BUILD_HOST_STATIC_LIBRARY` | Warning |
+| `BUILD_HOST_STATIC_TEST_LIBRARY` | Error |
| `BUILD_HOST_TEST_CONFIG` | Error |
-| `BUILD_NATIVE_BENCHMARK` | Warning |
+| `BUILD_NATIVE_BENCHMARK` | Error |
| `BUILD_SHARED_TEST_LIBRARY` | Error |
-| `BUILD_STATIC_TEST_LIBRARY` | Warning |
+| `BUILD_STATIC_TEST_LIBRARY` | Error |
| `BUILD_TARGET_TEST_CONFIG` | Error |
| `BUILD_*` | Available |
diff --git a/OWNERS b/OWNERS
index 77496f1..e89a6a1 100644
--- a/OWNERS
+++ b/OWNERS
@@ -1,6 +1,8 @@
# Core build team (MTV)
ccross@android.com
dwillemsen@google.com
+asmundak@google.com
+jungjw@google.com
# To expedite LON reviews
hansson@google.com
diff --git a/Usage.txt b/Usage.txt
index 558329b..ea4788a 100644
--- a/Usage.txt
+++ b/Usage.txt
@@ -26,12 +26,6 @@
If no targets are specified, the build system will build the images
for the configured product and variant.
- An alternative to setting $TARGET_PRODUCT and $TARGET_BUILD_VARIANT,
- which you may see in build servers, is to execute:
-
- m PRODUCT-<product>-<variant>
-
-
A target may be a file path. For example, out/host/linux-x86/bin/adb .
Note that when giving a relative file path as a target, that path is
interpreted relative to the root of the source tree (rather than relative
diff --git a/core/Makefile b/core/Makefile
index 57a05d4..6ced027 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -195,6 +195,7 @@
BUILDINFO_SH := build/make/tools/buildinfo.sh
BUILDINFO_COMMON_SH := build/make/tools/buildinfo_common.sh
+POST_PROCESS_PROPS :=$= build/make/tools/post_process_props.py
# Generates a set of sysprops common to all partitions to a file.
# $(1): Partition name
@@ -244,7 +245,7 @@
intermediate_system_build_prop := $(call intermediates-dir-for,ETC,system_build_prop)/build.prop
-$(INSTALLED_DEFAULT_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(intermediate_system_build_prop)
+$(INSTALLED_DEFAULT_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(intermediate_system_build_prop)
@echo Target buildinfo: $@
@mkdir -p $(dir $@)
@rm -f $@
@@ -253,7 +254,7 @@
echo "#" >> $@;
$(hide) $(foreach line,$(FINAL_DEFAULT_PROPERTIES), \
echo "$(line)" >> $@;)
- $(hide) build/make/tools/post_process_props.py $@
+ $(hide) $(POST_PROCESS_PROPS) $@
ifdef property_overrides_split_enabled
$(hide) mkdir -p $(TARGET_ROOT_OUT)
$(hide) ln -sf system/etc/prop.default $(INSTALLED_DEFAULT_PROP_OLD_TARGET)
@@ -266,7 +267,7 @@
INSTALLED_VENDOR_DEFAULT_PROP_TARGET := $(TARGET_OUT_VENDOR)/default.prop
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_VENDOR_DEFAULT_PROP_TARGET)
-$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET)
+$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET): $(INSTALLED_DEFAULT_PROP_TARGET) $(POST_PROCESS_PROPS)
@echo Target buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo "#" > $@; \
@@ -274,7 +275,7 @@
echo "#" >> $@;
$(hide) $(foreach line,$(FINAL_VENDOR_DEFAULT_PROPERTIES), \
echo "$(line)" >> $@;)
- $(hide) build/make/tools/post_process_props.py $@
+ $(hide) $(POST_PROCESS_PROPS) $@
endif # property_overrides_split_enabled
@@ -391,7 +392,7 @@
else
system_prop_file := $(wildcard $(TARGET_DEVICE_DIR)/system.prop)
endif
-$(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(API_FINGERPRINT)
+$(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTERNAL_BUILD_ID_MAKEFILE) $(BUILD_SYSTEM)/version_defaults.mk $(system_prop_file) $(INSTALLED_ANDROID_INFO_TXT_TARGET) $(API_FINGERPRINT) $(POST_PROCESS_PROPS)
@echo Target buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
@@ -455,7 +456,7 @@
echo "#" >> $@; )
$(hide) $(foreach line,$(FINAL_BUILD_PROPERTIES), \
echo "$(line)" >> $@;)
- $(hide) build/make/tools/post_process_props.py $@ $(PRODUCT_SYSTEM_PROPERTY_BLACKLIST)
+ $(hide) $(POST_PROCESS_PROPS) $@ $(PRODUCT_SYSTEM_PROPERTY_BLACKLIST)
build_desc :=
@@ -466,7 +467,7 @@
endif
endif
-$(INSTALLED_BUILD_PROP_TARGET): $(intermediate_system_build_prop) $(INSTALLED_RECOVERYIMAGE_TARGET)
+$(INSTALLED_BUILD_PROP_TARGET): $(intermediate_system_build_prop)
@echo "Target build info: $@"
$(hide) grep -v 'ro.product.first_api_level' $(intermediate_system_build_prop) > $@
@@ -484,7 +485,7 @@
$(FINAL_VENDOR_BUILD_PROPERTIES),=)
endif # property_overrides_split_enabled
-$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(intermediate_system_build_prop)
+$(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(intermediate_system_build_prop)
@echo Target vendor buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
@@ -522,7 +523,7 @@
$(hide) $(foreach line,$(FINAL_VENDOR_BUILD_PROPERTIES), \
echo "$(line)" >> $@;)
endif # property_overrides_split_enabled
- $(hide) build/make/tools/post_process_props.py $@ $(PRODUCT_VENDOR_PROPERTY_BLACKLIST)
+ $(hide) $(POST_PROCESS_PROPS) $@ $(PRODUCT_VENDOR_PROPERTY_BLACKLIST)
# -----------------------------------------------------------------
# product build.prop
@@ -540,7 +541,7 @@
FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_PRODUCT_PROPERTIES),=)
-$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(product_prop_files)
+$(INSTALLED_PRODUCT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS) $(product_prop_files)
@echo Target product buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
@@ -563,11 +564,11 @@
echo "ro.build.characteristics=$(TARGET_AAPT_CHARACTERISTICS)" >> $@;
$(hide) $(foreach line,$(FINAL_PRODUCT_PROPERTIES), \
echo "$(line)" >> $@;)
- $(hide) build/make/tools/post_process_props.py $@
+ $(hide) $(POST_PROCESS_PROPS) $@
# ----------------------------------------------------------------
# odm build.prop
-INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/build.prop
+INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/etc/build.prop
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_ODM_BUILD_PROP_TARGET)
FINAL_ODM_BUILD_PROPERTIES += \
@@ -575,7 +576,7 @@
FINAL_ODM_BUILD_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_ODM_BUILD_PROPERTIES),=)
-$(INSTALLED_ODM_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
+$(INSTALLED_ODM_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS)
@echo Target odm buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
@@ -588,36 +589,29 @@
echo "#" >> $@;
$(hide) $(foreach line,$(FINAL_ODM_BUILD_PROPERTIES), \
echo "$(line)" >> $@;)
- $(hide) build/make/tools/post_process_props.py $@
+ $(hide) $(POST_PROCESS_PROPS) $@
# -----------------------------------------------------------------
-# product_services build.prop (unless it's merged into /product)
-ifdef MERGE_PRODUCT_SERVICES_INTO_PRODUCT
- ifneq (,$(PRODUCT_PRODUCT_SERVICES_PROPERTIES))
- $(error PRODUCT_PRODUCT_SERVICES_PROPERTIES is not supported in this build.)
- endif
-else
-INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT_SERVICES)/build.prop
-ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
+# system_ext build.prop
+INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET := $(TARGET_OUT_SYSTEM_EXT)/build.prop
+ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET)
-FINAL_PRODUCT_SERVICES_PROPERTIES += \
- $(call collapse-pairs, $(PRODUCT_PRODUCT_SERVICES_PROPERTIES))
-FINAL_PRODUCT_SERVICES_PROPERTIES := $(call uniq-pairs-by-first-component, \
- $(FINAL_PRODUCT_SERVICES_PROPERTIES),=)
-$(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH)
- @echo Target product_services buildinfo: $@
+FINAL_SYSTEM_EXT_PROPERTIES += \
+ $(call collapse-pairs, $(PRODUCT_SYSTEM_EXT_PROPERTIES))
+FINAL_SYSTEM_EXT_PROPERTIES := $(call uniq-pairs-by-first-component, \
+ $(FINAL_SYSTEM_EXT_PROPERTIES),=)
+
+$(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET): $(BUILDINFO_COMMON_SH) $(POST_PROCESS_PROPS)
+ @echo Target system_ext buildinfo: $@
@mkdir -p $(dir $@)
$(hide) echo > $@
-ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
- $(hide) $(call generate-common-build-props,product_services,$@)
-endif # BOARD_USES_PRODUCT_SERVICESIMAGE
+ $(hide) $(call generate-common-build-props,system_ext,$@)
$(hide) echo "#" >> $@; \
- echo "# ADDITIONAL PRODUCT_SERVICES PROPERTIES" >> $@; \
+ echo "# ADDITIONAL SYSTEM_EXT BUILD PROPERTIES" >> $@; \
echo "#" >> $@;
- $(hide) $(foreach line,$(FINAL_PRODUCT_SERVICES_PROPERTIES), \
+ $(hide) $(foreach line,$(FINAL_SYSTEM_EXT_PROPERTIES), \
echo "$(line)" >> $@;)
- $(hide) build/make/tools/post_process_props.py $@
-endif # MERGE_PRODUCT_SERVICES_INTO_PRODUCT
+ $(hide) $(POST_PROCESS_PROPS) $@
# ----------------------------------------------------------------
@@ -648,6 +642,126 @@
$(hide) mv $@.tmp $@
# -----------------------------------------------------------------
+# kernel modules
+
+# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
+DEPMOD_STAGING_SUBDIR :=$= lib/modules/0.0
+
+# $(1): modules list
+# $(2): output dir
+# $(3): mount point
+# $(4): staging dir
+# $(5): module load list
+# $(6): module load list filename
+# Returns the a list of src:dest pairs to install the modules using copy-many-files.
+define build-image-kernel-modules
+ $(foreach module,$(1),$(module):$(2)/lib/modules/$(notdir $(module))) \
+ $(eval $(call build-image-kernel-modules-depmod,$(1),$(3),$(4),$(5),$(6))) \
+ $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.dep:$(2)/lib/modules/modules.dep \
+ $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.alias:$(2)/lib/modules/modules.alias \
+ $(4)/$(DEPMOD_STAGING_SUBDIR)/modules.softdep:$(2)/lib/modules/modules.softdep \
+ $(4)/$(DEPMOD_STAGING_SUBDIR)/$(6):$(2)/lib/modules/$(6)
+endef
+
+# $(1): modules list
+# $(2): mount point
+# $(3): staging dir
+# $(4): module load list
+# $(5): module load list filename
+define build-image-kernel-modules-depmod
+$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: .KATI_IMPLICIT_OUTPUTS := $(3)/$(DEPMOD_STAGING_SUBDIR)/modules.alias $(3)/$(DEPMOD_STAGING_SUBDIR)/modules.softdep $(3)/$(DEPMOD_STAGING_SUBDIR)/$(5)
+$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: $(DEPMOD)
+$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULES := $(1)
+$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MOUNT_POINT := $(2)
+$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_MODULE_DIR := $(3)/$(DEPMOD_STAGING_SUBDIR)/$(2)/lib/modules
+$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_STAGING_DIR := $(3)
+$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_LOAD_MODULES := $(4)
+$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: PRIVATE_LOAD_FILE := $(3)/$(DEPMOD_STAGING_SUBDIR)/$(5)
+$(3)/$(DEPMOD_STAGING_SUBDIR)/modules.dep: $(1)
+ @echo depmod $$(PRIVATE_STAGING_DIR)
+ rm -rf $$(PRIVATE_STAGING_DIR)
+ mkdir -p $$(PRIVATE_MODULE_DIR)
+ cp $$(PRIVATE_MODULES) $$(PRIVATE_MODULE_DIR)/
+ $(DEPMOD) -b $$(PRIVATE_STAGING_DIR) 0.0
+ # Turn paths in modules.dep into absolute paths
+ sed -i.tmp -e 's|\([^: ]*lib/modules/[^: ]*\)|/\1|g' $$(PRIVATE_STAGING_DIR)/$$(DEPMOD_STAGING_SUBDIR)/modules.dep
+ touch $$(PRIVATE_LOAD_FILE)
+ (for MODULE in $$(PRIVATE_LOAD_MODULES); do basename $$$$MODULE >> $$(PRIVATE_LOAD_FILE); done)
+endef
+
+# $(1): staging dir
+# $(2): module load list
+# $(3): module load list filename
+# $(4): output dir
+define module-load-list-copy-paths
+ $(eval $(call build-image-module-load-list,$(1),$(2),$(3))) \
+ $(1)/$(DEPMOD_STAGING_SUBDIR)/$(3):$(4)/lib/modules/$(3)
+endef
+
+# $(1): staging dir
+# $(2): module load list
+# $(3): module load list filename
+define build-image-module-load-list
+$(1)/$(DEPMOD_STAGING_SUBDIR)/$(3): PRIVATE_STAGING_DIR := $(1)
+$(1)/$(DEPMOD_STAGING_SUBDIR)/$(3): PRIVATE_LOAD_MODULES := $(2)
+$(1)/$(DEPMOD_STAGING_SUBDIR)/$(3): PRIVATE_LOAD_FILENAME := $(3)
+$(1)/$(DEPMOD_STAGING_SUBDIR)/$(3): $(2)
+ rm -f $$@
+ (for MODULE in $$(PRIVATE_LOAD_MODULES); do basename $$$$MODULE >> $$@; done)
+endef
+
+# Until support for a vendor-boot/vendor-ramdisk is added, store vendor ramdisk
+# kernel modules on the generic ramdisk as a stopgap.
+ifneq ($(BOARD_VENDOR_RAMDISK_KERNEL_MODULES),)
+ BOARD_GENERIC_RAMDISK_KERNEL_MODULES += $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES)
+endif
+ifneq ($(BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD),)
+ BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD += $(BOARD_VENDOR_RAMDISK_KERNEL_MODULES_LOAD)
+endif
+
+ifeq ($(BOARD_RECOVERY_KERNEL_MODULES_LOAD),)
+ BOARD_RECOVERY_KERNEL_MODULES_LOAD := $(BOARD_RECOVERY_KERNEL_MODULES)
+endif
+ifeq ($(BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD),)
+ BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD := $(BOARD_GENERIC_RAMDISK_KERNEL_MODULES)
+endif
+
+ifdef BOARD_GENERIC_RAMDISK_KERNEL_MODULES
+ ifeq ($(BOARD_USES_RECOVERY_AS_BOOT), true)
+ BOARD_RECOVERY_KERNEL_MODULES += $(BOARD_GENERIC_RAMDISK_KERNEL_MODULES)
+ endif
+endif
+
+ifdef BOARD_RECOVERY_KERNEL_MODULES
+ ifeq ($(BOARD_USES_RECOVERY_AS_BOOT), true)
+ ifdef BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD
+ ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call module-load-list-copy-paths,$(call intermediates-dir-for,PACKAGING,ramdisk_modules),$(BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD),modules.load,$(TARGET_RECOVERY_ROOT_OUT)))
+ endif
+ endif
+ ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_RECOVERY_KERNEL_MODULES),$(TARGET_RECOVERY_ROOT_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_recovery),$(BOARD_RECOVERY_KERNEL_MODULES_LOAD),modules.load.recovery))
+endif
+
+ifneq ($(BOARD_USES_RECOVERY_AS_BOOT), true)
+ ifdef BOARD_GENERIC_RAMDISK_KERNEL_MODULES
+ ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_GENERIC_RAMDISK_KERNEL_MODULES),$(TARGET_RAMDISK_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_ramdisk),$(BOARD_GENERIC_RAMDISK_KERNEL_MODULES_LOAD),modules.load))
+ endif
+endif
+
+ifdef BOARD_VENDOR_KERNEL_MODULES
+ ifeq ($(BOARD_VENDOR_KERNEL_MODULES_LOAD),)
+ BOARD_VENDOR_KERNEL_MODULES_LOAD := $(BOARD_VENDOR_KERNEL_MODULES)
+ endif
+ ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_VENDOR_KERNEL_MODULES),$(TARGET_OUT_VENDOR),vendor,$(call intermediates-dir-for,PACKAGING,depmod_vendor),$(BOARD_VENDOR_KERNEL_MODULES_LOAD),modules.load))
+endif
+
+ifdef BOARD_ODM_KERNEL_MODULES
+ ifeq ($(BOARD_RECOVERY_KERNEL_MODULES_LOAD),)
+ BOARD_ODM_KERNEL_MODULES_LOAD := $(BOARD_ODM_KERNEL_MODULES)
+ endif
+ ALL_DEFAULT_INSTALLED_MODULES += $(call copy-many-files,$(call build-image-kernel-modules,$(BOARD_ODM_KERNEL_MODULES),$(TARGET_OUT_ODM),odm,$(call intermediates-dir-for,PACKAGING,depmod_odm),$(BOARD_ODM_KERNEL_MODULES_LOAD),modules.load))
+endif
+
+# -----------------------------------------------------------------
# package stats
ifdef BUILDING_SYSTEM_IMAGE
@@ -695,7 +809,7 @@
@echo APK certs list: $@
@mkdir -p $(dir $@)
@rm -f $@
- $(foreach p,$(PACKAGES),\
+ $(foreach p,$(sort $(PACKAGES)),\
$(if $(PACKAGES.$(p).EXTERNAL_KEY),\
$(call _apkcerts_write_line,$(p),"EXTERNAL","",$(PACKAGES.$(p).COMPRESSED),$@),\
$(call _apkcerts_write_line,$(p),$(PACKAGES.$(p).CERTIFICATE),$(PACKAGES.$(p).PRIVATE_KEY),$(PACKAGES.$(p).COMPRESSED),$@)))
@@ -855,23 +969,24 @@
INSTALLED_FILES_FILE_ROOT := $(PRODUCT_OUT)/installed-files-root.txt
INSTALLED_FILES_JSON_ROOT := $(INSTALLED_FILES_FILE_ROOT:.txt=.json)
$(INSTALLED_FILES_FILE_ROOT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ROOT)
-$(INSTALLED_FILES_FILE_ROOT) : $(INTERNAL_ROOT_FILES) $(FILESLIST)
+$(INSTALLED_FILES_FILE_ROOT) : $(INTERNAL_ROOT_FILES) $(FILESLIST) $(FILESLIST_UTIL)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@rm -f $@
$(hide) $(FILESLIST) $(TARGET_ROOT_OUT) > $(@:.txt=.json)
- $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+ $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_ROOT))
#------------------------------------------------------------------
# dtb
-
-ifdef BOARD_PREBUILT_DTBIMAGE_DIR
+ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
INSTALLED_DTBIMAGE_TARGET := $(PRODUCT_OUT)/dtb.img
+ifdef BOARD_PREBUILT_DTBIMAGE_DIR
$(INSTALLED_DTBIMAGE_TARGET) : $(sort $(wildcard $(BOARD_PREBUILT_DTBIMAGE_DIR)/*.dtb))
cat $^ > $@
endif
+endif
# -----------------------------------------------------------------
# the ramdisk
@@ -883,13 +998,13 @@
INSTALLED_FILES_FILE_RAMDISK := $(PRODUCT_OUT)/installed-files-ramdisk.txt
INSTALLED_FILES_JSON_RAMDISK := $(INSTALLED_FILES_FILE_RAMDISK:.txt=.json)
$(INSTALLED_FILES_FILE_RAMDISK): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RAMDISK)
-$(INSTALLED_FILES_FILE_RAMDISK) : $(INTERNAL_RAMDISK_FILES) $(FILESLIST)
+$(INSTALLED_FILES_FILE_RAMDISK) : $(INTERNAL_RAMDISK_FILES) $(FILESLIST) $(FILESLIST_UTIL)
@echo Installed file list: $@
@mkdir -p $(TARGET_RAMDISK_OUT)
@mkdir -p $(dir $@)
@rm -f $@
$(hide) $(FILESLIST) $(TARGET_RAMDISK_OUT) > $(@:.txt=.json)
- $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+ $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
$(call dist-for-goals, sdk win_sdk sdk_addon, $(INSTALLED_FILES_FILE_RAMDISK))
BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
@@ -1035,6 +1150,7 @@
# Remove when b/63676296 is resolved.
$(error Prebuilt bootimage is only supported for AB targets)
endif
+INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
$(eval $(call copy-one-file,$(BOARD_PREBUILT_BOOTIMAGE),$(INSTALLED_BOOTIMAGE_TARGET)))
else # BOARD_PREBUILT_BOOTIMAGE not defined
INSTALLED_BOOTIMAGE_TARGET :=
@@ -1056,11 +1172,12 @@
.PHONY: notice_files
# Create the rule to combine the files into text and html/xml forms
-# $(1) - xml_excluded_vendor_product|xml_vendor|xml_product|html
+# $(1) - xml_excluded_system_product_odm|xml_excluded_vendor_product_odm
+# xml_product|xml_odm|xml_system_ext|xml_system|html
# $(2) - Plain text output file
# $(3) - HTML/XML output file
# $(4) - File title
-# $(5) - Directory to use. Notice files are all $(4)/src. Other
+# $(5) - Directory to use. Notice files are all $(5)/src. Other
# directories in there will be used for scratch
# $(6) - Dependencies for the output files
#
@@ -1081,11 +1198,13 @@
$(2) : $(3)
$(3) : $(6) $(BUILD_SYSTEM)/Makefile build/make/tools/generate-notice-files.py
build/make/tools/generate-notice-files.py --text-output $(2) \
- $(if $(filter $(1),xml_excluded_extra_partitions),-e vendor -e product -e product_services --xml-output, \
- $(if $(filter $(1),xml_vendor),-i vendor --xml-output, \
+ $(if $(filter $(1),xml_excluded_vendor_product_odm),-e vendor -e product -e system_ext -e odm --xml-output, \
+ $(if $(filter $(1),xml_excluded_system_product_odm),-e system -e product -e system_ext -e odm --xml-output, \
$(if $(filter $(1),xml_product),-i product --xml-output, \
- $(if $(filter $(1),xml_product_services),-i product_services --xml-output, \
- --html-output)))) $(3) \
+ $(if $(filter $(1),xml_system_ext),-i system_ext --xml-output, \
+ $(if $(filter $(1),xml_system),-i system --xml-output, \
+ $(if $(filter $(1),xml_odm),-i odm --xml-output, \
+ --html-output)))))) $(3) \
-t $$(PRIVATE_MESSAGE) -s $$(PRIVATE_DIR)/src
notice_files: $(2) $(3)
endef
@@ -1133,10 +1252,15 @@
target_product_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT.xml.gz
installed_product_notice_xml_gz := $(TARGET_OUT_PRODUCT)/etc/NOTICE.xml.gz
-target_product_services_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.txt
-target_product_services_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml
-target_product_services_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_PRODUCT_SERVICES.xml.gz
-installed_product_services_notice_xml_gz := $(TARGET_OUT_PRODUCT_SERVICES)/etc/NOTICE.xml.gz
+target_system_ext_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_SYSTEM_EXT.txt
+target_system_ext_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_SYSTEM_EXT.xml
+target_system_ext_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_SYSTEM_EXT.xml.gz
+installed_system_ext_notice_xml_gz := $(TARGET_OUT_SYSTEM_EXT)/etc/NOTICE.xml.gz
+
+target_odm_notice_file_txt := $(TARGET_OUT_INTERMEDIATES)/NOTICE_ODM.txt
+target_odm_notice_file_xml := $(TARGET_OUT_INTERMEDIATES)/NOTICE_ODM.xml
+target_odm_notice_file_xml_gz := $(TARGET_OUT_INTERMEDIATES)/NOTICE_ODM.xml.gz
+installed_odm_notice_xml_gz := $(TARGET_OUT_ODM)/etc/NOTICE.xml.gz
# Notice files are copied to TARGET_OUT_NOTICE_FILES as a side-effect of their module
# being built. A notice xml file must depend on all modules that could potentially
@@ -1144,22 +1268,42 @@
license_modules := $(ALL_DEFAULT_INSTALLED_MODULES) $(kernel_notice_file) $(pdk_fusion_notice_files)
# Phonys/fakes don't have notice files (though their deps might)
license_modules := $(filter-out $(TARGET_OUT_FAKE)/%,$(license_modules))
+# testcases are not relevant to the system image.
+license_modules := $(filter-out $(TARGET_OUT_TESTCASES)/%,$(license_modules))
+license_modules_system := $(filter $(TARGET_OUT)/%,$(license_modules))
license_modules_vendor := $(filter $(TARGET_OUT_VENDOR)/%,$(license_modules))
license_modules_product := $(filter $(TARGET_OUT_PRODUCT)/%,$(license_modules))
-license_modules_product_services := $(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,$(license_modules))
-license_modules_agg := $(license_modules_vendor) $(license_modules_product) $(license_modules_product_services)
+license_modules_system_ext := $(filter $(TARGET_OUT_SYSTEM_EXT)/%,$(license_modules))
+license_modules_odm := $(filter $(TARGET_OUT_ODM)/%,$(license_modules))
+license_modules_agg := $(license_modules_system) \
+ $(license_modules_vendor) \
+ $(license_modules_product) \
+ $(license_modules_system_ext) \
+ $(license_modules_odm)
license_modules_rest := $(filter-out $(license_modules_agg),$(license_modules))
-$(eval $(call combine-notice-files, xml_excluded_extra_partitions, \
+# If we are building in a configuration that includes a prebuilt vendor.img, we can't
+# update its notice file, so include those notices in the system partition instead
+ifdef BOARD_PREBUILT_VENDORIMAGE
+license_modules_system += $(license_modules_rest)
+system_xml_directories := xml_excluded_vendor_product_odm
+system_notice_file_message := "Notices for files contained in all filesystem images except vendor/system_ext/product/odm in this directory:"
+else
+license_modules_vendor += $(license_modules_rest)
+system_xml_directories := xml_system
+system_notice_file_message := "Notices for files contained in the system filesystem image in this directory:"
+endif
+
+$(eval $(call combine-notice-files, $(system_xml_directories), \
$(target_notice_file_txt), \
$(target_notice_file_xml), \
- "Notices for files contained in the filesystem images in this directory:", \
+ $(system_notice_file_message), \
$(TARGET_OUT_NOTICE_FILES), \
- $(license_modules_rest)))
-$(eval $(call combine-notice-files, xml_vendor, \
+ $(license_modules_system)))
+$(eval $(call combine-notice-files, xml_excluded_system_product_odm, \
$(target_vendor_notice_file_txt), \
$(target_vendor_notice_file_xml), \
- "Notices for files contained in the vendor filesystem image in this directory:", \
+ "Notices for files contained in all filesystem images except system/system_ext/product/odm in this directory:", \
$(TARGET_OUT_NOTICE_FILES), \
$(license_modules_vendor)))
$(eval $(call combine-notice-files, xml_product, \
@@ -1168,12 +1312,18 @@
"Notices for files contained in the product filesystem image in this directory:", \
$(TARGET_OUT_NOTICE_FILES), \
$(license_modules_product)))
-$(eval $(call combine-notice-files, xml_product_services, \
- $(target_product_services_notice_file_txt), \
- $(target_product_services_notice_file_xml), \
- "Notices for files contained in the product_services filesystem image in this directory:", \
+$(eval $(call combine-notice-files, xml_system_ext, \
+ $(target_system_ext_notice_file_txt), \
+ $(target_system_ext_notice_file_xml), \
+ "Notices for files contained in the system_ext filesystem image in this directory:", \
$(TARGET_OUT_NOTICE_FILES), \
- $(license_modules_product_services)))
+ $(license_modules_system_ext)))
+$(eval $(call combine-notice-files, xml_odm, \
+ $(target_odm_notice_file_txt), \
+ $(target_odm_notice_file_xml), \
+ "Notices for files contained in the odm filesystem image in this directory:", \
+ $(TARGET_OUT_NOTICE_FILES), \
+ $(license_modules_odm)))
$(target_notice_file_xml_gz): $(target_notice_file_xml) | $(MINIGZIP)
$(hide) $(MINIGZIP) -9 < $< > $@
@@ -1181,7 +1331,9 @@
$(hide) $(MINIGZIP) -9 < $< > $@
$(target_product_notice_file_xml_gz): $(target_product_notice_file_xml) | $(MINIGZIP)
$(hide) $(MINIGZIP) -9 < $< > $@
-$(target_product_services_notice_file_xml_gz): $(target_product_services_notice_file_xml) | $(MINIGZIP)
+$(target_system_ext_notice_file_xml_gz): $(target_system_ext_notice_file_xml) | $(MINIGZIP)
+ $(hide) $(MINIGZIP) -9 < $< > $@
+$(target_odm_notice_file_xml_gz): $(target_odm_notice_file_xml) | $(MINIGZIP)
$(hide) $(MINIGZIP) -9 < $< > $@
$(installed_notice_html_or_xml_gz): $(target_notice_file_xml_gz)
$(copy-file-to-target)
@@ -1189,26 +1341,19 @@
$(copy-file-to-target)
$(installed_product_notice_xml_gz): $(target_product_notice_file_xml_gz)
$(copy-file-to-target)
-
-# No notice file for product_services if its contents are merged into /product.
-# The notices will be part of the /product notice file.
-ifndef MERGE_PRODUCT_SERVICES_INTO_PRODUCT
-$(installed_product_services_notice_xml_gz): $(target_product_services_notice_file_xml_gz)
+$(installed_system_ext_notice_xml_gz): $(target_system_ext_notice_file_xml_gz)
$(copy-file-to-target)
-endif
+$(installed_odm_notice_xml_gz): $(target_odm_notice_file_xml_gz)
+ $(copy-file-to-target)
-# if we've been run my mm, mmm, etc, don't reinstall this every time
-ifeq ($(ONE_SHOT_MAKEFILE),)
- ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
- ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
- ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz)
- ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_services_notice_xml_gz)
-endif
+ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
+ALL_DEFAULT_INSTALLED_MODULES += $(installed_vendor_notice_xml_gz)
+ALL_DEFAULT_INSTALLED_MODULES += $(installed_product_notice_xml_gz)
+ALL_DEFAULT_INSTALLED_MODULES += $(installed_system_ext_notice_xml_gz)
+ALL_DEFAULT_INSTALLED_MODULES += $(installed_odm_notice_xml_gz)
endif # PRODUCT_NOTICE_SPLIT
-ifeq ($(ONE_SHOT_MAKEFILE),)
- ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
-endif
+ALL_DEFAULT_INSTALLED_MODULES += $(installed_notice_html_or_xml_gz)
$(eval $(call combine-notice-files, html, \
$(tools_notice_file_txt), \
@@ -1223,19 +1368,9 @@
# The kernel isn't really a module, so to get its module file in there, we
# make the target NOTICE files depend on this particular file too, which will
# then be in the right directory for the find in combine-notice-files to work.
-$(kernel_notice_file): \
- $(BUILD_SYSTEM)/LINUX_KERNEL_COPYING \
- | $(ACP)
- @echo Copying: $@
- $(hide) mkdir -p $(dir $@)
- $(hide) $(ACP) $< $@
+$(eval $(call copy-one-file,$(BUILD_SYSTEM)/LINUX_KERNEL_COPYING,$(kernel_notice_file)))
-$(winpthreads_notice_file): \
- $(BUILD_SYSTEM)/WINPTHREADS_COPYING \
- | $(ACP)
- @echo Copying: $@
- $(hide) mkdir -p $(dir $@)
- $(hide) $(ACP) $< $@
+$(eval $(call copy-one-file,$(BUILD_SYSTEM)/WINPTHREADS_COPYING,$(winpthreads_notice_file)))
# #################################################################
@@ -1265,25 +1400,22 @@
ifneq (true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED))
INTERNAL_USERIMAGES_SPARSE_EXT_FLAG := -s
endif
-
-INTERNAL_USERIMAGES_DEPS := $(SIMG2IMG)
-INTERNAL_USERIMAGES_DEPS += $(MKEXTUSERIMG) $(MAKE_EXT4FS) $(E2FSCK) $(TUNE2FS)
-ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
-INTERNAL_USERIMAGES_DEPS += $(MKF2FSUSERIMG) $(MAKE_F2FS)
-endif
-
-ifeq ($(BOARD_AVB_ENABLE),true)
-INTERNAL_USERIMAGES_DEPS += $(AVBTOOL)
-endif
-
ifneq (true,$(TARGET_USERIMAGES_SPARSE_SQUASHFS_DISABLED))
INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG := -s
endif
-ifneq ($(filter $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE) $(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE) $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE) $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs),)
-INTERNAL_USERIMAGES_DEPS += $(MAKE_SQUASHFS) $(MKSQUASHFSUSERIMG) $(IMG2SIMG)
+
+INTERNAL_USERIMAGES_DEPS := \
+ $(BUILD_IMAGE) \
+ $(MKE2FS_CONF) \
+ $(MKEXTUSERIMG)
+
+ifeq ($(TARGET_USERIMAGES_USE_F2FS),true)
+INTERNAL_USERIMAGES_DEPS += $(MKF2FSUSERIMG)
endif
-INTERNAL_USERIMAGES_BINARY_PATHS := $(sort $(dir $(INTERNAL_USERIMAGES_DEPS)))
+ifneq ($(filter $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE) $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE) $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE) $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),squashfs),)
+INTERNAL_USERIMAGES_DEPS += $(MKSQUASHFSUSERIMG)
+endif
ifeq (true,$(PRODUCT_SUPPORTS_VERITY))
INTERNAL_USERIMAGES_DEPS += $(BUILD_VERITY_METADATA) $(BUILD_VERITY_TREE) $(APPEND2SIMG) $(VERITY_SIGNER)
@@ -1292,26 +1424,26 @@
endif
endif
+ifeq ($(BOARD_AVB_ENABLE),true)
+INTERNAL_USERIMAGES_DEPS += $(AVBTOOL)
+endif
+
+# Get a colon-separated list of search paths.
+INTERNAL_USERIMAGES_BINARY_PATHS := $(subst $(space),:,$(sort $(dir $(INTERNAL_USERIMAGES_DEPS))))
+
SELINUX_FC := $(call intermediates-dir-for,ETC,file_contexts.bin)/file_contexts.bin
INTERNAL_USERIMAGES_DEPS += $(SELINUX_FC)
-INTERNAL_USERIMAGES_DEPS += $(BLK_ALLOC_TO_BASE_FS)
-
-INTERNAL_USERIMAGES_DEPS += $(MKE2FS_CONF)
-
ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
ifeq ($(PRODUCT_SUPPORTS_VERITY),true)
$(error vboot 1.0 doesn't support logical partition)
endif
-# TODO(b/80195851): Should not define BOARD_AVB_SYSTEM_KEY_PATH without
-# BOARD_AVB_SYSTEM_DETACHED_VBMETA.
-
endif # PRODUCT_USE_DYNAMIC_PARTITIONS
# $(1): the path of the output dictionary file
-# $(2): a subset of "system vendor cache userdata product product_services oem odm"
+# $(2): a subset of "system vendor cache userdata product system_ext oem odm"
# $(3): additional "key=value" pairs to append to the dictionary file.
define generate-image-prop-dictionary
$(if $(filter $(2),system),\
@@ -1328,14 +1460,17 @@
$(if $(PRODUCT_SYSTEM_BASE_FS_PATH),$(hide) echo "system_base_fs_file=$(PRODUCT_SYSTEM_BASE_FS_PATH)" >> $(1))
$(if $(PRODUCT_SYSTEM_HEADROOM),$(hide) echo "system_headroom=$(PRODUCT_SYSTEM_HEADROOM)" >> $(1))
$(if $(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_reserved_size=$(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
+ $(hide) echo "system_selinux_fc=$(SELINUX_FC)" >> $(1)
)
$(if $(filter $(2),userdata),\
$(if $(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "userdata_fs_type=$(BOARD_USERDATAIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
$(if $(BOARD_USERDATAIMAGE_PARTITION_SIZE),$(hide) echo "userdata_size=$(BOARD_USERDATAIMAGE_PARTITION_SIZE)" >> $(1))
+ $(hide) echo "userdata_selinux_fc=$(SELINUX_FC)" >> $(1)
)
$(if $(filter $(2),cache),\
$(if $(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "cache_fs_type=$(BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
$(if $(BOARD_CACHEIMAGE_PARTITION_SIZE),$(hide) echo "cache_size=$(BOARD_CACHEIMAGE_PARTITION_SIZE)" >> $(1))
+ $(hide) echo "cache_selinux_fc=$(SELINUX_FC)" >> $(1)
)
$(if $(filter $(2),vendor),\
$(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
@@ -1349,6 +1484,7 @@
$(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
$(if $(PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1))
$(if $(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_reserved_size=$(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
+ $(hide) echo "vendor_selinux_fc=$(SELINUX_FC)" >> $(1)
)
$(if $(filter $(2),product),\
$(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
@@ -1362,18 +1498,20 @@
$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
$(if $(PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1))
$(if $(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "product_reserved_size=$(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
+ $(hide) echo "product_selinux_fc=$(SELINUX_FC)" >> $(1)
)
-$(if $(filter $(2),product_services),\
- $(if $(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_services_fs_type=$(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
- $(if $(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_services_extfs_inode_count=$(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_INODE_COUNT)" >> $(1))
- $(if $(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_services_extfs_rsv_pct=$(BOARD_PRODUCT_SERVICESIMAGE_EXTFS_RSV_PCT)" >> $(1))
- $(if $(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE),$(hide) echo "product_services_size=$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE)" >> $(1))
- $(if $(BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE),$(hide) echo "product_services_journal_size=$(BOARD_PRODUCT_SERVICESIMAGE_JOURNAL_SIZE)" >> $(1))
- $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_services_squashfs_compressor=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
- $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_services_squashfs_compressor_opt=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
- $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_services_squashfs_block_size=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
- $(if $(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_services_squashfs_disable_4k_align=$(BOARD_PRODUCT_SERVICESIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
- $(if $(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "product_services_reserved_size=$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
+$(if $(filter $(2),system_ext),\
+ $(if $(BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_ext_fs_type=$(BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
+ $(if $(BOARD_SYSTEM_EXTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_ext_extfs_inode_count=$(BOARD_SYSTEM_EXTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
+ $(if $(BOARD_SYSTEM_EXTIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_ext_extfs_rsv_pct=$(BOARD_SYSTEM_EXTIMAGE_EXTFS_RSV_PCT)" >> $(1))
+ $(if $(BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE),$(hide) echo "system_ext_size=$(BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE)" >> $(1))
+ $(if $(BOARD_SYSTEM_EXTIMAGE_JOURNAL_SIZE),$(hide) echo "system_ext_journal_size=$(BOARD_SYSTEM_EXTIMAGE_JOURNAL_SIZE)" >> $(1))
+ $(if $(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_ext_squashfs_compressor=$(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
+ $(if $(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_ext_squashfs_compressor_opt=$(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
+ $(if $(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_ext_squashfs_block_size=$(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
+ $(if $(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_ext_squashfs_disable_4k_align=$(BOARD_SYSTEM_EXTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
+ $(if $(BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_ext_reserved_size=$(BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
+ $(hide) echo "system_ext_selinux_fc=$(SELINUX_FC)" >> $(1)
)
$(if $(filter $(2),odm),\
$(if $(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "odm_fs_type=$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
@@ -1387,12 +1525,14 @@
$(if $(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "odm_squashfs_disable_4k_align=$(BOARD_ODMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
$(if $(PRODUCT_ODM_BASE_FS_PATH),$(hide) echo "odm_base_fs_file=$(PRODUCT_ODM_BASE_FS_PATH)" >> $(1))
$(if $(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "odm_reserved_size=$(BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
+ $(hide) echo "odm_selinux_fc=$(SELINUX_FC)" >> $(1)
)
$(if $(filter $(2),oem),\
$(if $(BOARD_OEMIMAGE_PARTITION_SIZE),$(hide) echo "oem_size=$(BOARD_OEMIMAGE_PARTITION_SIZE)" >> $(1))
$(if $(BOARD_OEMIMAGE_JOURNAL_SIZE),$(hide) echo "oem_journal_size=$(BOARD_OEMIMAGE_JOURNAL_SIZE)" >> $(1))
$(if $(BOARD_OEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "oem_extfs_inode_count=$(BOARD_OEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
$(if $(BOARD_OEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "oem_extfs_rsv_pct=$(BOARD_OEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
+ $(hide) echo "oem_selinux_fc=$(SELINUX_FC)" >> $(1)
)
$(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1)
@@ -1402,7 +1542,6 @@
$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
$(if $(BOARD_FLASH_LOGICAL_BLOCK_SIZE), $(hide) echo "flash_logical_block_size=$(BOARD_FLASH_LOGICAL_BLOCK_SIZE)" >> $(1))
$(if $(BOARD_FLASH_ERASE_BLOCK_SIZE), $(hide) echo "flash_erase_block_size=$(BOARD_FLASH_ERASE_BLOCK_SIZE)" >> $(1))
-$(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1)
$(if $(PRODUCT_SUPPORTS_BOOT_SIGNER),$(hide) echo "boot_signer=$(PRODUCT_SUPPORTS_BOOT_SIGNER)" >> $(1))
$(if $(PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity=$(PRODUCT_SUPPORTS_VERITY)" >> $(1))
$(if $(PRODUCT_SUPPORTS_VERITY),$(hide) echo "verity_key=$(PRODUCT_VERITY_SIGNING_KEY)" >> $(1))
@@ -1412,7 +1551,7 @@
$(if $(PRODUCT_SYSTEM_VERITY_PARTITION),$(hide) echo "system_verity_block_device=$(PRODUCT_SYSTEM_VERITY_PARTITION)" >> $(1))
$(if $(PRODUCT_VENDOR_VERITY_PARTITION),$(hide) echo "vendor_verity_block_device=$(PRODUCT_VENDOR_VERITY_PARTITION)" >> $(1))
$(if $(PRODUCT_PRODUCT_VERITY_PARTITION),$(hide) echo "product_verity_block_device=$(PRODUCT_PRODUCT_VERITY_PARTITION)" >> $(1))
-$(if $(PRODUCT_PRODUCT_SERVICES_VERITY_PARTITION),$(hide) echo "product_services_verity_block_device=$(PRODUCT_PRODUCT_SERVICES_VERITY_PARTITION)" >> $(1))
+$(if $(PRODUCT_SYSTEM_EXT_VERITY_PARTITION),$(hide) echo "system_ext_verity_block_device=$(PRODUCT_SYSTEM_EXT_VERITY_PARTITION)" >> $(1))
$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot=$(PRODUCT_SUPPORTS_VBOOT)" >> $(1))
$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_key=$(PRODUCT_VBOOT_SIGNING_KEY)" >> $(1))
$(if $(PRODUCT_SUPPORTS_VBOOT),$(hide) echo "vboot_subkey=$(PRODUCT_VBOOT_SIGNING_SUBKEY)" >> $(1))
@@ -1446,14 +1585,14 @@
$(hide) echo "avb_product_key_path=$(BOARD_AVB_PRODUCT_KEY_PATH)" >> $(1)
$(hide) echo "avb_product_algorithm=$(BOARD_AVB_PRODUCT_ALGORITHM)" >> $(1)
$(hide) echo "avb_product_rollback_index_location=$(BOARD_AVB_PRODUCT_ROLLBACK_INDEX_LOCATION)" >> $(1)))
-$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_product_services_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
+$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_system_ext_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
$(if $(BOARD_AVB_ENABLE),\
- $(hide) echo "avb_product_services_add_hashtree_footer_args=$(BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
+ $(hide) echo "avb_system_ext_add_hashtree_footer_args=$(BOARD_AVB_SYSTEM_EXT_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
$(if $(BOARD_AVB_ENABLE),\
- $(if $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH),\
- $(hide) echo "avb_product_services_key_path=$(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH)" >> $(1)
- $(hide) echo "avb_product_services_algorithm=$(BOARD_AVB_PRODUCT_SERVICES_ALGORITHM)" >> $(1)
- $(hide) echo "avb_product_services_rollback_index_location=$(BOARD_AVB_PRODUCT_SERVICES_ROLLBACK_INDEX_LOCATION)" >> $(1)))
+ $(if $(BOARD_AVB_SYSTEM_EXT_KEY_PATH),\
+ $(hide) echo "avb_system_ext_key_path=$(BOARD_AVB_SYSTEM_EXT_KEY_PATH)" >> $(1)
+ $(hide) echo "avb_system_ext_algorithm=$(BOARD_AVB_SYSTEM_EXT_ALGORITHM)" >> $(1)
+ $(hide) echo "avb_system_ext_rollback_index_location=$(BOARD_AVB_SYSTEM_EXT_ROLLBACK_INDEX_LOCATION)" >> $(1)))
$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_hashtree_enable=$(BOARD_AVB_ENABLE)" >> $(1))
$(if $(BOARD_AVB_ENABLE),$(hide) echo "avb_odm_add_hashtree_footer_args=$(BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS)" >> $(1))
$(if $(BOARD_AVB_ENABLE),\
@@ -1472,8 +1611,30 @@
# $(1): the path of the output dictionary file
# $(2): additional "key=value" pairs to append to the dictionary file.
+PROP_DICTIONARY_IMAGES := oem
+ifdef BUILDING_CACHE_IMAGE
+ PROP_DICTIONARY_IMAGES += cache
+endif
+ifdef BUILDING_SYSTEM_IMAGE
+ PROP_DICTIONARY_IMAGES += system
+endif
+ifdef BUILDING_USERDATA_IMAGE
+ PROP_DICTIONARY_IMAGES += userdata
+endif
+ifdef BUILDING_VENDOR_IMAGE
+ PROP_DICTIONARY_IMAGES += vendor
+endif
+ifdef BUILDING_PRODUCT_IMAGE
+ PROP_DICTIONARY_IMAGES += product
+endif
+ifdef BUILDING_SYSTEM_EXT_IMAGE
+ PROP_DICTIONARY_IMAGES += system_ext
+endif
+ifdef BUILDING_ODM_IMAGE
+ PROP_DICTIONARY_IMAGES += odm
+endif
define generate-userimage-prop-dictionary
-$(call generate-image-prop-dictionary,$(1),system vendor cache userdata product product_services oem odm,$(2))
+ $(call generate-image-prop-dictionary,$(1),$(PROP_DICTIONARY_IMAGES),$(2))
endef
# $(1): the path of the input dictionary file, where each line has the format key=value
@@ -1482,23 +1643,6 @@
$$(grep '$(2)=' $(1) | cut -f2- -d'=')
endef
-# $(1): modules list
-# $(2): output dir
-# $(3): mount point
-# $(4): staging dir
-# Depmod requires a well-formed kernel version so 0.0 is used as a placeholder.
-define build-image-kernel-modules
- $(hide) rm -rf $(2)/lib/modules
- $(hide) mkdir -p $(2)/lib/modules
- $(hide) cp $(1) $(2)/lib/modules/
- $(hide) rm -rf $(4)
- $(hide) mkdir -p $(4)/lib/modules/0.0/$(3)lib/modules
- $(hide) cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
- $(hide) $(DEPMOD) -b $(4) 0.0
- $(hide) sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
- $(hide) cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
-endef
-
# -----------------------------------------------------------------
# Recovery image
@@ -1523,12 +1667,12 @@
endif
$(INSTALLED_FILES_FILE_RECOVERY): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RECOVERY)
-$(INSTALLED_FILES_FILE_RECOVERY): $(INTERNAL_RECOVERYIMAGE_FILES) $(FILESLIST)
+$(INSTALLED_FILES_FILE_RECOVERY): $(INTERNAL_RECOVERYIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@rm -f $@
$(hide) $(FILESLIST) $(TARGET_RECOVERY_ROOT_OUT) > $(@:.txt=.json)
- $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+ $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
recovery_initrc := $(call include-path-for, recovery)/etc/init.rc
recovery_sepolicy := \
@@ -1760,7 +1904,7 @@
$(INSTALLED_VENDOR_BUILD_PROP_TARGET) \
$(INSTALLED_ODM_BUILD_PROP_TARGET) \
$(INSTALLED_PRODUCT_BUILD_PROP_TARGET) \
- $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET)
+ $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET)
@echo "Target recovery buildinfo: $@"
$(hide) mkdir -p $(dir $@)
$(hide) rm -f $@
@@ -1770,7 +1914,7 @@
$(hide) cat $(INSTALLED_VENDOR_BUILD_PROP_TARGET) >> $@
$(hide) cat $(INSTALLED_ODM_BUILD_PROP_TARGET) >> $@
$(hide) cat $(INSTALLED_PRODUCT_BUILD_PROP_TARGET) >> $@
- $(hide) cat $(INSTALLED_PRODUCT_SERVICES_BUILD_PROP_TARGET) >> $@
+ $(hide) cat $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) >> $@
$(call append-recovery-ui-properties,$(PRIVATE_RECOVERY_UI_PROPERTIES),$@)
INTERNAL_RECOVERYIMAGE_ARGS := \
@@ -1802,8 +1946,6 @@
INTERNAL_RECOVERYIMAGE_ARGS += --dtb $(INSTALLED_DTBIMAGE_TARGET)
endif
-RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
-
# $(1): output file
define build-recoveryimage-target
# Making recovery image
@@ -1815,8 +1957,6 @@
# Modifying ramdisk contents...
$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),, \
$(hide) ln -sf /system/bin/init $(TARGET_RECOVERY_ROOT_OUT)/init)
- $(if $(BOARD_RECOVERY_KERNEL_MODULES), \
- $(call build-image-kernel-modules,$(BOARD_RECOVERY_KERNEL_MODULES),$(TARGET_RECOVERY_ROOT_OUT),,$(call intermediates-dir-for,PACKAGING,depmod_recovery)))
# Removes $(TARGET_RECOVERY_ROOT_OUT)/init*.rc EXCEPT init.recovery*.rc.
$(hide) find $(TARGET_RECOVERY_ROOT_OUT) -maxdepth 1 -name 'init*.rc' -type f -not -name "init.recovery.*.rc" | xargs rm -f
$(hide) cp -f $(recovery_initrc) $(TARGET_RECOVERY_ROOT_OUT)/
@@ -1838,7 +1978,7 @@
$(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
$(if $(filter true,$(PRODUCT_SUPPORTS_VBOOT)), \
$(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1).unsigned, \
- $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1) --id > $(RECOVERYIMAGE_ID_FILE))
+ $(hide) $(MKBOOTIMG) $(INTERNAL_RECOVERYIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(1))
$(if $(filter true,$(PRODUCT_SUPPORTS_BOOT_SIGNER)),\
$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
$(BOOT_SIGNER) /boot $(1) $(PRODUCT_VERITY_SIGNING_KEY).pk8 $(PRODUCT_VERITY_SIGNING_KEY).x509.pem $(1),\
@@ -1888,9 +2028,7 @@
$(INSTALLED_2NDBOOTLOADER_TARGET) \
$(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
$(recovery_resource_deps) \
- $(recovery_fstab) \
- $(BOARD_RECOVERY_KERNEL_MODULES) \
- $(DEPMOD)
+ $(recovery_fstab)
$(call pretty,"Target boot image from recovery: $@")
$(call build-recoveryimage-target, $@)
endif # BOARD_USES_RECOVERY_AS_BOOT
@@ -1918,9 +2056,7 @@
$(INSTALLED_2NDBOOTLOADER_TARGET) \
$(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
$(recovery_resource_deps) \
- $(recovery_fstab) \
- $(BOARD_RECOVERY_KERNEL_MODULES) \
- $(DEPMOD)
+ $(recovery_fstab)
$(call build-recoveryimage-target, $@)
ifdef RECOVERY_RESOURCE_ZIP
@@ -1978,12 +2114,12 @@
# Because ramdisk-debug.img will rsync from either ramdisk.img or ramdisk-recovery.img.
# Need to depend on the built ramdisk-debug.img, to get a complete list of the installed files.
$(INSTALLED_FILES_FILE_DEBUG_RAMDISK) : $(INSTALLED_DEBUG_RAMDISK_TARGET)
-$(INSTALLED_FILES_FILE_DEBUG_RAMDISK) : $(INTERNAL_DEBUG_RAMDISK_FILES) $(FILESLIST)
+$(INSTALLED_FILES_FILE_DEBUG_RAMDISK) : $(INTERNAL_DEBUG_RAMDISK_FILES) $(FILESLIST) $(FILESLIST_UTIL)
echo Installed file list: $@
mkdir -p $(dir $@)
rm -f $@
$(FILESLIST) $(DEBUG_RAMDISK_ROOT_DIR) > $(@:.txt=.json)
- build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+ $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
# ramdisk-debug.img will rsync the content from either ramdisk.img or ramdisk-recovery.img,
# depending on whether BOARD_USES_RECOVERY_AS_BOOT is set or not.
@@ -2061,7 +2197,8 @@
$(AVBTOOL) add_hash_footer \
--image $@ \
--partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
- --partition_name boot $(PRIVATE_AVB_DEBUG_BOOT_SIGNING_ARGS), \
+ --partition_name boot $(PRIVATE_AVB_DEBUG_BOOT_SIGNING_ARGS) \
+ $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS), \
$(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
.PHONY: bootimage_debug-nodeps
@@ -2073,7 +2210,8 @@
$(AVBTOOL) add_hash_footer \
--image $(INSTALLED_DEBUG_BOOTIMAGE_TARGET) \
--partition_size $(BOARD_BOOTIMAGE_PARTITION_SIZE) \
- --partition_name boot $(PRIVATE_AVB_DEBUG_BOOT_SIGNING_ARGS), \
+ --partition_name boot $(PRIVATE_AVB_DEBUG_BOOT_SIGNING_ARGS) \
+ $(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS), \
$(call assert-max-image-size,$(INSTALLED_DEBUG_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE)))
endif # TARGET_NO_KERNEL
@@ -2116,12 +2254,12 @@
INSTALLED_FILES_FILE := $(PRODUCT_OUT)/installed-files.txt
INSTALLED_FILES_JSON := $(INSTALLED_FILES_FILE:.txt=.json)
$(INSTALLED_FILES_FILE): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON)
-$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST)
+$(INSTALLED_FILES_FILE): $(FULL_SYSTEMIMAGE_DEPS) $(FILESLIST) $(FILESLIST_UTIL)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@rm -f $@
$(hide) $(FILESLIST) $(TARGET_OUT) > $(@:.txt=.json)
- $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+ $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
.PHONY: installed-file-list
installed-file-list: $(INSTALLED_FILES_FILE)
@@ -2162,33 +2300,18 @@
endef
endif
-# Create symlink /system/product_services to /product_services if necessary.
-ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
-define create-system-product_services-symlink
-$(hide) if [ -d $(TARGET_OUT)/product_services ] && [ ! -h $(TARGET_OUT)/product_services ]; then \
- echo 'Non-symlink $(TARGET_OUT)/product_services detected!' 1>&2; \
- echo 'You cannot install files to $(TARGET_OUT)/product_services while building a separate product_services.img!' 1>&2; \
+# Create symlink /system/system_ext to /system_ext if necessary.
+ifdef BOARD_USES_SYSTEM_EXTIMAGE
+define create-system-system_ext-symlink
+$(hide) if [ -d $(TARGET_OUT)/system_ext ] && [ ! -h $(TARGET_OUT)/system_ext ]; then \
+ echo 'Non-symlink $(TARGET_OUT)/system_ext detected!' 1>&2; \
+ echo 'You cannot install files to $(TARGET_OUT)/system_ext while building a separate system_ext.img!' 1>&2; \
exit 1; \
fi
-$(hide) ln -sf /product_services $(TARGET_OUT)/product_services
+$(hide) ln -sf /system_ext $(TARGET_OUT)/system_ext
endef
else
-define create-system-product_services-symlink
-endef
-endif
-
-# Create symlink /vendor/odm to /odm if necessary.
-ifdef BOARD_USES_ODMIMAGE
-define create-vendor-odm-symlink
-$(hide) if [ -d $(TARGET_OUT_VENDOR)/odm ] && [ ! -h $(TARGET_OUT_VENDOR)/odm ]; then \
- echo 'Non-symlink $(TARGET_OUT_VENDOR)/odm detected!' 1>&2; \
- echo 'You cannot install files to $(TARGET_OUT_VENDOR)/odm while building a separate odm.img!' 1>&2; \
- exit 1; \
-fi
-$(hide) ln -sf /odm $(TARGET_OUT_VENDOR)/odm
-endef
-else
-define create-vendor-odm-symlink
+define create-system-system_ext-symlink
endef
endif
@@ -2197,19 +2320,23 @@
@echo "Target system fs image: $(1)"
$(call create-system-vendor-symlink)
$(call create-system-product-symlink)
- $(call create-system-product_services-symlink)
+ $(call create-system-system_ext-symlink)
$(call check-apex-libs-absence-on-disk)
@mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
$(call generate-image-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt,system, \
skip_fsck=true)
- $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- build/make/tools/releasetools/build_image.py \
- $(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 )
+ PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
+ $(BUILD_IMAGE) \
+ $(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
-$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE) $(BUILD_IMAGE_SRCS)
+ifeq ($(BOARD_AVB_ENABLE),true)
+$(BUILT_SYSTEMIMAGE): $(BOARD_AVB_SYSTEM_KEY_PATH)
+endif
+$(BUILT_SYSTEMIMAGE): $(FULL_SYSTEMIMAGE_DEPS) $(INSTALLED_FILES_FILE)
$(call build-systemimage-target,$@)
INSTALLED_SYSTEMIMAGE_TARGET := $(PRODUCT_OUT)/system.img
@@ -2273,36 +2400,6 @@
.PHONY: sync syncsys
sync syncsys: $(INTERNAL_SYSTEMIMAGE_FILES)
-#######
-## system tarball
-define build-systemtarball-target
- $(call pretty,"Target system fs tarball: $(INSTALLED_SYSTEMTARBALL_TARGET)")
- $(call create-system-vendor-symlink)
- $(call create-system-product-symlink)
- $(call create-system-product_services-symlink)
- $(MKTARBALL) $(FS_GET_STATS) \
- $(PRODUCT_OUT) system $(PRIVATE_SYSTEM_TAR) \
- $(INSTALLED_SYSTEMTARBALL_TARGET) $(TARGET_OUT)
-endef
-
-ifndef SYSTEM_TARBALL_FORMAT
- SYSTEM_TARBALL_FORMAT := bz2
-endif
-
-system_tar := $(PRODUCT_OUT)/system.tar
-INSTALLED_SYSTEMTARBALL_TARGET := $(system_tar).$(SYSTEM_TARBALL_FORMAT)
-$(INSTALLED_SYSTEMTARBALL_TARGET): PRIVATE_SYSTEM_TAR := $(system_tar)
-$(INSTALLED_SYSTEMTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_SYSTEMIMAGE_FILES)
- $(build-systemtarball-target)
-
-.PHONY: systemtarball-nodeps
-systemtarball-nodeps: $(FS_GET_STATS) \
- $(filter-out systemtarball-nodeps stnod,$(MAKECMDGOALS))
- $(build-systemtarball-target)
-
-.PHONY: stnod
-stnod: systemtarball-nodeps
-
# -----------------------------------------------------------------
## platform.zip: system, plus other files to be used in PDK fusion build,
## in a zip file
@@ -2366,8 +2463,8 @@
ifdef BUILDING_PRODUCT_IMAGE
echo "-D $(TARGET_OUT_PRODUCT)" >> $@.lst
endif
-ifdef BUILDING_PRODUCT_SERVICES_IMAGE
- echo "-D $(TARGET_OUT_PRODUCT_SERVICES)" >> $@.lst
+ifdef BUILDING_SYSTEM_EXT_IMAGE
+ echo "-D $(TARGET_OUT_SYSTEM_EXT)" >> $@.lst
endif
ifdef BUILDING_ODM_IMAGE
echo "-D $(TARGET_OUT_ODM)" >> $@.lst
@@ -2405,34 +2502,6 @@
endif # BUILD_PLATFORM_ZIP
# -----------------------------------------------------------------
-## boot tarball
-define build-boottarball-target
- $(hide) echo "Target boot fs tarball: $(INSTALLED_BOOTTARBALL_TARGET)"
- $(hide) mkdir -p $(PRODUCT_OUT)/boot
- $(hide) cp -f $(INTERNAL_BOOTIMAGE_FILES) $(PRODUCT_OUT)/boot/.
- $(hide) echo $(INTERNAL_KERNEL_CMDLINE) > $(PRODUCT_OUT)/boot/cmdline
- $(hide) $(MKTARBALL) $(FS_GET_STATS) \
- $(PRODUCT_OUT) boot $(PRIVATE_BOOT_TAR) \
- $(INSTALLED_BOOTTARBALL_TARGET) $(TARGET_OUT)
-endef
-
-ifndef BOOT_TARBALL_FORMAT
- BOOT_TARBALL_FORMAT := bz2
-endif
-
-boot_tar := $(PRODUCT_OUT)/boot.tar
-INSTALLED_BOOTTARBALL_TARGET := $(boot_tar).$(BOOT_TARBALL_FORMAT)
-$(INSTALLED_BOOTTARBALL_TARGET): PRIVATE_BOOT_TAR := $(boot_tar)
-$(INSTALLED_BOOTTARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_BOOTIMAGE_FILES)
- $(build-boottarball-target)
-
-.PHONY: boottarball-nodeps btnod
-boottarball-nodeps btnod: $(FS_GET_STATS) \
- $(filter-out boottarball-nodeps btnod,$(MAKECMDGOALS))
- $(build-boottarball-target)
-
-
-# -----------------------------------------------------------------
# data partition image
INTERNAL_USERDATAIMAGE_FILES := \
$(filter $(TARGET_OUT_DATA)/%,$(ALL_DEFAULT_INSTALLED_MODULES))
@@ -2447,18 +2516,18 @@
@mkdir -p $(TARGET_OUT_DATA)
@mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt
$(call generate-image-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt,userdata,skip_fsck=true)
- $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- build/make/tools/releasetools/build_image.py \
- $(TARGET_OUT_DATA) $(userdataimage_intermediates)/userdata_image_info.txt $(INSTALLED_USERDATAIMAGE_TARGET) $(TARGET_OUT)
- $(hide) $(call assert-max-image-size,$(INSTALLED_USERDATAIMAGE_TARGET),$(BOARD_USERDATAIMAGE_PARTITION_SIZE))
+ PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
+ $(BUILD_IMAGE) \
+ $(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))
endef
# We just build this directly to the install location.
INSTALLED_USERDATAIMAGE_TARGET := $(BUILT_USERDATAIMAGE_TARGET)
INSTALLED_USERDATAIMAGE_TARGET_DEPS := \
$(INTERNAL_USERIMAGES_DEPS) \
- $(INTERNAL_USERDATAIMAGE_FILES) \
- $(BUILD_IMAGE_SRCS)
+ $(INTERNAL_USERDATAIMAGE_FILES)
$(INSTALLED_USERDATAIMAGE_TARGET): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
$(build-userdataimage-target)
@@ -2481,29 +2550,6 @@
$(ASAN_IN_SYSTEM_INSTALLED): $(INSTALLED_USERDATAIMAGE_TARGET_DEPS)
tar cfj $(ASAN_IN_SYSTEM_INSTALLED) $(ASAN_SYSTEM_INSTALL_OPTIONS) -C $(TARGET_OUT_DATA)/.. $(ASAN_OUT_DIRS_FOR_SYSTEM_INSTALL) >/dev/null
-#######
-## data partition tarball
-define build-userdatatarball-target
- $(call pretty,"Target userdata fs tarball: " \
- "$(INSTALLED_USERDATATARBALL_TARGET)")
- $(MKTARBALL) $(FS_GET_STATS) \
- $(PRODUCT_OUT) data $(PRIVATE_USERDATA_TAR) \
- $(INSTALLED_USERDATATARBALL_TARGET) $(TARGET_OUT)
-endef
-
-userdata_tar := $(PRODUCT_OUT)/userdata.tar
-INSTALLED_USERDATATARBALL_TARGET := $(userdata_tar).bz2
-$(INSTALLED_USERDATATARBALL_TARGET): PRIVATE_USERDATA_TAR := $(userdata_tar)
-$(INSTALLED_USERDATATARBALL_TARGET): $(FS_GET_STATS) $(INTERNAL_USERDATAIMAGE_FILES)
- $(build-userdatatarball-target)
-
-$(call dist-for-goals,userdatatarball,$(INSTALLED_USERDATATARBALL_TARGET))
-
-.PHONY: userdatatarball-nodeps
-userdatatarball-nodeps: $(FS_GET_STATS)
- $(build-userdatatarball-target)
-
-
# -----------------------------------------------------------------
# partition table image
ifdef BOARD_BPT_INPUT_FILES
@@ -2553,15 +2599,16 @@
@mkdir -p $(TARGET_OUT_CACHE)
@mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt
$(call generate-image-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt,cache,skip_fsck=true)
- $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- build/make/tools/releasetools/build_image.py \
- $(TARGET_OUT_CACHE) $(cacheimage_intermediates)/cache_image_info.txt $(INSTALLED_CACHEIMAGE_TARGET) $(TARGET_OUT)
- $(hide) $(call assert-max-image-size,$(INSTALLED_CACHEIMAGE_TARGET),$(BOARD_CACHEIMAGE_PARTITION_SIZE))
+ PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
+ $(BUILD_IMAGE) \
+ $(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
# We just build this directly to the install location.
INSTALLED_CACHEIMAGE_TARGET := $(BUILT_CACHEIMAGE_TARGET)
-$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES) $(BUILD_IMAGE_SRCS)
+$(INSTALLED_CACHEIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_CACHEIMAGE_FILES)
$(build-cacheimage-target)
.PHONY: cacheimage-nodeps
@@ -2596,12 +2643,12 @@
INSTALLED_FILES_FILE_SYSTEMOTHER := $(PRODUCT_OUT)/installed-files-system-other.txt
INSTALLED_FILES_JSON_SYSTEMOTHER := $(INSTALLED_FILES_FILE_SYSTEMOTHER:.txt=.json)
$(INSTALLED_FILES_FILE_SYSTEMOTHER): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEMOTHER)
-$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST)
+$(INSTALLED_FILES_FILE_SYSTEMOTHER) : $(INTERNAL_SYSTEMOTHERIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@rm -f $@
$(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_OTHER) > $(@:.txt=.json)
- $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+ $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
# Determines partition size for system_other.img.
ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
@@ -2624,10 +2671,11 @@
@mkdir -p $(TARGET_OUT_SYSTEM_OTHER)
@mkdir -p $(systemotherimage_intermediates) && rm -rf $(systemotherimage_intermediates)/system_other_image_info.txt
$(call generate-image-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt,system,skip_fsck=true)
- $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- build/make/tools/releasetools/build_image.py \
- $(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)
- $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
+ PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
+ $(BUILD_IMAGE) \
+ $(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
# We just build this directly to the install location.
@@ -2746,12 +2794,27 @@
INSTALLED_FILES_FILE_VENDOR := $(PRODUCT_OUT)/installed-files-vendor.txt
INSTALLED_FILES_JSON_VENDOR := $(INSTALLED_FILES_FILE_VENDOR:.txt=.json)
$(INSTALLED_FILES_FILE_VENDOR): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_VENDOR)
-$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST)
+$(INSTALLED_FILES_FILE_VENDOR) : $(INTERNAL_VENDORIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@rm -f $@
$(hide) $(FILESLIST) $(TARGET_OUT_VENDOR) > $(@:.txt=.json)
- $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+ $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
+
+# Create symlink /vendor/odm to /odm if necessary.
+ifdef BOARD_USES_ODMIMAGE
+define create-vendor-odm-symlink
+$(hide) if [ -d $(TARGET_OUT_VENDOR)/odm ] && [ ! -h $(TARGET_OUT_VENDOR)/odm ]; then \
+ echo 'Non-symlink $(TARGET_OUT_VENDOR)/odm detected!' 1>&2; \
+ echo 'You cannot install files to $(TARGET_OUT_VENDOR)/odm while building a separate odm.img!' 1>&2; \
+ exit 1; \
+fi
+$(hide) ln -sf /odm $(TARGET_OUT_VENDOR)/odm
+endef
+else
+define create-vendor-odm-symlink
+endef
+endif
vendorimage_intermediates := \
$(call intermediates-dir-for,PACKAGING,vendor)
@@ -2762,12 +2825,11 @@
$(call create-vendor-odm-symlink)
@mkdir -p $(vendorimage_intermediates) && rm -rf $(vendorimage_intermediates)/vendor_image_info.txt
$(call generate-image-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt,vendor,skip_fsck=true)
- $(if $(BOARD_VENDOR_KERNEL_MODULES), \
- $(call build-image-kernel-modules,$(BOARD_VENDOR_KERNEL_MODULES),$(TARGET_OUT_VENDOR),vendor/,$(call intermediates-dir-for,PACKAGING,depmod_vendor)))
- $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- build/make/tools/releasetools/build_image.py \
- $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT)
- $(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),$(BOARD_VENDORIMAGE_PARTITION_SIZE))
+ PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
+ $(BUILD_IMAGE) \
+ $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt \
+ $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT)
+ $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),$(BOARD_VENDORIMAGE_PARTITION_SIZE))
endef
# We just build this directly to the install location.
@@ -2775,11 +2837,14 @@
ifdef BUILT_VENDOR_MANIFEST
$(INSTALLED_VENDORIMAGE_TARGET): $(BUILT_ASSEMBLED_VENDOR_MANIFEST)
endif
-$(INSTALLED_VENDORIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_VENDORIMAGE_FILES) $(INSTALLED_FILES_FILE_VENDOR) $(BUILD_IMAGE_SRCS) $(DEPMOD) $(BOARD_VENDOR_KERNEL_MODULES)
+$(INSTALLED_VENDORIMAGE_TARGET): \
+ $(INTERNAL_USERIMAGES_DEPS) \
+ $(INTERNAL_VENDORIMAGE_FILES) \
+ $(INSTALLED_FILES_FILE_VENDOR)
$(build-vendorimage-target)
.PHONY: vendorimage-nodeps vnod
-vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS) $(DEPMOD)
+vendorimage-nodeps vnod: | $(INTERNAL_USERIMAGES_DEPS)
$(build-vendorimage-target)
sync: $(INTERNAL_VENDORIMAGE_FILES)
@@ -2804,12 +2869,12 @@
INSTALLED_FILES_FILE_PRODUCT := $(PRODUCT_OUT)/installed-files-product.txt
INSTALLED_FILES_JSON_PRODUCT := $(INSTALLED_FILES_FILE_PRODUCT:.txt=.json)
$(INSTALLED_FILES_FILE_PRODUCT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT)
-$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST)
+$(INSTALLED_FILES_FILE_PRODUCT) : $(INTERNAL_PRODUCTIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@rm -f $@
$(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT) > $(@:.txt=.json)
- $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+ $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
productimage_intermediates := \
$(call intermediates-dir-for,PACKAGING,product)
@@ -2819,15 +2884,19 @@
@mkdir -p $(TARGET_OUT_PRODUCT)
@mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt
$(call generate-image-prop-dictionary, $(productimage_intermediates)/product_image_info.txt,product,skip_fsck=true)
- $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- ./build/tools/releasetools/build_image.py \
- $(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT)
- $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),$(BOARD_PRODUCTIMAGE_PARTITION_SIZE))
+ PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
+ $(BUILD_IMAGE) \
+ $(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
# 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) $(BUILD_IMAGE_SRCS)
+$(INSTALLED_PRODUCTIMAGE_TARGET): \
+ $(INTERNAL_USERIMAGES_DEPS) \
+ $(INTERNAL_PRODUCTIMAGE_FILES) \
+ $(INSTALLED_FILES_FILE_PRODUCT)
$(build-productimage-target)
.PHONY: productimage-nodeps pnod
@@ -2888,55 +2957,61 @@
endif # BUILDING_SYSTEM_IMAGE
# -----------------------------------------------------------------
-# product_services partition image
-ifdef BUILDING_PRODUCT_SERVICES_IMAGE
-INTERNAL_PRODUCT_SERVICESIMAGE_FILES := \
- $(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,\
+# system_ext partition image
+ifdef BUILDING_SYSTEM_EXT_IMAGE
+INTERNAL_SYSTEM_EXTIMAGE_FILES := \
+ $(filter $(TARGET_OUT_SYSTEM_EXT)/%,\
$(ALL_DEFAULT_INSTALLED_MODULES)\
$(ALL_PDK_FUSION_FILES)) \
$(PDK_FUSION_SYMLINK_STAMP)
-# platform.zip depends on $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES).
-$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES)
+# platform.zip depends on $(INTERNAL_SYSTEM_EXTIMAGE_FILES).
+$(INSTALLED_PLATFORM_ZIP) : $(INTERNAL_SYSTEM_EXTIMAGE_FILES)
-INSTALLED_FILES_FILE_PRODUCT_SERVICES := $(PRODUCT_OUT)/installed-files-product_services.txt
-INSTALLED_FILES_JSON_PRODUCT_SERVICES := $(INSTALLED_FILES_FILE_PRODUCT_SERVICES:.txt=.json)
-$(INSTALLED_FILES_FILE_PRODUCT_SERVICES): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_PRODUCT_SERVICES)
-$(INSTALLED_FILES_FILE_PRODUCT_SERVICES) : $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES) $(FILESLIST)
+INSTALLED_FILES_FILE_SYSTEM_EXT := $(PRODUCT_OUT)/installed-files-system_ext.txt
+INSTALLED_FILES_JSON_SYSTEM_EXT := $(INSTALLED_FILES_FILE_SYSTEM_EXT:.txt=.json)
+$(INSTALLED_FILES_FILE_SYSTEM_EXT): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_SYSTEM_EXT)
+$(INSTALLED_FILES_FILE_SYSTEM_EXT) : $(INTERNAL_SYSTEM_EXTIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@rm -f $@
- $(hide) $(FILESLIST) $(TARGET_OUT_PRODUCT_SERVICES) > $(@:.txt=.json)
- $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+ $(hide) $(FILESLIST) $(TARGET_OUT_SYSTEM_EXT) > $(@:.txt=.json)
+ $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
-product_servicesimage_intermediates := \
- $(call intermediates-dir-for,PACKAGING,product_services)
-BUILT_PRODUCT_SERVICESIMAGE_TARGET := $(PRODUCT_OUT)/product_services.img
-define build-product_servicesimage-target
- $(call pretty,"Target product_services fs image: $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)")
- @mkdir -p $(TARGET_OUT_PRODUCT_SERVICES)
- @mkdir -p $(product_servicesimage_intermediates) && rm -rf $(product_servicesimage_intermediates)/product_services_image_info.txt
- $(call generate-image-prop-dictionary, $(product_servicesimage_intermediates)/product_services_image_info.txt,product_services, skip_fsck=true)
- $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- ./build/tools/releasetools/build_image.py \
- $(TARGET_OUT_PRODUCT_SERVICES) $(product_servicesimage_intermediates)/product_services_image_info.txt $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(TARGET_OUT)
- $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET),$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE))
+system_extimage_intermediates := \
+ $(call intermediates-dir-for,PACKAGING,system_ext)
+BUILT_SYSTEM_EXTIMAGE_TARGET := $(PRODUCT_OUT)/system_ext.img
+define build-system_extimage-target
+ $(call pretty,"Target system_ext fs image: $(INSTALLED_SYSTEM_EXTIMAGE_TARGET)")
+ @mkdir -p $(TARGET_OUT_SYSTEM_EXT)
+ @mkdir -p $(system_extimage_intermediates) && rm -rf $(system_extimage_intermediates)/system_ext_image_info.txt
+ $(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) \
+ $(TARGET_OUT_SYSTEM_EXT) \
+ $(system_extimage_intermediates)/system_ext_image_info.txt \
+ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
+ $(TARGET_OUT)
+ $(call assert-max-image-size,$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET),$(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE))
endef
# We just build this directly to the install location.
-INSTALLED_PRODUCT_SERVICESIMAGE_TARGET := $(BUILT_PRODUCT_SERVICESIMAGE_TARGET)
-$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES) $(INSTALLED_FILES_FILE_PRODUCT_SERVICES) $(BUILD_IMAGE_SRCS)
- $(build-product_servicesimage-target)
+INSTALLED_SYSTEM_EXTIMAGE_TARGET := $(BUILT_SYSTEM_EXTIMAGE_TARGET)
+$(INSTALLED_SYSTEM_EXTIMAGE_TARGET): \
+ $(INTERNAL_USERIMAGES_DEPS) \
+ $(INTERNAL_SYSTEM_EXTIMAGE_FILES) \
+ $(INSTALLED_FILES_FILE_SYSTEM_EXT)
+ $(build-system_extimage-target)
-.PHONY: productservicesimage-nodeps psnod
-productservicesimage-nodeps psnod: | $(INTERNAL_USERIMAGES_DEPS)
- $(build-product_servicesimage-target)
+.PHONY: systemextimage-nodeps senod
+systemextimage-nodeps senod: | $(INTERNAL_USERIMAGES_DEPS)
+ $(build-system_extimage-target)
-sync: $(INTERNAL_PRODUCT_SERVICESIMAGE_FILES)
+sync: $(INTERNAL_SYSTEM_EXTIMAGE_FILES)
-else ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
-INSTALLED_PRODUCT_SERVICESIMAGE_TARGET := $(PRODUCT_OUT)/product_services.img
-$(eval $(call copy-one-file,$(BOARD_PREBUILT_PRODUCT_SERVICESIMAGE),$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)))
+else ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
+INSTALLED_SYSTEM_EXTIMAGE_TARGET := $(PRODUCT_OUT)/system_ext.img
+$(eval $(call copy-one-file,$(BOARD_PREBUILT_SYSTEM_EXTIMAGE),$(INSTALLED_SYSTEM_EXTIMAGE_TARGET)))
endif
# -----------------------------------------------------------------
@@ -2953,12 +3028,12 @@
INSTALLED_FILES_FILE_ODM := $(PRODUCT_OUT)/installed-files-odm.txt
INSTALLED_FILES_JSON_ODM := $(INSTALLED_FILES_FILE_ODM:.txt=.json)
$(INSTALLED_FILES_FILE_ODM): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_ODM)
-$(INSTALLED_FILES_FILE_ODM) : $(INTERNAL_ODMIMAGE_FILES) $(FILESLIST)
+$(INSTALLED_FILES_FILE_ODM) : $(INTERNAL_ODMIMAGE_FILES) $(FILESLIST) $(FILESLIST_UTIL)
@echo Installed file list: $@
@mkdir -p $(dir $@)
@rm -f $@
$(hide) $(FILESLIST) $(TARGET_OUT_ODM) > $(@:.txt=.json)
- $(hide) build/tools/fileslist_util.py -c $(@:.txt=.json) > $@
+ $(hide) $(FILESLIST_UTIL) -c $(@:.txt=.json) > $@
odmimage_intermediates := \
$(call intermediates-dir-for,PACKAGING,odm)
@@ -2968,21 +3043,23 @@
@mkdir -p $(TARGET_OUT_ODM)
@mkdir -p $(odmimage_intermediates) && rm -rf $(odmimage_intermediates)/odm_image_info.txt
$(call generate-userimage-prop-dictionary, $(odmimage_intermediates)/odm_image_info.txt, skip_fsck=true)
- $(if $(BOARD_ODM_KERNEL_MODULES), \
- $(call build-image-kernel-modules,$(BOARD_ODM_KERNEL_MODULES),$(TARGET_OUT_ODM),odm/,$(call intermediates-dir-for,PACKAGING,depmod_odm)))
- $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- ./build/tools/releasetools/build_image.py \
- $(TARGET_OUT_ODM) $(odmimage_intermediates)/odm_image_info.txt $(INSTALLED_ODMIMAGE_TARGET) $(TARGET_OUT)
- $(hide) $(call assert-max-image-size,$(INSTALLED_ODMIMAGE_TARGET),$(BOARD_ODMIMAGE_PARTITION_SIZE))
+ PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
+ $(BUILD_IMAGE) \
+ $(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
# 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) $(BUILD_IMAGE_SRCS) $(DEPMOD) $(BOARD_ODM_KERNEL_MODULES)
+$(INSTALLED_ODMIMAGE_TARGET): \
+ $(INTERNAL_USERIMAGES_DEPS) \
+ $(INTERNAL_ODMIMAGE_FILES) \
+ $(INSTALLED_FILES_FILE_ODM)
$(build-odmimage-target)
.PHONY: odmimage-nodeps onod
-odmimage-nodeps onod: | $(INTERNAL_USERIMAGES_DEPS) $(DEPMOD)
+odmimage-nodeps onod: | $(INTERNAL_USERIMAGES_DEPS)
$(build-odmimage-target)
sync: $(INTERNAL_ODMIMAGE_FILES)
@@ -3015,7 +3092,7 @@
# Returns a list of image targets corresponding to the given list of partitions. For example, it
# returns "$(INSTALLED_PRODUCTIMAGE_TARGET)" for "product", or "$(INSTALLED_SYSTEMIMAGE_TARGET)
# $(INSTALLED_VENDORIMAGE_TARGET)" for "system vendor".
-# (1): list of partitions like "system", "vendor" or "system product product_services".
+# (1): list of partitions like "system", "vendor" or "system product system_ext".
define images-for-partitions
$(strip $(foreach item,$(1),$(INSTALLED_$(call to-upper,$(item))IMAGE_TARGET)))
endef
@@ -3077,9 +3154,9 @@
--prop com.android.build.product.os_version:$(PLATFORM_VERSION) \
--prop com.android.build.product.security_patch:$(PLATFORM_SECURITY_PATCH)
-BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS += \
- --prop com.android.build.product_services.os_version:$(PLATFORM_VERSION) \
- --prop com.android.build.product_services.security_patch:$(PLATFORM_SECURITY_PATCH)
+BOARD_AVB_SYSTEM_EXT_ADD_HASHTREE_FOOTER_ARGS += \
+ --prop com.android.build.system_ext.os_version:$(PLATFORM_VERSION) \
+ --prop com.android.build.system_ext.security_patch:$(PLATFORM_SECURITY_PATCH)
BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS += \
--prop com.android.build.boot.os_version:$(PLATFORM_VERSION)
@@ -3112,7 +3189,7 @@
VENDOR_FOOTER_ARGS := BOARD_AVB_VENDOR_ADD_HASHTREE_FOOTER_ARGS
RECOVERY_FOOTER_ARGS := BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS
PRODUCT_FOOTER_ARGS := BOARD_AVB_PRODUCT_ADD_HASHTREE_FOOTER_ARGS
-PRODUCT_SERVICES_FOOTER_ARGS := BOARD_AVB_PRODUCT_SERVICES_ADD_HASHTREE_FOOTER_ARGS
+SYSTEM_EXT_FOOTER_ARGS := BOARD_AVB_SYSTEM_EXT_ADD_HASHTREE_FOOTER_ARGS
ODM_FOOTER_ARGS := BOARD_AVB_ODM_ADD_HASHTREE_FOOTER_ARGS
# Helper function that checks and sets required build variables for an AVB chained partition.
@@ -3175,8 +3252,8 @@
$(eval $(call check-and-set-avb-args,product))
endif
-ifdef INSTALLED_PRODUCT_SERVICESIMAGE_TARGET
-$(eval $(call check-and-set-avb-args,product_services))
+ifdef INSTALLED_SYSTEM_EXTIMAGE_TARGET
+$(eval $(call check-and-set-avb-args,system_ext))
endif
ifdef INSTALLED_ODMIMAGE_TARGET
@@ -3249,9 +3326,9 @@
$(if $(BOARD_AVB_PRODUCT_KEY_PATH),\
$(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_KEY_PATH) \
--output $(1)/product.avbpubkey)
- $(if $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH),\
- $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_PRODUCT_SERVICES_KEY_PATH) \
- --output $(1)/product_services.avbpubkey)
+ $(if $(BOARD_AVB_SYSTEM_EXT_KEY_PATH),\
+ $(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_SYSTEM_EXT_KEY_PATH) \
+ --output $(1)/system_ext.avbpubkey)
$(if $(BOARD_AVB_ODM_KEY_PATH),\
$(hide) $(AVBTOOL) extract_public_key --key $(BOARD_AVB_ODM_KEY_PATH) \
--output $(1)/odm.avbpubkey)
@@ -3272,8 +3349,8 @@
# Builds a chained VBMeta image. This VBMeta image will contain the descriptors for the partitions
# specified in BOARD_AVB_VBMETA_<NAME>. The built VBMeta image will be included into the top-level
# vbmeta image as a chained partition. For example, if a target defines `BOARD_AVB_VBMETA_SYSTEM
-# := system product_services`, `vbmeta_system.img` will be created that includes the descriptors
-# for `system.img` and `product_services.img`. `vbmeta_system.img` itself will be included into
+# := system system_ext`, `vbmeta_system.img` will be created that includes the descriptors for
+# `system.img` and `system_ext.img`. `vbmeta_system.img` itself will be included into
# `vbmeta.img` as a chained partition.
# $(1): VBMeta image name, such as "vbmeta_system", "vbmeta_vendor" etc.
# $(2): Output filename.
@@ -3329,7 +3406,7 @@
$(INSTALLED_SYSTEMIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
$(INSTALLED_PRODUCTIMAGE_TARGET) \
- $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
+ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
$(INSTALLED_ODMIMAGE_TARGET) \
$(INSTALLED_DTBOIMAGE_TARGET) \
$(INSTALLED_RECOVERYIMAGE_TARGET) \
@@ -3354,11 +3431,10 @@
ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
-# (1): list of items like "system", "vendor", "product", "product_services"
+# (1): list of items like "system", "vendor", "product", "system_ext"
# return: map each item into a command ( wrapped in $$() ) that reads the size
define read-size-of-partitions
-$(foreach image,$(call images-for-partitions,$(1)),$$( \
- build/make/tools/releasetools/sparse_img.py --get_partition_size $(image)))
+$(foreach image,$(call images-for-partitions,$(1)),$$($(SPARSE_IMG) --get_partition_size $(image)))
endef
# round result to BOARD_SUPER_PARTITION_ALIGNMENT
@@ -3377,13 +3453,25 @@
$(if $(filter true,$(AB_OTA_UPDATER)),$(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)),,_a))
endef
+ifndef BOARD_SUPER_PARTITION_WARN_LIMIT
+BOARD_SUPER_PARTITION_WARN_LIMIT := $$(($(BOARD_SUPER_PARTITION_SIZE) * 95 / 100))
+endif
+
+ifndef BOARD_SUPER_PARTITION_ERROR_LIMIT
+BOARD_SUPER_PARTITION_ERROR_LIMIT := $(BOARD_SUPER_PARTITION_SIZE)
+endif
+
droid_targets: check-all-partition-sizes
.PHONY: check-all-partition-sizes check-all-partition-sizes-nodeps
+check_all_partition_sizes_file := $(call intermediates-dir-for,PACKAGING,check-all-partition-sizes)/timestamp
+
+check-all-partition-sizes: $(check_all_partition_sizes_file)
+
# Add image dependencies so that generated_*_image_info.txt are written before checking.
-check-all-partition-sizes: \
- build/make/tools/releasetools/sparse_img.py \
+$(check_all_partition_sizes_file): \
+ $(SPARSE_IMG) \
$(call images-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
@@ -3407,6 +3495,10 @@
# $(1): human-readable max size string
# $(2): max size expression
# $(3): list of partition names
+# $(4): human-readable warn size string
+# $(5): warn size expression
+# $(6): human readable error size string
+# $(7): error size expression
define check-sum-of-partition-sizes
partition_size_list="$$(for i in $(call read-size-of-partitions,$(3)); do \
echo $(call round-partition-size,$${i}); \
@@ -3417,6 +3509,17 @@
echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' "$(2)" '==' $$(( $(2) )); \
exit 1; \
else \
+ if [[ ! -z "$(7)" ]] && [ $$(( $${sum_sizes_expr} )) -gt $$(( $(7) )) ]; then \
+ echo "!!!! ERROR !!!! The sum of sizes of [$(strip $(3))] is larger than $(strip $(6)):"; \
+ echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' "$(7)" '==' $$(( $(7) )); \
+ echo "Super partition is" $$(( $$(( $$(( $${sum_sizes_expr} )) * 100)) / $$(( $(2) )) )) "percent occupied!"; \
+ exit 1; \
+ fi; \
+ if [[ ! -z "$(5)" ]] && [ $$(( $${sum_sizes_expr} )) -gt $$(( $(5) )) ]; then \
+ echo "!!!! WARNING !!!! The sum of sizes of [$(strip $(3))] is larger than $(strip $(4)):"; \
+ echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' "$(5)" '==' $$(( $(5) )); \
+ echo "Super partition is" $$(( $$(( $$(( $${sum_sizes_expr} )) * 100)) / $$(( $(2) )) )) "percent occupied!"; \
+ fi; \
echo "The sum of sizes of [$(strip $(3))] is within $(strip $(1)):"; \
echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' "$(2)" '==' $$(( $(2) )); \
fi;
@@ -3426,7 +3529,12 @@
# Check sum(all partitions) <= super partition (/ 2 for A/B devices launched with dynamic partitions)
$(if $(BOARD_SUPER_PARTITION_SIZE),$(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
$(call check-sum-of-partition-sizes,BOARD_SUPER_PARTITION_SIZE$(if $(call super-slot-suffix), / 2), \
- $(BOARD_SUPER_PARTITION_SIZE)$(if $(call super-slot-suffix), / 2),$(BOARD_SUPER_PARTITION_PARTITION_LIST))))
+ $(BOARD_SUPER_PARTITION_SIZE)$(if $(call super-slot-suffix), / 2),$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
+ BOARD_SUPER_PARTITION_WARN_LIMIT$(if $(call super-slot-suffix), / 2), \
+ $(BOARD_SUPER_PARTITION_WARN_LIMIT)$(if $(call super-slot-suffix), / 2), \
+ BOARD_SUPER_PARTITION_ERROR_LIMIT$(if $(call super-slot-suffix), / 2), \
+ $(BOARD_SUPER_PARTITION_ERROR_LIMIT)$(if $(call super-slot-suffix), / 2)) \
+ ))
# For each group, check sum(partitions in group) <= group size
$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
@@ -3450,7 +3558,12 @@
fi
endef
-check-all-partition-sizes check-all-partition-sizes-nodeps:
+$(check_all_partition_sizes_file):
+ $(call check-all-partition-sizes-target)
+ $(call check-super-partition-size)
+ touch $@
+
+check-all-partition-sizes-nodeps:
$(call check-all-partition-sizes-target)
$(call check-super-partition-size)
@@ -3515,6 +3628,8 @@
brillo_update_payload \
brotli \
bsdiff \
+ build_image \
+ build_super_image \
build_verity_metadata \
build_verity_tree \
care_map_generator \
@@ -3530,8 +3645,10 @@
imgdiff \
libconscrypt_openjdk_jni \
lpmake \
+ lpunpack \
make_f2fs \
minigzip \
+ mk_combined_img \
mkbootfs \
mkbootimg \
mke2fs \
@@ -3540,12 +3657,15 @@
mksquashfs \
mksquashfsimage.sh \
mkuserimg_mke2fs \
+ ota_from_target_files \
sefcontext_compile \
+ sgdisk \
shflags \
signapk \
simg2img \
sload_f2fs \
tune2fs \
+ update_host_simulator \
verity_signer \
verity_verifier \
zipalign \
@@ -3618,6 +3738,139 @@
endif # build_otatools_package
# -----------------------------------------------------------------
+# misc_info.txt
+
+INSTALLED_MISC_INFO_TARGET := $(PRODUCT_OUT)/misc_info.txt
+
+ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
+# default to common dir for device vendor
+tool_extensions := $(TARGET_DEVICE_DIR)/../common
+else
+tool_extensions := $(TARGET_RELEASETOOLS_EXTENSIONS)
+endif
+.KATI_READONLY := tool_extensions
+
+$(INSTALLED_MISC_INFO_TARGET):
+ rm -f $@
+ $(call pretty,"Target misc_info.txt: $@")
+ $(hide) echo "recovery_api_version=$(RECOVERY_API_VERSION)" >> $@
+ $(hide) echo "fstab_version=$(RECOVERY_FSTAB_VERSION)" >> $@
+ifdef BOARD_FLASH_BLOCK_SIZE
+ $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $@
+endif
+ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
+ $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $@
+endif
+ifeq ($(INSTALLED_BOOTIMAGE_TARGET),)
+ $(hide) echo "no_boot=true" >> $@
+endif
+ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
+ $(hide) echo "no_recovery=true" >> $@
+endif
+ifdef BOARD_INCLUDE_RECOVERY_DTBO
+ $(hide) echo "include_recovery_dtbo=true" >> $@
+endif
+ifdef BOARD_INCLUDE_RECOVERY_ACPIO
+ $(hide) echo "include_recovery_acpio=true" >> $@
+endif
+ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
+ $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $@
+endif
+ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS
+ @# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
+ $(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $@
+else
+ $(hide) echo "recovery_mount_options=$(DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $@
+endif
+ $(hide) echo "tool_extensions=$(tool_extensions)" >> $@
+ $(hide) echo "default_system_dev_certificate=$(DEFAULT_SYSTEM_DEV_CERTIFICATE)" >> $@
+ifdef PRODUCT_EXTRA_RECOVERY_KEYS
+ $(hide) echo "extra_recovery_keys=$(PRODUCT_EXTRA_RECOVERY_KEYS)" >> $@
+endif
+ $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $@
+ $(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $@
+ $(hide) echo "multistage_support=1" >> $@
+ $(hide) echo "blockimgdiff_versions=3,4" >> $@
+ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
+ $(hide) echo "build_generic_ota_package=true" >> $@
+endif
+ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
+ # OTA scripts are only interested in fingerprint related properties
+ $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $@
+endif
+ifneq (,$(filter address, $(SANITIZE_TARGET)))
+ # We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
+ $(hide) echo "userdata_img_with_data=true" >> $@
+endif
+ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
+ $(hide) echo "full_recovery_image=true" >> $@
+endif
+ifeq ($(BOARD_AVB_ENABLE),true)
+ $(hide) echo "avb_enable=true" >> $@
+ $(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $@
+ $(hide) echo "avb_vbmeta_algorithm=$(BOARD_AVB_ALGORITHM)" >> $@
+ $(hide) echo "avb_vbmeta_args=$(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS)" >> $@
+ $(hide) echo "avb_boot_add_hash_footer_args=$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)" >> $@
+ifdef BOARD_AVB_BOOT_KEY_PATH
+ $(hide) echo "avb_boot_key_path=$(BOARD_AVB_BOOT_KEY_PATH)" >> $@
+ $(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $@
+ $(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $@
+endif # BOARD_AVB_BOOT_KEY_PATH
+ $(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $@
+ifdef BOARD_AVB_RECOVERY_KEY_PATH
+ $(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $@
+ $(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $@
+ $(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $@
+endif # BOARD_AVB_RECOVERY_KEY_PATH
+ifneq (,$(strip $(BOARD_AVB_VBMETA_SYSTEM)))
+ $(hide) echo "avb_vbmeta_system=$(BOARD_AVB_VBMETA_SYSTEM)" >> $@
+ $(hide) echo "avb_vbmeta_system_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $@
+ $(hide) echo "avb_vbmeta_system_key_path=$(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)" >> $@
+ $(hide) echo "avb_vbmeta_system_algorithm=$(BOARD_AVB_VBMETA_SYSTEM_ALGORITHM)" >> $@
+ $(hide) echo "avb_vbmeta_system_rollback_index_location=$(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $@
+endif # BOARD_AVB_VBMETA_SYSTEM
+ifneq (,$(strip $(BOARD_AVB_VBMETA_VENDOR)))
+ $(hide) echo "avb_vbmeta_vendor=$(BOARD_AVB_VBMETA_VENDOR)" >> $@
+ $(hide) echo "avb_vbmeta_vendor_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $@
+ $(hide) echo "avb_vbmeta_vendor_key_path=$(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)" >> $@
+ $(hide) echo "avb_vbmeta_vendor_algorithm=$(BOARD_AVB_VBMETA_VENDOR_ALGORITHM)" >> $@
+ $(hide) echo "avb_vbmeta_vendor_rollback_index_location=$(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $@
+endif # BOARD_AVB_VBMETA_VENDOR_KEY_PATH
+endif # BOARD_AVB_ENABLE
+ifdef BOARD_BPT_INPUT_FILES
+ $(hide) echo "board_bpt_enable=true" >> $@
+ $(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $@
+ $(hide) echo "board_bpt_input_files=$(BOARD_BPT_INPUT_FILES)" >> $@
+endif
+ifdef BOARD_BPT_DISK_SIZE
+ $(hide) echo "board_bpt_disk_size=$(BOARD_BPT_DISK_SIZE)" >> $@
+endif
+ $(call generate-userimage-prop-dictionary, $@)
+ifeq ($(AB_OTA_UPDATER),true)
+ @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
+ $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $@
+ $(hide) echo "ab_update=true" >> $@
+endif
+ifdef BOARD_PREBUILT_DTBOIMAGE
+ $(hide) echo "has_dtbo=true" >> $@
+ifeq ($(BOARD_AVB_ENABLE),true)
+ $(hide) echo "dtbo_size=$(BOARD_DTBOIMG_PARTITION_SIZE)" >> $@
+ $(hide) echo "avb_dtbo_add_hash_footer_args=$(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)" >> $@
+ifdef BOARD_AVB_DTBO_KEY_PATH
+ $(hide) echo "avb_dtbo_key_path=$(BOARD_AVB_DTBO_KEY_PATH)" >> $@
+ $(hide) echo "avb_dtbo_algorithm=$(BOARD_AVB_DTBO_ALGORITHM)" >> $@
+ $(hide) echo "avb_dtbo_rollback_index_location=$(BOARD_AVB_DTBO_ROLLBACK_INDEX_LOCATION)" >> $@
+endif # BOARD_AVB_DTBO_KEY_PATH
+endif # BOARD_AVB_ENABLE
+endif # BOARD_PREBUILT_DTBOIMAGE
+ $(call dump-dynamic-partitions-info,$@)
+
+.PHONY: misc_info
+misc_info: $(INSTALLED_MISC_INFO_TARGET)
+
+droidcore: $(INSTALLED_MISC_INFO_TARGET)
+
+# -----------------------------------------------------------------
# A zip of the directories that map to the target filesystem.
# This zip can be used to create an OTA package or filesystem image
# as a post-build step.
@@ -3654,17 +3907,7 @@
$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_OTA_TOOLS := $(built_ota_tools)
-$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_API_VERSION := $(RECOVERY_API_VERSION)
-$(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_FSTAB_VERSION := $(RECOVERY_FSTAB_VERSION)
-
-ifeq ($(TARGET_RELEASETOOLS_EXTENSIONS),)
-# default to common dir for device vendor
-tool_extensions := $(TARGET_DEVICE_DIR)/../common
-else
-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)
@@ -3734,6 +3977,11 @@
$(BUILT_TARGET_FILES_PACKAGE): $(FULL_SYSTEMIMAGE_DEPS)
endif
+ifeq ($(BUILD_QEMU_IMAGES),true)
+MK_VBMETA_BOOT_KERNEL_CMDLINE_SH := device/generic/goldfish/tools/mk_vbmeta_boot_params.sh
+$(BUILT_TARGET_FILES_PACKAGE): $(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH)
+endif
+
# Depending on the various images guarantees that the underlying
# directories are up-to-date.
$(BUILT_TARGET_FILES_PACKAGE): \
@@ -3745,13 +3993,14 @@
$(INSTALLED_CACHEIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
$(INSTALLED_PRODUCTIMAGE_TARGET) \
- $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
+ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
$(INSTALLED_VBMETAIMAGE_TARGET) \
$(INSTALLED_ODMIMAGE_TARGET) \
$(INSTALLED_DTBOIMAGE_TARGET) \
$(INTERNAL_SYSTEMOTHERIMAGE_FILES) \
$(INSTALLED_ANDROID_INFO_TXT_TARGET) \
$(INSTALLED_KERNEL_TARGET) \
+ $(INSTALLED_DTBIMAGE_TARGET) \
$(INSTALLED_2NDBOOTLOADER_TARGET) \
$(BOARD_PREBUILT_DTBOIMAGE) \
$(BOARD_PREBUILT_RECOVERY_DTBOIMAGE) \
@@ -3759,17 +4008,17 @@
$(PRODUCT_SYSTEM_BASE_FS_PATH) \
$(PRODUCT_VENDOR_BASE_FS_PATH) \
$(PRODUCT_PRODUCT_BASE_FS_PATH) \
- $(PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
+ $(PRODUCT_SYSTEM_EXT_BASE_FS_PATH) \
$(PRODUCT_ODM_BASE_FS_PATH) \
$(LPMAKE) \
$(SELINUX_FC) \
+ $(INSTALLED_MISC_INFO_TARGET) \
$(APKCERTS_FILE) \
$(SOONG_APEX_KEYS_FILE) \
$(SOONG_ZIP) \
$(HOST_OUT_EXECUTABLES)/fs_config \
- $(HOST_OUT_EXECUTABLES)/imgdiff \
- $(HOST_OUT_EXECUTABLES)/bsdiff \
$(HOST_OUT_EXECUTABLES)/care_map_generator \
+ $(MAKE_RECOVERY_PATCH) \
$(BUILD_IMAGE_SRCS) \
$(BUILT_ASSEMBLED_FRAMEWORK_MANIFEST) \
$(BUILT_ASSEMBLED_VENDOR_MANIFEST) \
@@ -3779,7 +4028,7 @@
@echo "Package target files: $@"
$(call create-system-vendor-symlink)
$(call create-system-product-symlink)
- $(call create-system-product_services-symlink)
+ $(call create-system-system_ext-symlink)
$(call create-vendor-odm-symlink)
$(hide) rm -rf $@ $@.list $(zip_root)
$(hide) mkdir -p $(dir $@) $(zip_root)
@@ -3804,7 +4053,7 @@
ifdef BOARD_INCLUDE_RECOVERY_ACPIO
$(hide) cp $(BOARD_RECOVERY_ACPIO) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/recovery_acpio
endif
-ifdef BOARD_INCLUDE_DTB_IN_BOOTIMG
+ifdef INSTALLED_DTBIMAGE_TARGET
$(hide) cp $(INSTALLED_DTBIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/dtb
endif
ifdef INTERNAL_KERNEL_CMDLINE
@@ -3870,10 +4119,10 @@
$(hide) $(call package_files-copy-root, \
$(TARGET_OUT_PRODUCT),$(zip_root)/PRODUCT)
endif
-ifdef BUILDING_PRODUCT_SERVICES_IMAGE
- @# Contents of the product_services image
+ifdef BUILDING_SYSTEM_EXT_IMAGE
+ @# Contents of the system_ext image
$(hide) $(call package_files-copy-root, \
- $(TARGET_OUT_PRODUCT_SERVICES),$(zip_root)/PRODUCT_SERVICES)
+ $(TARGET_OUT_SYSTEM_EXT),$(zip_root)/SYSTEM_EXT)
endif
ifdef BUILDING_ODM_IMAGE
@# Contents of the odm image
@@ -3904,51 +4153,7 @@
endif
$(hide) echo "$(PRODUCT_OTA_PUBLIC_KEYS)" > $(zip_root)/META/otakeys.txt
$(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
- $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt
-endif
-ifdef BOARD_BOOTIMAGE_PARTITION_SIZE
- $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
-endif
-ifeq ($(INSTALLED_BOOTIMAGE_TARGET),)
- $(hide) echo "no_boot=true" >> $(zip_root)/META/misc_info.txt
-endif
-ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
- $(hide) echo "no_recovery=true" >> $(zip_root)/META/misc_info.txt
-endif
-ifdef BOARD_INCLUDE_RECOVERY_DTBO
- $(hide) echo "include_recovery_dtbo=true" >> $(zip_root)/META/misc_info.txt
-endif
-ifdef BOARD_INCLUDE_RECOVERY_ACPIO
- $(hide) echo "include_recovery_acpio=true" >> $(zip_root)/META/misc_info.txt
-endif
-ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE
- $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
-endif
-ifdef TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS
- @# TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS can be empty to indicate that nothing but defaults should be used.
- $(hide) echo "recovery_mount_options=$(TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
-else
- $(hide) echo "recovery_mount_options=$(DEFAULT_TARGET_RECOVERY_FSTYPE_MOUNT_OPTIONS)" >> $(zip_root)/META/misc_info.txt
-endif
- $(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
-endif
- $(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $(zip_root)/META/misc_info.txt
- $(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $(zip_root)/META/misc_info.txt
- $(hide) echo "multistage_support=1" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "blockimgdiff_versions=3,4" >> $(zip_root)/META/misc_info.txt
-ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
- $(hide) echo "build_generic_ota_package=true" >> $(zip_root)/META/misc_info.txt
-endif
-ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
- # OTA scripts are only interested in fingerprint related properties
- $(hide) echo "oem_fingerprint_properties=$(OEM_THUMBPRINT_PROPERTIES)" >> $(zip_root)/META/misc_info.txt
-endif
+ $(hide) cp $(INSTALLED_MISC_INFO_TARGET) $(zip_root)/META/misc_info.txt
ifneq ($(PRODUCT_SYSTEM_BASE_FS_PATH),)
$(hide) cp $(PRODUCT_SYSTEM_BASE_FS_PATH) \
$(zip_root)/META/$(notdir $(PRODUCT_SYSTEM_BASE_FS_PATH))
@@ -3961,66 +4166,18 @@
$(hide) cp $(PRODUCT_PRODUCT_BASE_FS_PATH) \
$(zip_root)/META/$(notdir $(PRODUCT_PRODUCT_BASE_FS_PATH))
endif
-ifneq ($(PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH),)
- $(hide) cp $(PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH) \
- $(zip_root)/META/$(notdir $(PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH))
+ifneq ($(PRODUCT_SYSTEM_EXT_BASE_FS_PATH),)
+ $(hide) cp $(PRODUCT_SYSTEM_EXT_BASE_FS_PATH) \
+ $(zip_root)/META/$(notdir $(PRODUCT_SYSTEM_EXT_BASE_FS_PATH))
endif
ifneq ($(PRODUCT_ODM_BASE_FS_PATH),)
$(hide) cp $(PRODUCT_ODM_BASE_FS_PATH) \
$(zip_root)/META/$(notdir $(PRODUCT_ODM_BASE_FS_PATH))
endif
-ifneq (,$(filter address, $(SANITIZE_TARGET)))
- # We need to create userdata.img with real data because the instrumented libraries are in userdata.img.
- $(hide) echo "userdata_img_with_data=true" >> $(zip_root)/META/misc_info.txt
-endif
-ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
- $(hide) echo "full_recovery_image=true" >> $(zip_root)/META/misc_info.txt
-endif
-ifeq ($(BOARD_AVB_ENABLE),true)
- $(hide) echo "avb_enable=true" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_vbmeta_key_path=$(BOARD_AVB_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_vbmeta_algorithm=$(BOARD_AVB_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_vbmeta_args=$(BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_boot_add_hash_footer_args=$(BOARD_AVB_BOOT_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
-ifdef BOARD_AVB_BOOT_KEY_PATH
- $(hide) echo "avb_boot_key_path=$(BOARD_AVB_BOOT_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_boot_algorithm=$(BOARD_AVB_BOOT_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_boot_rollback_index_location=$(BOARD_AVB_BOOT_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
-endif # BOARD_AVB_BOOT_KEY_PATH
- $(hide) echo "avb_recovery_add_hash_footer_args=$(BOARD_AVB_RECOVERY_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
-ifdef BOARD_AVB_RECOVERY_KEY_PATH
- $(hide) echo "avb_recovery_key_path=$(BOARD_AVB_RECOVERY_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_recovery_algorithm=$(BOARD_AVB_RECOVERY_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_recovery_rollback_index_location=$(BOARD_AVB_RECOVERY_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
-endif # BOARD_AVB_RECOVERY_KEY_PATH
-ifneq (,$(strip $(BOARD_AVB_VBMETA_SYSTEM)))
- $(hide) echo "avb_vbmeta_system=$(BOARD_AVB_VBMETA_SYSTEM)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_vbmeta_system_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_vbmeta_system_key_path=$(BOARD_AVB_VBMETA_SYSTEM_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_vbmeta_system_algorithm=$(BOARD_AVB_VBMETA_SYSTEM_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_vbmeta_system_rollback_index_location=$(BOARD_AVB_VBMETA_SYSTEM_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
-endif # BOARD_AVB_VBMETA_SYSTEM
-ifneq (,$(strip $(BOARD_AVB_VBMETA_VENDOR)))
- $(hide) echo "avb_vbmeta_vendor=$(BOARD_AVB_VBMETA_VENDOR)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_vbmeta_vendor_args=$(BOARD_AVB_MAKE_VBMETA_SYSTEM_IMAGE_ARGS)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_vbmeta_vendor_key_path=$(BOARD_AVB_VBMETA_VENDOR_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_vbmeta_vendor_algorithm=$(BOARD_AVB_VBMETA_VENDOR_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_vbmeta_vendor_rollback_index_location=$(BOARD_AVB_VBMETA_VENDOR_ROLLBACK_INDEX_LOCATION)" >> $(zip_root)/META/misc_info.txt
-endif # BOARD_AVB_VBMETA_VENDOR_KEY_PATH
-endif # BOARD_AVB_ENABLE
-ifdef BOARD_BPT_INPUT_FILES
- $(hide) echo "board_bpt_enable=true" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "board_bpt_make_table_args=$(BOARD_BPT_MAKE_TABLE_ARGS)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "board_bpt_input_files=$(BOARD_BPT_INPUT_FILES)" >> $(zip_root)/META/misc_info.txt
-endif
-ifdef BOARD_BPT_DISK_SIZE
- $(hide) echo "board_bpt_disk_size=$(BOARD_BPT_DISK_SIZE)" >> $(zip_root)/META/misc_info.txt
-endif
- $(call generate-userimage-prop-dictionary, $(zip_root)/META/misc_info.txt)
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
ifdef BUILDING_SYSTEM_IMAGE
- $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
- build/make/tools/releasetools/make_recovery_patch $(zip_root) $(zip_root)
+ $(hide) PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH MKBOOTIMG=$(MKBOOTIMG) \
+ $(MAKE_RECOVERY_PATCH) $(zip_root) $(zip_root)
endif # BUILDING_SYSTEM_IMAGE
endif
ifeq ($(AB_OTA_UPDATER),true)
@@ -4032,9 +4189,6 @@
$(hide) for conf in $(AB_OTA_POSTINSTALL_CONFIG); do \
echo "$${conf}" >> $(zip_root)/META/postinstall_config.txt; \
done
- @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds.
- $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "ab_update=true" >> $(zip_root)/META/misc_info.txt
ifdef OSRELEASED_DIRECTORY
$(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
@@ -4043,7 +4197,7 @@
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
+ $(hide) cp -R $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
endif
ifdef BOARD_PREBUILT_VENDORIMAGE
$(hide) mkdir -p $(zip_root)/IMAGES
@@ -4053,9 +4207,9 @@
$(hide) mkdir -p $(zip_root)/IMAGES
$(hide) cp $(INSTALLED_PRODUCTIMAGE_TARGET) $(zip_root)/IMAGES/
endif
-ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
+ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
$(hide) mkdir -p $(zip_root)/IMAGES
- $(hide) cp $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(zip_root)/IMAGES/
+ $(hide) cp $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) $(zip_root)/IMAGES/
endif
ifdef BOARD_PREBUILT_BOOTIMAGE
$(hide) mkdir -p $(zip_root)/IMAGES
@@ -4068,19 +4222,7 @@
ifdef BOARD_PREBUILT_DTBOIMAGE
$(hide) mkdir -p $(zip_root)/PREBUILT_IMAGES
$(hide) cp $(INSTALLED_DTBOIMAGE_TARGET) $(zip_root)/PREBUILT_IMAGES/
- $(hide) echo "has_dtbo=true" >> $(zip_root)/META/misc_info.txt
-ifeq ($(BOARD_AVB_ENABLE),true)
- $(hide) echo "dtbo_size=$(BOARD_DTBOIMG_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_dtbo_add_hash_footer_args=$(BOARD_AVB_DTBO_ADD_HASH_FOOTER_ARGS)" >> $(zip_root)/META/misc_info.txt
-ifdef BOARD_AVB_DTBO_KEY_PATH
- $(hide) echo "avb_dtbo_key_path=$(BOARD_AVB_DTBO_KEY_PATH)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_dtbo_algorithm=$(BOARD_AVB_DTBO_ALGORITHM)" >> $(zip_root)/META/misc_info.txt
- $(hide) echo "avb_dtbo_rollback_index_location=$(BOARD_AVB_DTBO_ROLLBACK_INDEX_LOCATION)" \
- >> $(zip_root)/META/misc_info.txt
-endif # BOARD_AVB_DTBO_KEY_PATH
-endif # BOARD_AVB_ENABLE
endif # BOARD_PREBUILT_DTBOIMAGE
- $(call dump-dynamic-partitions-info,$(zip_root)/META/misc_info.txt)
@# The radio images in BOARD_PACK_RADIOIMAGES will be additionally copied from RADIO/ into
@# IMAGES/, which then will be added into <product>-img.zip. Such images must be listed in
@# INSTALLED_RADIOIMAGE_TARGET.
@@ -4097,8 +4239,8 @@
ifdef BUILDING_PRODUCT_IMAGE
$(hide) $(call fs_config,$(zip_root)/PRODUCT,product/) > $(zip_root)/META/product_filesystem_config.txt
endif
-ifdef BUILDING_PRODUCT_SERVICES_IMAGE
- $(hide) $(call fs_config,$(zip_root)/PRODUCT_SERVICES,product_services/) > $(zip_root)/META/product_services_filesystem_config.txt
+ifdef BUILDING_SYSTEM_EXT_IMAGE
+ $(hide) $(call fs_config,$(zip_root)/SYSTEM_EXT,system_ext/) > $(zip_root)/META/system_ext_filesystem_config.txt
endif
ifdef BUILDING_ODM_IMAGE
$(hide) $(call fs_config,$(zip_root)/ODM,odm/) > $(zip_root)/META/odm_filesystem_config.txt
@@ -4142,8 +4284,13 @@
$(if $(_group_partition_list), \
echo "$(group)_partition_list=$(_group_partition_list)" >> $(zip_root)/META/dynamic_partitions_info.txt;))
endif # BOARD_SUPER_PARTITION_GROUPS
- $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
- build/make/tools/releasetools/add_img_to_target_files -a -v -p $(HOST_OUT) $(zip_root)
+ @# TODO(b/134525174): Remove `-r` after addressing the issue with recovery patch generation.
+ $(hide) PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH MKBOOTIMG=$(MKBOOTIMG) \
+ build/make/tools/releasetools/add_img_to_target_files -a -r -v -p $(HOST_OUT) $(zip_root)
+ifeq ($(BUILD_QEMU_IMAGES),true)
+ $(hide) AVBTOOL=$(AVBTOOL) $(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH) $(zip_root)/IMAGES/vbmeta.img \
+ $(zip_root)/IMAGES/system.img $(zip_root)/IMAGES/VerifiedBootParams.textproto
+endif
@# Zip everything up, preserving symlinks and placing META/ files first to
@# help early validation of the .zip file while uploading it.
$(hide) find $(zip_root)/META | sort >$@.list
@@ -4173,14 +4320,14 @@
# $(1): output file
# $(2): additional args
define build-ota-package-target
-PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \
- build/make/tools/releasetools/ota_from_target_files -v \
- --block \
- --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
- -p $(HOST_OUT) \
- $(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \
- $(2) \
- $(BUILT_TARGET_FILES_PACKAGE) $(1)
+PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
+ $(OTA_FROM_TARGET_FILES) \
+ --verbose \
+ --extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
+ --path $(HOST_OUT) \
+ $(if $(OEM_OTA_CONFIG), --oem_settings $(OEM_OTA_CONFIG)) \
+ $(2) \
+ $(BUILT_TARGET_FILES_PACKAGE) $(1)
endef
name := $(TARGET_PRODUCT)
@@ -4190,21 +4337,11 @@
name := $(name)-ota-$(FILE_NAME_TAG)
INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
-
INTERNAL_OTA_METADATA := $(PRODUCT_OUT)/ota_metadata
$(INTERNAL_OTA_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
-
-ifeq ($(AB_OTA_UPDATER),true)
-$(INTERNAL_OTA_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
-else
-$(INTERNAL_OTA_PACKAGE_TARGET): $(BROTLI)
-endif
-
$(INTERNAL_OTA_PACKAGE_TARGET): .KATI_IMPLICIT_OUTPUTS := $(INTERNAL_OTA_METADATA)
-
-$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
- build/make/tools/releasetools/ota_from_target_files
+$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTA_FROM_TARGET_FILES)
@echo "Package OTA: $@"
$(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --output_metadata_path $(INTERNAL_OTA_METADATA))
@@ -4219,17 +4356,10 @@
name := $(name)-ota-retrofit-$(FILE_NAME_TAG)
INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
-
$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
-
-ifeq ($(AB_OTA_UPDATER),true)
-$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BRILLO_UPDATE_PAYLOAD)
-else
-$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BROTLI)
-endif
-
-$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
- build/make/tools/releasetools/ota_from_target_files
+$(INTERNAL_OTA_RETROFIT_DYNAMIC_PARTITIONS_PACKAGE_TARGET): \
+ $(BUILT_TARGET_FILES_PACKAGE) \
+ $(OTA_FROM_TARGET_FILES)
@echo "Package OTA (retrofit dynamic partitions): $@"
$(call build-ota-package-target,$@,-k $(KEY_CERT_PAIR) --retrofit_dynamic_partitions)
@@ -4252,7 +4382,7 @@
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
$(INSTALLED_PRODUCTIMAGE_TARGET) \
- $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)
+ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET)
endif
$(APPCOMPAT_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,appcompat)/filelist
$(APPCOMPAT_ZIP): $(SOONG_ZIP)
@@ -4281,7 +4411,7 @@
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
$(INSTALLED_PRODUCTIMAGE_TARGET) \
- $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
+ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
$(INSTALLED_ODMIMAGE_TARGET) \
$(updater_dep)
endif
@@ -4295,11 +4425,10 @@
# -----------------------------------------------------------------
# A zip of the coverage directory.
#
-name := $(TARGET_PRODUCT)
+name := gcov-report-files-all
ifeq ($(TARGET_BUILD_TYPE),debug)
name := $(name)_debug
endif
-name := $(name)-coverage-$(FILE_NAME_TAG)
COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip
ifndef TARGET_BUILD_APPS
$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE_TARGET) \
@@ -4308,7 +4437,7 @@
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
$(INSTALLED_PRODUCTIMAGE_TARGET) \
- $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) \
+ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) \
$(INSTALLED_ODMIMAGE_TARGET)
endif
$(COVERAGE_ZIP): PRIVATE_LIST_FILE := $(call intermediates-dir-for,PACKAGING,coverage)/filelist
@@ -4385,6 +4514,19 @@
endif # TARGET_BUILD_APPS
+
+ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
+
+# Dump variables used by build_super_image.py (for building super.img and super_empty.img).
+# $(1): output file
+define dump-super-image-info
+ $(call dump-dynamic-partitions-info,$(1))
+ $(if $(filter true,$(AB_OTA_UPDATER)), \
+ echo "ab_update=true" >> $(1))
+endef
+
+endif # PRODUCT_USE_DYNAMIC_PARTITIONS
+
# -----------------------------------------------------------------
# super partition image (dist)
@@ -4393,17 +4535,11 @@
# BOARD_SUPER_PARTITION_SIZE must be defined to build super image.
ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
-# Dump variables used by build_super_image.py.
-define dump-super-image-info
- $(call dump-dynamic-partitions-info,$(1))
- $(if $(filter true,$(AB_OTA_UPDATER)), \
- echo "ab_update=true" >> $(1))
-endef
-
ifneq (true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS))
# For real devices and for dist builds, build super image from target files to an intermediate directory.
INTERNAL_SUPERIMAGE_DIST_TARGET := $(call intermediates-dir-for,PACKAGING,super.img)/super.img
+INTERNAL_SUPERIMAGE_MISC_INFO := $(call intermediates-dir-for,PACKAGING,superimage_debug)/misc_info.txt
$(INTERNAL_SUPERIMAGE_DIST_TARGET): extracted_input_target_files := $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE))
$(INTERNAL_SUPERIMAGE_DIST_TARGET): $(LPMAKE) $(BUILT_TARGET_FILES_PACKAGE) $(BUILD_SUPER_IMAGE)
$(call pretty,"Target super fs image from target files: $@")
@@ -4455,7 +4591,7 @@
$(INSTALLED_SUPERIMAGE_TARGET): $(INSTALLED_SUPERIMAGE_DEPENDENCIES)
$(call pretty,"Target super fs image for debug: $@")
$(call build-superimage-target,$(INSTALLED_SUPERIMAGE_TARGET),\
- $(call intermediates-dir-for,PACKAGING,superimage_debug)/misc_info.txt)
+ $(INTERNAL_SUPERIMAGE_MISC_INFO))
droidcore: $(INSTALLED_SUPERIMAGE_TARGET)
@@ -4479,7 +4615,7 @@
# -----------------------------------------------------------------
# super empty image
-ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
+ifeq (true,$(PRODUCT_USE_DYNAMIC_PARTITIONS))
ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
INSTALLED_SUPERIMAGE_EMPTY_TARGET := $(PRODUCT_OUT)/super_empty.img
@@ -4495,7 +4631,7 @@
$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_EMPTY_TARGET))
endif # BOARD_SUPER_PARTITION_SIZE != ""
-endif # PRODUCT_BUILD_SUPER_PARTITION == "true"
+endif # PRODUCT_USE_DYNAMIC_PARTITIONS == "true"
# -----------------------------------------------------------------
@@ -4528,17 +4664,22 @@
$(if $(filter true,$(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS)), \
$(foreach device,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
OTA/super_$(device).img:super_$(device).img)) \
+ IMAGES/VerifiedBootParams.textproto:VerifiedBootParams.textproto \
OTA/android-info.txt:android-info.txt "IMAGES/*.img:."
+ $(if $(INTERNAL_SUPERIMAGE_MISC_INFO), zip -q -j -u $@ $(INTERNAL_SUPERIMAGE_MISC_INFO))
$(if $(INTERNAL_SUPERIMAGE_DIST_TARGET), zip -q -j -u $@ $(INTERNAL_SUPERIMAGE_DIST_TARGET))
else
-$(INTERNAL_UPDATE_PACKAGE_TARGET):
+$(INTERNAL_UPDATE_PACKAGE_TARGET): $(INSTALLED_MISC_INFO_TARGET)
@echo "Package: $@"
$(hide) $(ZIP2ZIP) -i $(BUILT_TARGET_FILES_PACKAGE) -o $@ \
+ IMAGES/VerifiedBootParams.textproto:VerifiedBootParams.textproto \
OTA/android-info.txt:android-info.txt "IMAGES/*.img:."
+ $(if $(INSTALLED_MISC_INFO_TARGET), zip -q -j -u $@ $(INSTALLED_MISC_INFO_TARGET))
endif # BOARD_SUPER_IMAGE_IN_UPDATE_PACKAGE
.PHONY: updatepackage
updatepackage: $(INTERNAL_UPDATE_PACKAGE_TARGET)
+$(call dist-for-goals,updatepackage,$(INTERNAL_UPDATE_PACKAGE_TARGET))
# -----------------------------------------------------------------
@@ -4548,7 +4689,7 @@
ifeq ($(BUILD_QEMU_IMAGES),true)
MK_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_qemu_image.sh
-MK_COMBINE_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_combined_img.py
+MK_COMBINE_QEMU_IMAGE := $(HOST_OUT_EXECUTABLES)/mk_combined_img
SGDISK_HOST := $(HOST_OUT_EXECUTABLES)/sgdisk
ifdef INSTALLED_SYSTEMIMAGE_TARGET
@@ -4557,11 +4698,11 @@
$(INSTALLED_SYSTEM_QEMU_CONFIG): $(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_VBMETAIMAGE_TARGET)
@echo "$(PRODUCT_OUT)/vbmeta.img vbmeta 1" > $@
@echo "$(INSTALLED_SUPERIMAGE_TARGET) super 2" >> $@
-$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_VBMETAIMAGE_TARGET) $(MK_COMBINE_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG) \
+$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_VBMETAIMAGE_TARGET) $(MK_COMBINE_QEMU_IMAGE) $(SGDISK_HOST) $(SIMG2IMG) \
$(INSTALLED_SUPERIMAGE_TARGET) $(INSTALLED_SYSTEM_QEMU_CONFIG)
@echo Create system-qemu.img now
(export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); \
- $(MK_COMBINE_QEMU_IMAGE_SH) -i $(INSTALLED_SYSTEM_QEMU_CONFIG) -o $@)
+ $(MK_COMBINE_QEMU_IMAGE) -i $(INSTALLED_SYSTEM_QEMU_CONFIG) -o $@)
systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE)
droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE)
@@ -4584,14 +4725,14 @@
productimage: $(INSTALLED_QEMU_PRODUCTIMAGE)
droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE)
endif
-ifdef INSTALLED_PRODUCT_SERVICESIMAGE_TARGET
-INSTALLED_QEMU_PRODUCT_SERVICESIMAGE := $(PRODUCT_OUT)/product_services-qemu.img
-$(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE): $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
- @echo Create product_services-qemu.img
- (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET))
+ifdef INSTALLED_SYSTEM_EXTIMAGE_TARGET
+INSTALLED_QEMU_SYSTEM_EXTIMAGE := $(PRODUCT_OUT)/system_ext-qemu.img
+$(INSTALLED_QEMU_SYSTEM_EXTIMAGE): $(INSTALLED_SYSTEM_EXTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
+ @echo Create system_ext-qemu.img
+ (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) $(INSTALLED_SYSTEM_EXTIMAGE_TARGET))
-productservicesimage: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
-droidcore: $(INSTALLED_QEMU_PRODUCT_SERVICESIMAGE)
+systemextimage: $(INSTALLED_QEMU_SYSTEM_EXTIMAGE)
+droidcore: $(INSTALLED_QEMU_SYSTEM_EXTIMAGE)
endif
ifdef INSTALLED_ODMIMAGE_TARGET
INSTALLED_QEMU_ODMIMAGE := $(PRODUCT_OUT)/odm-qemu.img
@@ -4604,7 +4745,6 @@
endif
QEMU_VERIFIED_BOOT_PARAMS := $(PRODUCT_OUT)/VerifiedBootParams.textproto
-MK_VBMETA_BOOT_KERNEL_CMDLINE_SH := device/generic/goldfish/tools/mk_vbmeta_boot_params.sh
$(QEMU_VERIFIED_BOOT_PARAMS): $(INSTALLED_VBMETAIMAGE_TARGET) $(INSTALLED_SYSTEMIMAGE_TARGET) \
$(MK_VBMETA_BOOT_KERNEL_CMDLINE_SH) $(AVBTOOL)
@echo Creating $@
diff --git a/core/aapt2.mk b/core/aapt2.mk
index fbbf3dd..7b17df4 100644
--- a/core/aapt2.mk
+++ b/core/aapt2.mk
@@ -61,8 +61,8 @@
# Always set --pseudo-localize, it will be stripped out later for release
# builds that don't want it.
-$(my_res_resources_flat) $(my_overlay_resources_flat) $(my_resources_flata): \
- PRIVATE_AAPT2_CFLAGS := --pseudo-localize
+$(my_res_resources_flat) $(my_overlay_resources_flat) $(my_resources_flata) $(my_generated_resources_flata) $(my_zippped_resources_flata): \
+ PRIVATE_AAPT2_CFLAGS := --pseudo-localize $(filter --legacy,$(LOCAL_AAPT_FLAGS))
# TODO(b/78447299): Forbid LOCAL_STATIC_JAVA_AAR_LIBRARIES in aapt2 and remove
# support for it.
diff --git a/core/app_prebuilt_internal.mk b/core/app_prebuilt_internal.mk
index dd263dd..399d173 100644
--- a/core/app_prebuilt_internal.mk
+++ b/core/app_prebuilt_internal.mk
@@ -41,7 +41,7 @@
include $(BUILD_SYSTEM)/base_rules.mk
built_module := $(LOCAL_BUILT_MODULE)
-# Run veridex on product, product_services and vendor modules.
+# Run veridex on product, system_ext and vendor modules.
# We skip it for unbundled app builds where we cannot build veridex.
module_run_appcompat :=
ifeq (true,$(non_system_module))
@@ -92,6 +92,32 @@
endif
endif
+# Verify LOCAL_USES_LIBRARIES/LOCAL_OPTIONAL_USES_LIBRARIES
+# If LOCAL_ENFORCE_USES_LIBRARIES is not set, default to true if either of LOCAL_USES_LIBRARIES or
+# LOCAL_OPTIONAL_USES_LIBRARIES are specified.
+# Will change the default to true unconditionally in the future.
+ifndef LOCAL_ENFORCE_USES_LIBRARIES
+ ifneq (,$(strip $(LOCAL_USES_LIBRARIES)$(LOCAL_OPTIONAL_USES_LIBRARIES)))
+ LOCAL_ENFORCE_USES_LIBRARIES := true
+ endif
+endif
+
+my_enforced_uses_libraries :=
+ifdef LOCAL_ENFORCE_USES_LIBRARIES
+ my_enforced_uses_libraries := $(intermediates.COMMON)/enforce_uses_libraries.timestamp
+ $(my_enforced_uses_libraries): PRIVATE_USES_LIBRARIES := $(LOCAL_USES_LIBRARIES)
+ $(my_enforced_uses_libraries): PRIVATE_OPTIONAL_USES_LIBRARIES := $(LOCAL_OPTIONAL_USES_LIBRARIES)
+ $(my_enforced_uses_libraries): $(BUILD_SYSTEM)/verify_uses_libraries.sh $(AAPT)
+ $(my_enforced_uses_libraries): $(my_prebuilt_src_file)
+ @echo Verifying uses-libraries: $<
+ aapt_binary=$(AAPT) \
+ uses_library_names="$(strip $(PRIVATE_USES_LIBRARIES))" \
+ optional_uses_library_names="$(strip $(PRIVATE_OPTIONAL_USES_LIBRARIES))" \
+ $(BUILD_SYSTEM)/verify_uses_libraries.sh $<
+ touch $@
+ $(built_module) : $(my_enforced_uses_libraries)
+endif
+
dex_preopt_profile_src_file := $(my_prebuilt_src_file)
rs_compatibility_jni_libs :=
diff --git a/core/autogen_test_config.mk b/core/autogen_test_config.mk
index 6d75132..d4ca56f 100644
--- a/core/autogen_test_config.mk
+++ b/core/autogen_test_config.mk
@@ -36,7 +36,7 @@
$(autogen_test_config_file): PRIVATE_MODULE_NAME := $(LOCAL_MODULE)
$(autogen_test_config_file) : $(autogen_test_config_template)
@echo "Auto generating test config $(notdir $@)"
- $(hide) sed 's&{MODULE}&$(PRIVATE_MODULE_NAME)&g;s&{EXTRA_OPTIONS}&&g' $< > $@
+ $(hide) sed 's&{MODULE}&$(PRIVATE_MODULE_NAME)&g;s&{EXTRA_CONFIGS}&&g' $< > $@
my_auto_generate_config := true
else
# Auto generating test config file for instrumentation test
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 94aa1e4..4a0c15b 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -81,11 +81,17 @@
LOCAL_ODM_MODULE := true
else ifneq ($(filter $(TARGET_OUT_PRODUCT)/%,$(_path)),)
LOCAL_PRODUCT_MODULE := true
-else ifneq ($(filter $(TARGET_OUT_PRODUCT_SERVICES)/%,$(_path)),)
-LOCAL_PRODUCT_SERVICES_MODULE := true
+else ifneq ($(filter $(TARGET_OUT_SYSTEM_EXT)/%,$(_path)),)
+LOCAL_SYSTEM_EXT_MODULE := true
endif
_path :=
+# TODO(b/135957588) Remove following workaround
+# LOCAL_PRODUCT_SERVICES_MODULE to LOCAL_PRODUCT_MODULE for all Android.mk
+ifndef LOCAL_PRODUCT_MODULE
+LOCAL_PRODUCT_MODULE := $(LOCAL_PRODUCT_SERVICES_MODULE)
+endif
+
ifndef LOCAL_PROPRIETARY_MODULE
LOCAL_PROPRIETARY_MODULE := $(LOCAL_VENDOR_MODULE)
endif
@@ -98,7 +104,7 @@
non_system_module := $(filter true, \
$(LOCAL_PRODUCT_MODULE) \
- $(LOCAL_PRODUCT_SERVICES_MODULE) \
+ $(LOCAL_SYSTEM_EXT_MODULE) \
$(LOCAL_VENDOR_MODULE) \
$(LOCAL_PROPRIETARY_MODULE))
@@ -167,19 +173,14 @@
ifeq (true,$(LOCAL_UNINSTALLABLE_MODULE))
$(call pretty-warning,LOCAL_MODULE_TAGS := $(my_bad_module_tags) does not do anything for uninstallable modules)
endif
- ifneq ($(BUILD_BROKEN_ENG_DEBUG_TAGS),true)
- $(call pretty-error,LOCAL_MODULE_TAGS := $(my_bad_module_tags) is obsolete. See $(CHANGES_URL)#LOCAL_MODULE_TAGS)
- else
- $(call pretty-warning,LOCAL_MODULE_TAGS := $(my_bad_module_tags) is deprecated. See $(CHANGES_URL)#LOCAL_MODULE_TAGS)
- endif
- my_bad_module_tags :=
+ $(call pretty-error,LOCAL_MODULE_TAGS := $(my_bad_module_tags) is obsolete. See $(CHANGES_URL)#LOCAL_MODULE_TAGS)
endif
# Only the tags mentioned in this test are expected to be set by module
# makefiles. Anything else is either a typo or a source of unexpected
# behaviors.
-ifneq ($(filter-out debug eng tests optional samples,$(my_module_tags)),)
-$(call pretty-error,unusual tags: $(filter-out debug eng tests optional samples,$(my_module_tags)))
+ifneq ($(filter-out tests optional samples,$(my_module_tags)),)
+$(call pretty-error,unusual tags: $(filter-out tests optional samples,$(my_module_tags)))
endif
# Add implicit tags.
@@ -232,8 +233,8 @@
partition_tag := _ODM
else ifeq (true,$(strip $(LOCAL_PRODUCT_MODULE)))
partition_tag := _PRODUCT
-else ifeq (true,$(strip $(LOCAL_PRODUCT_SERVICES_MODULE)))
- partition_tag := _PRODUCT_SERVICES
+else ifeq (true,$(strip $(LOCAL_SYSTEM_EXT_MODULE)))
+ partition_tag := _SYSTEM_EXT
else ifeq (NATIVE_TESTS,$(LOCAL_MODULE_CLASS))
partition_tag := _DATA
else
@@ -401,7 +402,7 @@
logtags_sources := $(filter %.logtags,$(LOCAL_SRC_FILES)) $(LOCAL_LOGTAGS_FILES)
ifneq ($(strip $(logtags_sources)),)
-event_log_tags := $(addprefix $(LOCAL_PATH)/,$(logtags_sources))
+event_log_tags := $(foreach f,$(addprefix $(LOCAL_PATH)/,$(logtags_sources)),$(call clean-path,$(f)))
else
event_log_tags :=
endif
@@ -715,18 +716,6 @@
endif
endif
-
-ifeq ($(use_testcase_folder),true)
-ifneq ($(my_test_data_file_pairs),)
-$(foreach pair, $(my_test_data_file_pairs), \
- $(eval parts := $(subst :,$(space),$(pair))) \
- $(eval src_path := $(word 1,$(parts))) \
- $(eval file := $(word 2,$(parts))) \
- $(foreach suite, $(LOCAL_COMPATIBILITY_SUITE), \
- $(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite),$(arch_dir)), \
- $(call filter-copy-pair,$(src_path),$(call append-path,$(dir),$(file)),$(my_installed_test_data))))))
-endif
-else
ifneq ($(my_test_data_file_pairs),)
$(foreach pair, $(my_test_data_file_pairs), \
$(eval parts := $(subst :,$(space),$(pair))) \
@@ -736,7 +725,6 @@
$(eval my_compat_dist_$(suite) += $(foreach dir, $(call compatibility_suite_dirs,$(suite),$(arch_dir)), \
$(src_path):$(call append-path,$(dir),$(file))))))
endif
-endif
@@ -892,13 +880,13 @@
# Use $(LOCAL_MODULE) instead of $(my_register_name) to ignore module's bitness.
ALL_DEPS.MODULES := $(ALL_DEPS.MODULES) $(LOCAL_MODULE)
ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS := $(sort \
- $(ALL_MODULES.$(LOCAL_MODULE).ALL_DEPS) \
+ $(ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS) \
$(LOCAL_STATIC_LIBRARIES) \
$(LOCAL_WHOLE_STATIC_LIBRARIES) \
$(LOCAL_SHARED_LIBRARIES) \
$(LOCAL_HEADER_LIBRARIES) \
$(LOCAL_STATIC_JAVA_LIBRARIES) \
- $(LOCAL_JAVA_LIBRARIES)\
+ $(LOCAL_JAVA_LIBRARIES) \
$(LOCAL_JNI_SHARED_LIBRARIES))
ALL_DEPS.$(LOCAL_MODULE).LICENSE := $(sort $(ALL_DEPS.$(LOCAL_MODULE).LICENSE) $(license_files))
diff --git a/core/binary.mk b/core/binary.mk
index a420c02..4709e8e 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -112,6 +112,8 @@
my_ndk_sysroot :=
my_ndk_sysroot_include :=
my_ndk_sysroot_lib :=
+my_api_level := 10000
+
ifneq ($(LOCAL_SDK_VERSION),)
ifdef LOCAL_IS_HOST_MODULE
$(error $(LOCAL_PATH): LOCAL_SDK_VERSION cannot be used in host module)
@@ -147,20 +149,14 @@
my_ndk_api := $(call math_max,$(my_ndk_api),$(my_min_sdk_version))
endif
- my_ndk_api_def := $(my_ndk_api)
my_ndk_hist_api := $(my_ndk_api)
ifeq ($(my_ndk_api),current)
- my_ndk_api_def := __ANDROID_API_FUTURE__
# The last API level supported by the old prebuilt NDKs.
my_ndk_hist_api := 24
+ else
+ my_api_level := $(my_ndk_api)
endif
-
- # Traditionally this has come from android/api-level.h, but with the libc
- # headers unified it must be set by the build system since we don't have
- # per-API level copies of that header now.
- my_cflags += -D__ANDROID_API__=$(my_ndk_api_def)
-
my_ndk_source_root := \
$(HISTORICAL_NDK_VERSIONS_ROOT)/$(LOCAL_NDK_VERSION)/sources
my_ndk_sysroot := \
@@ -267,16 +263,30 @@
endif
endif
+ifeq ($(NATIVE_COVERAGE),true)
+ ifndef LOCAL_IS_HOST_MODULE
+ my_ldflags += -Wl,--wrap,getenv
+
+ ifneq ($(LOCAL_MODULE_CLASS),STATIC_LIBRARIES)
+ ifeq ($(LOCAL_SDK_VERSION),)
+ my_whole_static_libraries += libprofile-extras
+ else
+ my_whole_static_libraries += libprofile-extras_ndk
+ endif
+ endif
+ endif
+endif
+
ifneq ($(LOCAL_USE_VNDK),)
# Required VNDK version for vendor modules is BOARD_VNDK_VERSION.
- my_vndk_version := $(BOARD_VNDK_VERSION)
- ifeq ($(my_vndk_version),current)
+ my_api_level := $(BOARD_VNDK_VERSION)
+ ifeq ($(my_api_level),current)
# Build with current PLATFORM_VNDK_VERSION.
# If PLATFORM_VNDK_VERSION has a CODENAME, it will return
# __ANDROID_API_FUTURE__.
- my_vndk_version := $(call codename-or-sdk-to-sdk,$(PLATFORM_VNDK_VERSION))
+ my_api_level := $(call codename-or-sdk-to-sdk,$(PLATFORM_VNDK_VERSION))
endif
- my_cflags += -D__ANDROID_API__=$(my_vndk_version) -D__ANDROID_VNDK__
+ my_cflags += -D__ANDROID_VNDK__
endif
ifndef LOCAL_IS_HOST_MODULE
@@ -560,7 +570,7 @@
## Compile RenderScript with reflected C++
####################################################
-renderscript_sources := $(filter %.rs %.fs,$(my_src_files))
+renderscript_sources := $(filter %.rscript %.fs,$(my_src_files))
ifneq (,$(renderscript_sources))
my_soong_problems += rs
@@ -604,7 +614,7 @@
endif
bc_dep_files := $(addprefix $(renderscript_intermediate)/, \
- $(patsubst %.fs,%.d, $(patsubst %.rs,%.d, $(notdir $(renderscript_sources)))))
+ $(patsubst %.fs,%.d, $(patsubst %.rscript,%.d, $(notdir $(renderscript_sources)))))
$(RenderScript_file_stamp): PRIVATE_RS_INCLUDES := $(renderscript_includes)
$(RenderScript_file_stamp): PRIVATE_RS_CC := $(LOCAL_RENDERSCRIPT_CC)
@@ -622,7 +632,7 @@
LOCAL_INTERMEDIATE_TARGETS += $(RenderScript_file_stamp)
rs_generated_cpps := $(addprefix \
- $(renderscript_intermediate)/ScriptC_,$(patsubst %.fs,%.cpp, $(patsubst %.rs,%.cpp, \
+ $(renderscript_intermediate)/ScriptC_,$(patsubst %.fs,%.cpp, $(patsubst %.rscript,%.cpp, \
$(notdir $(renderscript_sources)))))
$(call track-src-file-gen,$(renderscript_sources),$(rs_generated_cpps))
@@ -876,7 +886,7 @@
ifneq ($(strip $(cpp_objects)),)
$(cpp_objects): $(intermediates)/%.o: \
$(TOPDIR)$(LOCAL_PATH)/%$(LOCAL_CPP_EXTENSION) \
- $(my_additional_dependencies)
+ $(my_additional_dependencies) $(CLANG_CXX)
$(transform-$(PRIVATE_HOST)cpp-to-o)
$(call include-depfiles-for-objs, $(cpp_objects))
endif
@@ -897,7 +907,7 @@
$(gen_cpp_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
$(gen_cpp_objects): $(intermediates)/%.o: \
$(intermediates)/%$(LOCAL_CPP_EXTENSION) \
- $(my_additional_dependencies)
+ $(my_additional_dependencies) $(CLANG_CXX)
$(transform-$(PRIVATE_HOST)cpp-to-o)
$(call include-depfiles-for-objs, $(gen_cpp_objects))
endif
@@ -912,7 +922,7 @@
ifneq ($(strip $(gen_S_sources)),)
$(gen_S_objects): $(intermediates)/%.o: $(intermediates)/%.S \
- $(my_additional_dependencies)
+ $(my_additional_dependencies) $(CLANG)
$(transform-$(PRIVATE_HOST)s-to-o)
$(call include-depfiles-for-objs, $(gen_S_objects))
endif
@@ -923,7 +933,7 @@
ifneq ($(strip $(gen_s_objects)),)
$(gen_s_objects): $(intermediates)/%.o: $(intermediates)/%.s \
- $(my_additional_dependencies)
+ $(my_additional_dependencies) $(CLANG)
$(transform-$(PRIVATE_HOST)s-to-o)
endif
@@ -961,7 +971,7 @@
ifneq ($(strip $(c_objects)),)
$(c_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.c \
- $(my_additional_dependencies)
+ $(my_additional_dependencies) $(CLANG)
$(transform-$(PRIVATE_HOST)c-to-o)
$(call include-depfiles-for-objs, $(c_objects))
endif
@@ -981,7 +991,7 @@
$(gen_c_objects): PRIVATE_ARM_MODE := $(normal_objects_mode)
$(gen_c_objects): PRIVATE_ARM_CFLAGS := $(normal_objects_cflags)
$(gen_c_objects): $(intermediates)/%.o: $(intermediates)/%.c \
- $(my_additional_dependencies)
+ $(my_additional_dependencies) $(CLANG)
$(transform-$(PRIVATE_HOST)c-to-o)
$(call include-depfiles-for-objs, $(gen_c_objects))
endif
@@ -997,7 +1007,7 @@
ifneq ($(strip $(objc_objects)),)
my_soong_problems += objc
$(objc_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.m \
- $(my_additional_dependencies)
+ $(my_additional_dependencies) $(CLANG)
$(transform-$(PRIVATE_HOST)m-to-o)
$(call include-depfiles-for-objs, $(objc_objects))
endif
@@ -1012,7 +1022,7 @@
ifneq ($(strip $(objcpp_objects)),)
$(objcpp_objects): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.mm \
- $(my_additional_dependencies)
+ $(my_additional_dependencies) $(CLANG_CXX)
$(transform-$(PRIVATE_HOST)mm-to-o)
$(call include-depfiles-for-objs, $(objcpp_objects))
endif
@@ -1036,7 +1046,7 @@
ifneq ($(strip $(asm_objects_S)),)
$(asm_objects_S): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.S \
- $(my_additional_dependencies)
+ $(my_additional_dependencies) $(CLANG)
$(transform-$(PRIVATE_HOST)s-to-o)
$(call include-depfiles-for-objs, $(asm_objects_S))
endif
@@ -1056,7 +1066,7 @@
ifneq ($(strip $(asm_objects_s)),)
$(asm_objects_s): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.s \
- $(my_additional_dependencies)
+ $(my_additional_dependencies) $(CLANG)
$(transform-$(PRIVATE_HOST)s-to-o)
endif
@@ -1069,7 +1079,7 @@
ifneq ($(strip $(asm_sources_asm)),)
asm_objects_asm := $(addprefix $(intermediates)/,$(asm_sources_asm:.asm=.o))
$(asm_objects_asm): $(intermediates)/%.o: $(TOPDIR)$(LOCAL_PATH)/%.asm \
- $(my_additional_dependencies)
+ $(my_additional_dependencies) $(YASM)
$(transform-asm-to-o)
$(call track-src-file-obj,$(asm_sources_asm),$(asm_objects_asm))
@@ -1164,31 +1174,6 @@
####################################################
-## Import includes
-####################################################
-import_includes := $(intermediates)/import_includes
-import_includes_deps := $(strip \
- $(if $(LOCAL_USE_VNDK),\
- $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \
- $(foreach l, $(installed_shared_library_module_names), \
- $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \
- $(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \
- $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes) \
- $(foreach l, $(my_header_libraries), \
- $(call intermediates-dir-for,HEADER_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
-$(import_includes): PRIVATE_IMPORT_EXPORT_INCLUDES := $(import_includes_deps)
-$(import_includes) : $(import_includes_deps)
- @echo Import includes file: $@
- $(hide) mkdir -p $(dir $@) && rm -f $@
-ifdef import_includes_deps
- $(hide) for f in $(PRIVATE_IMPORT_EXPORT_INCLUDES); do \
- cat $$f >> $@; \
- done
-else
- $(hide) touch $@
-endif
-
-####################################################
## Verify that NDK-built libraries only link against
## other NDK-built libraries
####################################################
@@ -1299,7 +1284,6 @@
# that custom build rules which generate .o files don't consume other generated
# sources as input (or if they do they take care of that dependency themselves).
$(normal_objects) : | $(my_generated_sources)
-$(all_objects) : $(import_includes)
ALL_C_CPP_ETC_OBJECTS += $(all_objects)
@@ -1362,6 +1346,10 @@
$(my_ndk_shared_libraries_fullpath) \
$(my_system_shared_libraries_fullpath) \
+built_shared_library_deps += \
+ $(my_ndk_shared_libraries_fullpath) \
+ $(my_system_shared_libraries_fullpath) \
+
else
built_shared_libraries := \
$(foreach lib,$(installed_shared_library_module_names), \
@@ -1389,15 +1377,9 @@
# libraries have already been linked into the module at that point.
# We do, however, care about the NOTICE files for any static
# libraries that we use. (see notice_files.mk)
-#
-# Don't do this in mm, since many of the targets won't exist.
-ifeq ($(ONE_SHOT_MAKEFILE),)
installed_static_library_notice_file_targets := \
$(foreach lib,$(my_static_libraries) $(my_whole_static_libraries), \
NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST$(if $(my_host_cross),_CROSS,),TARGET)-STATIC_LIBRARIES-$(lib))
-else
-installed_static_library_notice_file_targets :=
-endif
$(notice_target): | $(installed_static_library_notice_file_targets)
$(LOCAL_INSTALLED_MODULE): | $(notice_target)
@@ -1600,13 +1582,25 @@
ifeq ($(my_use_clang_lld),true)
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LLDFLAGS)
include $(BUILD_SYSTEM)/pack_dyn_relocs_setup.mk
- ifeq ($(my_pack_module_relocations),false)
+ ifeq ($(my_pack_module_relocations),true)
+ my_target_global_ldflags += -Wl,--pack-dyn-relocs=android+relr -Wl,--use-android-relr-tags
+ else
my_target_global_ldflags += -Wl,--pack-dyn-relocs=none
endif
else
my_target_global_ldflags := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)GLOBAL_LDFLAGS)
endif # my_use_clang_lld
+my_target_triple := $($(LOCAL_2ND_ARCH_VAR_PREFIX)CLANG_$(my_prefix)TRIPLE)
+ifndef LOCAL_IS_HOST_MODULE
+ my_target_triple_flag := -target $(my_target_triple)$(my_api_level)
+else
+ my_target_triple_flag := -target $(my_target_triple)
+endif
+my_asflags += $(my_target_triple_flag)
+my_cflags += $(my_target_triple_flag)
+my_ldflags += $(my_target_triple_flag)
+
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_INCLUDES := $(my_target_global_c_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_GLOBAL_C_SYSTEM_INCLUDES := $(my_target_global_c_system_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TARGET_GLOBAL_CFLAGS := $(my_target_global_cflags)
@@ -1658,6 +1652,22 @@
$(LOCAL_INTERMEDIATE_TARGETS): $(my_coverage_lib)
endif
+####################################################
+## Import includes
+####################################################
+imported_includes := $(strip \
+ $(if $(LOCAL_USE_VNDK),\
+ $(call intermediates-dir-for,HEADER_LIBRARIES,device_kernel_headers,$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))) \
+ $(foreach l, $(installed_shared_library_module_names), \
+ $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))) \
+ $(foreach l, $(my_static_libraries) $(my_whole_static_libraries), \
+ $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))) \
+ $(foreach l, $(my_header_libraries), \
+ $(call intermediates-dir-for,HEADER_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))))
+
+$(foreach dep,$(imported_includes),\
+ $(eval EXPORTS.$$(dep).USERS := $$(EXPORTS.$$(dep).USERS) $$(all_objects)))
+
###########################################################
## Define PRIVATE_ variables used by multiple module types
###########################################################
@@ -1710,7 +1720,7 @@
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_RTTI_FLAG := $(LOCAL_RTTI_FLAG)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_DEBUG_CFLAGS := $(debug_cflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_C_INCLUDES := $(my_c_includes)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORT_INCLUDES := $(import_includes)
+$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_IMPORTED_INCLUDES := $(imported_includes)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDFLAGS := $(my_ldflags)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_LDLIBS := $(my_ldlibs)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_TIDY_CHECKS := $(my_tidy_checks)
@@ -1737,51 +1747,30 @@
###########################################################
# Export includes
###########################################################
-export_includes := $(intermediates)/export_includes
-export_cflags := $(foreach d,$(my_export_c_include_dirs),-I $(d))
-$(export_includes): PRIVATE_EXPORT_CFLAGS := $(export_cflags)
+
# Headers exported by whole static libraries are also exported by this library.
export_include_deps := $(strip \
$(foreach l,$(my_whole_static_libraries), \
- $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
+ $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))))
# Re-export requested headers from shared libraries.
export_include_deps += $(strip \
$(foreach l,$(LOCAL_EXPORT_SHARED_LIBRARY_HEADERS), \
- $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
+ $(call intermediates-dir-for,SHARED_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))))
# Re-export requested headers from static libraries.
export_include_deps += $(strip \
$(foreach l,$(LOCAL_EXPORT_STATIC_LIBRARY_HEADERS), \
- $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
+ $(call intermediates-dir-for,STATIC_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))))
# Re-export requested headers from header libraries.
export_include_deps += $(strip \
$(foreach l,$(LOCAL_EXPORT_HEADER_LIBRARY_HEADERS), \
- $(call intermediates-dir-for,HEADER_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))/export_includes))
-$(export_includes): PRIVATE_REEXPORTED_INCLUDES := $(export_include_deps)
-# By adding $(my_generated_sources) it makes sure the headers get generated
-# before any dependent source files get compiled.
-$(export_includes) : $(my_export_c_include_deps) $(my_generated_sources) $(export_include_deps) $(LOCAL_EXPORT_C_INCLUDE_DEPS)
- @echo Export includes file: $< -- $@
- $(hide) mkdir -p $(dir $@) && rm -f $@.tmp && touch $@.tmp
-ifdef export_cflags
- $(hide) echo "$(PRIVATE_EXPORT_CFLAGS)" >>$@.tmp
-endif
-ifdef export_include_deps
- $(hide) for f in $(PRIVATE_REEXPORTED_INCLUDES); do \
- cat $$f >> $@.tmp; \
- done
-endif
- $(hide) if cmp -s $@.tmp $@ ; then \
- rm $@.tmp ; \
- else \
- mv $@.tmp $@ ; \
- fi
-export_cflags :=
+ $(call intermediates-dir-for,HEADER_LIBRARIES,$(l),$(my_kind),,$(LOCAL_2ND_ARCH_VAR_PREFIX),$(my_host_cross))))
-# Kati adds restat=1 to ninja. GNU make does nothing for this.
-.KATI_RESTAT: $(export_includes)
-
-# Make sure export_includes gets generated when you are running mm/mmm
-$(LOCAL_BUILT_MODULE) : | $(export_includes)
+ifneq ($(strip $(my_export_c_include_dirs)$(export_include_deps)),)
+ EXPORTS_LIST := $(EXPORTS_LIST) $(intermediates)
+ EXPORTS.$(intermediates).FLAGS := $(foreach d,$(my_export_c_include_dirs),-I $(d))
+ EXPORTS.$(intermediates).REEXPORT := $(export_include_deps)
+ EXPORTS.$(intermediates).DEPS := $(my_export_c_include_deps) $(my_generated_sources) $(LOCAL_EXPORT_C_INCLUDE_DEPS)
+endif
ifneq (,$(filter-out $(LOCAL_PATH)/%,$(my_export_c_include_dirs)))
my_soong_problems += non_local__export_c_include_dirs
diff --git a/core/board_config.mk b/core/board_config.mk
index 33cfa62..db60cee 100644
--- a/core/board_config.mk
+++ b/core/board_config.mk
@@ -67,8 +67,8 @@
BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE \
BOARD_PRODUCTIMAGE_PARTITION_SIZE \
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE \
- BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE \
- BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE \
+ BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE \
+ BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE \
BOARD_ODMIMAGE_PARTITION_SIZE \
BOARD_ODMIMAGE_FILE_SYSTEM_TYPE \
@@ -78,16 +78,14 @@
BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE \
BOARD_ODMIMAGE_PARTITION_RESERVED_SIZE \
BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE \
- BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE \
+ BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE \
BOARD_SUPER_PARTITION_SIZE \
BOARD_SUPER_PARTITION_GROUPS \
_board_strip_readonly_list += $(_dynamic_partitions_var_list)
_build_broken_var_list := \
- BUILD_BROKEN_ANDROIDMK_EXPORTS \
BUILD_BROKEN_DUP_RULES \
- BUILD_BROKEN_ENG_DEBUG_TAGS \
BUILD_BROKEN_USES_NETWORK \
_build_broken_var_list += \
@@ -195,9 +193,16 @@
# Note that this assumes that the 2ND_CPU_ABI for a 64 bit target
# is always 32 bits. If this isn't the case, these variables should
# be overriden in the board configuration.
+#
+# Similarly, TARGET_NATIVE_BRIDGE_2ND_ABI for a 64 bit target is always
+# 32 bits. Note that all CPU_ABIs are preferred over all NATIVE_BRIDGE_ABIs.
+_target_native_bridge_abi_list_32_bit :=
+_target_native_bridge_abi_list_64_bit :=
+
ifeq (,$(TARGET_CPU_ABI_LIST_64_BIT))
ifeq (true|true,$(TARGET_IS_64_BIT)|$(TARGET_SUPPORTS_64_BIT_APPS))
TARGET_CPU_ABI_LIST_64_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2)
+ _target_native_bridge_abi_list_64_bit := $(TARGET_NATIVE_BRIDGE_ABI)
endif
endif
@@ -212,11 +217,13 @@
ifeq (,$(TARGET_CPU_ABI_LIST_32_BIT))
ifneq (true,$(TARGET_IS_64_BIT))
TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_CPU_ABI) $(TARGET_CPU_ABI2)
+ _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_ABI)
else
ifeq (true,$(TARGET_SUPPORTS_32_BIT_APPS))
# For a 64 bit target, assume that the 2ND_CPU_ABI
# is a 32 bit ABI.
TARGET_CPU_ABI_LIST_32_BIT := $(TARGET_2ND_CPU_ABI) $(TARGET_2ND_CPU_ABI2)
+ _target_native_bridge_abi_list_32_bit := $(TARGET_NATIVE_BRIDGE_2ND_ABI)
endif
endif
endif
@@ -225,23 +232,26 @@
# of preference) that the target supports. If a TARGET_CPU_ABI_LIST
# is specified by the board configuration, we use that. If not, we
# build a list out of the TARGET_CPU_ABIs specified by the config.
+# Add NATIVE_BRIDGE_ABIs at the end to keep order of preference.
ifeq (,$(TARGET_CPU_ABI_LIST))
ifeq ($(TARGET_IS_64_BIT)|$(TARGET_PREFER_32_BIT_APPS),true|true)
- TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_32_BIT) $(TARGET_CPU_ABI_LIST_64_BIT)
+ TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_32_BIT) $(TARGET_CPU_ABI_LIST_64_BIT) \
+ $(_target_native_bridge_abi_list_32_bit) $(_target_native_bridge_abi_list_64_bit)
else
- TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT)
+ TARGET_CPU_ABI_LIST := $(TARGET_CPU_ABI_LIST_64_BIT) $(TARGET_CPU_ABI_LIST_32_BIT) \
+ $(_target_native_bridge_abi_list_64_bit) $(_target_native_bridge_abi_list_32_bit)
endif
endif
+# Add NATIVE_BRIDGE_ABIs at the end of 32 and 64 bit CPU_ABIs to keep order of preference.
+TARGET_CPU_ABI_LIST_32_BIT += $(_target_native_bridge_abi_list_32_bit)
+TARGET_CPU_ABI_LIST_64_BIT += $(_target_native_bridge_abi_list_64_bit)
+
# Strip whitespace from the ABI list string.
TARGET_CPU_ABI_LIST := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST)))
TARGET_CPU_ABI_LIST_32_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_32_BIT)))
TARGET_CPU_ABI_LIST_64_BIT := $(subst $(space),$(comma),$(strip $(TARGET_CPU_ABI_LIST_64_BIT)))
-ifneq ($(BUILD_BROKEN_ANDROIDMK_EXPORTS),true)
-$(KATI_obsolete_export It is a global setting. See $(CHANGES_URL)#export_keyword)
-endif
-
###########################################
# Now we can substitute with the real value of TARGET_COPY_OUT_RAMDISK
ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
@@ -427,48 +437,48 @@
.KATI_READONLY := BUILDING_PRODUCT_IMAGE
###########################################
-# Now we can substitute with the real value of TARGET_COPY_OUT_PRODUCT_SERVICES
-MERGE_PRODUCT_SERVICES_INTO_PRODUCT :=
-ifeq ($(TARGET_COPY_OUT_PRODUCT_SERVICES),$(_product_services_path_placeholder))
- TARGET_COPY_OUT_PRODUCT_SERVICES := $(TARGET_COPY_OUT_PRODUCT)
- MERGE_PRODUCT_SERVICES_INTO_PRODUCT := true
-else ifeq ($(TARGET_COPY_OUT_PRODUCT),$(TARGET_COPY_OUT_PRODUCT_SERVICES))
- MERGE_PRODUCT_SERVICES_INTO_PRODUCT := true
-else ifeq ($(filter product_services system/product_services,$(TARGET_COPY_OUT_PRODUCT_SERVICES)),)
- $(error TARGET_COPY_OUT_PRODUCT_SERVICES must be either 'product_services',\
- '$(TARGET_COPY_OUT_PRODUCT)' or 'system/product_services', seeing '$(TARGET_COPY_OUT_PRODUCT_SERVICES)'.)
-endif
-.KATI_READONLY := MERGE_PRODUCT_SERVICES_INTO_PRODUCT
-PRODUCT_COPY_FILES := $(subst $(_product_services_path_placeholder),$(TARGET_COPY_OUT_PRODUCT_SERVICES),$(PRODUCT_COPY_FILES))
+# TODO(b/135957588) TARGET_COPY_OUT_PRODUCT_SERVICES will be set to
+# TARGET_COPY_OUT_PRODUCT as a workaround.
+TARGET_COPY_OUT_PRODUCT_SERVICES := $(TARGET_COPY_OUT_PRODUCT)
-BOARD_USES_PRODUCT_SERVICESIMAGE :=
-ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
- BOARD_USES_PRODUCT_SERVICESIMAGE := true
+###########################################
+# Now we can substitute with the real value of TARGET_COPY_OUT_SYSTEM_EXT
+ifeq ($(TARGET_COPY_OUT_SYSTEM_EXT),$(_system_ext_path_placeholder))
+TARGET_COPY_OUT_SYSTEM_EXT := system/system_ext
+else ifeq ($(filter system_ext system/system_ext,$(TARGET_COPY_OUT_SYSTEM_EXT)),)
+$(error TARGET_COPY_OUT_SYSTEM_EXT must be either 'system_ext' or 'system/system_ext', seeing '$(TARGET_COPY_OUT_SYSTEM_EXT)'.)
endif
-ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
- BOARD_USES_PRODUCT_SERVICESIMAGE := true
-endif
-ifeq ($(TARGET_COPY_OUT_PRODUCT_SERVICES),product_services)
- BOARD_USES_PRODUCT_SERVICESIMAGE := true
-else ifdef BOARD_USES_PRODUCT_SERVICESIMAGE
- $(error TARGET_COPY_OUT_PRODUCT_SERVICES must be set to 'product_services' to use a product_services image)
-endif
+PRODUCT_COPY_FILES := $(subst $(_system_ext_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_EXT),$(PRODUCT_COPY_FILES))
-BUILDING_PRODUCT_SERVICES_IMAGE :=
-ifeq ($(PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE),)
- ifdef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
- BUILDING_PRODUCT_SERVICES_IMAGE := true
+BOARD_USES_SYSTEM_EXTIMAGE :=
+ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
+ BOARD_USES_SYSTEM_EXTIMAGE := true
+endif
+ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
+ BOARD_USES_SYSTEM_EXTIMAGE := true
+endif
+ifeq ($(TARGET_COPY_OUT_SYSTEM_EXT),system_ext)
+ BOARD_USES_SYSTEM_EXTIMAGE := true
+else ifdef BOARD_USES_SYSTEM_EXTIMAGE
+ $(error TARGET_COPY_OUT_SYSTEM_EXT must be set to 'system_ext' to use a system_ext image)
+endif
+.KATI_READONLY := BOARD_USES_SYSTEM_EXTIMAGE
+
+BUILDING_SYSTEM_EXT_IMAGE :=
+ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),)
+ ifdef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
+ BUILDING_SYSTEM_EXT_IMAGE := true
endif
-else ifeq ($(PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE),true)
- BUILDING_PRODUCT_SERVICES_IMAGE := true
- ifndef BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE
- $(error PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE set to true, but BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE not defined)
+else ifeq ($(PRODUCT_BUILD_SYSTEM_EXT_IMAGE),true)
+ BUILDING_SYSTEM_EXT_IMAGE := true
+ ifndef BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE
+ $(error PRODUCT_BUILD_SYSTEM_EXT_IMAGE set to true, but BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE not defined)
endif
endif
-ifdef BOARD_PREBUILT_PRODUCT_SERVICESIMAGE
- BUILDING_PRODUCT_SERVICES_IMAGE :=
+ifdef BOARD_PREBUILT_SYSTEM_EXTIMAGE
+ BUILDING_SYSTEM_EXT_IMAGE :=
endif
-.KATI_READONLY := BUILDING_PRODUCT_SERVICES_IMAGE
+.KATI_READONLY := BUILDING_SYSTEM_EXT_IMAGE
###########################################
# Now we can substitute with the real value of TARGET_COPY_OUT_ODM
@@ -526,6 +536,12 @@
endif
endif
+ifdef BOARD_PREBUILT_DTBIMAGE_DIR
+ ifneq ($(BOARD_INCLUDE_DTB_IN_BOOTIMG),true)
+ $(error BOARD_PREBUILT_DTBIMAGE_DIR with 'BOARD_INCLUDE_DTB_IN_BOOTIMG != true' is not supported)
+ endif
+endif
+
# Check BOARD_VNDK_VERSION
define check_vndk_version
$(eval vndk_path := prebuilts/vndk/v$(1)) \
diff --git a/core/build_rro_package.mk b/core/build_rro_package.mk
index a6921d5..e5d7685 100644
--- a/core/build_rro_package.mk
+++ b/core/build_rro_package.mk
@@ -20,8 +20,8 @@
partition := $(TARGET_OUT_ODM)
else ifeq ($(strip $(LOCAL_VENDOR_MODULE)),true)
partition := $(TARGET_OUT_VENDOR)
-else ifeq ($(strip $(LOCAL_PRODUCT_SERVICES_MODULE)),true)
- partition := $(TARGET_OUT_PRODUCT_SERVICES)
+else ifeq ($(strip $(LOCAL_SYSTEM_EXT_MODULE)),true)
+ partition := $(TARGET_OUT_SYSTEM_EXT)
else
partition := $(TARGET_OUT_PRODUCT)
endif
diff --git a/core/cc_prebuilt_internal.mk b/core/cc_prebuilt_internal.mk
index b936bd7..a8930d5 100644
--- a/core/cc_prebuilt_internal.mk
+++ b/core/cc_prebuilt_internal.mk
@@ -18,6 +18,11 @@
# Internal build rules for native prebuilt modules
############################################################
+prebuilt_module_classes := STATIC_LIBRARIES SHARED_LIBRARIES EXECUTABLES NATIVE_TESTS
+ifeq ($(filter $(prebuilt_module_classes),$(LOCAL_MODULE_CLASS)),)
+$(call pretty-error,cc_prebuilt_internal.mk is for $(prebuilt_module_classes) modules only)
+endif
+
my_strip_module := $(firstword \
$(LOCAL_STRIP_MODULE_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)) \
$(LOCAL_STRIP_MODULE))
@@ -70,18 +75,9 @@
built_module := $(LOCAL_BUILT_MODULE)
ifdef prebuilt_module_is_a_library
-export_includes := $(intermediates)/export_includes
-export_cflags := $(foreach d,$(LOCAL_EXPORT_C_INCLUDE_DIRS),-I $(d))
-$(export_includes): PRIVATE_EXPORT_CFLAGS := $(export_cflags)
-$(export_includes): $(LOCAL_EXPORT_C_INCLUDE_DEPS)
- @echo Export includes file: $< -- $@
- $(hide) mkdir -p $(dir $@) && rm -f $@
-ifdef export_cflags
- $(hide) echo "$(PRIVATE_EXPORT_CFLAGS)" >$@
-else
- $(hide) touch $@
-endif
-export_cflags :=
+EXPORTS_LIST := $(EXPORTS_LIST) $(intermediates)
+EXPORTS.$(intermediates).FLAGS := $(foreach d,$(LOCAL_EXPORT_C_INCLUDE_DIRS),-I $(d))
+EXPORTS.$(intermediates).DEPS := $(LOCAL_EXPORT_C_INCLUDE_DEPS)
include $(BUILD_SYSTEM)/allowed_ndk_types.mk
@@ -130,21 +126,23 @@
endif
endif
-my_shared_libraries := \
+my_shared_libraries := $(strip \
$(filter-out $(my_system_shared_libraries),$(LOCAL_SHARED_LIBRARIES)) \
- $(my_system_shared_libraries)
+ $(my_system_shared_libraries))
+
+# Extra shared libraries introduced by LOCAL_CXX_STL (may append some libraries to
+# my_shared_libraries).
+include $(BUILD_SYSTEM)/cxx_stl_setup.mk
ifdef my_shared_libraries
-# Extra shared libraries introduced by LOCAL_CXX_STL.
-include $(BUILD_SYSTEM)/cxx_stl_setup.mk
ifdef LOCAL_USE_VNDK
my_shared_libraries := $(foreach l,$(my_shared_libraries),\
$(if $(SPLIT_VENDOR.SHARED_LIBRARIES.$(l)),$(l).vendor,$(l)))
endif
$(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)DEPENDENCIES_ON_SHARED_LIBRARIES += \
$(my_register_name):$(LOCAL_INSTALLED_MODULE):$(subst $(space),$(comma),$(my_shared_libraries))
-endif
endif # my_shared_libraries
+endif # LOCAL_INSTALLED_MODULE
# We need to enclose the above export_includes and my_built_shared_libraries in
# "my_strip_module not true" because otherwise the rules are defined in dynamic_binary.mk.
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index fafdce6..3cc8594 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -216,7 +216,8 @@
LOCAL_PRIVILEGED_MODULE:=
# '',full,custom,disabled,obfuscation,optimization
LOCAL_PRODUCT_MODULE:=
-LOCAL_PRODUCT_SERVICES_MODULE:=
+# TODO(b/135957588) Remove LOCAL_PRODUCT_SERVICES_MODULE
+LOCAL_PRODUCT_SERVICES_MODULE :=
LOCAL_PROGUARD_ENABLED:=
LOCAL_PROGUARD_FLAG_FILES:=
LOCAL_PROGUARD_FLAGS:=
@@ -269,6 +270,7 @@
LOCAL_SOONG_SYMBOL_PATH :=
LOCAL_SOONG_TOC :=
LOCAL_SOONG_UNSTRIPPED_BINARY :=
+LOCAL_SOONG_VNDK_VERSION :=
# '',true
LOCAL_SOURCE_FILES_ALL_GENERATED:=
LOCAL_SRC_FILES:=
@@ -278,6 +280,7 @@
LOCAL_STATIC_JAVA_AAR_LIBRARIES:=
LOCAL_STATIC_JAVA_LIBRARIES:=
LOCAL_STATIC_LIBRARIES:=
+LOCAL_SYSTEM_EXT_MODULE:=
LOCAL_STRIP_MODULE:=
LOCAL_SYSTEM_SHARED_LIBRARIES:=none
LOCAL_TARGET_REQUIRED_MODULES:=
diff --git a/core/combo/TARGET_linux-mips.mk b/core/combo/TARGET_linux-mips.mk
index ba76969..9f14aa2 100644
--- a/core/combo/TARGET_linux-mips.mk
+++ b/core/combo/TARGET_linux-mips.mk
@@ -33,12 +33,6 @@
TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT := mips32r2-fp
endif
-TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_$(combo_2nd_arch_prefix)ARCH)/$(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT).mk
-ifeq ($(strip $(wildcard $(TARGET_ARCH_SPECIFIC_MAKEFILE))),)
-$(error Unknown MIPS architecture variant: $(TARGET_$(combo_2nd_arch_prefix)ARCH_VARIANT))
-endif
-
-include $(TARGET_ARCH_SPECIFIC_MAKEFILE)
include $(BUILD_SYSTEM)/combo/fdo.mk
define $(combo_var_prefix)transform-shared-lib-to-toc
diff --git a/core/combo/TARGET_linux-mips64.mk b/core/combo/TARGET_linux-mips64.mk
index b498d1f..ae17e46 100644
--- a/core/combo/TARGET_linux-mips64.mk
+++ b/core/combo/TARGET_linux-mips64.mk
@@ -33,12 +33,6 @@
TARGET_ARCH_VARIANT := mips64r6
endif
-TARGET_ARCH_SPECIFIC_MAKEFILE := $(BUILD_COMBOS)/arch/$(TARGET_ARCH)/$(TARGET_ARCH_VARIANT).mk
-ifeq ($(strip $(wildcard $(TARGET_ARCH_SPECIFIC_MAKEFILE))),)
-$(error Unknown MIPS architecture variant: $(TARGET_ARCH_VARIANT))
-endif
-
-include $(TARGET_ARCH_SPECIFIC_MAKEFILE)
include $(BUILD_SYSTEM)/combo/fdo.mk
define $(combo_var_prefix)transform-shared-lib-to-toc
diff --git a/core/combo/arch/arm/armv7-a-neon.mk b/core/combo/arch/arm/armv7-a-neon.mk
index 01d2235..0c01ac3 100644
--- a/core/combo/arch/arm/armv7-a-neon.mk
+++ b/core/combo/arch/arm/armv7-a-neon.mk
@@ -1,7 +1,6 @@
# Configuration for Linux on ARM.
# Generating binaries for the ARMv7-a architecture and higher with NEON
#
-ARCH_ARM_HAVE_ARMV7A := true
ARCH_ARM_HAVE_VFP := true
ARCH_ARM_HAVE_VFP_D32 := true
ARCH_ARM_HAVE_NEON := true
diff --git a/core/combo/arch/arm/armv8-2a.mk b/core/combo/arch/arm/armv8-2a.mk
index c1d8182..7e2ca18 100644
--- a/core/combo/arch/arm/armv8-2a.mk
+++ b/core/combo/arch/arm/armv8-2a.mk
@@ -3,7 +3,6 @@
#
# Many libraries are not aware of armv8-2a, and AArch32 is (almost) a superset
# of armv7-a-neon. So just let them think we are just like v7.
-ARCH_ARM_HAVE_ARMV7A := true
ARCH_ARM_HAVE_VFP := true
ARCH_ARM_HAVE_VFP_D32 := true
ARCH_ARM_HAVE_NEON := true
diff --git a/core/combo/arch/arm/armv8-a.mk b/core/combo/arch/arm/armv8-a.mk
index 9ef5c49..19bc014 100644
--- a/core/combo/arch/arm/armv8-a.mk
+++ b/core/combo/arch/arm/armv8-a.mk
@@ -3,7 +3,6 @@
#
# Many libraries are not aware of armv8-a, and AArch32 is (almost) a superset
# of armv7-a-neon. So just let them think we are just like v7.
-ARCH_ARM_HAVE_ARMV7A := true
ARCH_ARM_HAVE_VFP := true
ARCH_ARM_HAVE_VFP_D32 := true
ARCH_ARM_HAVE_NEON := true
diff --git a/core/combo/arch/mips/mips32-fp.mk b/core/combo/arch/mips/mips32-fp.mk
deleted file mode 100644
index 4b09bc1..0000000
--- a/core/combo/arch/mips/mips32-fp.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-# Configuration for Android on MIPS.
-# Generating binaries for MIPS32/hard-float/little-endian
-
-ARCH_MIPS_HAS_FPU :=true
-ARCH_HAVE_ALIGNED_DOUBLES :=true
diff --git a/core/combo/arch/mips/mips32r2-fp-xburst.mk b/core/combo/arch/mips/mips32r2-fp-xburst.mk
deleted file mode 100644
index 83fb12e..0000000
--- a/core/combo/arch/mips/mips32r2-fp-xburst.mk
+++ /dev/null
@@ -1,6 +0,0 @@
-# Configuration for Android on Ingenic xb4780/Xburst MIPS CPU.
-# Generating binaries for MIPS32R2/hard-float/little-endian without
-# support for the Madd family of instructions.
-
-ARCH_MIPS_HAS_FPU :=true
-ARCH_HAVE_ALIGNED_DOUBLES :=true
diff --git a/core/combo/arch/mips/mips32r2-fp.mk b/core/combo/arch/mips/mips32r2-fp.mk
deleted file mode 100644
index 97c14c3..0000000
--- a/core/combo/arch/mips/mips32r2-fp.mk
+++ /dev/null
@@ -1,5 +0,0 @@
-# Configuration for Android on MIPS.
-# Generating binaries for MIPS32R2/hard-float/little-endian
-
-ARCH_MIPS_HAS_FPU :=true
-ARCH_HAVE_ALIGNED_DOUBLES :=true
diff --git a/core/combo/arch/mips/mips32r2dsp-fp.mk b/core/combo/arch/mips/mips32r2dsp-fp.mk
deleted file mode 100644
index 522b6b9..0000000
--- a/core/combo/arch/mips/mips32r2dsp-fp.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-# Configuration for Android on MIPS.
-# Generating binaries for MIPS32R2/hard-float/little-endian/dsp
-
-ARCH_MIPS_HAS_DSP :=true
-ARCH_MIPS_DSP_REV :=1
-ARCH_MIPS_HAS_FPU :=true
-ARCH_HAVE_ALIGNED_DOUBLES :=true
diff --git a/core/combo/arch/mips/mips32r2dspr2-fp.mk b/core/combo/arch/mips/mips32r2dspr2-fp.mk
deleted file mode 100644
index 886d378..0000000
--- a/core/combo/arch/mips/mips32r2dspr2-fp.mk
+++ /dev/null
@@ -1,7 +0,0 @@
-# Configuration for Android on MIPS.
-# Generating binaries for MIPS32R2/hard-float/little-endian/dsp
-
-ARCH_MIPS_HAS_DSP :=true
-ARCH_MIPS_DSP_REV :=2
-ARCH_MIPS_HAS_FPU :=true
-ARCH_HAVE_ALIGNED_DOUBLES :=true
diff --git a/core/combo/arch/mips/mips32r6.mk b/core/combo/arch/mips/mips32r6.mk
deleted file mode 100644
index 7bc6cac..0000000
--- a/core/combo/arch/mips/mips32r6.mk
+++ /dev/null
@@ -1,4 +0,0 @@
-# Configuration for Android on MIPS.
-# Generating binaries for MIPS32R6/hard-float/little-endian
-
-ARCH_MIPS_REV6 := true
diff --git a/core/combo/arch/mips64/mips64r2.mk b/core/combo/arch/mips64/mips64r2.mk
deleted file mode 100644
index 54aa387..0000000
--- a/core/combo/arch/mips64/mips64r2.mk
+++ /dev/null
@@ -1,6 +0,0 @@
-# Configuration for Android on mips64r2.
-
-# This target is for temporary use only, until mips64r6 is supported by Android's qemu.
-
-ARCH_MIPS_HAS_FPU :=true
-ARCH_HAVE_ALIGNED_DOUBLES :=true
diff --git a/core/combo/arch/mips64/mips64r6.mk b/core/combo/arch/mips64/mips64r6.mk
deleted file mode 100644
index 42d6c9e..0000000
--- a/core/combo/arch/mips64/mips64r6.mk
+++ /dev/null
@@ -1,3 +0,0 @@
-# Configuration for Android on mips64r6.
-
-ARCH_MIPS64_REV6 := true
diff --git a/core/combo/arch/x86/amberlake.mk b/core/combo/arch/x86/amberlake.mk
index 37100a4..a7ae6ed 100644
--- a/core/combo/arch/x86/amberlake.mk
+++ b/core/combo/arch/x86/amberlake.mk
@@ -3,11 +3,4 @@
# that have AVX2 feature flag
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86/atom.mk b/core/combo/arch/x86/atom.mk
index 43a170c..bae7946 100644
--- a/core/combo/arch/x86/atom.mk
+++ b/core/combo/arch/x86/atom.mk
@@ -4,6 +4,3 @@
#
# See build/make/core/combo/arch/x86/x86.mk for differences.
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_MOVBE := true
-ARCH_X86_HAVE_POPCNT := false # popcnt is not supported by current Atom CPUs
diff --git a/core/combo/arch/x86/broadwell.mk b/core/combo/arch/x86/broadwell.mk
index 37100a4..a7ae6ed 100644
--- a/core/combo/arch/x86/broadwell.mk
+++ b/core/combo/arch/x86/broadwell.mk
@@ -3,11 +3,4 @@
# that have AVX2 feature flag
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86/haswell.mk b/core/combo/arch/x86/haswell.mk
index 50c27b4..ffa3bac 100644
--- a/core/combo/arch/x86/haswell.mk
+++ b/core/combo/arch/x86/haswell.mk
@@ -1,11 +1,4 @@
# Configuration for Linux on x86.
# Generating binaries for Haswell processors.
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AES_NI := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86/icelake.mk b/core/combo/arch/x86/icelake.mk
index 76fe212..a7ae6ed 100644
--- a/core/combo/arch/x86/icelake.mk
+++ b/core/combo/arch/x86/icelake.mk
@@ -3,12 +3,4 @@
# that have AVX2 feature flag
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_AVX512 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86/ivybridge.mk b/core/combo/arch/x86/ivybridge.mk
index 44035d8..a1358e6 100644
--- a/core/combo/arch/x86/ivybridge.mk
+++ b/core/combo/arch/x86/ivybridge.mk
@@ -1,11 +1,4 @@
# Configuration for Linux on x86.
# Generating binaries for Ivy Bridge processors.
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AES_NI := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := false
diff --git a/core/combo/arch/x86/kabylake.mk b/core/combo/arch/x86/kabylake.mk
index 50518d6..9906259 100644
--- a/core/combo/arch/x86/kabylake.mk
+++ b/core/combo/arch/x86/kabylake.mk
@@ -3,11 +3,4 @@
# that support AVX2 feature flag
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86/sandybridge.mk b/core/combo/arch/x86/sandybridge.mk
index a4c1bd9..d6552ab 100644
--- a/core/combo/arch/x86/sandybridge.mk
+++ b/core/combo/arch/x86/sandybridge.mk
@@ -1,11 +1,4 @@
# Configuration for Linux on x86.
# Generating binaries for SandyBridge processors.
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AES_NI := false
-ARCH_X86_HAVE_AVX := false
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := false
diff --git a/core/combo/arch/x86/silvermont.mk b/core/combo/arch/x86/silvermont.mk
index cba1079..8ac2b98 100644
--- a/core/combo/arch/x86/silvermont.mk
+++ b/core/combo/arch/x86/silvermont.mk
@@ -4,10 +4,4 @@
# See build/make/core/combo/arch/x86/x86-atom.mk for differences.
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AES_NI := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86/skylake.mk b/core/combo/arch/x86/skylake.mk
index 03705c0..9906259 100644
--- a/core/combo/arch/x86/skylake.mk
+++ b/core/combo/arch/x86/skylake.mk
@@ -3,13 +3,4 @@
# that support AVX2 feature flag
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_AVX512 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
-
diff --git a/core/combo/arch/x86/stoneyridge.mk b/core/combo/arch/x86/stoneyridge.mk
index 30405a1..05ff77a 100644
--- a/core/combo/arch/x86/stoneyridge.mk
+++ b/core/combo/arch/x86/stoneyridge.mk
@@ -1,12 +1,4 @@
# Configuration for Linux on x86.
# Generating binaries for Stoney Ridge processors.
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AES_NI := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86/tigerlake.mk b/core/combo/arch/x86/tigerlake.mk
index 76fe212..a7ae6ed 100644
--- a/core/combo/arch/x86/tigerlake.mk
+++ b/core/combo/arch/x86/tigerlake.mk
@@ -3,12 +3,4 @@
# that have AVX2 feature flag
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_AVX512 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86/whiskeylake.mk b/core/combo/arch/x86/whiskeylake.mk
index 37100a4..a7ae6ed 100644
--- a/core/combo/arch/x86/whiskeylake.mk
+++ b/core/combo/arch/x86/whiskeylake.mk
@@ -3,11 +3,4 @@
# that have AVX2 feature flag
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86/x86.mk b/core/combo/arch/x86/x86.mk
index db55ff8..066f66a 100644
--- a/core/combo/arch/x86/x86.mk
+++ b/core/combo/arch/x86/x86.mk
@@ -8,9 +8,3 @@
# These features are optional and shall not be included in the base platform
# Otherwise, sdk_x86-eng system images might fail to run on some
# developer machines.
-ARCH_X86_HAVE_SSSE3 := false
-ARCH_X86_HAVE_MOVBE := false
-ARCH_X86_HAVE_POPCNT := false
-ARCH_X86_HAVE_AVX := false
-ARCH_X86_HAVE_AVX2 := false
-ARCH_X86_HAVE_AVX512 := false
diff --git a/core/combo/arch/x86/x86_64.mk b/core/combo/arch/x86/x86_64.mk
index fc2a087..eff406b 100644
--- a/core/combo/arch/x86/x86_64.mk
+++ b/core/combo/arch/x86/x86_64.mk
@@ -4,9 +4,4 @@
# The generic 'x86' variant cannot be used, since it resets some flags used
# by the 'x86_64' variant.
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_MOVBE := false # Only supported on Atom.
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
diff --git a/core/combo/arch/x86_64/amberlake.mk b/core/combo/arch/x86_64/amberlake.mk
index 37100a4..a7ae6ed 100644
--- a/core/combo/arch/x86_64/amberlake.mk
+++ b/core/combo/arch/x86_64/amberlake.mk
@@ -3,11 +3,4 @@
# that have AVX2 feature flag
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86_64/broadwell.mk b/core/combo/arch/x86_64/broadwell.mk
index 37100a4..a7ae6ed 100644
--- a/core/combo/arch/x86_64/broadwell.mk
+++ b/core/combo/arch/x86_64/broadwell.mk
@@ -3,11 +3,4 @@
# that have AVX2 feature flag
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86_64/haswell.mk b/core/combo/arch/x86_64/haswell.mk
index f9c6ebd..faf12fa 100644
--- a/core/combo/arch/x86_64/haswell.mk
+++ b/core/combo/arch/x86_64/haswell.mk
@@ -1,11 +1,4 @@
# Configuration for Linux on x86_64.
# Generating binaries for Haswell processors.
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AES_NI := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86_64/icelake.mk b/core/combo/arch/x86_64/icelake.mk
index 76fe212..a7ae6ed 100644
--- a/core/combo/arch/x86_64/icelake.mk
+++ b/core/combo/arch/x86_64/icelake.mk
@@ -3,12 +3,4 @@
# that have AVX2 feature flag
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_AVX512 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86_64/ivybridge.mk b/core/combo/arch/x86_64/ivybridge.mk
index 69011d6..464fa98 100644
--- a/core/combo/arch/x86_64/ivybridge.mk
+++ b/core/combo/arch/x86_64/ivybridge.mk
@@ -1,11 +1,4 @@
# Configuration for Linux on x86_64.
# Generating binaries for Ivy Bridge processors.
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AES_NI := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := false
diff --git a/core/combo/arch/x86_64/kabylake.mk b/core/combo/arch/x86_64/kabylake.mk
index 37100a4..a7ae6ed 100644
--- a/core/combo/arch/x86_64/kabylake.mk
+++ b/core/combo/arch/x86_64/kabylake.mk
@@ -3,11 +3,4 @@
# that have AVX2 feature flag
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86_64/sandybridge.mk b/core/combo/arch/x86_64/sandybridge.mk
index 2092d19..a09db2a 100644
--- a/core/combo/arch/x86_64/sandybridge.mk
+++ b/core/combo/arch/x86_64/sandybridge.mk
@@ -1,11 +1,4 @@
# Configuration for Linux on x86_64.
# Generating binaries for SandyBridge processors.
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AES_NI := false
-ARCH_X86_HAVE_AVX := false
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := false
diff --git a/core/combo/arch/x86_64/silvermont.mk b/core/combo/arch/x86_64/silvermont.mk
index cba1079..8ac2b98 100644
--- a/core/combo/arch/x86_64/silvermont.mk
+++ b/core/combo/arch/x86_64/silvermont.mk
@@ -4,10 +4,4 @@
# See build/make/core/combo/arch/x86/x86-atom.mk for differences.
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AES_NI := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86_64/skylake.mk b/core/combo/arch/x86_64/skylake.mk
index 76fe212..a7ae6ed 100644
--- a/core/combo/arch/x86_64/skylake.mk
+++ b/core/combo/arch/x86_64/skylake.mk
@@ -3,12 +3,4 @@
# that have AVX2 feature flag
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_AVX512 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86_64/stoneyridge.mk b/core/combo/arch/x86_64/stoneyridge.mk
index f7d9583..5950d9a 100644
--- a/core/combo/arch/x86_64/stoneyridge.mk
+++ b/core/combo/arch/x86_64/stoneyridge.mk
@@ -1,12 +1,4 @@
# Configuration for Linux on x86_64.
# Generating binaries for Stoney Ridge processors.
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AES_NI := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86_64/tigerlake.mk b/core/combo/arch/x86_64/tigerlake.mk
index 76fe212..a7ae6ed 100644
--- a/core/combo/arch/x86_64/tigerlake.mk
+++ b/core/combo/arch/x86_64/tigerlake.mk
@@ -3,12 +3,4 @@
# that have AVX2 feature flag
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_AVX512 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86_64/whiskeylake.mk b/core/combo/arch/x86_64/whiskeylake.mk
index 37100a4..a7ae6ed 100644
--- a/core/combo/arch/x86_64/whiskeylake.mk
+++ b/core/combo/arch/x86_64/whiskeylake.mk
@@ -3,11 +3,4 @@
# that have AVX2 feature flag
#
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AVX := true
-ARCH_X86_HAVE_AVX2 := true
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_MOVBE := true
diff --git a/core/combo/arch/x86_64/x86_64.mk b/core/combo/arch/x86_64/x86_64.mk
index e7c8928..17413c7 100755
--- a/core/combo/arch/x86_64/x86_64.mk
+++ b/core/combo/arch/x86_64/x86_64.mk
@@ -5,12 +5,4 @@
# that are run in the emulator under KVM emulation (i.e. running directly on
# the host development machine's CPU).
-ARCH_X86_HAVE_SSSE3 := true
-ARCH_X86_HAVE_MOVBE := false # Only supported on Atom.
-ARCH_X86_HAVE_POPCNT := true
-ARCH_X86_HAVE_SSE4 := true
ARCH_X86_HAVE_SSE4_1 := true
-ARCH_X86_HAVE_SSE4_2 := true
-ARCH_X86_HAVE_AVX := false
-ARCH_X86_HAVE_AVX2 := false
-ARCH_X86_HAVE_AVX512 := false
diff --git a/core/combo/javac.mk b/core/combo/javac.mk
index dac2628..32a5c9e 100644
--- a/core/combo/javac.mk
+++ b/core/combo/javac.mk
@@ -16,4 +16,5 @@
# TODO(ccross): remove this, it is needed for now because it is used by
# config.mk before makevars from soong are loaded
-JAVA := $(ANDROID_JAVA_TOOLCHAIN)/java
+JAVA := $(ANDROID_JAVA_TOOLCHAIN)/java -XX:OnError="cat hs_err_pid%p.log" -XX:CICompilerCount=6 -XX:+UseDynamicNumberOfGCThreads
+
diff --git a/core/config.mk b/core/config.mk
index 088bb15..0f9f112 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -97,9 +97,28 @@
$(KATI_obsolete_var TARGET_ROOT_OUT_SBIN_UNSTRIPPED,/sbin has been removed, use /system/bin instead)
$(KATI_obsolete_var BUILD_BROKEN_PHONY_TARGETS)
$(KATI_obsolete_var BUILD_BROKEN_DUP_COPY_HEADERS)
-
-# This is marked as obsolete in envsetup.mk after reading the BoardConfig.mk
-$(KATI_deprecate_export It is a global setting. See $(CHANGES_URL)#export_keyword)
+$(KATI_obsolete_var BUILD_BROKEN_ENG_DEBUG_TAGS)
+$(KATI_obsolete_export It is a global setting. See $(CHANGES_URL)#export_keyword)
+$(KATI_obsolete_var BUILD_BROKEN_ANDROIDMK_EXPORTS)
+$(KATI_obsolete_var PRODUCT_STATIC_BOOT_CONTROL_HAL,Use shared library module instead. See $(CHANGES_URL)#PRODUCT_STATIC_BOOT_CONTROL_HAL)
+$(KATI_obsolete_var \
+ ARCH_ARM_HAVE_ARMV7A \
+ ARCH_DSP_REV \
+ ARCH_HAVE_ALIGNED_DOUBLES \
+ ARCH_MIPS_HAS_DSP \
+ ARCH_MIPS_HAS_FPU \
+ ARCH_MIPS_REV6 \
+ ARCH_X86_HAVE_AES_NI \
+ ARCH_X86_HAVE_AVX \
+ ARCH_X86_HAVE_AVX2 \
+ ARCH_X86_HAVE_AVX512 \
+ ARCH_X86_HAVE_MOVBE \
+ ARCH_X86_HAVE_POPCNT \
+ ARCH_X86_HAVE_SSE4 \
+ ARCH_X86_HAVE_SSE4_2 \
+ ARCH_X86_HAVE_SSSE3 \
+)
+$(KATI_obsolete_var PRODUCT_IOT)
# Used to force goals to build. Only use for conditionally defined goals.
.PHONY: FORCE
@@ -119,6 +138,9 @@
.KATI_READONLY := TARGET_DEVICE_DIR
endif
+ONE_SHOT_MAKEFILE :=
+.KATI_READONLY := ONE_SHOT_MAKEFILE
+
# Set up efficient math functions which are used in make.
# Here since this file is included by envsetup as well as during build.
include $(BUILD_SYSTEM_COMMON)/math.mk
@@ -311,6 +333,7 @@
ifeq ($(CALLED_FROM_SETUP),true)
include $(BUILD_SYSTEM)/ccache.mk
include $(BUILD_SYSTEM)/goma.mk
+include $(BUILD_SYSTEM)/rbe.mk
endif
ifdef TARGET_PREFER_32_BIT
@@ -450,9 +473,6 @@
ifneq ($(filter true,$(SOONG_ALLOW_MISSING_DEPENDENCIES)),)
ALLOW_MISSING_DEPENDENCIES := true
endif
-ifneq ($(ONE_SHOT_MAKEFILE),)
-ALLOW_MISSING_DEPENDENCIES := true
-endif
.KATI_READONLY := ALLOW_MISSING_DEPENDENCIES
TARGET_BUILD_APPS_USE_PREBUILT_SDK :=
@@ -465,7 +485,6 @@
prebuilt_sdk_tools := prebuilts/sdk/tools
prebuilt_sdk_tools_bin := $(prebuilt_sdk_tools)/$(HOST_OS)/bin
-# Always use prebuilts for ckati and makeparallel
prebuilt_build_tools := prebuilts/build-tools
prebuilt_build_tools_wrappers := prebuilts/build-tools/common/bin
prebuilt_build_tools_jars := prebuilts/build-tools/common/framework
@@ -521,8 +540,8 @@
CKATI := $(prebuilt_build_tools_bin)/ckati
DEPMOD := $(HOST_OUT_EXECUTABLES)/depmod
FILESLIST := $(SOONG_HOST_OUT_EXECUTABLES)/fileslist
+FILESLIST_UTIL :=$= build/make/tools/fileslist_util.py
HOST_INIT_VERIFIER := $(HOST_OUT_EXECUTABLES)/host_init_verifier
-MAKEPARALLEL := $(prebuilt_build_tools_bin)/makeparallel
SOONG_JAVAC_WRAPPER := $(SOONG_HOST_OUT_EXECUTABLES)/soong_javac_wrapper
SOONG_ZIP := $(SOONG_HOST_OUT_EXECUTABLES)/soong_zip
MERGE_ZIPS := $(SOONG_HOST_OUT_EXECUTABLES)/merge_zips
@@ -557,7 +576,6 @@
VTSC := $(HOST_OUT_EXECUTABLES)/vtsc$(HOST_EXECUTABLE_SUFFIX)
MKBOOTFS := $(HOST_OUT_EXECUTABLES)/mkbootfs$(HOST_EXECUTABLE_SUFFIX)
MINIGZIP := $(HOST_OUT_EXECUTABLES)/minigzip$(HOST_EXECUTABLE_SUFFIX)
-BROTLI := $(HOST_OUT_EXECUTABLES)/brotli$(HOST_EXECUTABLE_SUFFIX)
ifeq (,$(strip $(BOARD_CUSTOM_MKBOOTIMG)))
MKBOOTIMG := $(HOST_OUT_EXECUTABLES)/mkbootimg$(HOST_EXECUTABLE_SUFFIX)
else
@@ -575,26 +593,23 @@
endif
APICHECK := $(HOST_OUT_JAVA_LIBRARIES)/metalava$(COMMON_JAVA_PACKAGE_SUFFIX)
FS_GET_STATS := $(HOST_OUT_EXECUTABLES)/fs_get_stats$(HOST_EXECUTABLE_SUFFIX)
-MAKE_EXT4FS := $(HOST_OUT_EXECUTABLES)/mke2fs$(HOST_EXECUTABLE_SUFFIX)
MKEXTUSERIMG := $(HOST_OUT_EXECUTABLES)/mkuserimg_mke2fs
MKE2FS_CONF := system/extras/ext4_utils/mke2fs.conf
-BLK_ALLOC_TO_BASE_FS := $(HOST_OUT_EXECUTABLES)/blk_alloc_to_base_fs$(HOST_EXECUTABLE_SUFFIX)
-MAKE_SQUASHFS := $(HOST_OUT_EXECUTABLES)/mksquashfs$(HOST_EXECUTABLE_SUFFIX)
MKSQUASHFSUSERIMG := $(HOST_OUT_EXECUTABLES)/mksquashfsimage.sh
-MAKE_F2FS := $(HOST_OUT_EXECUTABLES)/make_f2fs$(HOST_EXECUTABLE_SUFFIX)
MKF2FSUSERIMG := $(HOST_OUT_EXECUTABLES)/mkf2fsuserimg.sh
SIMG2IMG := $(HOST_OUT_EXECUTABLES)/simg2img$(HOST_EXECUTABLE_SUFFIX)
-IMG2SIMG := $(HOST_OUT_EXECUTABLES)/img2simg$(HOST_EXECUTABLE_SUFFIX)
E2FSCK := $(HOST_OUT_EXECUTABLES)/e2fsck$(HOST_EXECUTABLE_SUFFIX)
-MKTARBALL := build/make/tools/mktarball.sh
TUNE2FS := $(HOST_OUT_EXECUTABLES)/tune2fs$(HOST_EXECUTABLE_SUFFIX)
JARJAR := $(HOST_OUT_JAVA_LIBRARIES)/jarjar.jar
DATA_BINDING_COMPILER := $(HOST_OUT_JAVA_LIBRARIES)/databinding-compiler.jar
FAT16COPY := build/make/tools/fat16copy.py
-CHECK_LINK_TYPE := build/make/tools/check_link_type.py
CHECK_ELF_FILE := build/make/tools/check_elf_file.py
LPMAKE := $(HOST_OUT_EXECUTABLES)/lpmake$(HOST_EXECUTABLE_SUFFIX)
-BUILD_SUPER_IMAGE := build/make/tools/releasetools/build_super_image.py
+BUILD_IMAGE := $(HOST_OUT_EXECUTABLES)/build_image$(HOST_EXECUTABLE_SUFFIX)
+BUILD_SUPER_IMAGE := $(HOST_OUT_EXECUTABLES)/build_super_image$(HOST_EXECUTABLE_SUFFIX)
+MAKE_RECOVERY_PATCH := $(HOST_OUT_EXECUTABLES)/make_recovery_patch$(HOST_EXECUTABLE_SUFFIX)
+OTA_FROM_TARGET_FILES := $(HOST_OUT_EXECUTABLES)/ota_from_target_files$(HOST_EXECUTABLE_SUFFIX)
+SPARSE_IMG := $(HOST_OUT_EXECUTABLES)/sparse_img$(HOST_EXECUTABLE_SUFFIX)
PROGUARD_HOME := external/proguard
PROGUARD := $(PROGUARD_HOME)/bin/proguard.sh
@@ -610,7 +625,6 @@
FUTILITY := $(HOST_OUT_EXECUTABLES)/futility-host
VBOOT_SIGNER := $(HOST_OUT_EXECUTABLES)/vboot_signer
FEC := $(HOST_OUT_EXECUTABLES)/fec
-BRILLO_UPDATE_PAYLOAD := $(HOST_OUT_EXECUTABLES)/brillo_update_payload
DEXDUMP := $(HOST_OUT_EXECUTABLES)/dexdump$(BUILD_EXECUTABLE_SUFFIX)
PROFMAN := $(HOST_OUT_EXECUTABLES)/profman
@@ -807,6 +821,7 @@
26.0 \
27.0 \
28.0 \
+ 29.0 \
.KATI_READONLY := \
PLATFORM_SEPOLICY_COMPAT_VERSIONS \
@@ -872,10 +887,10 @@
endif
endif
-ifneq ($(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE),)
-ifneq ($(BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE),)
-$(error Should not define BOARD_PRODUCT_SERVICESIMAGE_PARTITION_SIZE and \
- BOARD_PRODUCT_SERVICESIMAGE_PARTITION_RESERVED_SIZE together)
+ifneq ($(BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE),)
+ifneq ($(BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE),)
+$(error Should not define BOARD_SYSTEM_EXTIMAGE_PARTITION_SIZE and \
+ BOARD_SYSTEM_EXTIMAGE_PARTITION_RESERVED_SIZE together)
endif
endif
@@ -892,19 +907,15 @@
# - BOARD_{GROUP}_PARTITION_PARTITION_LIST: the list of partitions that belongs to this group.
# If empty, no partitions belong to this group, and the sum of sizes is effectively 0.
$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
- $(eval BOARD_$(group)_PARTITION_LIST ?=) \
- $(eval .KATI_READONLY := BOARD_$(group)_PARTITION_LIST) \
-)
-ifeq ($(PRODUCT_BUILD_SUPER_PARTITION),true)
-$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
$(eval BOARD_$(group)_SIZE := $(strip $(BOARD_$(group)_SIZE))) \
$(if $(BOARD_$(group)_SIZE),,$(error BOARD_$(group)_SIZE must not be empty)) \
$(eval .KATI_READONLY := BOARD_$(group)_SIZE) \
+ $(eval BOARD_$(group)_PARTITION_LIST ?=) \
+ $(eval .KATI_READONLY := BOARD_$(group)_PARTITION_LIST) \
)
-endif # PRODUCT_BUILD_SUPER_PARTITION
# BOARD_*_PARTITION_LIST: a list of the following tokens
-valid_super_partition_list := system vendor product product_services odm
+valid_super_partition_list := system vendor product system_ext odm
$(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
$(if $(filter-out $(valid_super_partition_list),$(BOARD_$(group)_PARTITION_LIST)), \
$(error BOARD_$(group)_PARTITION_LIST contains invalid partition name \
@@ -923,10 +934,6 @@
$(BOARD_$(group)_PARTITION_LIST))
.KATI_READONLY := BOARD_SUPER_PARTITION_PARTITION_LIST
-endif # PRODUCT_USE_DYNAMIC_PARTITIONS
-
-ifeq ($(PRODUCT_BUILD_SUPER_PARTITION),true)
-
ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
ifeq ($(PRODUCT_RETROFIT_DYNAMIC_PARTITIONS),true)
@@ -986,8 +993,11 @@
endif # PRODUCT_RETROFIT_DYNAMIC_PARTITIONS
endif # BOARD_SUPER_PARTITION_SIZE
+BOARD_SUPER_PARTITION_BLOCK_DEVICES ?=
.KATI_READONLY := BOARD_SUPER_PARTITION_BLOCK_DEVICES
+BOARD_SUPER_PARTITION_METADATA_DEVICE ?=
.KATI_READONLY := BOARD_SUPER_PARTITION_METADATA_DEVICE
+BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE ?=
.KATI_READONLY := BOARD_BUILD_RETROFIT_DYNAMIC_PARTITIONS_OTA_PACKAGE
$(foreach device,$(call to-upper,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES)), \
@@ -996,7 +1006,7 @@
$(error BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE must not be empty)) \
$(eval .KATI_READONLY := BOARD_SUPER_PARTITION_$(device)_DEVICE_SIZE))
-endif # PRODUCT_BUILD_SUPER_PARTITION
+endif # PRODUCT_USE_DYNAMIC_PARTITIONS
# ###############################################################
# Set up final options.
@@ -1102,7 +1112,7 @@
TARGET_AVAIALBLE_SDK_VERSIONS := $(call numerically_sort,$(TARGET_AVAILABLE_SDK_VERSIONS))
TARGET_SDK_VERSIONS_WITHOUT_JAVA_18_SUPPORT := $(call numbers_less_than,24,$(TARGET_AVAILABLE_SDK_VERSIONS))
-TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT := $(call numbers_less_than,27,$(TARGET_AVAILABLE_SDK_VERSIONS))
+TARGET_SDK_VERSIONS_WITHOUT_JAVA_19_SUPPORT := $(call numbers_less_than,30,$(TARGET_AVAILABLE_SDK_VERSIONS))
ifndef INTERNAL_PLATFORM_PRIVATE_API_FILE
INTERNAL_PLATFORM_PRIVATE_API_FILE := $(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/private.txt
@@ -1118,8 +1128,11 @@
endif
# Missing optional uses-libraries so that the platform doesn't create build rules that depend on
-# them. See setup_one_odex.mk.
-INTERNAL_PLATFORM_MISSING_USES_LIBRARIES := com.google.android.ble com.google.android.wearable
+# them.
+INTERNAL_PLATFORM_MISSING_USES_LIBRARIES := \
+ com.google.android.ble \
+ com.google.android.media.effects \
+ com.google.android.wearable \
# This is the standard way to name a directory containing prebuilt target
# objects. E.g., prebuilt/$(TARGET_PREBUILT_TAG)/libc.so
@@ -1157,13 +1170,12 @@
# in the source tree.
dont_bother_goals := out \
snod systemimage-nodeps \
- stnod systemtarball-nodeps \
- userdataimage-nodeps userdatatarball-nodeps \
+ userdataimage-nodeps \
cacheimage-nodeps \
bptimage-nodeps \
vnod vendorimage-nodeps \
pnod productimage-nodeps \
- psnod productservicesimage-nodeps \
+ senod systemextimage-nodeps \
onod odmimage-nodeps \
systemotherimage-nodeps \
ramdisk-nodeps \
diff --git a/core/config_sanitizers.mk b/core/config_sanitizers.mk
index d3adee5..2439f79 100644
--- a/core/config_sanitizers.mk
+++ b/core/config_sanitizers.mk
@@ -235,12 +235,20 @@
my_sanitize := $(CLANG_DEFAULT_UB_CHECKS)
endif
-ifneq ($(filter coverage,$(my_sanitize)),)
- ifeq ($(filter address,$(my_sanitize)),)
- $(error $(LOCAL_PATH): $(LOCAL_MODULE): Use of 'coverage' also requires 'address')
- endif
- my_cflags += -fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp
- my_sanitize := $(filter-out coverage,$(my_sanitize))
+ifneq ($(filter fuzzer,$(my_sanitize)),)
+ # SANITIZE_TARGET='fuzzer' actually means to create the fuzzer coverage
+ # information, not to link against the fuzzer main().
+ my_sanitize := $(filter-out fuzzer,$(my_sanitize))
+ my_sanitize += fuzzer-no-link
+
+ # TODO(b/131771163): Disable LTO for fuzzer builds. Note that Cfi causes
+ # dependency on LTO.
+ my_sanitize := $(filter-out cfi,$(my_sanitize))
+ my_cflags += -fno-lto
+ my_ldflags += -fno-lto
+
+ # TODO(b/133876586): Disable experimental pass manager for fuzzer builds.
+ my_cflags += -fno-experimental-new-pass-manager
endif
ifneq ($(filter integer_overflow,$(my_sanitize)),)
@@ -280,7 +288,12 @@
my_cflags += -fsanitize=$(fsanitize_arg)
my_asflags += -fsanitize=$(fsanitize_arg)
- ifdef LOCAL_IS_HOST_MODULE
+ # When fuzzing, we wish to crash with diagnostics on any bug.
+ ifneq ($(filter fuzzer-no-link,$(my_sanitize)),)
+ my_cflags += -fno-sanitize-trap=all
+ my_cflags += -fno-sanitize-recover=all
+ my_ldflags += -fsanitize=fuzzer-no-link
+ else ifdef LOCAL_IS_HOST_MODULE
my_cflags += -fno-sanitize-recover=all
my_ldflags += -fsanitize=$(fsanitize_arg)
else
@@ -332,9 +345,6 @@
my_shared_libraries := $($(LOCAL_2ND_ARCH_VAR_PREFIX)ADDRESS_SANITIZER_RUNTIME_LIBRARY) \
$(my_shared_libraries)
endif
- ifeq (,$(filter $(LOCAL_MODULE),$(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)))
- my_static_libraries += $(ADDRESS_SANITIZER_CONFIG_EXTRA_STATIC_LIBRARIES)
- endif
# Do not add unnecessary dependency in shared libraries.
ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
@@ -378,7 +388,7 @@
ifneq ($(filter unsigned-integer-overflow signed-integer-overflow integer,$(my_sanitize)),)
ifeq ($(filter unsigned-integer-overflow signed-integer-overflow integer,$(my_sanitize_diag)),)
ifeq ($(filter cfi,$(my_sanitize_diag)),)
- ifeq ($(filter address hwaddress,$(my_sanitize)),)
+ ifeq ($(filter address hwaddress fuzzer-no-link,$(my_sanitize)),)
my_cflags += -fsanitize-minimal-runtime
my_cflags += -fno-sanitize-trap=integer
my_cflags += -fno-sanitize-recover=integer
diff --git a/core/construct_context.sh b/core/construct_context.sh
index 399c15d..794795a 100755
--- a/core/construct_context.sh
+++ b/core/construct_context.sh
@@ -22,6 +22,11 @@
# class_loader_context_arg: final class loader conext arg
# stored_class_loader_context_arg: final stored class loader context arg
+if [ -z "${target_sdk_version}" ]; then
+ echo "ERROR: target_sdk_version not set"
+ exit 2
+fi
+
# The hidl.manager shared library has a dependency on hidl.base. We'll manually
# add that information to the class loader context if we see those libraries.
hidl_manager="android.hidl.manager-V1.0-java"
diff --git a/core/definitions.mk b/core/definitions.mk
index af6248d..f32a995 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -364,7 +364,7 @@
###########################################################
define all-renderscript-files-under
-$(call find-subdir-files,$(1) \( -name "*.rs" -or -name "*.fs" \) -and -not -name ".*")
+$(call find-subdir-files,$(1) \( -name "*.rscript" -or -name "*.fs" \) -and -not -name ".*")
endef
###########################################################
@@ -425,8 +425,8 @@
define find-subdir-assets
$(sort $(if $(1),$(patsubst ./%,%, \
- $(shell if [ -d $(1) ] ; then cd $(1) ; find -L ./ -not -name '.*' -and -type f ; fi)), \
- $(warning Empty argument supplied to find-subdir-assets in $(LOCAL_PATH)) \
+ $(shell if [ -d $(1) ] ; then cd $(1) ; find -L ./ -not -name '.*' -and -type f ; fi)), \
+ $(warning Empty argument supplied to find-subdir-assets in $(LOCAL_PATH)) \
))
endef
@@ -782,8 +782,8 @@
#TODO(jbq): as of 20100106 nobody uses the second parameter
define get-tagged-modules
$(filter-out \
- $(call modules-for-tag-list,$(2)), \
- $(call modules-for-tag-list,$(1)))
+ $(call modules-for-tag-list,$(2)), \
+ $(call modules-for-tag-list,$(1)))
endef
###########################################################
@@ -950,16 +950,16 @@
@echo "Renderscript compatibility: $(notdir $@) <= $(notdir $<)"
$(hide) mkdir -p $(dir $@)
$(hide) $(BCC_COMPAT) -O3 -o $(dir $@)/$(notdir $(<:.bc=.o)) -fPIC -shared \
- -rt-path $(RS_PREBUILT_CLCORE) -mtriple $(RS_COMPAT_TRIPLE) $<
+ -rt-path $(RS_PREBUILT_CLCORE) -mtriple $(RS_COMPAT_TRIPLE) $<
$(hide) $(PRIVATE_CXX) -shared -Wl,-soname,$(notdir $@) -nostdlib \
- -Wl,-rpath,\$$ORIGIN/../lib \
- $(dir $@)/$(notdir $(<:.bc=.o)) \
- $(RS_PREBUILT_COMPILER_RT) \
- -o $@ $(CLANG_TARGET_GLOBAL_LDFLAGS) -Wl,--hash-style=sysv \
- -L $(SOONG_OUT_DIR)/ndk/platforms/android-$(PRIVATE_SDK_VERSION)/arch-$(TARGET_ARCH)/usr/lib64 \
- -L $(SOONG_OUT_DIR)/ndk/platforms/android-$(PRIVATE_SDK_VERSION)/arch-$(TARGET_ARCH)/usr/lib \
- $(call intermediates-dir-for,SHARED_LIBRARIES,libRSSupport)/libRSSupport.so \
- -lm -lc
+ -Wl,-rpath,\$$ORIGIN/../lib \
+ $(dir $@)/$(notdir $(<:.bc=.o)) \
+ $(RS_PREBUILT_COMPILER_RT) \
+ -o $@ $(CLANG_TARGET_GLOBAL_LDFLAGS) -Wl,--hash-style=sysv \
+ -L $(SOONG_OUT_DIR)/ndk/platforms/android-$(PRIVATE_SDK_VERSION)/arch-$(TARGET_ARCH)/usr/lib64 \
+ -L $(SOONG_OUT_DIR)/ndk/platforms/android-$(PRIVATE_SDK_VERSION)/arch-$(TARGET_ARCH)/usr/lib \
+ $(call intermediates-dir-for,SHARED_LIBRARIES,libRSSupport)/libRSSupport.so \
+ -lm -lc
endef
###########################################################
@@ -1012,7 +1012,7 @@
# You must call this with $(eval).
define define-aidl-java-rule
define-aidl-java-rule-src := $(patsubst %.aidl,%.java,$(subst ../,dotdot/,$(addprefix $(2)/,$(1))))
-$$(define-aidl-java-rule-src) : $(LOCAL_PATH)/$(1) $(AIDL)
+$$(define-aidl-java-rule-src) : $(call clean-path,$(LOCAL_PATH)/$(1)) $(AIDL)
$$(transform-aidl-to-java)
$(3) += $$(define-aidl-java-rule-src)
endef
@@ -1025,7 +1025,7 @@
# You must call this with $(eval).
define define-aidl-cpp-rule
define-aidl-cpp-rule-src := $(patsubst %.aidl,%$(LOCAL_CPP_EXTENSION),$(subst ../,dotdot/,$(addprefix $(2)/,$(1))))
-$$(define-aidl-cpp-rule-src) : $(LOCAL_PATH)/$(1) $(AIDL_CPP)
+$$(define-aidl-cpp-rule-src) : $(call clean-path,$(LOCAL_PATH)/$(1)) $(AIDL_CPP)
$$(transform-aidl-to-cpp)
$(3) += $$(define-aidl-cpp-rule-src)
endef
@@ -1082,7 +1082,7 @@
$(PRIVATE_PROTOC_FLAGS) \
$$f || exit 33; \
done
-$(hide) touch $@
+$(SOONG_ZIP) -o $@ -C $(PRIVATE_PROTO_JAVA_OUTPUT_DIR) -D $(PRIVATE_PROTO_JAVA_OUTPUT_DIR)
endef
######################################################################
@@ -1093,10 +1093,10 @@
@echo "Protoc: $@ <= $<"
@mkdir -p $(dir $@)
$(hide) \
- $(PROTOC) \
- $(addprefix --proto_path=, $(PRIVATE_PROTO_INCLUDES)) \
- $(PRIVATE_PROTOC_FLAGS) \
- $<
+ $(PROTOC) \
+ $(addprefix --proto_path=, $(PRIVATE_PROTO_INCLUDES)) \
+ $(PRIVATE_PROTOC_FLAGS) \
+ $<
@# aprotoc outputs only .cc. Rename it to .cpp if necessary.
$(if $(PRIVATE_RENAME_CPP_EXT),\
$(hide) mv $(basename $@).cc $@)
@@ -1107,7 +1107,7 @@
###########################################################
define c-includes
$(addprefix -I , $(PRIVATE_C_INCLUDES)) \
-$$(cat $(PRIVATE_IMPORT_INCLUDES))\
+$(foreach i,$(PRIVATE_IMPORTED_INCLUDES),$(EXPORTS.$(i)))\
$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),,\
$(addprefix -I ,\
$(filter-out $(PRIVATE_C_INCLUDES), \
@@ -1122,19 +1122,19 @@
###########################################################
define transform-cpp-to-o-compiler-args
- $(c-includes) \
- -c \
- $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
- $(PRIVATE_TARGET_GLOBAL_CFLAGS) \
- $(PRIVATE_TARGET_GLOBAL_CPPFLAGS) \
- $(PRIVATE_ARM_CFLAGS) \
- ) \
- $(PRIVATE_RTTI_FLAG) \
- $(PRIVATE_CFLAGS) \
- $(PRIVATE_CPPFLAGS) \
- $(PRIVATE_DEBUG_CFLAGS) \
- $(PRIVATE_CFLAGS_NO_OVERRIDE) \
- $(PRIVATE_CPPFLAGS_NO_OVERRIDE)
+$(c-includes) \
+-c \
+$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
+ $(PRIVATE_TARGET_GLOBAL_CFLAGS) \
+ $(PRIVATE_TARGET_GLOBAL_CPPFLAGS) \
+ $(PRIVATE_ARM_CFLAGS) \
+ ) \
+$(PRIVATE_RTTI_FLAG) \
+$(PRIVATE_CFLAGS) \
+$(PRIVATE_CPPFLAGS) \
+$(PRIVATE_DEBUG_CFLAGS) \
+$(PRIVATE_CFLAGS_NO_OVERRIDE) \
+$(PRIVATE_CPPFLAGS_NO_OVERRIDE)
endef
# PATH_TO_CLANG_TIDY is defined in build/soong
@@ -1172,14 +1172,14 @@
# $(1): extra flags
define transform-c-or-s-to-o-compiler-args
- $(c-includes) \
- -c \
- $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
- $(PRIVATE_TARGET_GLOBAL_CFLAGS) \
- $(PRIVATE_TARGET_GLOBAL_CONLYFLAGS) \
- $(PRIVATE_ARM_CFLAGS) \
- ) \
- $(1)
+$(c-includes) \
+-c \
+$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
+ $(PRIVATE_TARGET_GLOBAL_CFLAGS) \
+ $(PRIVATE_TARGET_GLOBAL_CONLYFLAGS) \
+ $(PRIVATE_ARM_CFLAGS) \
+ ) \
+ $(1)
endef
define transform-c-to-o-compiler-args
@@ -1245,17 +1245,17 @@
###########################################################
define transform-host-cpp-to-o-compiler-args
- $(c-includes) \
- -c \
- $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
- $(PRIVATE_HOST_GLOBAL_CFLAGS) \
- $(PRIVATE_HOST_GLOBAL_CPPFLAGS) \
- ) \
- $(PRIVATE_CFLAGS) \
- $(PRIVATE_CPPFLAGS) \
- $(PRIVATE_DEBUG_CFLAGS) \
- $(PRIVATE_CFLAGS_NO_OVERRIDE) \
- $(PRIVATE_CPPFLAGS_NO_OVERRIDE)
+$(c-includes) \
+-c \
+$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
+ $(PRIVATE_HOST_GLOBAL_CFLAGS) \
+ $(PRIVATE_HOST_GLOBAL_CPPFLAGS) \
+ ) \
+$(PRIVATE_CFLAGS) \
+$(PRIVATE_CPPFLAGS) \
+$(PRIVATE_DEBUG_CFLAGS) \
+$(PRIVATE_CFLAGS_NO_OVERRIDE) \
+$(PRIVATE_CPPFLAGS_NO_OVERRIDE)
endef
define clang-tidy-host-cpp
@@ -1285,12 +1285,12 @@
###########################################################
define transform-host-c-or-s-to-o-common-args
- $(c-includes) \
- -c \
- $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
- $(PRIVATE_HOST_GLOBAL_CFLAGS) \
- $(PRIVATE_HOST_GLOBAL_CONLYFLAGS) \
- )
+$(c-includes) \
+-c \
+$(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
+ $(PRIVATE_HOST_GLOBAL_CFLAGS) \
+ $(PRIVATE_HOST_GLOBAL_CONLYFLAGS) \
+ )
endef
# $(1): extra flags
@@ -1365,7 +1365,7 @@
# $(3): the variable name to collect the output object file.
define compile-dotdot-cpp-file
o := $(intermediates)/$(patsubst %$(LOCAL_CPP_EXTENSION),%.o,$(subst ../,$(DOTDOT_REPLACEMENT),$(1)))
-$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2)
+$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2) $(CLANG_CXX)
$$(transform-$$(PRIVATE_HOST)cpp-to-o)
$$(call include-depfiles-for-objs, $$(o))
$(3) += $$(o)
@@ -1378,7 +1378,7 @@
# $(3): the variable name to collect the output object file.
define compile-dotdot-c-file
o := $(intermediates)/$(patsubst %.c,%.o,$(subst ../,$(DOTDOT_REPLACEMENT),$(1)))
-$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2)
+$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2) $(CLANG)
$$(transform-$$(PRIVATE_HOST)c-to-o)
$$(call include-depfiles-for-objs, $$(o))
$(3) += $$(o)
@@ -1391,7 +1391,7 @@
# $(3): the variable name to collect the output object file.
define compile-dotdot-s-file
o := $(intermediates)/$(patsubst %.S,%.o,$(subst ../,$(DOTDOT_REPLACEMENT),$(1)))
-$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2)
+$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2) $(CLANG)
$$(transform-$$(PRIVATE_HOST)s-to-o)
$$(call include-depfiles-for-objs, $$(o))
$(3) += $$(o)
@@ -1404,7 +1404,7 @@
# $(3): the variable name to collect the output object file.
define compile-dotdot-s-file-no-deps
o := $(intermediates)/$(patsubst %.s,%.o,$(subst ../,$(DOTDOT_REPLACEMENT),$(1)))
-$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2)
+$$(o) : $(TOPDIR)$(LOCAL_PATH)/$(1) $(2) $(CLANG)
$$(transform-$$(PRIVATE_HOST)s-to-o)
$(3) += $$(o)
endef
@@ -1534,15 +1534,15 @@
define transform-o-to-aux-executable-inner
$(hide) $(PRIVATE_CXX) -pie \
- -Bdynamic \
- -Wl,--gc-sections \
- $(PRIVATE_ALL_OBJECTS) \
- -Wl,--whole-archive \
- $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
- -Wl,--no-whole-archive \
- $(PRIVATE_ALL_STATIC_LIBRARIES) \
- $(PRIVATE_LDFLAGS) \
- -o $@
+ -Bdynamic \
+ -Wl,--gc-sections \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
+ -Wl,--no-whole-archive \
+ $(PRIVATE_ALL_STATIC_LIBRARIES) \
+ $(PRIVATE_LDFLAGS) \
+ -o $@
endef
define transform-o-to-aux-executable
@@ -1553,16 +1553,16 @@
define transform-o-to-aux-static-executable-inner
$(hide) $(PRIVATE_CXX) \
- -Bstatic \
- -Wl,--gc-sections \
- $(PRIVATE_ALL_OBJECTS) \
- -Wl,--whole-archive \
- $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
- -Wl,--no-whole-archive \
- $(PRIVATE_ALL_STATIC_LIBRARIES) \
- $(PRIVATE_LDFLAGS) \
- -Wl,-Map=$(@).map \
- -o $@
+ -Bstatic \
+ -Wl,--gc-sections \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
+ -Wl,--no-whole-archive \
+ $(PRIVATE_ALL_STATIC_LIBRARIES) \
+ $(PRIVATE_LDFLAGS) \
+ -Wl,-Map=$(@).map \
+ -o $@
endef
define transform-o-to-aux-static-executable
@@ -1654,25 +1654,25 @@
ifneq ($(HOST_CUSTOM_LD_COMMAND),true)
define transform-host-o-to-shared-lib-inner
$(hide) $(PRIVATE_CXX) \
- -Wl,-rpath,\$$ORIGIN/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_SHARED_LIBRARIES)) \
- -Wl,-rpath,\$$ORIGIN/$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_SHARED_LIBRARIES)) \
- -shared -Wl,-soname,$(notdir $@) \
- $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
- $(PRIVATE_HOST_GLOBAL_LDFLAGS) \
- ) \
- $(PRIVATE_LDFLAGS) \
- $(PRIVATE_ALL_OBJECTS) \
- -Wl,--whole-archive \
- $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
- -Wl,--no-whole-archive \
- $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
- $(PRIVATE_ALL_STATIC_LIBRARIES) \
- $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
- $(if $(filter true,$(NATIVE_COVERAGE)),-lgcov) \
- $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_HOST_LIBPROFILE_RT)) \
- $(PRIVATE_ALL_SHARED_LIBRARIES) \
- -o $@ \
- $(PRIVATE_LDLIBS)
+ -Wl,-rpath,\$$ORIGIN/../$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_SHARED_LIBRARIES)) \
+ -Wl,-rpath,\$$ORIGIN/$(notdir $($(PRIVATE_2ND_ARCH_VAR_PREFIX)$(PRIVATE_PREFIX)OUT_SHARED_LIBRARIES)) \
+ -shared -Wl,-soname,$(notdir $@) \
+ $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
+ $(PRIVATE_HOST_GLOBAL_LDFLAGS) \
+ ) \
+ $(PRIVATE_LDFLAGS) \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
+ -Wl,--no-whole-archive \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
+ $(PRIVATE_ALL_STATIC_LIBRARIES) \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
+ $(if $(filter true,$(NATIVE_COVERAGE)),-lgcov) \
+ $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_HOST_LIBPROFILE_RT)) \
+ $(PRIVATE_ALL_SHARED_LIBRARIES) \
+ -o $@ \
+ $(PRIVATE_LDLIBS)
endef
endif
@@ -1695,27 +1695,27 @@
define transform-o-to-shared-lib-inner
$(hide) $(PRIVATE_CXX) \
- -nostdlib -Wl,-soname,$(notdir $@) \
- -Wl,--gc-sections \
- -shared \
- $(PRIVATE_TARGET_CRTBEGIN_SO_O) \
- $(PRIVATE_ALL_OBJECTS) \
- -Wl,--whole-archive \
- $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
- -Wl,--no-whole-archive \
- $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
- $(PRIVATE_ALL_STATIC_LIBRARIES) \
- $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
- $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
- $(PRIVATE_TARGET_LIBCRT_BUILTINS) \
- $(PRIVATE_TARGET_LIBATOMIC) \
- $(PRIVATE_TARGET_LIBGCC) \
- $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
- $(PRIVATE_LDFLAGS) \
- $(PRIVATE_ALL_SHARED_LIBRARIES) \
- -o $@ \
- $(PRIVATE_TARGET_CRTEND_SO_O) \
- $(PRIVATE_LDLIBS)
+ -nostdlib -Wl,-soname,$(notdir $@) \
+ -Wl,--gc-sections \
+ -shared \
+ $(PRIVATE_TARGET_CRTBEGIN_SO_O) \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
+ -Wl,--no-whole-archive \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
+ $(PRIVATE_ALL_STATIC_LIBRARIES) \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
+ $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
+ $(PRIVATE_TARGET_LIBCRT_BUILTINS) \
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(PRIVATE_TARGET_LIBGCC) \
+ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
+ $(PRIVATE_LDFLAGS) \
+ $(PRIVATE_ALL_SHARED_LIBRARIES) \
+ -o $@ \
+ $(PRIVATE_TARGET_CRTEND_SO_O) \
+ $(PRIVATE_LDLIBS)
endef
define transform-o-to-shared-lib
@@ -1730,28 +1730,28 @@
define transform-o-to-executable-inner
$(hide) $(PRIVATE_CXX) -pie \
- -nostdlib -Bdynamic \
- -Wl,-dynamic-linker,$(PRIVATE_LINKER) \
- -Wl,--gc-sections \
- -Wl,-z,nocopyreloc \
- $(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O) \
- $(PRIVATE_ALL_OBJECTS) \
- -Wl,--whole-archive \
- $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
- -Wl,--no-whole-archive \
- $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
- $(PRIVATE_ALL_STATIC_LIBRARIES) \
- $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
- $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
- $(PRIVATE_TARGET_LIBCRT_BUILTINS) \
- $(PRIVATE_TARGET_LIBATOMIC) \
- $(PRIVATE_TARGET_LIBGCC) \
- $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
- $(PRIVATE_LDFLAGS) \
- $(PRIVATE_ALL_SHARED_LIBRARIES) \
- -o $@ \
- $(PRIVATE_TARGET_CRTEND_O) \
- $(PRIVATE_LDLIBS)
+ -nostdlib -Bdynamic \
+ -Wl,-dynamic-linker,$(PRIVATE_LINKER) \
+ -Wl,--gc-sections \
+ -Wl,-z,nocopyreloc \
+ $(PRIVATE_TARGET_CRTBEGIN_DYNAMIC_O) \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
+ -Wl,--no-whole-archive \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
+ $(PRIVATE_ALL_STATIC_LIBRARIES) \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
+ $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
+ $(PRIVATE_TARGET_LIBCRT_BUILTINS) \
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(PRIVATE_TARGET_LIBGCC) \
+ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
+ $(PRIVATE_LDFLAGS) \
+ $(PRIVATE_ALL_SHARED_LIBRARIES) \
+ -o $@ \
+ $(PRIVATE_TARGET_CRTEND_O) \
+ $(PRIVATE_LDLIBS)
endef
define transform-o-to-executable
@@ -1773,28 +1773,28 @@
define transform-o-to-static-executable-inner
$(hide) $(PRIVATE_CXX) \
- -nostdlib -Bstatic \
- $(if $(filter $(PRIVATE_LDFLAGS),-shared),,-static) \
- -Wl,--gc-sections \
- -o $@ \
- $(PRIVATE_TARGET_CRTBEGIN_STATIC_O) \
- $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
- $(PRIVATE_LDFLAGS) \
- $(PRIVATE_ALL_OBJECTS) \
- -Wl,--whole-archive \
- $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
- -Wl,--no-whole-archive \
- $(filter-out %libcompiler_rt.hwasan.a %libc_nomalloc.hwasan.a %libc.hwasan.a %libcompiler_rt.a %libc_nomalloc.a %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
- -Wl,--start-group \
- $(filter %libc.a %libc.hwasan.a,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
- $(filter %libc_nomalloc.a %libc_nomalloc.hwasan.a,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
- $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
- $(PRIVATE_TARGET_LIBATOMIC) \
- $(filter %libcompiler_rt.a %libcompiler_rt.hwasan.a,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
- $(PRIVATE_TARGET_LIBCRT_BUILTINS) \
- $(PRIVATE_TARGET_LIBGCC) \
- -Wl,--end-group \
- $(PRIVATE_TARGET_CRTEND_O)
+ -nostdlib -Bstatic \
+ $(if $(filter $(PRIVATE_LDFLAGS),-shared),,-static) \
+ -Wl,--gc-sections \
+ -o $@ \
+ $(PRIVATE_TARGET_CRTBEGIN_STATIC_O) \
+ $(PRIVATE_TARGET_GLOBAL_LDFLAGS) \
+ $(PRIVATE_LDFLAGS) \
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
+ -Wl,--no-whole-archive \
+ $(filter-out %libcompiler_rt.hwasan.a %libc_nomalloc.hwasan.a %libc.hwasan.a %libcompiler_rt.a %libc_nomalloc.a %libc.a,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ -Wl,--start-group \
+ $(filter %libc.a %libc.hwasan.a,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(filter %libc_nomalloc.a %libc_nomalloc.hwasan.a,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_TARGET_COVERAGE_LIB)) \
+ $(PRIVATE_TARGET_LIBATOMIC) \
+ $(filter %libcompiler_rt.a %libcompiler_rt.hwasan.a,$(PRIVATE_ALL_STATIC_LIBRARIES)) \
+ $(PRIVATE_TARGET_LIBCRT_BUILTINS) \
+ $(PRIVATE_TARGET_LIBGCC) \
+ -Wl,--end-group \
+ $(PRIVATE_TARGET_CRTEND_O)
endef
define transform-o-to-static-executable
@@ -1811,24 +1811,24 @@
ifneq ($(HOST_CUSTOM_LD_COMMAND),true)
define transform-host-o-to-executable-inner
$(hide) $(PRIVATE_CXX) \
- $(PRIVATE_ALL_OBJECTS) \
- -Wl,--whole-archive \
- $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
- -Wl,--no-whole-archive \
- $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
- $(PRIVATE_ALL_STATIC_LIBRARIES) \
- $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
- $(if $(filter true,$(NATIVE_COVERAGE)),-lgcov) \
- $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_HOST_LIBPROFILE_RT)) \
- $(PRIVATE_ALL_SHARED_LIBRARIES) \
- $(foreach path,$(PRIVATE_RPATHS), \
- -Wl,-rpath,\$$ORIGIN/$(path)) \
- $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
- $(PRIVATE_HOST_GLOBAL_LDFLAGS) \
- ) \
- $(PRIVATE_LDFLAGS) \
- -o $@ \
- $(PRIVATE_LDLIBS)
+ $(PRIVATE_ALL_OBJECTS) \
+ -Wl,--whole-archive \
+ $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES) \
+ -Wl,--no-whole-archive \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--start-group) \
+ $(PRIVATE_ALL_STATIC_LIBRARIES) \
+ $(if $(PRIVATE_GROUP_STATIC_LIBRARIES),-Wl$(comma)--end-group) \
+ $(if $(filter true,$(NATIVE_COVERAGE)),-lgcov) \
+ $(if $(filter true,$(NATIVE_COVERAGE)),$(PRIVATE_HOST_LIBPROFILE_RT)) \
+ $(PRIVATE_ALL_SHARED_LIBRARIES) \
+ $(foreach path,$(PRIVATE_RPATHS), \
+ -Wl,-rpath,\$$ORIGIN/$(path)) \
+ $(if $(PRIVATE_NO_DEFAULT_COMPILER_FLAGS),, \
+ $(PRIVATE_HOST_GLOBAL_LDFLAGS) \
+ ) \
+ $(PRIVATE_LDFLAGS) \
+ -o $@ \
+ $(PRIVATE_LDLIBS)
endef
endif
@@ -1838,6 +1838,16 @@
$(transform-host-o-to-executable-inner)
endef
+###########################################################
+## Commands for packaging native coverage files
+###########################################################
+define package-coverage-files
+ @rm -f $@ $@.lst $@.premerged
+ @touch $@.lst
+ $(foreach obj,$(strip $(PRIVATE_ALL_OBJECTS)), $(hide) echo $(obj) >> $@.lst$(newline))
+ $(hide) $(SOONG_ZIP) -o $@.premerged -C $(OUT_DIR) -l $@.lst
+ $(hide) $(MERGE_ZIPS) -ignore-duplicates $@ $@.premerged $(strip $(PRIVATE_ALL_WHOLE_STATIC_LIBRARIES))
+endef
###########################################################
## Commands for running javac to make .class files
@@ -1853,15 +1863,15 @@
-name Manifest.java 2> /dev/null`; do \
dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_MANIFEST_FILE`; \
mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
- $(ACP) -fp $$GENERATED_MANIFEST_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
+ cp $$GENERATED_MANIFEST_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
done;
$(hide) for GENERATED_R_FILE in `find $(1) \
-name R.java 2> /dev/null`; do \
dir=`awk '/package/{gsub(/\./,"/",$$2);gsub(/;/,"",$$2);print $$2;exit}' $$GENERATED_R_FILE`; \
mkdir -p $(TARGET_COMMON_OUT_ROOT)/R/$$dir; \
- $(ACP) -fp $$GENERATED_R_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir \
+ cp $$GENERATED_R_FILE $(TARGET_COMMON_OUT_ROOT)/R/$$dir \
|| exit 31; \
- $(ACP) -fp $$GENERATED_R_FILE $(2) || exit 32; \
+ cp $$GENERATED_R_FILE $(2) || exit 32; \
done;
@# Ensure that the target file is always created, i.e. also in case we did not
@# enter the GENERATED_R_FILE-loop above. This avoids unnecessary rebuilding.
@@ -1873,20 +1883,20 @@
###########################################################
define aapt2-compile-one-resource-file
@mkdir -p $(dir $@)
-$(hide) $(AAPT2) compile -o $(dir $@) $(PRIVATE_AAPT2_CFLAGS) --legacy $<
+$(hide) $(AAPT2) compile -o $(dir $@) $(PRIVATE_AAPT2_CFLAGS) $<
endef
define aapt2-compile-resource-dirs
@mkdir -p $(dir $@)
$(hide) $(AAPT2) compile -o $@ $(addprefix --dir ,$(PRIVATE_SOURCE_RES_DIRS)) \
- $(PRIVATE_AAPT2_CFLAGS) --legacy
+ $(PRIVATE_AAPT2_CFLAGS)
endef
# TODO(b/74574557): use aapt2 compile --zip if it gets implemented
define aapt2-compile-resource-zips
@mkdir -p $(dir $@)
$(ZIPSYNC) -d $@.contents -l $@.list $(PRIVATE_SOURCE_RES_ZIPS)
-$(hide) $(AAPT2) compile -o $@ --dir $@.contents $(PRIVATE_AAPT2_CFLAGS) --legacy
+$(hide) $(AAPT2) compile -o $@ --dir $@.contents $(PRIVATE_AAPT2_CFLAGS)
endef
# Set up rule to compile one resource file with aapt2.
@@ -1925,7 +1935,7 @@
$(addprefix --manifest ,$(PRIVATE_ANDROID_MANIFEST)) \
$(addprefix -I ,$(PRIVATE_AAPT_INCLUDES)) \
$(addprefix -I ,$(PRIVATE_SHARED_ANDROID_LIBRARIES)) \
- $(addprefix -A ,$(PRIVATE_ASSET_DIR)) \
+ $(addprefix -A ,$(foreach d,$(PRIVATE_ASSET_DIR),$(call clean-path,$(d)))) \
$(addprefix --java ,$(PRIVATE_JAVA_GEN_DIR)) \
$(addprefix --proguard ,$(PRIVATE_PROGUARD_OPTIONS_FILE)) \
$(addprefix --min-sdk-version ,$(PRIVATE_DEFAULT_APP_TARGET_SDK)) \
@@ -2013,8 +2023,6 @@
$(hide) if [ -d "$(PRIVATE_SOURCE_INTERMEDIATES_DIR)" ]; then \
find $(PRIVATE_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $(1); \
fi
-$(if $(PRIVATE_HAS_PROTO_SOURCES), \
- $(hide) find $(PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR) -name '*.java' -and -not -name '.*' >> $(1))
endef
# Some historical notes:
@@ -2307,13 +2315,15 @@
echo "Install path on $(TARGET_PRODUCT)-$(TARGET_BUILD_VARIANT): $(PRIVATE_INSTALLED_MODULE)" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
echo >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log
endef
+ART_VERIDEX_APPCOMPAT_SCRIPT:=$(HOST_OUT)/bin/appcompat.sh
define run-appcompat
$(hide) \
echo "appcompat.sh output:" >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log && \
- PACKAGING=$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING ANDROID_LOG_TAGS="*:e" art/tools/veridex/appcompat.sh --dex-file=$@ --api-flags=$(INTERNAL_PLATFORM_HIDDENAPI_FLAGS) 2>&1 >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log
+ PACKAGING=$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING ANDROID_LOG_TAGS="*:e" $(ART_VERIDEX_APPCOMPAT_SCRIPT) --dex-file=$@ --api-flags=$(INTERNAL_PLATFORM_HIDDENAPI_FLAGS) 2>&1 >> $(PRODUCT_OUT)/appcompat/$(PRIVATE_MODULE).log
endef
appcompat-files = \
- art/tools/veridex/appcompat.sh \
+ $(AAPT2) \
+ $(ART_VERIDEX_APPCOMPAT_SCRIPT) \
$(INTERNAL_PLATFORM_HIDDENAPI_FLAGS) \
$(HOST_OUT_EXECUTABLES)/veridex \
$(TARGET_OUT_COMMON_INTERMEDIATES)/PACKAGING/core_dex_intermediates/classes.dex \
@@ -2409,16 +2419,6 @@
$(if $(filter-out $(2), $(LOCAL_INSTALLED_MODULE)), $(1):$(2))
endef
-# Create copy pair for $(1) $(2)
-# If $(2) is substring of $(3) do nothing.
-# $(1): source path
-# $(2): destination path
-# $(3): filter-out target
-# The format of copy pair is src:dst
-define filter-copy-pair
-$(if $(findstring $(2), $(3)),,$(1):$(2))
-endef
-
# Copies many files.
# $(1): The files to copy. Each entry is a ':' separated src:dst pair
# $(2): An optional directory to prepend to the destination
@@ -2441,8 +2441,20 @@
define copy-init-script-file-checked
# Host init verifier doesn't exist on darwin.
ifneq ($(HOST_OS),darwin)
-$(2): $(1) $(HOST_INIT_VERIFIER) $(call intermediates-dir-for,ETC,passwd)/passwd
- $(hide) $(HOST_INIT_VERIFIER) $$< $(call intermediates-dir-for,ETC,passwd)/passwd
+$(2): \
+ $(1) \
+ $(HOST_INIT_VERIFIER) \
+ $(HIDL_INHERITANCE_HIERARCHY) \
+ $(call intermediates-dir-for,ETC,passwd_system)/passwd_system \
+ $(call intermediates-dir-for,ETC,passwd_vendor)/passwd_vendor \
+ $(call intermediates-dir-for,ETC,passwd_odm)/passwd_odm \
+ $(call intermediates-dir-for,ETC,passwd_product)/passwd_product
+ $(hide) $(HOST_INIT_VERIFIER) \
+ -p $(call intermediates-dir-for,ETC,passwd_system)/passwd_system \
+ -p $(call intermediates-dir-for,ETC,passwd_vendor)/passwd_vendor \
+ -p $(call intermediates-dir-for,ETC,passwd_odm)/passwd_odm \
+ -p $(call intermediates-dir-for,ETC,passwd_product)/passwd_product \
+ -i $(HIDL_INHERITANCE_HIERARCHY) $$<
else
$(2): $(1)
endif
@@ -2724,60 +2736,6 @@
###########################################################
-# Override the package defined in $(1), setting the
-# variables listed below differently.
-#
-# $(1): The makefile to override (relative to the source
-# tree root)
-# $(2): Old LOCAL_PACKAGE_NAME value.
-# $(3): New LOCAL_PACKAGE_NAME value.
-# $(4): New LOCAL_MANIFEST_PACKAGE_NAME value.
-# $(5): New LOCAL_CERTIFICATE value.
-# $(6): New LOCAL_INSTRUMENTATION_FOR value.
-# $(7): New LOCAL_MANIFEST_INSTRUMENTATION_FOR value.
-# $(8): New LOCAL_COMPATIBILITY_SUITE value.
-#
-# Note that LOCAL_PACKAGE_OVERRIDES is NOT cleared in
-# clear_vars.mk.
-###########################################################
-define inherit-package
- $(eval $(call inherit-package-internal,$(1),$(2),$(3),$(4),$(5),$(6),$(7),$(8)))
-endef
-
-define inherit-package-internal
- LOCAL_PACKAGE_OVERRIDES \
- := $(strip $(1))||$(strip $(2))||$(strip $(3))||$(strip $(4))||&&$(strip $(5))||&&$(strip $(6))||&&$(strip $(7))||&&$(strip $(8)) $(LOCAL_PACKAGE_OVERRIDES)
- include $(1)
- LOCAL_PACKAGE_OVERRIDES \
- := $(wordlist 1,$(words $(LOCAL_PACKAGE_OVERRIDES)), $(LOCAL_PACKAGE_OVERRIDES))
-endef
-
-# To be used with inherit-package above
-# Evalutes to true if the package was overridden
-define set-inherited-package-variables
-$(strip $(call set-inherited-package-variables-internal))
-endef
-
-define keep-or-override
-$(eval $(1) := $(if $(2),$(2),$($(1))))
-endef
-
-define set-inherited-package-variables-internal
- $(eval _o := $(subst ||, ,$(lastword $(LOCAL_PACKAGE_OVERRIDES))))
- $(eval _n := $(subst ||, ,$(firstword $(LOCAL_PACKAGE_OVERRIDES))))
- $(if $(filter $(word 2,$(_n)),$(LOCAL_PACKAGE_NAME)), \
- $(eval LOCAL_PACKAGE_NAME := $(word 3,$(_o))) \
- $(eval LOCAL_MANIFEST_PACKAGE_NAME := $(word 4,$(_o))) \
- $(call keep-or-override,LOCAL_CERTIFICATE,$(patsubst &&%,%,$(word 5,$(_o)))) \
- $(call keep-or-override,LOCAL_INSTRUMENTATION_FOR,$(patsubst &&%,%,$(word 6,$(_o)))) \
- $(call keep-or-override,LOCAL_MANIFEST_INSTRUMENTATION_FOR,$(patsubst &&%,%,$(word 7,$(_o)))) \
- $(call keep-or-override,LOCAL_COMPATIBILITY_SUITE,$(patsubst &&%,%,$(word 8,$(_o)))) \
- $(eval LOCAL_OVERRIDES_PACKAGES := $(sort $(LOCAL_OVERRIDES_PACKAGES) $(word 2,$(_o)))) \
- true \
- ,)
-endef
-
-###########################################################
## API Check
###########################################################
@@ -3309,7 +3267,8 @@
$(KATI_obsolete_var \
create-empty-package \
initialize-package-file \
- add-jni-shared-libs-to-package,\
+ add-jni-shared-libs-to-package \
+ inherit-package,\
These functions have been removed)
###########################################################
@@ -3323,7 +3282,7 @@
define verify-vndk-libs-identical
@echo "Checking VNDK vendor variant: $(2)"
$(hide) CLANG_BIN="$(LLVM_PREBUILTS_PATH)" \
- CROSS_COMPILE="$(strip $(3))" \
- XZ="$(XZ)" \
- $(LIBRARY_IDENTITY_CHECK_SCRIPT) $(SOONG_STRIP_PATH) $(1) $(2)
+ CROSS_COMPILE="$(strip $(3))" \
+ XZ="$(XZ)" \
+ $(LIBRARY_IDENTITY_CHECK_SCRIPT) $(SOONG_STRIP_PATH) $(1) $(2)
endef
diff --git a/core/deprecation.mk b/core/deprecation.mk
index 11fe290..761a9b6 100644
--- a/core/deprecation.mk
+++ b/core/deprecation.mk
@@ -10,7 +10,6 @@
BUILD_HOST_JAVA_LIBRARY \
BUILD_HOST_PREBUILT \
BUILD_HOST_SHARED_LIBRARY \
- BUILD_HOST_STATIC_LIBRARY \
BUILD_JAVA_LIBRARY \
BUILD_MULTI_PREBUILT \
BUILD_NATIVE_TEST \
@@ -28,19 +27,20 @@
# relevant BUILD_BROKEN_USES_BUILD_* variables, then these would move to
# DEFAULT_ERROR_BUILD_MODULE_TYPES.
DEFAULT_WARNING_BUILD_MODULE_TYPES :=$= \
- BUILD_AUX_EXECUTABLE \
- BUILD_AUX_STATIC_LIBRARY \
- BUILD_HOST_FUZZ_TEST \
- BUILD_HOST_NATIVE_TEST \
- BUILD_HOST_STATIC_TEST_LIBRARY \
- BUILD_NATIVE_BENCHMARK \
- BUILD_STATIC_TEST_LIBRARY \
+ BUILD_HOST_STATIC_LIBRARY \
# These are BUILD_* variables that are errors to reference, but you can set
# BUILD_BROKEN_USES_BUILD_* in your BoardConfig.mk in order to turn them back
# to warnings.
DEFAULT_ERROR_BUILD_MODULE_TYPES :=$= \
+ BUILD_AUX_EXECUTABLE \
+ BUILD_AUX_STATIC_LIBRARY \
+ BUILD_HOST_FUZZ_TEST \
+ BUILD_HOST_NATIVE_TEST \
+ BUILD_HOST_STATIC_TEST_LIBRARY \
BUILD_HOST_TEST_CONFIG \
+ BUILD_NATIVE_BENCHMARK \
+ BUILD_STATIC_TEST_LIBRARY \
BUILD_TARGET_TEST_CONFIG \
# These are BUILD_* variables that are always errors to reference.
diff --git a/core/dex_preopt_config.mk b/core/dex_preopt_config.mk
index c44e4bd..b856bf4 100644
--- a/core/dex_preopt_config.mk
+++ b/core/dex_preopt_config.mk
@@ -8,8 +8,8 @@
SYSTEM_OTHER_ODEX_FILTER ?= \
app/% \
priv-app/% \
- product_services/app/% \
- product_services/priv-app/% \
+ system_ext/app/% \
+ system_ext/priv-app/% \
product/app/% \
product/priv-app/% \
@@ -116,7 +116,6 @@
$(call add_json_bool, NeverSystemServerDebugInfo, $(filter false,$(PRODUCT_SYSTEM_SERVER_DEBUG_INFO)))
$(call add_json_bool, AlwaysOtherDebugInfo, $(filter true,$(PRODUCT_OTHER_JAVA_DEBUG_INFO)))
$(call add_json_bool, NeverOtherDebugInfo, $(filter false,$(PRODUCT_OTHER_JAVA_DEBUG_INFO)))
- $(call add_json_list, MissingUsesLibraries, $(INTERNAL_PLATFORM_MISSING_USES_LIBRARIES))
$(call add_json_bool, IsEng, $(filter eng,$(TARGET_BUILD_VARIANT)))
$(call add_json_bool, SanitizeLite, $(SANITIZE_LITE))
$(call add_json_bool, DefaultAppImages, $(WITH_DEX_PREOPT_APP_IMAGE))
@@ -139,9 +138,7 @@
$(call end_json_map)
$(call add_json_str, DirtyImageObjects, $(DIRTY_IMAGE_OBJECTS))
- $(call add_json_str, PreloadedClasses, $(PRELOADED_CLASSES))
$(call add_json_list, BootImageProfiles, $(PRODUCT_DEX_PREOPT_BOOT_IMAGE_PROFILE_LOCATION))
- $(call add_json_bool, UseProfileForBootImage, $(call invert_bool,$(filter false,$(PRODUCT_USE_PROFILE_FOR_BOOT_IMAGE))))
$(call add_json_str, BootFlags, $(PRODUCT_DEX_PREOPT_BOOT_FLAGS))
$(call add_json_str, Dex2oatImageXmx, $(DEX2OAT_IMAGE_XMX))
$(call add_json_str, Dex2oatImageXms, $(DEX2OAT_IMAGE_XMS))
@@ -152,7 +149,7 @@
$(call add_json_str, Aapt, $(SOONG_HOST_OUT_EXECUTABLES)/aapt)
$(call add_json_str, SoongZip, $(SOONG_ZIP))
$(call add_json_str, Zip2zip, $(ZIP2ZIP))
- $(call add_json_str, VerifyUsesLibraries, $(BUILD_SYSTEM)/verify_uses_libraries.sh)
+ $(call add_json_str, ManifestCheck, $(SOONG_HOST_OUT_EXECUTABLES)/manifest_check)
$(call add_json_str, ConstructContext, $(BUILD_SYSTEM)/construct_context.sh)
$(call end_json_map)
@@ -175,7 +172,6 @@
$(SOONG_HOST_OUT_EXECUTABLES)/aapt \
$(SOONG_ZIP) \
$(ZIP2ZIP) \
- $(BUILD_SYSTEM)/verify_uses_libraries.sh \
$(BUILD_SYSTEM)/construct_context.sh \
DEXPREOPT_STRIP_DEPS := \
diff --git a/core/dex_preopt_odex_install.mk b/core/dex_preopt_odex_install.mk
index 266ebd2..50e922e 100644
--- a/core/dex_preopt_odex_install.mk
+++ b/core/dex_preopt_odex_install.mk
@@ -103,20 +103,9 @@
endif
endif
-# If LOCAL_ENFORCE_USES_LIBRARIES is not set, default to true if either of LOCAL_USES_LIBRARIES or
-# LOCAL_OPTIONAL_USES_LIBRARIES are specified.
-ifeq (,$(LOCAL_ENFORCE_USES_LIBRARIES))
- # Will change the default to true unconditionally in the future.
- ifneq (,$(LOCAL_OPTIONAL_USES_LIBRARIES))
- LOCAL_ENFORCE_USES_LIBRARIES := true
- endif
- ifneq (,$(LOCAL_USES_LIBRARIES))
- LOCAL_ENFORCE_USES_LIBRARIES := true
- endif
-endif
-
my_dexpreopt_archs :=
my_dexpreopt_images :=
+my_dexpreopt_images_deps :=
my_dexpreopt_infix := boot
ifeq (true, $(DEXPREOPT_USE_APEX_IMAGE))
my_dexpreopt_infix := apex
@@ -155,12 +144,14 @@
# Odex for the 1st arch
my_dexpreopt_archs += $(TARGET_ARCH)
my_dexpreopt_images += $(DEXPREOPT_IMAGE_$(my_dexpreopt_infix)_$(TARGET_ARCH))
+ my_dexpreopt_images_deps += $(DEXPREOPT_IMAGE_DEPS_$(my_dexpreopt_infix)_$(TARGET_ARCH))
# Odex for the 2nd arch
ifdef TARGET_2ND_ARCH
ifneq ($(TARGET_TRANSLATE_2ND_ARCH),true)
ifneq (first,$(my_module_multilib))
my_dexpreopt_archs += $(TARGET_2ND_ARCH)
my_dexpreopt_images += $(DEXPREOPT_IMAGE_$(my_dexpreopt_infix)_$(TARGET_2ND_ARCH))
+ my_dexpreopt_images_deps += $(DEXPREOPT_IMAGE_DEPS_$(my_dexpreopt_infix)_$(TARGET_2ND_ARCH))
endif # my_module_multilib is not first.
endif # TARGET_TRANSLATE_2ND_ARCH not true
endif # TARGET_2ND_ARCH
@@ -172,6 +163,8 @@
my_dexpreopt_archs += $(TARGET_$(my_2nd_arch_prefix)ARCH)
my_dexpreopt_images += \
$(DEXPREOPT_IMAGE_$(my_dexpreopt_infix)_$(TARGET_$(my_2nd_arch_prefix)ARCH))
+ my_dexpreopt_images_deps += \
+ $(DEXPREOPT_IMAGE_DEPS_$(my_dexpreopt_infix)_$(TARGET_$(my_2nd_arch_prefix)ARCH))
ifdef TARGET_2ND_ARCH
ifeq ($(my_module_multilib),both)
# The non-preferred arch
@@ -179,10 +172,28 @@
my_dexpreopt_archs += $(TARGET_$(my_2nd_arch_prefix)ARCH)
my_dexpreopt_images += \
$(DEXPREOPT_IMAGE_$(my_dexpreopt_infix)_$(TARGET_$(my_2nd_arch_prefix)ARCH))
+ my_dexpreopt_images_deps += \
+ $(DEXPREOPT_IMAGE_DEPS_$(my_dexpreopt_infix)_$(TARGET_$(my_2nd_arch_prefix)ARCH))
endif # LOCAL_MULTILIB is both
endif # TARGET_2ND_ARCH
endif # LOCAL_MODULE_CLASS
+ my_filtered_optional_uses_libraries := $(filter-out $(INTERNAL_PLATFORM_MISSING_USES_LIBRARIES), \
+ $(LOCAL_OPTIONAL_USES_LIBRARIES))
+
+ # dexpreopt needs the paths to the dex jars of these libraries in case
+ # construct_context.sh needs to pass them to dex2oat.
+ my_extra_dexpreopt_libs := \
+ org.apache.http.legacy \
+ android.hidl.base-V1.0-java \
+ android.hidl.manager-V1.0-java \
+
+ my_dexpreopt_libs := $(sort \
+ $(LOCAL_USES_LIBRARIES) \
+ $(my_filtered_optional_uses_libraries) \
+ $(my_extra_dexpreopt_libs) \
+ )
+
# Record dex-preopt config.
DEXPREOPT.$(LOCAL_MODULE).DEX_PREOPT := $(LOCAL_DEX_PREOPT)
DEXPREOPT.$(LOCAL_MODULE).MULTILIB := $(LOCAL_MULTILIB)
@@ -202,6 +213,7 @@
$(call add_json_str, Name, $(LOCAL_MODULE))
$(call add_json_str, DexLocation, $(patsubst $(PRODUCT_OUT)%,%,$(LOCAL_INSTALLED_MODULE)))
$(call add_json_str, BuildPath, $(LOCAL_BUILT_MODULE))
+ $(call add_json_str, ManifestPath, $(full_android_manifest))
$(call add_json_str, ExtrasOutputPath, $$2)
$(call add_json_bool, Privileged, $(filter true,$(LOCAL_PRIVILEGED_MODULE)))
$(call add_json_bool, UncompressedDex, $(filter true,$(LOCAL_UNCOMPRESS_DEX)))
@@ -210,10 +222,10 @@
$(call add_json_str, ProfileClassListing, $(if $(my_process_profile),$(LOCAL_DEX_PREOPT_PROFILE)))
$(call add_json_bool, ProfileIsTextListing, $(my_profile_is_text_listing))
$(call add_json_bool, EnforceUsesLibraries, $(LOCAL_ENFORCE_USES_LIBRARIES))
- $(call add_json_list, OptionalUsesLibraries, $(LOCAL_OPTIONAL_USES_LIBRARIES))
+ $(call add_json_list, OptionalUsesLibraries, $(my_filtered_optional_uses_libraries))
$(call add_json_list, UsesLibraries, $(LOCAL_USES_LIBRARIES))
$(call add_json_map, LibraryPaths)
- $(foreach lib,$(sort $(LOCAL_USES_LIBRARIES) $(LOCAL_OPTIONAL_USES_LIBRARIES) org.apache.http.legacy android.hidl.base-V1.0-java android.hidl.manager-V1.0-java),\
+ $(foreach lib,$(my_dexpreopt_libs),\
$(call add_json_str, $(lib), $(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/javalib.jar))
$(call end_json_map)
$(call add_json_list, Archs, $(my_dexpreopt_archs))
@@ -256,9 +268,9 @@
my_dexpreopt_deps := $(my_dex_jar)
my_dexpreopt_deps += $(if $(my_process_profile),$(LOCAL_DEX_PREOPT_PROFILE))
my_dexpreopt_deps += \
- $(foreach lib,$(sort $(LOCAL_USES_LIBRARIES) $(LOCAL_OPTIONAL_USES_LIBRARIES) org.apache.http.legacy android.hidl.base-V1.0-java android.hidl.manager-V1.0-java),\
+ $(foreach lib, $(my_dexpreopt_libs), \
$(call intermediates-dir-for,JAVA_LIBRARIES,$(lib),,COMMON)/javalib.jar)
- my_dexpreopt_deps += $(my_dexpreopt_images)
+ my_dexpreopt_deps += $(my_dexpreopt_images_deps)
my_dexpreopt_deps += $(DEXPREOPT_BOOTCLASSPATH_DEX_FILES)
$(my_dexpreopt_zip): PRIVATE_MODULE := $(LOCAL_MODULE)
diff --git a/core/dumpvar.mk b/core/dumpvar.mk
index 59efb04..b2ee8fd 100644
--- a/core/dumpvar.mk
+++ b/core/dumpvar.mk
@@ -17,6 +17,7 @@
ANDROID_BUILD_PATHS := $(ABP)
ANDROID_PREBUILTS := prebuilt/$(HOST_PREBUILT_TAG)
ANDROID_GCC_PREBUILTS := prebuilts/gcc/$(HOST_PREBUILT_TAG)
+ANDROID_CLANG_PREBUILTS := prebuilts/clang/host/$(HOST_PREBUILT_TAG)
# Dump mulitple variables to "<var>=<value>" pairs, one per line.
# The output may be executed as bash script.
@@ -26,6 +27,6 @@
.PHONY: dump-many-vars
dump-many-vars :
@$(foreach v, $(DUMP_MANY_VARS),\
- echo "$(DUMP_VAR_PREFIX)$(v)='$($(v))'";)
+ printf "%s='%s'\n" '$(DUMP_VAR_PREFIX)$(v)' '$($(v))';)
endif # CALLED_FROM_SETUP
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 46edc0e..3e8fd3f 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -82,8 +82,6 @@
# ---------------------------------------------------------------
# The product defaults to generic on hardware
-# NOTE: This will be overridden in product_config.mk if make
-# was invoked with a PRODUCT-xxx-yyy goal.
ifeq ($(TARGET_PRODUCT),)
TARGET_PRODUCT := aosp_arm
endif
@@ -94,6 +92,13 @@
TARGET_BUILD_VARIANT := eng
endif
+TARGET_BUILD_APPS ?=
+
+.KATI_READONLY := \
+ TARGET_PRODUCT \
+ TARGET_BUILD_VARIANT \
+ TARGET_BUILD_APPS
+
# ---------------------------------------------------------------
# Set up configuration for host machine. We don't do cross-
# compiles except for arm/mips, so the HOST is whatever we are
@@ -233,11 +238,14 @@
# BoardConfig, to be either the partition dir, or a subdir within 'system'.
_vendor_path_placeholder := ||VENDOR-PATH-PH||
_product_path_placeholder := ||PRODUCT-PATH-PH||
-_product_services_path_placeholder := ||PRODUCT_SERVICES-PATH-PH||
+_system_ext_path_placeholder := ||SYSTEM_EXT-PATH-PH||
_odm_path_placeholder := ||ODM-PATH-PH||
TARGET_COPY_OUT_VENDOR := $(_vendor_path_placeholder)
TARGET_COPY_OUT_PRODUCT := $(_product_path_placeholder)
-TARGET_COPY_OUT_PRODUCT_SERVICES := $(_product_services_path_placeholder)
+# TODO(b/135957588) TARGET_COPY_OUT_PRODUCT_SERVICES will copy the target to
+# product
+TARGET_COPY_OUT_PRODUCT_SERVICES := $(_product_path_placeholder)
+TARGET_COPY_OUT_SYSTEM_EXT := $(_system_ext_path_placeholder)
TARGET_COPY_OUT_ODM := $(_odm_path_placeholder)
# Returns the non-sanitized version of the path provided in $1.
@@ -785,38 +793,38 @@
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS \
$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_APPS_PRIVILEGED
-TARGET_OUT_PRODUCT_SERVICES := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_PRODUCT_SERVICES)
+TARGET_OUT_SYSTEM_EXT := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_SYSTEM_EXT)
ifneq ($(filter address,$(SANITIZE_TARGET)),)
-target_out_product_services_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_PRODUCT_SERVICES)
+target_out_system_ext_shared_libraries_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_SYSTEM_EXT)
ifeq ($(SANITIZE_LITE),true)
# When using SANITIZE_LITE, APKs must not be packaged with sanitized libraries, as they will not
# work with unsanitized app_process. For simplicity, generate APKs into /data/asan/.
-target_out_product_services_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_PRODUCT_SERVICES)
+target_out_system_ext_app_base := $(PRODUCT_OUT)/$(TARGET_COPY_OUT_ASAN)/$(TARGET_COPY_OUT_SYSTEM_EXT)
else
-target_out_product_services_app_base := $(TARGET_OUT_PRODUCT_SERVICES)
+target_out_system_ext_app_base := $(TARGET_OUT_SYSTEM_EXT)
endif
else
-target_out_product_services_shared_libraries_base := $(TARGET_OUT_PRODUCT_SERVICES)
-target_out_product_services_app_base := $(TARGET_OUT_PRODUCT_SERVICES)
+target_out_system_ext_shared_libraries_base := $(TARGET_OUT_SYSTEM_EXT)
+target_out_system_ext_app_base := $(TARGET_OUT_SYSTEM_EXT)
endif
ifeq ($(TARGET_IS_64_BIT),true)
-TARGET_OUT_PRODUCT_SERVICES_SHARED_LIBRARIES := $(target_out_product_services_shared_libraries_base)/lib64
+TARGET_OUT_SYSTEM_EXT_SHARED_LIBRARIES := $(target_out_system_ext_shared_libraries_base)/lib64
else
-TARGET_OUT_PRODUCT_SERVICES_SHARED_LIBRARIES := $(target_out_product_services_shared_libraries_base)/lib
+TARGET_OUT_SYSTEM_EXT_SHARED_LIBRARIES := $(target_out_system_ext_shared_libraries_base)/lib
endif
-TARGET_OUT_PRODUCT_SERVICES_JAVA_LIBRARIES:= $(TARGET_OUT_PRODUCT_SERVICES)/framework
-TARGET_OUT_PRODUCT_SERVICES_APPS := $(target_out_product_services_app_base)/app
-TARGET_OUT_PRODUCT_SERVICES_APPS_PRIVILEGED := $(target_out_product_services_app_base)/priv-app
-TARGET_OUT_PRODUCT_SERVICES_ETC := $(TARGET_OUT_PRODUCT_SERVICES)/etc
+TARGET_OUT_SYSTEM_EXT_JAVA_LIBRARIES:= $(TARGET_OUT_SYSTEM_EXT)/framework
+TARGET_OUT_SYSTEM_EXT_APPS := $(target_out_system_ext_app_base)/app
+TARGET_OUT_SYSTEM_EXT_APPS_PRIVILEGED := $(target_out_system_ext_app_base)/priv-app
+TARGET_OUT_SYSTEM_EXT_ETC := $(TARGET_OUT_SYSTEM_EXT)/etc
ifeq ($(TARGET_TRANSLATE_2ND_ARCH),true)
-$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SERVICES_SHARED_LIBRARIES := $(target_out_product_services_shared_libraries_base)/lib/$(TARGET_2ND_ARCH)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_SHARED_LIBRARIES := $(target_out_system_ext_shared_libraries_base)/lib/$(TARGET_2ND_ARCH)
else
-$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SERVICES_SHARED_LIBRARIES := $(target_out_product_services_shared_libraries_base)/lib
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_SHARED_LIBRARIES := $(target_out_system_ext_shared_libraries_base)/lib
endif
-$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SERVICES_APPS := $(TARGET_OUT_PRODUCT_SERVICES_APPS)
-$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_PRODUCT_SERVICES_APPS_PRIVILEGED := $(TARGET_OUT_PRODUCT_SERVICES_APPS_PRIVILEGED)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_APPS := $(TARGET_OUT_SYSTEM_EXT_APPS)
+$(TARGET_2ND_ARCH_VAR_PREFIX)TARGET_OUT_SYSTEM_EXT_APPS_PRIVILEGED := $(TARGET_OUT_SYSTEM_EXT_APPS_PRIVILEGED)
TARGET_OUT_BREAKPAD := $(PRODUCT_OUT)/breakpad
.KATI_READONLY := TARGET_OUT_BREAKPAD
diff --git a/core/executable_internal.mk b/core/executable_internal.mk
index c28c144..a9915aa 100644
--- a/core/executable_internal.mk
+++ b/core/executable_internal.mk
@@ -74,17 +74,17 @@
$(linked_module): PRIVATE_POST_LINK_CMD := $(LOCAL_POST_LINK_CMD)
ifeq ($(LOCAL_FORCE_STATIC_EXECUTABLE),true)
-$(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(my_target_libcrt_builtins) $(my_target_libgcc) $(my_target_libatomic)
+$(linked_module): $(my_target_crtbegin_static_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(my_target_libcrt_builtins) $(my_target_libgcc) $(my_target_libatomic) $(CLANG_CXX)
$(transform-o-to-static-executable)
$(PRIVATE_POST_LINK_CMD)
else
-$(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(my_target_libcrt_builtins) $(my_target_libgcc) $(my_target_libatomic)
+$(linked_module): $(my_target_crtbegin_dynamic_o) $(all_objects) $(all_libraries) $(my_target_crtend_o) $(my_target_libcrt_builtins) $(my_target_libgcc) $(my_target_libatomic) $(CLANG_CXX)
$(transform-o-to-executable)
$(PRIVATE_POST_LINK_CMD)
endif
ifeq ($(my_native_coverage),true)
-gcno_suffix := .gcnodir
+gcno_suffix := .zip
built_whole_gcno_libraries := \
$(foreach lib,$(my_whole_static_libraries), \
@@ -106,11 +106,11 @@
GCNO_ARCHIVE := $(my_installed_module_stem)$(gcno_suffix)
+$(intermediates)/$(GCNO_ARCHIVE) : $(SOONG_ZIP) $(MERGE_ZIPS)
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS := $(strip $(LOCAL_GCNO_FILES))
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(strip $(built_whole_gcno_libraries)) $(strip $(built_static_gcno_libraries))
-$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_INTERMEDIATES_DIR := $(intermediates)
$(intermediates)/$(GCNO_ARCHIVE) : $(LOCAL_GCNO_FILES) $(built_whole_gcno_libraries) $(built_static_gcno_libraries)
- $(transform-o-to-static-lib)
+ $(package-coverage-files)
$(my_coverage_path)/$(GCNO_ARCHIVE) : $(intermediates)/$(GCNO_ARCHIVE)
$(copy-file-to-target)
diff --git a/core/fuzz_test.mk b/core/fuzz_test.mk
index 2cc2e2c..f5bdef0 100644
--- a/core/fuzz_test.mk
+++ b/core/fuzz_test.mk
@@ -15,8 +15,7 @@
my_fuzzer:=$(TARGET_FUZZ_ENGINE)
endif
-
-LOCAL_CFLAGS += -fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp
+LOCAL_SANITIZE += fuzzer
ifeq ($(my_fuzzer),libFuzzer)
LOCAL_STATIC_LIBRARIES += libFuzzer
diff --git a/core/host_dalvik_java_library.mk b/core/host_dalvik_java_library.mk
index 423575c..8e655ff 100644
--- a/core/host_dalvik_java_library.mk
+++ b/core/host_dalvik_java_library.mk
@@ -73,7 +73,6 @@
java_sources_deps := \
$(java_sources) \
$(java_resource_sources) \
- $(proto_java_sources_file_stamp) \
$(LOCAL_SRCJARS) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
diff --git a/core/host_executable_internal.mk b/core/host_executable_internal.mk
index e72c419..0cf62a4 100644
--- a/core/host_executable_internal.mk
+++ b/core/host_executable_internal.mk
@@ -39,7 +39,7 @@
endif
my_libdir :=
-$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries)
+$(LOCAL_BUILT_MODULE): $(all_objects) $(all_libraries) $(CLANG_CXX)
$(transform-host-o-to-executable)
endif # skip_build_from_source
diff --git a/core/host_fuzz_test.mk b/core/host_fuzz_test.mk
index 556e02f..54c6577 100644
--- a/core/host_fuzz_test.mk
+++ b/core/host_fuzz_test.mk
@@ -4,7 +4,7 @@
################################################
$(call record-module-type,HOST_FUZZ_TEST)
-LOCAL_CFLAGS += -fsanitize-coverage=trace-pc-guard,indirect-calls,trace-cmp
+LOCAL_SANITIZE += fuzzer
LOCAL_STATIC_LIBRARIES += libLLVMFuzzer
include $(BUILD_HOST_EXECUTABLE)
diff --git a/core/host_java_library.mk b/core/host_java_library.mk
index 1225fa9..6c23789 100644
--- a/core/host_java_library.mk
+++ b/core/host_java_library.mk
@@ -52,6 +52,8 @@
$(filter %.java,$(LOCAL_GENERATED_SOURCES))
all_java_sources := $(java_sources)
+ALL_MODULES.$(my_register_name).SRCS := $(ALL_MODULES.$(my_register_name).SRCS) $(all_java_sources)
+
include $(BUILD_SYSTEM)/java_common.mk
# The layers file allows you to enforce a layering between java packages.
@@ -62,7 +64,6 @@
java_sources_deps := \
$(java_sources) \
$(java_resource_sources) \
- $(proto_java_sources_file_stamp) \
$(LOCAL_SRCJARS) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
diff --git a/core/install_jni_libs.mk b/core/install_jni_libs.mk
index 515d34f..0fec9ca 100644
--- a/core/install_jni_libs.mk
+++ b/core/install_jni_libs.mk
@@ -26,7 +26,7 @@
$(TARGET_OUT_VENDOR)/% \
$(TARGET_OUT_OEM)/% \
$(TARGET_OUT_PRODUCT)/% \
- $(TARGET_OUT_PRODUCT_SERVICES)/% \
+ $(TARGET_OUT_SYSTEM_EXT)/% \
ifeq ($(filter $(supported_partition_patterns),$(my_module_path)),)
my_embed_jni := true
diff --git a/core/instrumentation_test_config_template.xml b/core/instrumentation_test_config_template.xml
index 18ea676..afaa561 100644
--- a/core/instrumentation_test_config_template.xml
+++ b/core/instrumentation_test_config_template.xml
@@ -22,6 +22,8 @@
<option name="test-file-name" value="{MODULE}.apk" />
</target_preparer>
+ {EXTRA_CONFIGS}
+
<test class="com.android.tradefed.testtype.{TEST_TYPE}" >
<option name="package" value="{PACKAGE}" />
<option name="runner" value="{RUNNER}" />
diff --git a/core/java.mk b/core/java.mk
index b951f14..b463037 100644
--- a/core/java.mk
+++ b/core/java.mk
@@ -233,13 +233,14 @@
java_sources_deps := \
$(java_sources) \
$(java_resource_sources) \
- $(proto_java_sources_file_stamp) \
$(LOCAL_SRCJARS) \
$(LOCAL_ADDITIONAL_DEPENDENCIES)
-$(java_source_list_file): $(java_sources_deps)
+$(java_source_list_file): $(java_sources_deps) $(NORMALIZE_PATH)
$(write-java-source-list)
+ALL_MODULES.$(my_register_name).SRCJARS := $(LOCAL_SRCJARS)
+
ifneq ($(TURBINE_ENABLED),false)
$(full_classes_turbine_jar): PRIVATE_JAVACFLAGS := $(LOCAL_JAVACFLAGS) $(annotation_processor_flags)
@@ -408,7 +409,7 @@
$(full_shared_java_header_libs)))
legacy_proguard_lib_deps := $(my_proguard_sdk_raise) \
- $(filter-out $(my_proguard_sdk_raise),$(full_shared_java_header_libs))
+ $(filter-out $(my_proguard_sdk_raise),$(full_java_bootclasspath_libs) $(full_shared_java_header_libs))
legacy_proguard_flags += -printmapping $(proguard_dictionary)
legacy_proguard_flags += -printconfiguration $(proguard_configuration)
diff --git a/core/java_common.mk b/core/java_common.mk
index db5b6c3..cb88a9e 100644
--- a/core/java_common.mk
+++ b/core/java_common.mk
@@ -67,37 +67,36 @@
LOCAL_PROTOC_OPTIMIZE_TYPE := lite
endif
proto_sources := $(filter %.proto,$(LOCAL_SRC_FILES))
-# Because names of the .java files compiled from .proto files are unknown until the
-# .proto files are compiled, we use a timestamp file as depedency.
-proto_java_sources_file_stamp :=
ifneq ($(proto_sources),)
proto_sources_fullpath := $(addprefix $(LOCAL_PATH)/, $(proto_sources))
proto_java_intemediate_dir := $(intermediates.COMMON)/proto
-proto_java_sources_file_stamp := $(proto_java_intemediate_dir)/Proto.stamp
proto_java_sources_dir := $(proto_java_intemediate_dir)/src
+proto_java_srcjar := $(intermediates.COMMON)/proto.srcjar
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_INCLUDES := $(TOP)
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_SRC_FILES := $(proto_sources_fullpath)
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_DIR := $(proto_java_sources_dir)
-$(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
+LOCAL_SRCJARS += $(proto_java_srcjar)
+
+$(proto_java_srcjar): PRIVATE_PROTO_INCLUDES := $(TOP)
+$(proto_java_srcjar): PRIVATE_PROTO_SRC_FILES := $(proto_sources_fullpath)
+$(proto_java_srcjar): PRIVATE_PROTO_JAVA_OUTPUT_DIR := $(proto_java_sources_dir)
+$(proto_java_srcjar): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS)
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),micro)
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javamicro_out
+$(proto_java_srcjar): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javamicro_out
else
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),nano)
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javanano_out
+$(proto_java_srcjar): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javanano_out
else
ifeq ($(LOCAL_PROTOC_OPTIMIZE_TYPE),stream)
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javastream_out
-$(proto_java_sources_file_stamp): PRIVATE_PROTOC_FLAGS += --plugin=$(HOST_OUT_EXECUTABLES)/protoc-gen-javastream
-$(proto_java_sources_file_stamp): $(HOST_OUT_EXECUTABLES)/protoc-gen-javastream
+$(proto_java_srcjar): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --javastream_out
+$(proto_java_srcjar): PRIVATE_PROTOC_FLAGS += --plugin=$(HOST_OUT_EXECUTABLES)/protoc-gen-javastream
+$(proto_java_srcjar): $(HOST_OUT_EXECUTABLES)/protoc-gen-javastream
else
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --java_out
+$(proto_java_srcjar): PRIVATE_PROTO_JAVA_OUTPUT_OPTION := --java_out
endif
endif
endif
-$(proto_java_sources_file_stamp): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(if $(filter lite,$(LOCAL_PROTOC_OPTIMIZE_TYPE)),lite$(if $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS),:,),)$(LOCAL_PROTO_JAVA_OUTPUT_PARAMS)
-$(proto_java_sources_file_stamp) : $(proto_sources_fullpath) $(PROTOC)
+$(proto_java_srcjar): PRIVATE_PROTO_JAVA_OUTPUT_PARAMS := $(if $(filter lite,$(LOCAL_PROTOC_OPTIMIZE_TYPE)),lite$(if $(LOCAL_PROTO_JAVA_OUTPUT_PARAMS),:,),)$(LOCAL_PROTO_JAVA_OUTPUT_PARAMS)
+$(proto_java_srcjar) : $(proto_sources_fullpath) $(PROTOC) $(SOONG_ZIP)
$(call transform-proto-to-java)
#TODO: protoc should output the dependencies introduced by imports.
@@ -231,8 +230,6 @@
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_CLASS_INTERMEDIATES_DIR := $(intermediates.COMMON)/classes
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_ANNO_INTERMEDIATES_DIR := $(intermediates.COMMON)/anno
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/src
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HAS_PROTO_SOURCES := $(if $(proto_sources),true)
-$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_PROTO_SOURCE_INTERMEDIATES_DIR := $(intermediates.COMMON)/proto
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_HAS_RS_SOURCES :=
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCES := $(all_java_sources)
$(LOCAL_INTERMEDIATE_TARGETS): PRIVATE_JAVA_SOURCE_LIST := $(java_source_list_file)
@@ -419,8 +416,8 @@
ifndef SOONG_SYSTEM_MODULES_$(my_system_modules)
$(call pretty-error, Invalid system modules $(my_system_modules))
endif
- full_java_system_modules_deps := $(SOONG_SYSTEM_MODULES_$(my_system_modules))
- my_system_modules_dir := $(patsubst %/lib/modules,%,$(SOONG_SYSTEM_MODULES_$(my_system_modules)))
+ full_java_system_modules_deps := $(SOONG_SYSTEM_MODULES_DEPS_$(my_system_modules))
+ my_system_modules_dir := $(SOONG_SYSTEM_MODULES_$(my_system_modules))
endif
endif
endif
@@ -497,13 +494,9 @@
##########################################################
# Copy NOTICE files of transitive static dependencies
# Don't do this in mm, since many of the targets won't exist.
-ifeq ($(ONE_SHOT_MAKEFILE),)
installed_static_library_notice_file_targets := \
$(foreach lib,$(LOCAL_STATIC_JAVA_LIBRARIES), \
NOTICE-$(if $(LOCAL_IS_HOST_MODULE),HOST$(if $(my_host_cross),_CROSS,),TARGET)-JAVA_LIBRARIES-$(lib))
-else
-installed_static_library_notice_file_targets :=
-endif
$(notice_target): | $(installed_static_library_notice_file_targets)
$(LOCAL_INSTALLED_MODULE): | $(notice_target)
diff --git a/core/java_host_test_config_template.xml b/core/java_host_test_config_template.xml
index d808001..26c1caf 100644
--- a/core/java_host_test_config_template.xml
+++ b/core/java_host_test_config_template.xml
@@ -17,6 +17,9 @@
<configuration description="Runs {MODULE}">
<option name="test-suite-tag" value="apct" />
<option name="test-suite-tag" value="apct-junit" />
+
+ {EXTRA_CONFIGS}
+
<test class="com.android.tradefed.testtype.HostTest" >
<option name="jar" value="{MODULE}.jar" />
</test>
diff --git a/core/java_library.mk b/core/java_library.mk
index c706cea..34e4874 100644
--- a/core/java_library.mk
+++ b/core/java_library.mk
@@ -68,7 +68,7 @@
$(common_javalib.jar): PRIVATE_DEX_FILE := $(built_dex)
$(common_javalib.jar): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar)
$(common_javalib.jar): $(MERGE_ZIPS) $(SOONG_ZIP) $(ZIP2ZIP)
-$(common_javalib.jar) : $(built_dex) $(java_resource_sources) | $(ZIPTIME) $(ZIPALIGN)
+$(common_javalib.jar) : $(full_classes_pre_proguard_jar) $(built_dex) $(java_resource_sources) | $(ZIPTIME) $(ZIPALIGN)
@echo "target Jar: $(PRIVATE_MODULE) ($@)"
rm -rf $@.parts && mkdir -p $@.parts
$(call create-dex-jar,$@.parts/dex.zip,$(PRIVATE_DEX_FILE))
diff --git a/core/java_prebuilt_internal.mk b/core/java_prebuilt_internal.mk
index 31aae83..5b7e9db 100644
--- a/core/java_prebuilt_internal.mk
+++ b/core/java_prebuilt_internal.mk
@@ -39,6 +39,8 @@
$(call pretty-error,Modules in PRODUCT_BOOT_JARS must be defined in Android.bp files)
endif
+ALL_MODULES.$(my_register_name).CLASSES_JAR := $(common_classes_jar)
+
#######################################
# defines built_odex along with rule to install odex
include $(BUILD_SYSTEM)/dex_preopt_odex_install.mk
@@ -239,4 +241,3 @@
endif # ! prebuilt_module_is_dex_javalib
endif # LOCAL_IS_HOST_MODULE is not set
-
diff --git a/core/java_renderscript.mk b/core/java_renderscript.mk
index 13a6f8e..820967a 100644
--- a/core/java_renderscript.mk
+++ b/core/java_renderscript.mk
@@ -1,10 +1,10 @@
###############################################################
## Renderscript support for java
-## Adds rules to convert .rs files to .java and .bc files
+## Adds rules to convert .rscript files to .java and .bc files
###############################################################
-renderscript_sources := $(filter %.rs,$(LOCAL_SRC_FILES))
-LOCAL_SRC_FILES := $(filter-out %.rs,$(LOCAL_SRC_FILES))
+renderscript_sources := $(filter %.rscript,$(LOCAL_SRC_FILES))
+LOCAL_SRC_FILES := $(filter-out %.rscript,$(LOCAL_SRC_FILES))
rs_generated_res_zip :=
rs_generated_src_jar :=
@@ -67,7 +67,7 @@
LOCAL_RENDERSCRIPT_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES_OVERRIDE)
endif
-bc_files := $(patsubst %.rs,%.bc, $(notdir $(renderscript_sources)))
+bc_files := $(patsubst %.rscript,%.bc, $(notdir $(renderscript_sources)))
bc_dep_files := $(addprefix $(renderscript_intermediate.COMMON)/,$(patsubst %.bc,%.d,$(bc_files)))
$(rs_generated_src_jar): PRIVATE_RS_INCLUDES := $(LOCAL_RENDERSCRIPT_INCLUDES)
diff --git a/core/java_test_config_template.xml b/core/java_test_config_template.xml
index 4ee5b07..811cf93 100644
--- a/core/java_test_config_template.xml
+++ b/core/java_test_config_template.xml
@@ -22,6 +22,9 @@
<option name="push" value="cts-dalvik-device-test-runner.jar->/data/local/tmp/{MODULE}/cts-dalvik-device-test-runner.jar" />
<option name="push" value="{MODULE}.jar->/data/local/tmp/{MODULE}/{MODULE}.jar" />
</target_preparer>
+
+ {EXTRA_CONFIGS}
+
<test class="com.android.compatibility.testtype.DalvikTest" >
<option name="run-name" value="{MODULE}" />
<option name="classpath" value="/data/local/tmp/{MODULE}/{MODULE}.jar" />
diff --git a/core/main.mk b/core/main.mk
index 656a6ec..a240b35 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -10,22 +10,11 @@
endif
ifndef KATI
-
-host_prebuilts := linux-x86
-ifeq ($(shell uname),Darwin)
-host_prebuilts := darwin-x86
+$(warning Calling make directly is no longer supported.)
+$(warning Either use 'envsetup.sh; m' or 'build/soong/soong_ui.bash --make-mode')
+$(error done)
endif
-.PHONY: run_soong_ui
-run_soong_ui:
- +@prebuilts/build-tools/$(host_prebuilts)/bin/makeparallel --ninja build/soong/soong_ui.bash --make-mode $(MAKECMDGOALS)
-
-.PHONY: $(MAKECMDGOALS)
-$(sort $(MAKECMDGOALS)) : run_soong_ui
- @#empty
-
-else # KATI
-
$(info [1/1] initializing build system ...)
# Absolute path of the present working direcotry.
@@ -102,6 +91,8 @@
-include test/sts/tools/sts-tradefed/build/config.mk
# CTS-Instant-specific config
-include test/suite_harness/tools/cts-instant-tradefed/build/config.mk
+# MTS-specific config.
+-include test/mts/tools/build/config.mk
# Clean rules
.PHONY: clean-dex-files
@@ -194,6 +185,8 @@
$(error stopping)
endif
+# These are the valid values of TARGET_BUILD_VARIANT.
+INTERNAL_VALID_VARIANTS := user userdebug eng
ifneq ($(filter-out $(INTERNAL_VALID_VARIANTS),$(TARGET_BUILD_VARIANT)),)
$(info ***************************************************************)
$(info ***************************************************************)
@@ -343,6 +336,15 @@
endif
endif
+## java coverage ##
+# Install additional tools on java coverage builds
+ifeq (true,$(EMMA_INSTRUMENT))
+ifneq (,$(filter debug,$(tags_to_install)))
+ tags_to_install += java_coverage
+endif
+endif
+
+
## sdk ##
ifdef is_sdk_build
@@ -429,43 +431,6 @@
subdir_makefiles_inc := .
FULL_BUILD :=
-ifneq ($(ONE_SHOT_MAKEFILE),)
-# We've probably been invoked by the "mm" shell function
-# with a subdirectory's makefile.
-include $(SOONG_ANDROID_MK) $(wildcard $(ONE_SHOT_MAKEFILE))
-# Change CUSTOM_MODULES to include only modules that were
-# defined by this makefile; this will install all of those
-# modules as a side-effect. Do this after including ONE_SHOT_MAKEFILE
-# so that the modules will be installed in the same place they
-# would have been with a normal make.
-CUSTOM_MODULES := $(sort $(call get-tagged-modules,$(ALL_MODULE_TAGS)))
-
-# A helper goal printing out install paths
-define register_module_install_path
-.PHONY: GET-MODULE-INSTALL-PATH-$(1)
-GET-MODULE-INSTALL-PATH-$(1):
- echo 'INSTALL-PATH: $(1) $(ALL_MODULES.$(1).INSTALLED)'
-endef
-
-SORTED_ALL_MODULES := $(sort $(ALL_MODULES))
-UNIQUE_ALL_MODULES :=
-$(foreach m,$(SORTED_ALL_MODULES),\
- $(if $(call streq,$(m),$(lastword $(UNIQUE_ALL_MODULES))),,\
- $(eval UNIQUE_ALL_MODULES += $(m))))
-SORTED_ALL_MODULES :=
-
-$(foreach mod,$(UNIQUE_ALL_MODULES),$(if $(ALL_MODULES.$(mod).INSTALLED),\
- $(eval $(call register_module_install_path,$(mod)))\
- $(foreach path,$(ALL_MODULES.$(mod).PATH),\
- $(eval my_path_prefix := GET-INSTALL-PATH-IN)\
- $(foreach component,$(subst /,$(space),$(path)),\
- $(eval my_path_prefix := $$(my_path_prefix)-$$(component))\
- $(eval .PHONY: $$(my_path_prefix))\
- $(eval $$(my_path_prefix): GET-MODULE-INSTALL-PATH-$(mod))))))
-UNIQUE_ALL_MODULES :=
-
-else # ONE_SHOT_MAKEFILE
-
ifneq ($(dont_bother),true)
FULL_BUILD := true
#
@@ -487,8 +452,6 @@
endif # dont_bother
-endif # ONE_SHOT_MAKEFILE
-
ifndef subdir_makefiles_total
subdir_makefiles_total := $(words init post finish)
endif
@@ -832,6 +795,9 @@
$(call update-host-shared-libs-deps-for-suites)
ifdef HOST_CROSS_OS
$(call resolve-shared-libs-depes,HOST_CROSS_,,true)
+ifdef HOST_CROSS_2ND_ARCH
+$(call resolve-shared-libs-depes,HOST_CROSS_,true,true)
+endif
endif
# Pass the shared libraries dependencies to prebuilt ELF file check.
@@ -1006,44 +972,26 @@
$(error exiting from previous errors)
endif
-# The intermediate filename for link type rules
-#
-# APPS are special -- they have up to three different rules:
-# 1. The COMMON rule for Java libraries
-# 2. The jni_link_type rule for embedded native code
-# 3. The 2ND_jni_link_type for the second architecture native code
-define link-type-file
-$(eval _ltf_aux_variant:=$(link-type-aux-variant))\
-$(if $(_ltf_aux_variant),$(call aux-variant-load-env,$(_ltf_aux_variant)))\
-$(call intermediates-dir-for,$(link-type-class),$(link-type-name),$(filter AUX HOST HOST_CROSS,$(link-type-prefix)),$(link-type-common),$(link-type-2ndarchprefix),$(filter HOST_CROSS,$(link-type-prefix)))/$(if $(filter APPS,$(link-type-class)),$(if $(link-type-common),,$(link-type-2ndarchprefix)jni_))link_type\
-$(if $(_ltf_aux_variant),$(call aux-variant-load-env,none))\
-$(eval _ltf_aux_variant:=)
-endef
+# -------------------------------------------------------------------
+# Handle exported/imported includes
-# Write out the file-based link_type rules for the ALLOW_MISSING_DEPENDENCIES
-# case. We always need to write the file for mm to work, but only need to
-# check it if we weren't able to check it when reading the Android.mk files.
-define link-type-file-rule
-my_link_type_deps := $(foreach l,$($(1).DEPS),$(call link-type-file,$(l)))
-my_link_type_file := $(call link-type-file,$(1))
-$($(1).BUILT): | $$(my_link_type_file)
-$$(my_link_type_file): PRIVATE_DEPS := $$(my_link_type_deps)
-ifeq ($($(1).MISSING),true)
-$$(my_link_type_file): $(CHECK_LINK_TYPE)
-endif
-$$(my_link_type_file): $$(my_link_type_deps)
- @echo Check module type: $$@
- $$(hide) mkdir -p $$(dir $$@) && rm -f $$@
-ifeq ($($(1).MISSING),true)
- $$(hide) $(CHECK_LINK_TYPE) --makefile $($(1).MAKEFILE) --module $(link-type-name) \
- --type "$($(1).TYPE)" $(addprefix --allowed ,$($(1).ALLOWED)) \
- $(addprefix --warn ,$($(1).WARN)) $$(PRIVATE_DEPS)
-endif
- $$(hide) echo "$($(1).TYPE)" >$$@
-endef
+# Recursively calculate flags
+$(foreach export,$(EXPORTS_LIST), \
+ $(eval EXPORTS.$$(export) = $$(EXPORTS.$(export).FLAGS) \
+ $(foreach dep,$(EXPORTS.$(export).REEXPORT),$$(EXPORTS.$(dep)))))
-$(foreach lt,$(ALL_LINK_TYPES),\
- $(eval $(call link-type-file-rule,$(lt))))
+# Recursively calculate dependencies
+$(foreach export,$(EXPORTS_LIST), \
+ $(eval EXPORT_DEPS.$$(export) = $$(EXPORTS.$(export).DEPS) \
+ $(foreach dep,$(EXPORTS.$(export).REEXPORT),$$(EXPORT_DEPS.$(dep)))))
+
+# Converts the recursive variables to simple variables so that we don't have to
+# evaluate them for every .o rule
+$(foreach export,$(EXPORTS_LIST),$(eval EXPORTS.$$(export) := $$(strip $$(EXPORTS.$$(export)))))
+$(foreach export,$(EXPORTS_LIST),$(eval EXPORT_DEPS.$$(export) := $$(sort $$(EXPORT_DEPS.$$(export)))))
+
+# Add dependencies
+$(foreach export,$(EXPORTS_LIST),$(eval $(call add-dependency,$$(EXPORTS.$$(export).USERS),$$(EXPORT_DEPS.$$(export)))))
# -------------------------------------------------------------------
# Figure out our module sets.
@@ -1099,7 +1047,7 @@
define resolve-product-relative-paths
$(subst $(_vendor_path_placeholder),$(TARGET_COPY_OUT_VENDOR),\
$(subst $(_product_path_placeholder),$(TARGET_COPY_OUT_PRODUCT),\
- $(subst $(_product_services_path_placeholder),$(TARGET_COPY_OUT_PRODUCT_SERVICES),\
+ $(subst $(_system_ext_path_placeholder),$(TARGET_COPY_OUT_SYSTEM_EXT),\
$(subst $(_odm_path_placeholder),$(TARGET_COPY_OUT_ODM),\
$(foreach p,$(1),$(call append-path,$(PRODUCT_OUT),$(p)$(2)))))))
endef
@@ -1137,6 +1085,7 @@
$(if $(filter debug,$(tags_to_install)),$(PRODUCTS.$(_mk).PRODUCT_PACKAGES_DEBUG)) \
$(if $(filter tests,$(tags_to_install)),$(PRODUCTS.$(_mk).PRODUCT_PACKAGES_TESTS)) \
$(if $(filter asan,$(tags_to_install)),$(PRODUCTS.$(_mk).PRODUCT_PACKAGES_DEBUG_ASAN)) \
+ $(if $(filter java_coverage,$(tags_to_install)),$(PRODUCTS.$(_mk).PRODUCT_PACKAGES_DEBUG_JAVA_COVERAGE)) \
$(call auto-included-modules) \
) \
$(eval ### Filter out the overridden packages and executables before doing expansion) \
@@ -1231,6 +1180,7 @@
libnativebridge.so \
libnativehelper.so \
libnativeloader.so \
+ libneuralnetworks.so \
libnpt.so \
libopenjdk.so \
libopenjdkjvm.so \
@@ -1253,14 +1203,22 @@
# Bionic should not be in /system, except for the bootstrap instance.
APEX_LIBS_ABSENCE_CHECK_EXCLUDE := lib/bootstrap lib64/bootstrap
-# Exclude lib/arm and lib/arm64 which contain the native bridge proxy libs. They
+# Exclude lib/arm and lib64/arm64 which contain the native bridge proxy libs. They
# are compiled for the guest architecture and used with an entirely different
# linker config. The native libs are then linked to as usual via exported
# interfaces, so the proxy libs do not violate the interface boundaries on the
# native architecture.
# TODO(b/130630776): Introduce a make variable for the appropriate directory
# when native bridge is active.
-APEX_LIBS_ABSENCE_CHECK_EXCLUDE += lib/arm lib/arm64
+APEX_LIBS_ABSENCE_CHECK_EXCLUDE += lib/arm lib64/arm64
+
+ifdef TARGET_NATIVE_BRIDGE_RELATIVE_PATH
+ APEX_LIBS_ABSENCE_CHECK_EXCLUDE += lib/$(TARGET_NATIVE_BRIDGE_RELATIVE_PATH) lib64/$(TARGET_NATIVE_BRIDGE_RELATIVE_PATH)
+endif
+
+ifdef TARGET_NATIVE_BRIDGE_2ND_RELATIVE_PATH
+ APEX_LIBS_ABSENCE_CHECK_EXCLUDE += lib/$(TARGET_NATIVE_BRIDGE_2ND_RELATIVE_PATH) lib64/$(TARGET_NATIVE_BRIDGE_2ND_RELATIVE_PATH)
+endif
# Exclude vndk-* subdirectories which contain prebuilts from older releases.
APEX_LIBS_ABSENCE_CHECK_EXCLUDE += lib/vndk-% lib64/vndk-%
@@ -1296,7 +1254,7 @@
$(filter-out $(foreach dir,$(APEX_LIBS_ABSENCE_CHECK_EXCLUDE), \
$(TARGET_OUT)/$(if $(findstring %,$(dir)),$(dir),$(dir)/%)), \
$(filter $(TARGET_OUT)/lib/% $(TARGET_OUT)/lib64/%,$(1)))), \
- APEX libraries found in system image (see comment for check-apex-libs-absence in \
+ APEX libraries found in product_target_FILES (see comment for check-apex-libs-absence in \
build/make/core/main.mk for details))
endef
@@ -1304,6 +1262,11 @@
# dependencies visible to make, but as long as they have install rules in
# /system they may still be created there through other make targets. To catch
# that we also do a check on disk just before the system image is built.
+ # NB: This check may fail if you have built intermediate targets in the out
+ # tree earlier, e.g. "m <some lib in APEX_MODULE_LIBS>". In that case, please
+ # try "m installclean && m systemimage" to get a correct system image. For
+ # local work you can also disable the check with the
+ # DISABLE_APEX_LIBS_ABSENCE_CHECK environment variable.
define check-apex-libs-absence-on-disk
$(hide) ( \
cd $(TARGET_OUT) && \
@@ -1312,8 +1275,9 @@
-type f \( -false $(foreach lib,$(APEX_MODULE_LIBS),-o -name $(lib)) \) \
-print) && \
if [ -n "$$findres" ]; then \
- echo "APEX libraries found in system image (see comment for check-apex-libs-absence" 1>&2; \
- echo "in build/make/core/main.mk for details):" 1>&2; \
+ echo "APEX libraries found in system image in TARGET_OUT (see comments for" 1>&2; \
+ echo "check-apex-libs-absence and check-apex-libs-absence-on-disk in" 1>&2; \
+ echo "build/make/core/main.mk for details):" 1>&2; \
echo "$$findres" | sort 1>&2; \
false; \
fi; \
@@ -1327,15 +1291,18 @@
ifeq (true,$(PRODUCT_ENFORCE_PACKAGES_EXIST))
_whitelist := $(PRODUCT_ENFORCE_PACKAGES_EXIST_WHITELIST)
_modules := $(PRODUCT_PACKAGES)
+ # Strip :32 and :64 suffixes
+ _modules := $(patsubst %:32,%,$(_modules))
+ _modules := $(patsubst %:64,%,$(_modules))
# Sanity check all modules in PRODUCT_PACKAGES exist. We check for the
# existence if either <module> or the <module>_32 variant.
- _nonexistant_modules := $(filter-out $(ALL_MODULES),$(_modules))
- _nonexistant_modules := $(foreach m,$(_nonexistant_modules),\
+ _nonexistent_modules := $(filter-out $(ALL_MODULES),$(_modules))
+ _nonexistent_modules := $(foreach m,$(_nonexistent_modules),\
$(if $(call get-32-bit-modules,$(m)),,$(m)))
- $(call maybe-print-list-and-error,$(filter-out $(_whitelist),$(_nonexistant_modules)),\
- $(INTERNAL_PRODUCT) includes non-existant modules in PRODUCT_PACKAGES)
- $(call maybe-print-list-and-error,$(filter-out $(_nonexistant_modules),$(_whitelist)),\
- $(INTERNAL_PRODUCT) includes redundant whitelist entries for nonexistant PRODUCT_PACKAGES)
+ $(call maybe-print-list-and-error,$(filter-out $(_whitelist),$(_nonexistent_modules)),\
+ $(INTERNAL_PRODUCT) includes non-existent modules in PRODUCT_PACKAGES)
+ $(call maybe-print-list-and-error,$(filter-out $(_nonexistent_modules),$(_whitelist)),\
+ $(INTERNAL_PRODUCT) includes redundant whitelist entries for nonexistent PRODUCT_PACKAGES)
endif
# Check to ensure that all modules in PRODUCT_HOST_PACKAGES exist
@@ -1344,10 +1311,13 @@
# maybe it would make sense to have PRODUCT_HOST_PACKAGES_LINUX/_DARWIN?
ifneq ($(HOST_OS),darwin)
_modules := $(PRODUCT_HOST_PACKAGES)
- _nonexistant_modules := $(foreach m,$(_modules),\
+ # Strip :32 and :64 suffixes
+ _modules := $(patsubst %:32,%,$(_modules))
+ _modules := $(patsubst %:64,%,$(_modules))
+ _nonexistent_modules := $(foreach m,$(_modules),\
$(if $(ALL_MODULES.$(m).REQUIRED_FROM_HOST)$(filter $(HOST_OUT_ROOT)/%,$(ALL_MODULES.$(m).INSTALLED)),,$(m)))
- $(call maybe-print-list-and-error,$(_nonexistant_modules),\
- $(INTERNAL_PRODUCT) includes non-existant modules in PRODUCT_HOST_PACKAGES)
+ $(call maybe-print-list-and-error,$(_nonexistent_modules),\
+ $(INTERNAL_PRODUCT) includes non-existent modules in PRODUCT_HOST_PACKAGES)
endif
endif
@@ -1450,7 +1420,6 @@
$(ALL_DEFAULT_INSTALLED_MODULES) \
$(product_target_FILES) \
$(product_host_FILES) \
- $(call get-tagged-modules,$(tags_to_install)) \
$(CUSTOM_MODULES) \
)
@@ -1555,12 +1524,6 @@
.PHONY: ramdisk_debug
ramdisk_debug: $(INSTALLED_DEBUG_RAMDISK_TARGET)
-.PHONY: systemtarball
-systemtarball: $(INSTALLED_SYSTEMTARBALL_TARGET)
-
-.PHONY: boottarball
-boottarball: $(INSTALLED_BOOTTARBALL_TARGET)
-
.PHONY: userdataimage
userdataimage: $(INSTALLED_USERDATAIMAGE_TARGET)
@@ -1568,9 +1531,6 @@
$(call dist-for-goals, userdataimage, $(BUILT_USERDATAIMAGE_TARGET))
endif
-.PHONY: userdatatarball
-userdatatarball: $(INSTALLED_USERDATATARBALL_TARGET)
-
.PHONY: cacheimage
cacheimage: $(INSTALLED_CACHEIMAGE_TARGET)
@@ -1583,8 +1543,8 @@
.PHONY: productimage
productimage: $(INSTALLED_PRODUCTIMAGE_TARGET)
-.PHONY: productservicesimage
-productservicesimage: $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)
+.PHONY: systemextimage
+systemextimage: $(INSTALLED_SYSTEM_EXTIMAGE_TARGET)
.PHONY: odmimage
odmimage: $(INSTALLED_ODMIMAGE_TARGET)
@@ -1613,6 +1573,7 @@
$(INSTALLED_SYSTEMIMAGE_TARGET) \
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
+ $(INSTALLED_RADIOIMAGE_TARGET) \
$(INSTALLED_DEBUG_RAMDISK_TARGET) \
$(INSTALLED_DEBUG_BOOTIMAGE_TARGET) \
$(INSTALLED_RECOVERYIMAGE_TARGET) \
@@ -1633,8 +1594,8 @@
$(INSTALLED_FILES_JSON_ODM) \
$(INSTALLED_FILES_FILE_PRODUCT) \
$(INSTALLED_FILES_JSON_PRODUCT) \
- $(INSTALLED_FILES_FILE_PRODUCT_SERVICES) \
- $(INSTALLED_FILES_JSON_PRODUCT_SERVICES) \
+ $(INSTALLED_FILES_FILE_SYSTEM_EXT) \
+ $(INSTALLED_FILES_JSON_SYSTEM_EXT) \
$(INSTALLED_FILES_FILE_SYSTEMOTHER) \
$(INSTALLED_FILES_JSON_SYSTEMOTHER) \
$(INSTALLED_FILES_FILE_RAMDISK) \
@@ -1726,8 +1687,8 @@
$(INSTALLED_FILES_JSON_ODM) \
$(INSTALLED_FILES_FILE_PRODUCT) \
$(INSTALLED_FILES_JSON_PRODUCT) \
- $(INSTALLED_FILES_FILE_PRODUCT_SERVICES) \
- $(INSTALLED_FILES_JSON_PRODUCT_SERVICES) \
+ $(INSTALLED_FILES_FILE_SYSTEM_EXT) \
+ $(INSTALLED_FILES_JSON_SYSTEM_EXT) \
$(INSTALLED_FILES_FILE_SYSTEMOTHER) \
$(INSTALLED_FILES_JSON_SYSTEMOTHER) \
$(INSTALLED_FILES_FILE_RECOVERY) \
@@ -1825,22 +1786,6 @@
# Phony target to run all java compilations that use javac
.PHONY: javac-check
-ifneq (,$(filter samplecode, $(MAKECMDGOALS)))
-.PHONY: samplecode
-sample_MODULES := $(sort $(call get-tagged-modules,samples))
-sample_APKS_DEST_PATH := $(TARGET_COMMON_OUT_ROOT)/samples
-sample_APKS_COLLECTION := \
- $(foreach module,$(sample_MODULES),$(sample_APKS_DEST_PATH)/$(notdir $(module)))
-$(foreach module,$(sample_MODULES),$(eval $(call \
- copy-one-file,$(module),$(sample_APKS_DEST_PATH)/$(notdir $(module)))))
-sample_ADDITIONAL_INSTALLED := \
- $(filter-out $(modules_to_install) $(modules_to_check),$(sample_MODULES))
-samplecode: $(sample_APKS_COLLECTION)
- @echo "Collect sample code apks: $^"
- # remove apks that are not intended to be installed.
- rm -f $(sample_ADDITIONAL_INSTALLED)
-endif # samplecode in $(MAKECMDGOALS)
-
.PHONY: findbugs
findbugs: $(INTERNAL_FINDBUGS_HTML_TARGET) $(INTERNAL_FINDBUGS_XML_TARGET)
@@ -1884,5 +1829,3 @@
$(call dist-write-file,$(KATI_PACKAGE_MK_DIR)/dist.mk)
$(info [$(call inc_and_print,subdir_makefiles_inc)/$(subdir_makefiles_total)] writing build rules ...)
-
-endif # KATI
diff --git a/core/misc_prebuilt_internal.mk b/core/misc_prebuilt_internal.mk
new file mode 100644
index 0000000..cc2683c
--- /dev/null
+++ b/core/misc_prebuilt_internal.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+############################################################
+# Internal build rules for misc prebuilt modules that don't need additional processing
+############################################################
+
+prebuilt_module_classes := SCRIPT ETC DATA
+ifeq ($(filter $(prebuilt_module_classes),$(LOCAL_MODULE_CLASS)),)
+$(call pretty-error,misc_prebuilt_internal.mk is for $(prebuilt_module_classes) modules only)
+endif
+
+include $(BUILD_SYSTEM)/base_rules.mk
+
+$(LOCAL_BUILT_MODULE) : $(my_prebuilt_src_file)
+ $(transform-prebuilt-to-target)
+
+built_module := $(LOCAL_BUILT_MODULE)
\ No newline at end of file
diff --git a/core/native_benchmark_test_config_template.xml b/core/native_benchmark_test_config_template.xml
index 18736bf..d1f0199 100644
--- a/core/native_benchmark_test_config_template.xml
+++ b/core/native_benchmark_test_config_template.xml
@@ -17,6 +17,9 @@
<configuration description="Runs {MODULE}.">
<option name="test-suite-tag" value="apct" />
<option name="test-suite-tag" value="apct-native-metric" />
+
+ {EXTRA_CONFIGS}
+
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" />
<option name="push" value="{MODULE}->/data/local/tmp/{MODULE}" />
diff --git a/core/native_host_test_config_template.xml b/core/native_host_test_config_template.xml
index c0fcd1a..818b9b9 100644
--- a/core/native_host_test_config_template.xml
+++ b/core/native_host_test_config_template.xml
@@ -16,6 +16,9 @@
<!-- This test config file is auto-generated. -->
<configuration description="Runs {MODULE}.">
<option name="null-device" value="true" />
+
+ {EXTRA_CONFIGS}
+
<test class="com.android.tradefed.testtype.HostGTest" >
<option name="module-name" value="{MODULE}" />
</test>
diff --git a/core/native_test_config_template.xml b/core/native_test_config_template.xml
index f3d3231..ef1818f 100644
--- a/core/native_test_config_template.xml
+++ b/core/native_test_config_template.xml
@@ -18,7 +18,7 @@
<option name="test-suite-tag" value="apct" />
<option name="test-suite-tag" value="apct-native" />
- {EXTRA_OPTIONS}
+ {EXTRA_CONFIGS}
<target_preparer class="com.android.tradefed.targetprep.PushFilePreparer">
<option name="cleanup" value="true" />
diff --git a/core/ninja_config.mk b/core/ninja_config.mk
index e9e89c3..b1f4b03 100644
--- a/core/ninja_config.mk
+++ b/core/ninja_config.mk
@@ -7,7 +7,7 @@
KATI_OUTPUT_PATTERNS := $(OUT_DIR)/build%.ninja $(OUT_DIR)/ninja%.sh
# Modifier goals we don't need to pass to Ninja.
-NINJA_EXCLUDE_GOALS := all APP-% PRODUCT-%
+NINJA_EXCLUDE_GOALS := all
# A list of goals which affect parsing of makefiles and we need to pass to Kati.
PARSE_TIME_MAKE_GOALS := \
@@ -16,7 +16,6 @@
all \
ECLIPSE-% \
AUX-% \
- boottarball-nodeps \
brillo_tests \
btnod \
build-art% \
@@ -44,7 +43,6 @@
snod \
stnod \
systemimage-nodeps \
- systemtarball-nodeps \
target-files-package \
test-art% \
user \
@@ -57,7 +55,7 @@
include $(wildcard vendor/*/build/ninja_config.mk)
# Any Android goals that need to be built.
-ANDROID_GOALS := $(filter-out $(KATI_OUTPUT_PATTERNS) $(CKATI) $(MAKEPARALLEL),\
+ANDROID_GOALS := $(filter-out $(KATI_OUTPUT_PATTERNS),\
$(sort $(ORIGINAL_MAKECMDGOALS) $(MAKECMDGOALS)))
# Goals we need to pass to Ninja.
NINJA_GOALS := $(filter-out $(NINJA_EXCLUDE_GOALS), $(ANDROID_GOALS))
diff --git a/core/notice_files.mk b/core/notice_files.mk
index c314734..6df570e 100644
--- a/core/notice_files.mk
+++ b/core/notice_files.mk
@@ -61,6 +61,9 @@
# device-obj or host-obj.
module_installed_filename := \
$(patsubst $(PRODUCT_OUT)/%,%,$($(LOCAL_2ND_ARCH_VAR_PREFIX)$(my_prefix)OUT_SHARED_LIBRARIES))/$(notdir $(LOCAL_BUILT_MODULE))
+ else ifeq ($(LOCAL_MODULE_CLASS),SHARED_LIBRARIES)
+ # Shared modules may be uninstallable(e.g. TARGET_SKIP_CURRENT_VNDK=true)
+ module_installed_filename :=
else
ifeq ($(LOCAL_MODULE_CLASS),JAVA_LIBRARIES)
# Stick the static java libraries with the regular java libraries.
diff --git a/core/pack_dyn_relocs_setup.mk b/core/pack_dyn_relocs_setup.mk
index c5564b1..f86e11e 100644
--- a/core/pack_dyn_relocs_setup.mk
+++ b/core/pack_dyn_relocs_setup.mk
@@ -32,3 +32,12 @@
# Do not pack relocations on host modules
my_pack_module_relocations := false
endif
+
+# Lld relocation packing cannot be enabled for binaries before Android Pie.
+ifneq ($(LOCAL_SDK_VERSION),)
+ ifneq ($(LOCAL_SDK_VERSION),current)
+ ifeq ($(call math_lt,$(LOCAL_SDK_VERSION),28),true)
+ my_pack_module_relocations := false
+ endif
+ endif
+endif
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 493a0f1..2130058 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -25,18 +25,6 @@
## be set for you.
###########################################################
-# If this makefile is being read from within an inheritance,
-# use the new values.
-skip_definition:=
-ifdef LOCAL_PACKAGE_OVERRIDES
- package_overridden := $(call set-inherited-package-variables)
- ifeq ($(strip $(package_overridden)),)
- skip_definition := true
- endif
-endif
-
-ifndef skip_definition
-
LOCAL_PACKAGE_NAME := $(strip $(LOCAL_PACKAGE_NAME))
ifeq ($(LOCAL_PACKAGE_NAME),)
$(error $(LOCAL_PATH): Package modules must define LOCAL_PACKAGE_NAME)
@@ -121,7 +109,7 @@
$(LOCAL_ODM_MODULE) \
$(LOCAL_OEM_MODULE) \
$(LOCAL_PRODUCT_MODULE) \
- $(LOCAL_PRODUCT_SERVICES_MODULE) \
+ $(LOCAL_SYSTEM_EXT_MODULE) \
$(LOCAL_PROPRIETARY_MODULE) \
$(LOCAL_VENDOR_MODULE))
enforce_rro_enabled := $(if $(non_system_module),,true)
@@ -340,7 +328,7 @@
built_apk_splits := $(foreach s,$(my_split_suffixes),$(intermediates)/package_$(s).apk)
endif
-$(R_file_stamp) $(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
+$(R_file_stamp) $(my_res_package): PRIVATE_AAPT_FLAGS := $(filter-out --legacy,$(LOCAL_AAPT_FLAGS))
$(R_file_stamp) $(my_res_package): PRIVATE_TARGET_AAPT_CHARACTERISTICS := $(TARGET_AAPT_CHARACTERISTICS)
$(R_file_stamp) $(my_res_package): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
$(R_file_stamp) $(my_res_package): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
@@ -358,7 +346,6 @@
my_full_asset_paths := $(all_assets)
# Add AAPT2 link specific flags.
-$(my_res_package): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
ifndef LOCAL_AAPT_NAMESPACES
$(my_res_package): PRIVATE_AAPT_FLAGS += --no-static-lib-packages
endif
@@ -428,19 +415,11 @@
$(my_res_package) : $(all_library_res_package_export_deps)
-# These four are set above for $(R_stamp_file) and $(my_res_package), but
-# $(LOCAL_BUILT_MODULE) is not set before java.mk, so they have to be set again
-# here.
-$(LOCAL_BUILT_MODULE): PRIVATE_AAPT_FLAGS := $(LOCAL_AAPT_FLAGS)
-$(LOCAL_BUILT_MODULE): PRIVATE_TARGET_AAPT_CHARACTERISTICS := $(TARGET_AAPT_CHARACTERISTICS)
-$(LOCAL_BUILT_MODULE): PRIVATE_MANIFEST_PACKAGE_NAME := $(LOCAL_MANIFEST_PACKAGE_NAME)
-$(LOCAL_BUILT_MODULE): PRIVATE_MANIFEST_INSTRUMENTATION_FOR := $(LOCAL_MANIFEST_INSTRUMENTATION_FOR)
-
ifneq ($(full_classes_jar),)
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE := $(built_dex)
# Use the jarjar processed arhive as the initial package file.
$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE := $(full_classes_pre_proguard_jar)
-$(LOCAL_BUILT_MODULE): $(built_dex)
+$(LOCAL_BUILT_MODULE): $(built_dex) $(full_classes_pre_proguard_jar)
else
$(LOCAL_BUILT_MODULE): PRIVATE_DEX_FILE :=
$(LOCAL_BUILT_MODULE): PRIVATE_SOURCE_ARCHIVE :=
@@ -483,6 +462,31 @@
$(LOCAL_BUILT_MODULE): $(additional_certificates)
$(LOCAL_BUILT_MODULE): PRIVATE_ADDITIONAL_CERTIFICATES := $(additional_certificates)
+# Verify LOCAL_USES_LIBRARIES/LOCAL_OPTIONAL_USES_LIBRARIES
+# If LOCAL_ENFORCE_USES_LIBRARIES is not set, default to true if either of LOCAL_USES_LIBRARIES or
+# LOCAL_OPTIONAL_USES_LIBRARIES are specified.
+# Will change the default to true unconditionally in the future.
+ifndef LOCAL_ENFORCE_USES_LIBRARIES
+ ifneq (,$(strip $(LOCAL_USES_LIBRARIES)$(LOCAL_OPTIONAL_USES_LIBRARIES)))
+ LOCAL_ENFORCE_USES_LIBRARIES := true
+ endif
+endif
+
+my_enforced_uses_libraries :=
+ifdef LOCAL_ENFORCE_USES_LIBRARIES
+ my_manifest_check := $(intermediates.COMMON)/manifest/AndroidManifest.xml.check
+ $(my_manifest_check): $(MANIFEST_CHECK)
+ $(my_manifest_check): PRIVATE_USES_LIBRARIES := $(LOCAL_USES_LIBRARIES)
+ $(my_manifest_check): PRIVATE_OPTIONAL_USES_LIBRARIES := $(LOCAL_OPTIONAL_USES_LIBRARIES)
+ $(my_manifest_check): $(full_android_manifest)
+ @echo Checking manifest: $<
+ $(MANIFEST_CHECK) --enforce-uses-libraries \
+ $(addprefix --uses-library ,$(PRIVATE_USES_LIBRARIES)) \
+ $(addprefix --optional-uses-library ,$(PRIVATE_OPTIONAL_USES_LIBRARIES)) \
+ $< -o $@
+ $(LOCAL_BUILT_MODULE): $(my_manifest_check)
+endif
+
# Define the rule to build the actual package.
# PRIVATE_JNI_SHARED_LIBRARIES is a list of <abi>:<path_of_built_lib>.
$(LOCAL_BUILT_MODULE): PRIVATE_JNI_SHARED_LIBRARIES := $(jni_shared_libraries_with_abis)
@@ -504,7 +508,7 @@
endif
endif
-# Run veridex on product, product_services and vendor modules.
+# Run veridex on product, system_ext and vendor modules.
# We skip it for unbundled app builds where we cannot build veridex.
module_run_appcompat :=
ifeq (true,$(non_system_module))
@@ -524,7 +528,7 @@
$(LOCAL_BUILT_MODULE) : $(jni_shared_libraries)
$(LOCAL_BUILT_MODULE) : $(JAR_ARGS) $(SOONG_ZIP) $(MERGE_ZIPS) $(ZIP2ZIP)
$(LOCAL_BUILT_MODULE): PRIVATE_RES_PACKAGE := $(my_res_package)
-$(LOCAL_BUILT_MODULE) : $(my_res_package) $(AAPT2) | $(ACP)
+$(LOCAL_BUILT_MODULE) : $(my_res_package) $(AAPT2)
ifdef LOCAL_COMPRESSED_MODULE
$(LOCAL_BUILT_MODULE) : $(MINIGZIP)
endif
@@ -638,7 +642,7 @@
## the APK
ifdef LOCAL_DEX_PREOPT
$(my_dex_jar): PRIVATE_DEX_FILE := $(built_dex)
- $(my_dex_jar): $(built_dex)
+ $(my_dex_jar): $(built_dex) $(SOONG_ZIP)
$(hide) mkdir -p $(dir $@) && rm -f $@
$(call create-dex-jar,$@,$(PRIVATE_DEX_FILE))
endif
@@ -692,8 +696,6 @@
PACKAGES := $(PACKAGES) $(LOCAL_PACKAGE_NAME)
-endif # skip_definition
-
# Reset internal variables.
all_res_assets :=
diff --git a/core/prebuilt_internal.mk b/core/prebuilt_internal.mk
index f5b92fe..7006667 100644
--- a/core/prebuilt_internal.mk
+++ b/core/prebuilt_internal.mk
@@ -23,13 +23,13 @@
ifdef LOCAL_PREBUILT_MODULE_FILE
my_prebuilt_src_file := $(LOCAL_PREBUILT_MODULE_FILE)
else ifdef LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)
- my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH))
+ my_prebuilt_src_file := $(call clean-path,$(LOCAL_PATH)/$(LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH)))
LOCAL_SRC_FILES_$($(my_prefix)$(LOCAL_2ND_ARCH_VAR_PREFIX)ARCH) :=
else ifdef LOCAL_SRC_FILES_$(my_32_64_bit_suffix)
- my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES_$(my_32_64_bit_suffix))
+ my_prebuilt_src_file := $(call clean-path,$(LOCAL_PATH)/$(LOCAL_SRC_FILES_$(my_32_64_bit_suffix)))
LOCAL_SRC_FILES_$(my_32_64_bit_suffix) :=
else ifdef LOCAL_SRC_FILES
- my_prebuilt_src_file := $(LOCAL_PATH)/$(LOCAL_SRC_FILES)
+ my_prebuilt_src_file := $(call clean-path,$(LOCAL_PATH)/$(LOCAL_SRC_FILES))
LOCAL_SRC_FILES :=
else ifdef LOCAL_REPLACE_PREBUILT_APK_INSTALLED
# This is handled specially in app_prebuilt_internal.mk
@@ -49,9 +49,12 @@
include $(BUILD_SYSTEM)/app_prebuilt_internal.mk
else ifeq (JAVA_LIBRARIES,$(LOCAL_MODULE_CLASS))
include $(BUILD_SYSTEM)/java_prebuilt_internal.mk
-else
- # TODO(jungjw): Check LOCAL_MODULE_CLASS value and generate an error for unexpected ones.
+else ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES EXECUTABLES NATIVE_TESTS,$(LOCAL_MODULE_CLASS)),)
include $(BUILD_SYSTEM)/cc_prebuilt_internal.mk
+else ifneq ($(filter SCRIPT ETC DATA,$(LOCAL_MODULE_CLASS)),)
+ include $(BUILD_SYSTEM)/misc_prebuilt_internal.mk
+else
+ $(error $(LOCAL_MODULE) : unexpected LOCAL_MODULE_CLASS for prebuilts: $(LOCAL_MODULE_CLASS))
endif
$(built_module) : $(LOCAL_ADDITIONAL_DEPENDENCIES)
diff --git a/core/product-graph.mk b/core/product-graph.mk
index a114b65..9fc8e57 100644
--- a/core/product-graph.mk
+++ b/core/product-graph.mk
@@ -52,13 +52,27 @@
open_parethesis := (
close_parenthesis := )
+node_color_target := orange
+node_color_common := beige
+node_color_vendor := lavenderblush
+node_color_default := white
+define node-color
+$(if $(filter $(1),$(PRIVATE_PRODUCTS_FILTER)),\
+ $(node_color_target),\
+ $(if $(filter build/make/target/product/%,$(1)),\
+ $(node_color_common),\
+ $(if $(filter vendor/%,$(1)),$(node_color_vendor),$(node_color_default))\
+ )\
+)
+endef
+
# Emit properties of a product node to a file.
# $(1) the product
# $(2) the output file
define emit-product-node-props
$(hide) echo \"$(1)\" [ \
label=\"$(dir $(1))\\n$(notdir $(1))\\n\\n$(subst $(close_parenthesis),,$(subst $(open_parethesis),,$(PRODUCTS.$(strip $(1)).PRODUCT_MODEL)))\\n$(PRODUCTS.$(strip $(1)).PRODUCT_DEVICE)\" \
-$(if $(filter $(1),$(PRIVATE_PRODUCTS_FILTER)), style=\"filled\" fillcolor=\"#FFFDB0\",) \
+style=\"filled\" fillcolor=\"$(strip $(call node-color,$(1)))\" \
colorscheme=\"svg\" fontcolor=\"darkblue\" href=\"products/$(1).html\" \
] >> $(2)
@@ -103,7 +117,7 @@
$(hide) echo 'PRODUCT_DEFAULT_PROPERTY_OVERRIDES=$$(PRODUCTS.$(strip $(1)).PRODUCT_DEFAULT_PROPERTY_OVERRIDES)' >> $$@
$(hide) echo 'PRODUCT_SYSTEM_DEFAULT_PROPERTIES=$$(PRODUCTS.$(strip $(1)).PRODUCT_SYSTEM_DEFAULT_PROPERTIES)' >> $$@
$(hide) echo 'PRODUCT_PRODUCT_PROPERTIES=$$(PRODUCTS.$(strip $(1)).PRODUCT_PRODUCT_PROPERTIES)' >> $$@
- $(hide) echo 'PRODUCT_PRODUCT_SERVICES_PROPERTIES=$$(PRODUCTS.$(strip $(1)).PRODUCT_PRODUCT_SERVICES_PROPERTIES)' >> $$@
+ $(hide) echo 'PRODUCT_SYSTEM_EXT_PROPERTIES=$$(PRODUCTS.$(strip $(1)).PRODUCT_SYSTEM_EXT_PROPERTIES)' >> $$@
$(hide) echo 'PRODUCT_ODM_PROPERTIES=$$(PRODUCTS.$(strip $(1)).PRODUCT_ODM_PROPERTIES)' >> $$@
$(hide) echo 'PRODUCT_CHARACTERISTICS=$$(PRODUCTS.$(strip $(1)).PRODUCT_CHARACTERISTICS)' >> $$@
$(hide) echo 'PRODUCT_COPY_FILES=$$(PRODUCTS.$(strip $(1)).PRODUCT_COPY_FILES)' >> $$@
diff --git a/core/product.mk b/core/product.mk
index 838673c..c54583d 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -126,6 +126,8 @@
_product_list_vars += PRODUCT_PACKAGES
_product_list_vars += PRODUCT_PACKAGES_DEBUG
_product_list_vars += PRODUCT_PACKAGES_DEBUG_ASAN
+# Packages included only for eng/userdebug builds, when building with EMMA_INSTRUMENT=true
+_product_list_vars += PRODUCT_PACKAGES_DEBUG_JAVA_COVERAGE
_product_list_vars += PRODUCT_PACKAGES_ENG
_product_list_vars += PRODUCT_PACKAGES_TESTS
@@ -159,8 +161,8 @@
# A list of property assignments, like "key = value", with zero or more
# whitespace characters on either side of the '='.
-# used for adding properties to build.prop of product partition
-_product_list_vars += PRODUCT_PRODUCT_SERVICES_PROPERTIES
+# used for adding properties to build.prop of system_ext and odm partitions
+_product_list_vars += PRODUCT_SYSTEM_EXT_PROPERTIES
_product_list_vars += PRODUCT_ODM_PROPERTIES
# The characteristics of the product, which among other things is passed to aapt
@@ -236,7 +238,7 @@
_product_single_value_vars += PRODUCT_SYSTEM_VERITY_PARTITION
_product_single_value_vars += PRODUCT_VENDOR_VERITY_PARTITION
_product_single_value_vars += PRODUCT_PRODUCT_VERITY_PARTITION
-_product_single_value_vars += PRODUCT_PRODUCT_SERVICES_VERITY_PARTITION
+_product_single_value_vars += PRODUCT_SYSTEM_EXT_VERITY_PARTITION
_product_single_value_vars += PRODUCT_ODM_VERITY_PARTITION
_product_single_value_vars += PRODUCT_SYSTEM_SERVER_DEBUG_INFO
_product_single_value_vars += PRODUCT_OTHER_JAVA_DEBUG_INFO
@@ -263,7 +265,7 @@
_product_single_value_vars += PRODUCT_SYSTEM_BASE_FS_PATH
_product_single_value_vars += PRODUCT_VENDOR_BASE_FS_PATH
_product_single_value_vars += PRODUCT_PRODUCT_BASE_FS_PATH
-_product_single_value_vars += PRODUCT_PRODUCT_SERVICES_BASE_FS_PATH
+_product_single_value_vars += PRODUCT_SYSTEM_EXT_BASE_FS_PATH
_product_single_value_vars += PRODUCT_ODM_BASE_FS_PATH
# The first API level this product shipped with
@@ -278,9 +280,6 @@
# Make this art variable visible to soong_config.mk.
_product_single_value_vars += PRODUCT_ART_USE_READ_BARRIER
-# Whether the product is an Android Things variant.
-_product_single_value_vars += PRODUCT_IOT
-
# Add reserved headroom to a system image.
_product_single_value_vars += PRODUCT_SYSTEM_HEADROOM
@@ -355,7 +354,7 @@
_product_single_value_vars += PRODUCT_BUILD_SYSTEM_OTHER_IMAGE
_product_single_value_vars += PRODUCT_BUILD_VENDOR_IMAGE
_product_single_value_vars += PRODUCT_BUILD_PRODUCT_IMAGE
-_product_single_value_vars += PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE
+_product_single_value_vars += PRODUCT_BUILD_SYSTEM_EXT_IMAGE
_product_single_value_vars += PRODUCT_BUILD_ODM_IMAGE
_product_single_value_vars += PRODUCT_BUILD_CACHE_IMAGE
_product_single_value_vars += PRODUCT_BUILD_RAMDISK_IMAGE
@@ -541,10 +540,15 @@
endef
#
-# Strip the variables in _product_strip_var_list
+# Strip the variables in _product_var_list and a few build-system
+# internal variables, and assign the ones for the current product
+# to a shorthand that is more convenient to read from elsewhere.
#
define strip-product-vars
-$(foreach v,$(_product_var_list), \
+$(foreach v,\
+ $(_product_var_list) \
+ PRODUCT_ENFORCE_PACKAGES_EXIST \
+ PRODUCT_ENFORCE_PACKAGES_EXIST_WHITELIST, \
$(eval $(v) := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).$(v)))) \
)
endef
diff --git a/core/product_config.mk b/core/product_config.mk
index cb58cf4..1293c94 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -78,86 +78,18 @@
endef
# ---------------------------------------------------------------
-
-# These are the valid values of TARGET_BUILD_VARIANT. Also, if anything else is passed
-# as the variant in the PRODUCT-$TARGET_BUILD_PRODUCT-$TARGET_BUILD_VARIANT form,
-# it will be treated as a goal, and the eng variant will be used.
-INTERNAL_VALID_VARIANTS := user userdebug eng
-
-# ---------------------------------------------------------------
-# Provide "PRODUCT-<prodname>-<goal>" targets, which lets you build
-# a particular configuration without needing to set up the environment.
-#
+# Check for obsolete PRODUCT- and APP- goals
ifeq ($(CALLED_FROM_SETUP),true)
product_goals := $(strip $(filter PRODUCT-%,$(MAKECMDGOALS)))
ifdef product_goals
- # Scrape the product and build names out of the goal,
- # which should be of the form PRODUCT-<productname>-<buildname>.
- #
- ifneq ($(words $(product_goals)),1)
- $(error Only one PRODUCT-* goal may be specified; saw "$(product_goals)")
- endif
- goal_name := $(product_goals)
- product_goals := $(patsubst PRODUCT-%,%,$(product_goals))
- product_goals := $(subst -, ,$(product_goals))
- ifneq ($(words $(product_goals)),2)
- $(error Bad PRODUCT-* goal "$(goal_name)")
- endif
-
- # The product they want
- TARGET_PRODUCT := $(word 1,$(product_goals))
-
- # The variant they want
- TARGET_BUILD_VARIANT := $(word 2,$(product_goals))
-
- ifeq ($(TARGET_BUILD_VARIANT),tests)
- $(error "tests" has been deprecated as a build variant. Use it as a build goal instead.)
- endif
-
- # The build server wants to do make PRODUCT-dream-sdk
- # which really means TARGET_PRODUCT=dream make sdk.
- ifneq ($(filter-out $(INTERNAL_VALID_VARIANTS),$(TARGET_BUILD_VARIANT)),)
- override MAKECMDGOALS := $(MAKECMDGOALS) $(TARGET_BUILD_VARIANT)
- TARGET_BUILD_VARIANT := userdebug
- default_goal_substitution :=
- else
- default_goal_substitution := droid
- endif
-
- # Replace the PRODUCT-* goal with the build goal that it refers to.
- # Note that this will ensure that it appears in the same relative
- # position, in case it matters.
- override MAKECMDGOALS := $(patsubst $(goal_name),$(default_goal_substitution),$(MAKECMDGOALS))
+ $(error The PRODUCT-* goal is no longer supported. Use `TARGET_PRODUCT=<product> m droid` instead)
endif
-endif # CALLED_FROM_SETUP
-# else: Use the value set in the environment or buildspec.mk.
-
-# ---------------------------------------------------------------
-# Provide "APP-<appname>" targets, which lets you build
-# an unbundled app.
-#
-ifeq ($(CALLED_FROM_SETUP),true)
unbundled_goals := $(strip $(filter APP-%,$(MAKECMDGOALS)))
ifdef unbundled_goals
- ifneq ($(words $(unbundled_goals)),1)
- $(error Only one APP-* goal may be specified; saw "$(unbundled_goals)")
- endif
- TARGET_BUILD_APPS := $(strip $(subst -, ,$(patsubst APP-%,%,$(unbundled_goals))))
- ifneq ($(filter droid,$(MAKECMDGOALS)),)
- override MAKECMDGOALS := $(patsubst $(unbundled_goals),,$(MAKECMDGOALS))
- else
- override MAKECMDGOALS := $(patsubst $(unbundled_goals),droid,$(MAKECMDGOALS))
- endif
+ $(error The APP-* goal is no longer supported. Use `TARGET_BUILD_APPS="<app>" m droid` instead)
endif # unbundled_goals
endif
-# Now that we've parsed APP-* and PRODUCT-*, mark these as readonly
-TARGET_BUILD_APPS ?=
-.KATI_READONLY := \
- TARGET_PRODUCT \
- TARGET_BUILD_VARIANT \
- TARGET_BUILD_APPS
-
# Default to building dalvikvm on hosts that support it...
ifeq ($(HOST_OS),linux)
# ... or if the if the option is already set
@@ -418,7 +350,7 @@
SYSTEM_OTHER \
VENDOR \
PRODUCT \
- PRODUCT_SERVICES \
+ SYSTEM_EXT \
ODM \
CACHE \
RAMDISK \
diff --git a/core/rbe.mk b/core/rbe.mk
new file mode 100644
index 0000000..766b121
--- /dev/null
+++ b/core/rbe.mk
@@ -0,0 +1,32 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Notice: this works only with Google's RBE service.
+ifneq ($(filter-out false,$(USE_RBE)),)
+ ifdef RBE_DIR
+ rbe_dir := $(RBE_DIR)
+ else
+ rbe_dir := $(HOME)/rbe
+ endif
+ RBE_WRAPPER := $(rbe_dir)/rewrapper
+
+ # Append rewrapper to existing *_WRAPPER variables so it's possible to
+ # use both ccache and rewrapper.
+ CC_WRAPPER := $(strip $(CC_WRAPPER) $(RBE_WRAPPER))
+ CXX_WRAPPER := $(strip $(CXX_WRAPPER) $(RBE_WRAPPER))
+
+ rbe_dir :=
+endif
diff --git a/core/shared_library_internal.mk b/core/shared_library_internal.mk
index 44bb020..8ec07f8 100644
--- a/core/shared_library_internal.mk
+++ b/core/shared_library_internal.mk
@@ -73,11 +73,11 @@
$(my_target_libcrt_builtins) \
$(my_target_libgcc) \
$(my_target_libatomic) \
- $(LOCAL_ADDITIONAL_DEPENDENCIES)
+ $(LOCAL_ADDITIONAL_DEPENDENCIES) $(CLANG_CXX)
$(transform-o-to-shared-lib)
ifeq ($(my_native_coverage),true)
-gcno_suffix := .gcnodir
+gcno_suffix := .zip
built_whole_gcno_libraries := \
$(foreach lib,$(my_whole_static_libraries), \
@@ -99,11 +99,11 @@
GCNO_ARCHIVE := $(basename $(my_installed_module_stem))$(gcno_suffix)
+$(intermediates)/$(GCNO_ARCHIVE) : $(SOONG_ZIP) $(MERGE_ZIPS)
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS := $(strip $(LOCAL_GCNO_FILES))
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(strip $(built_whole_gcno_libraries)) $(strip $(built_static_gcno_libraries))
-$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_INTERMEDIATES_DIR := $(intermediates)
$(intermediates)/$(GCNO_ARCHIVE) : $(LOCAL_GCNO_FILES) $(built_whole_gcno_libraries) $(built_static_gcno_libraries)
- $(transform-o-to-static-lib)
+ $(package-coverage-files)
$(my_coverage_path)/$(GCNO_ARCHIVE) : $(intermediates)/$(GCNO_ARCHIVE)
$(copy-file-to-target)
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index d873cc4..8fc2e4c 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -43,7 +43,7 @@
endif # TURBINE_ENABLED != false
endif
-# Run veridex on product, product_services and vendor modules.
+# Run veridex on product, system_ext and vendor modules.
# We skip it for unbundled app builds where we cannot build veridex.
module_run_appcompat :=
ifeq (true,$(non_system_module))
diff --git a/core/soong_cc_prebuilt.mk b/core/soong_cc_prebuilt.mk
index 7a8f46e..34dd3e8 100644
--- a/core/soong_cc_prebuilt.mk
+++ b/core/soong_cc_prebuilt.mk
@@ -3,6 +3,7 @@
# LOCAL_SOONG_LINK_TYPE
# LOCAL_SOONG_TOC
# LOCAL_SOONG_UNSTRIPPED_BINARY
+# LOCAL_SOONG_VNDK_VERSION : means the version of VNDK where this module belongs
ifneq ($(LOCAL_MODULE_MAKEFILE),$(SOONG_ANDROID_MK))
$(call pretty-error,soong_cc_prebuilt.mk may only be used from Soong)
@@ -51,22 +52,22 @@
endif
endif
+# Don't install modules of current VNDK when it is told so
+ifeq ($(TARGET_SKIP_CURRENT_VNDK),true)
+ ifeq ($(LOCAL_SOONG_VNDK_VERSION),$(PLATFORM_VNDK_VERSION))
+ LOCAL_UNINSTALLABLE_MODULE := true
+ endif
+endif
+
#######################################
include $(BUILD_SYSTEM)/base_rules.mk
#######################################
ifneq ($(filter STATIC_LIBRARIES SHARED_LIBRARIES HEADER_LIBRARIES,$(LOCAL_MODULE_CLASS)),)
# Soong module is a static or shared library
- export_includes := $(intermediates)/export_includes
- $(export_includes): PRIVATE_EXPORT_CFLAGS := $(LOCAL_EXPORT_CFLAGS)
- $(export_includes): $(LOCAL_EXPORT_C_INCLUDE_DEPS)
- @echo Export includes file: $< -- $@
- $(hide) mkdir -p $(dir $@) && rm -f $@
- ifdef LOCAL_EXPORT_CFLAGS
- $(hide) echo "$(PRIVATE_EXPORT_CFLAGS)" >$@
- else
- $(hide) touch $@
- endif
+ EXPORTS_LIST := $(EXPORTS_LIST) $(intermediates)
+ EXPORTS.$(intermediates).FLAGS := $(LOCAL_EXPORT_CFLAGS)
+ EXPORTS.$(intermediates).DEPS := $(LOCAL_EXPORT_C_INCLUDE_DEPS)
ifdef LOCAL_SOONG_TOC
$(eval $(call copy-one-file,$(LOCAL_SOONG_TOC),$(LOCAL_BUILT_MODULE).toc))
@@ -179,14 +180,14 @@
ifeq ($(NATIVE_COVERAGE),true)
ifneq (,$(strip $(LOCAL_PREBUILT_COVERAGE_ARCHIVE)))
- $(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(intermediates)/$(LOCAL_MODULE).gcnodir))
+ $(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(intermediates)/$(LOCAL_MODULE).zip))
ifneq ($(LOCAL_UNINSTALLABLE_MODULE),true)
ifdef LOCAL_IS_HOST_MODULE
my_coverage_path := $($(my_prefix)OUT_COVERAGE)/$(patsubst $($(my_prefix)OUT)/%,%,$(my_module_path))
else
my_coverage_path := $(TARGET_OUT_COVERAGE)/$(patsubst $(PRODUCT_OUT)/%,%,$(my_module_path))
endif
- my_coverage_path := $(my_coverage_path)/$(patsubst %.so,%,$(my_installed_module_stem)).gcnodir
+ my_coverage_path := $(my_coverage_path)/$(patsubst %.so,%,$(my_installed_module_stem)).zip
$(eval $(call copy-one-file,$(LOCAL_PREBUILT_COVERAGE_ARCHIVE),$(my_coverage_path)))
$(LOCAL_BUILT_MODULE): $(my_coverage_path)
endif
@@ -194,13 +195,12 @@
# Coverage information is needed when static lib is a dependency of another
# coverage-enabled module.
ifeq (STATIC_LIBRARIES, $(LOCAL_MODULE_CLASS))
- GCNO_ARCHIVE := $(LOCAL_MODULE).gcnodir
+ GCNO_ARCHIVE := $(LOCAL_MODULE).zip
+ $(intermediates)/$(GCNO_ARCHIVE) : $(SOONG_ZIP) $(MERGE_ZIPS)
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS :=
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES :=
- $(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_PREFIX := $(my_prefix)
- $(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
$(intermediates)/$(GCNO_ARCHIVE) :
- $(transform-o-to-static-lib)
+ $(package-coverage-files)
endif
endif
endif
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 220e2c8..6737472 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -25,7 +25,7 @@
$(call add_json_str, Make_suffix, -$(TARGET_PRODUCT))
$(call add_json_str, BuildId, $(BUILD_ID))
-$(call add_json_str, BuildNumberFromFile, $$$(BUILD_NUMBER_FROM_FILE))
+$(call add_json_str, BuildNumberFromFile, $(BUILD_NUMBER_FROM_FILE))
$(call add_json_str, Platform_version_name, $(PLATFORM_VERSION))
$(call add_json_val, Platform_sdk_version, $(PLATFORM_SDK_VERSION))
@@ -62,11 +62,13 @@
$(call add_json_str, NativeBridgeArchVariant, $(TARGET_NATIVE_BRIDGE_ARCH_VARIANT))
$(call add_json_str, NativeBridgeCpuVariant, $(TARGET_NATIVE_BRIDGE_CPU_VARIANT))
$(call add_json_list, NativeBridgeAbi, $(TARGET_NATIVE_BRIDGE_ABI))
+$(call add_json_str, NativeBridgeRelativePath, $(TARGET_NATIVE_BRIDGE_RELATIVE_PATH))
$(call add_json_str, NativeBridgeSecondaryArch, $(TARGET_NATIVE_BRIDGE_2ND_ARCH))
$(call add_json_str, NativeBridgeSecondaryArchVariant, $(TARGET_NATIVE_BRIDGE_2ND_ARCH_VARIANT))
$(call add_json_str, NativeBridgeSecondaryCpuVariant, $(TARGET_NATIVE_BRIDGE_2ND_CPU_VARIANT))
$(call add_json_list, NativeBridgeSecondaryAbi, $(TARGET_NATIVE_BRIDGE_2ND_ABI))
+$(call add_json_str, NativeBridgeSecondaryRelativePath, $(TARGET_NATIVE_BRIDGE_2ND_RELATIVE_PATH))
$(call add_json_str, HostArch, $(HOST_ARCH))
$(call add_json_str, HostSecondaryArch, $(HOST_2ND_ARCH))
@@ -134,8 +136,6 @@
$(call add_json_bool, VndkUseCoreVariant, $(TARGET_VNDK_USE_CORE_VARIANT))
-$(call add_json_bool, Product_is_iot, $(filter true,$(PRODUCT_IOT)))
-
$(call add_json_bool, Treble_linker_namespaces, $(filter true,$(PRODUCT_TREBLE_LINKER_NAMESPACES)))
$(call add_json_bool, Enforce_vintf_manifest, $(filter true,$(PRODUCT_ENFORCE_VINTF_MANIFEST)))
@@ -146,17 +146,18 @@
$(call add_json_str, VendorPath, $(TARGET_COPY_OUT_VENDOR))
$(call add_json_str, OdmPath, $(TARGET_COPY_OUT_ODM))
$(call add_json_str, ProductPath, $(TARGET_COPY_OUT_PRODUCT))
-$(call add_json_str, ProductServicesPath, $(TARGET_COPY_OUT_PRODUCT_SERVICES))
+$(call add_json_str, SystemExtPath, $(TARGET_COPY_OUT_SYSTEM_EXT))
$(call add_json_bool, MinimizeJavaDebugInfo, $(filter true,$(PRODUCT_MINIMIZE_JAVA_DEBUG_INFO)))
$(call add_json_bool, UseGoma, $(filter-out false,$(USE_GOMA)))
+$(call add_json_bool, UseRBE, $(filter-out false,$(USE_RBE)))
$(call add_json_bool, Arc, $(filter true,$(TARGET_ARC)))
$(call add_json_list, NamespacesToExport, $(PRODUCT_SOONG_NAMESPACES))
$(call add_json_list, PgoAdditionalProfileDirs, $(PGO_ADDITIONAL_PROFILE_DIRS))
-$(call add_json_list, BoardVendorSepolicyDirs, $(BOARD_SEPOLICY_DIRS))
+$(call add_json_list, BoardVendorSepolicyDirs, $(BOARD_VENDOR_SEPOLICY_DIRS) $(BOARD_SEPOLICY_DIRS))
$(call add_json_list, BoardOdmSepolicyDirs, $(BOARD_ODM_SEPOLICY_DIRS))
$(call add_json_list, BoardPlatPublicSepolicyDirs, $(BOARD_PLAT_PUBLIC_SEPOLICY_DIR))
$(call add_json_list, BoardPlatPrivateSepolicyDirs, $(BOARD_PLAT_PRIVATE_SEPOLICY_DIR))
@@ -183,6 +184,8 @@
$(call add_json_list, TargetFSConfigGen, $(TARGET_FS_CONFIG_GEN))
+$(call add_json_list, MissingUsesLibraries, $(INTERNAL_PLATFORM_MISSING_USES_LIBRARIES))
+
$(call add_json_map, VendorVars)
$(foreach namespace,$(SOONG_CONFIG_NAMESPACES),\
$(call add_json_map, $(namespace))\
diff --git a/core/soong_java_prebuilt.mk b/core/soong_java_prebuilt.mk
index 6a76fc4..1496d56 100644
--- a/core/soong_java_prebuilt.mk
+++ b/core/soong_java_prebuilt.mk
@@ -128,6 +128,7 @@
my_installed := $(call copy-many-files, $(my_built_installed))
ALL_MODULES.$(my_register_name).INSTALLED += $(my_installed)
ALL_MODULES.$(my_register_name).BUILT_INSTALLED += $(my_built_installed)
+ALL_MODULES.$(my_register_name).CLASSES_JAR := $(full_classes_jar)
$(my_register_name): $(my_installed)
ifdef LOCAL_SOONG_AAR
diff --git a/core/static_library_internal.mk b/core/static_library_internal.mk
index 6b4d22f..0392460 100644
--- a/core/static_library_internal.mk
+++ b/core/static_library_internal.mk
@@ -21,11 +21,11 @@
include $(BUILD_SYSTEM)/binary.mk
$(LOCAL_BUILT_MODULE) : $(built_whole_libraries)
-$(LOCAL_BUILT_MODULE) : $(all_objects)
+$(LOCAL_BUILT_MODULE) : $(all_objects) $($(LOCAL_2ND_ARCH_VAR_PREFIX)TARGET_AR)
$(transform-o-to-static-lib)
ifeq ($(NATIVE_COVERAGE),true)
-gcno_suffix := .gcnodir
+gcno_suffix := .zip
built_whole_gcno_libraries := \
$(foreach lib,$(my_whole_static_libraries), \
@@ -35,11 +35,9 @@
GCNO_ARCHIVE := $(LOCAL_MODULE)$(gcno_suffix)
+$(intermediates)/$(GCNO_ARCHIVE) : $(SOONG_ZIP) $(MERGE_ZIPS)
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_OBJECTS := $(strip $(LOCAL_GCNO_FILES))
$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_ALL_WHOLE_STATIC_LIBRARIES := $(strip $(built_whole_gcno_libraries))
-$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_PREFIX := $(my_prefix)
-$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_2ND_ARCH_VAR_PREFIX := $(LOCAL_2ND_ARCH_VAR_PREFIX)
-$(intermediates)/$(GCNO_ARCHIVE) : PRIVATE_INTERMEDIATES_DIR := $(intermediates)
$(intermediates)/$(GCNO_ARCHIVE) : $(LOCAL_GCNO_FILES) $(built_whole_gcno_libraries)
- $(transform-o-to-static-lib)
+ $(package-coverage-files)
endif
diff --git a/core/tasks/device-tests.mk b/core/tasks/device-tests.mk
index 0028ce4..f071c7c 100644
--- a/core/tasks/device-tests.mk
+++ b/core/tasks/device-tests.mk
@@ -18,25 +18,33 @@
device-tests-zip := $(PRODUCT_OUT)/device-tests.zip
# Create an artifact to include a list of test config files in device-tests.
device-tests-list-zip := $(PRODUCT_OUT)/device-tests_list.zip
+# Create an artifact to include all test config files in device-tests.
+device-tests-configs-zip := $(PRODUCT_OUT)/device-tests_configs.zip
my_host_shared_lib_for_device_tests := $(call copy-many-files,$(COMPATIBILITY.device-tests.HOST_SHARED_LIBRARY.FILES))
-$(device-tests-zip) : .KATI_IMPLICIT_OUTPUTS := $(device-tests-list-zip)
+$(device-tests-zip) : .KATI_IMPLICIT_OUTPUTS := $(device-tests-list-zip) $(device-tests-configs-zip)
$(device-tests-zip) : PRIVATE_device_tests_list := $(PRODUCT_OUT)/device-tests_list
$(device-tests-zip) : PRIVATE_HOST_SHARED_LIBS := $(my_host_shared_lib_for_device_tests)
$(device-tests-zip) : $(COMPATIBILITY.device-tests.FILES) $(my_host_shared_lib_for_device_tests) $(SOONG_ZIP)
echo $(sort $(COMPATIBILITY.device-tests.FILES)) | tr " " "\n" > $@.list
grep $(HOST_OUT_TESTCASES) $@.list > $@-host.list || true
+ grep -e .*\\.config$$ $@-host.list > $@-host-test-configs.list || true
$(hide) for shared_lib in $(PRIVATE_HOST_SHARED_LIBS); do \
echo $$shared_lib >> $@-host.list; \
done
grep $(TARGET_OUT_TESTCASES) $@.list > $@-target.list || true
+ grep -e .*\\.config$$ $@-target.list > $@-target-test-configs.list || true
$(hide) $(SOONG_ZIP) -d -o $@ -P host -C $(HOST_OUT) -l $@-host.list -P target -C $(PRODUCT_OUT) -l $@-target.list
+ $(hide) $(SOONG_ZIP) -d -o $(device-tests-configs-zip) \
+ -P host -C $(HOST_OUT) -l $@-host-test-configs.list \
+ -P target -C $(PRODUCT_OUT) -l $@-target-test-configs.list
rm -f $(PRIVATE_device_tests_list)
- $(hide) grep -e .*.config$$ $@-host.list | sed s%$(HOST_OUT)%host%g > $(PRIVATE_device_tests_list)
- $(hide) grep -e .*.config$$ $@-target.list | sed s%$(PRODUCT_OUT)%target%g >> $(PRIVATE_device_tests_list)
+ $(hide) grep -e .*\\.config$$ $@-host.list | sed s%$(HOST_OUT)%host%g > $(PRIVATE_device_tests_list)
+ $(hide) grep -e .*\\.config$$ $@-target.list | sed s%$(PRODUCT_OUT)%target%g >> $(PRIVATE_device_tests_list)
$(hide) $(SOONG_ZIP) -d -o $(device-tests-list-zip) -C $(dir $@) -f $(PRIVATE_device_tests_list)
- rm -f $@.list $@-host.list $@-target.list $(PRIVATE_device_tests_list)
+ rm -f $@.list $@-host.list $@-target.list $@-host-test-configs.list $@-target-test-configs.list \
+ $(PRIVATE_device_tests_list)
device-tests: $(device-tests-zip)
-$(call dist-for-goals, device-tests, $(device-tests-zip) $(device-tests-list-zip))
+$(call dist-for-goals, device-tests, $(device-tests-zip) $(device-tests-list-zip) $(device-tests-configs-zip))
tests: device-tests
diff --git a/core/tasks/find-shareduid-violation.mk b/core/tasks/find-shareduid-violation.mk
index 45fd937..86052f2 100644
--- a/core/tasks/find-shareduid-violation.mk
+++ b/core/tasks/find-shareduid-violation.mk
@@ -24,7 +24,7 @@
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
$(INSTALLED_PRODUCTIMAGE_TARGET) \
- $(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET)
+ $(INSTALLED_SYSTEM_EXTIMAGE_TARGET)
$(shareduid_violation_modules_filename): $(find_shareduid_script)
$(shareduid_violation_modules_filename): $(AAPT2)
diff --git a/core/tasks/general-tests.mk b/core/tasks/general-tests.mk
index 36ab101..9ea4e62 100644
--- a/core/tasks/general-tests.mk
+++ b/core/tasks/general-tests.mk
@@ -34,11 +34,18 @@
my_host_shared_lib_for_general_tests += $(call copy-many-files,$(my_general_tests_shared_lib_files))
+# Create an artifact to include all test config files in general-tests.
+general_tests_configs_zip := $(PRODUCT_OUT)/general-tests_configs.zip
+# Create an artifact to include all shared librariy files in general-tests.
+general_tests_host_shared_libs_zip := $(PRODUCT_OUT)/general-tests_host-shared-libs.zip
+
$(general_tests_zip) : PRIVATE_general_tests_list_zip := $(general_tests_list_zip)
-$(general_tests_zip) : .KATI_IMPLICIT_OUTPUTS := $(general_tests_list_zip)
+$(general_tests_zip) : .KATI_IMPLICIT_OUTPUTS := $(general_tests_list_zip) $(general_tests_configs_zip) $(general_tests_host_shared_libs_zip)
$(general_tests_zip) : PRIVATE_TOOLS := $(general_tests_tools)
$(general_tests_zip) : PRIVATE_INTERMEDIATES_DIR := $(intermediates_dir)
$(general_tests_zip) : PRIVATE_HOST_SHARED_LIBS := $(my_host_shared_lib_for_general_tests)
+$(general_tests_zip) : PRIVATE_general_tests_configs_zip := $(general_tests_configs_zip)
+$(general_tests_zip) : PRIVATE_general_host_shared_libs_zip := $(general_tests_host_shared_libs_zip)
$(general_tests_zip) : $(COMPATIBILITY.general-tests.FILES) $(general_tests_tools) $(my_host_shared_lib_for_general_tests) $(SOONG_ZIP)
rm -rf $(PRIVATE_INTERMEDIATES_DIR)
rm -f $@ $(PRIVATE_general_tests_list_zip)
@@ -46,22 +53,33 @@
echo $(sort $(COMPATIBILITY.general-tests.FILES)) | tr " " "\n" > $(PRIVATE_INTERMEDIATES_DIR)/list
grep $(HOST_OUT_TESTCASES) $(PRIVATE_INTERMEDIATES_DIR)/list > $(PRIVATE_INTERMEDIATES_DIR)/host.list || true
grep $(TARGET_OUT_TESTCASES) $(PRIVATE_INTERMEDIATES_DIR)/list > $(PRIVATE_INTERMEDIATES_DIR)/target.list || true
+ grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/host.list > $(PRIVATE_INTERMEDIATES_DIR)/host-test-configs.list || true
+ grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/target.list > $(PRIVATE_INTERMEDIATES_DIR)/target-test-configs.list || true
$(hide) for shared_lib in $(PRIVATE_HOST_SHARED_LIBS); do \
echo $$shared_lib >> $(PRIVATE_INTERMEDIATES_DIR)/host.list; \
+ echo $$shared_lib >> $(PRIVATE_INTERMEDIATES_DIR)/shared-libs.list; \
done
+ grep $(HOST_OUT_TESTCASES) $(PRIVATE_INTERMEDIATES_DIR)/shared-libs.list > $(PRIVATE_INTERMEDIATES_DIR)/host-shared-libs.list || true
cp -fp $(PRIVATE_TOOLS) $(PRIVATE_INTERMEDIATES_DIR)/tools/
$(SOONG_ZIP) -d -o $@ \
-P host -C $(PRIVATE_INTERMEDIATES_DIR) -D $(PRIVATE_INTERMEDIATES_DIR)/tools \
-P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host.list \
-P target -C $(PRODUCT_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/target.list
- grep -e .*.config$$ $(PRIVATE_INTERMEDIATES_DIR)/host.list | sed s%$(HOST_OUT)%host%g > $(PRIVATE_INTERMEDIATES_DIR)/general-tests_list
- grep -e .*.config$$ $(PRIVATE_INTERMEDIATES_DIR)/target.list | sed s%$(PRODUCT_OUT)%target%g >> $(PRIVATE_INTERMEDIATES_DIR)/general-tests_list
+ $(SOONG_ZIP) -d -o $(PRIVATE_general_tests_configs_zip) \
+ -P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host-test-configs.list \
+ -P target -C $(PRODUCT_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/target-test-configs.list
+ $(SOONG_ZIP) -d -o $(PRIVATE_general_host_shared_libs_zip) \
+ -P host -C $(HOST_OUT) -l $(PRIVATE_INTERMEDIATES_DIR)/host-shared-libs.list
+ grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/host.list | sed s%$(HOST_OUT)%host%g > $(PRIVATE_INTERMEDIATES_DIR)/general-tests_list
+ grep -e .*\\.config$$ $(PRIVATE_INTERMEDIATES_DIR)/target.list | sed s%$(PRODUCT_OUT)%target%g >> $(PRIVATE_INTERMEDIATES_DIR)/general-tests_list
$(SOONG_ZIP) -d -o $(PRIVATE_general_tests_list_zip) -C $(PRIVATE_INTERMEDIATES_DIR) -f $(PRIVATE_INTERMEDIATES_DIR)/general-tests_list
general-tests: $(general_tests_zip)
-$(call dist-for-goals, general-tests, $(general_tests_zip) $(general_tests_list_zip))
+$(call dist-for-goals, general-tests, $(general_tests_zip) $(general_tests_list_zip) $(general_tests_configs_zip) $(general_tests_host_shared_libs_zip))
intermediates_dir :=
general_tests_tools :=
general_tests_zip :=
general_tests_list_zip :=
+general_tests_configs_zip :=
+general_tests_host_shared_libs_zip :=
diff --git a/core/tasks/module-info.mk b/core/tasks/module-info.mk
index 2c56162..f6cec15 100644
--- a/core/tasks/module-info.mk
+++ b/core/tasks/module-info.mk
@@ -17,15 +17,13 @@
'"test_config": [$(if $(ALL_MODULES.$(m).TEST_CONFIG),"$(ALL_MODULES.$(m).TEST_CONFIG)")], ' \
'"dependencies": [$(foreach w,$(sort $(ALL_DEPS.$(m).ALL_DEPS)),"$(w)", )], ' \
'"srcs": [$(foreach w,$(sort $(ALL_MODULES.$(m).SRCS)),"$(w)", )], ' \
+ '"srcjars": [$(foreach w,$(sort $(ALL_MODULES.$(m).SRCJARS)),"$(w)", )], ' \
+ '"classes_jar": [$(foreach w,$(sort $(ALL_MODULES.$(m).CLASSES_JAR)),"$(w)", )], ' \
'},\n' \
) | sed -e 's/, *\]/]/g' -e 's/, *\}/ }/g' -e '$$s/,$$//' >> $@
$(hide) echo '}' >> $@
-# If ONE_SHOT_MAKEFILE is set, our view of the world is smaller, so don't
-# rewrite the file in that came.
-ifndef ONE_SHOT_MAKEFILE
droidcore: $(MODULE_INFO_JSON)
-endif
$(call dist-for-goals, general-tests, $(MODULE_INFO_JSON))
diff --git a/core/tasks/mts.mk b/core/tasks/mts.mk
new file mode 100644
index 0000000..56b2390
--- /dev/null
+++ b/core/tasks/mts.mk
@@ -0,0 +1,23 @@
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+test_suite_name := mts
+test_suite_tradefed := mts-tradefed
+test_suite_readme := test/mts/README.md
+
+include $(BUILD_SYSTEM)/tasks/tools/compatibility.mk
+
+.PHONY: mts
+mts: $(compatibility_zip)
+$(call dist-for-goals, mts, $(compatibility_zip))
diff --git a/core/tasks/oem_image.mk b/core/tasks/oem_image.mk
index e9c506a..a847b9d 100644
--- a/core/tasks/oem_image.mk
+++ b/core/tasks/oem_image.mk
@@ -34,10 +34,10 @@
@mkdir -p $(TARGET_OUT_OEM)
@mkdir -p $(oemimage_intermediates) && rm -rf $(oemimage_intermediates)/oem_image_info.txt
$(call generate-image-prop-dictionary, $(oemimage_intermediates)/oem_image_info.txt,oem,skip_fsck=true)
- $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- build/make/tools/releasetools/build_image.py \
- $(TARGET_OUT_OEM) $(oemimage_intermediates)/oem_image_info.txt $@ $(TARGET_OUT)
- $(hide) $(call assert-max-image-size,$@,$(BOARD_OEMIMAGE_PARTITION_SIZE))
+ PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
+ $(BUILD_IMAGE) \
+ $(TARGET_OUT_OEM) $(oemimage_intermediates)/oem_image_info.txt $@ $(TARGET_OUT)
+ $(call assert-max-image-size,$@,$(BOARD_OEMIMAGE_PARTITION_SIZE))
.PHONY: oem_image
oem_image : $(INSTALLED_OEMIMAGE_TARGET)
diff --git a/core/tasks/sdk-addon.mk b/core/tasks/sdk-addon.mk
index 93db1de..7f777a5 100644
--- a/core/tasks/sdk-addon.mk
+++ b/core/tasks/sdk-addon.mk
@@ -14,8 +14,6 @@
.PHONY: sdk_addon
-ifndef ONE_SHOT_MAKEFILE
-
# If they didn't define PRODUCT_SDK_ADDON_NAME, then we won't define
# any of these rules.
addon_name := $(PRODUCT_SDK_ADDON_NAME)
@@ -114,20 +112,20 @@
$(full_target): PRIVATE_STAGING_DIR := $(call append-path,$(staging),$(addon_dir_leaf))
-$(full_target): $(sdk_addon_deps) | $(ACP) $(SOONG_ZIP)
+$(full_target): $(sdk_addon_deps) | $(SOONG_ZIP)
@echo Packaging SDK Addon: $@
$(hide) mkdir -p $(PRIVATE_STAGING_DIR)/docs
$(hide) for d in $(PRIVATE_DOCS_DIRS); do \
- $(ACP) -r $$d $(PRIVATE_STAGING_DIR)/docs ;\
+ cp -R $$d $(PRIVATE_STAGING_DIR)/docs ;\
done
$(hide) mkdir -p $(dir $@)
$(hide) $(SOONG_ZIP) -o $@ -C $(dir $(PRIVATE_STAGING_DIR)) -D $(PRIVATE_STAGING_DIR)
$(full_target_img): PRIVATE_STAGING_DIR := $(call append-path,$(staging),$(addon_dir_img))/images/$(TARGET_CPU_ABI)
-$(full_target_img): $(full_target) $(addon_img_source_prop) | $(ACP) $(SOONG_ZIP)
+$(full_target_img): $(full_target) $(addon_img_source_prop) | $(SOONG_ZIP)
@echo Packaging SDK Addon System-Image: $@
$(hide) mkdir -p $(dir $@)
- $(ACP) -r $(PRODUCT_OUT)/data $(PRIVATE_STAGING_DIR)/data
+ cp -R $(PRODUCT_OUT)/data $(PRIVATE_STAGING_DIR)/data
$(hide) $(SOONG_ZIP) -o $@ -C $(dir $(PRIVATE_STAGING_DIR)) -D $(PRIVATE_STAGING_DIR)
@@ -150,5 +148,3 @@
$(error Trying to build sdk_addon, but product '$(INTERNAL_PRODUCT)' does not define one)
endif
endif # addon_name
-
-endif # !ONE_SHOT_MAKEFILE
diff --git a/core/tasks/tools/build_custom_image.mk b/core/tasks/tools/build_custom_image.mk
index 19d2ab5..4721591 100644
--- a/core/tasks/tools/build_custom_image.mk
+++ b/core/tasks/tools/build_custom_image.mk
@@ -54,9 +54,15 @@
$(eval my_copy_pairs += $(bui):$(my_staging_dir)/$(my_copy_dest)))\
))
+my_kernel_module_copy_files :=
+my_custom_image_modules_var := BOARD_$(strip $(call to-upper,$(my_custom_image_name)))_KERNEL_MODULES
+ifdef $(my_custom_image_modules_var)
+ my_kernel_module_copy_files += $(call build-image-kernel-modules,$(my_custom_image_modules_var),$(my_staging_dir),$(my_custom_image_name)/,$(call intermediates-dir-for,PACKAGING,depmod_$(my_custom_image_name)))
+endif
+
# Collect CUSTOM_IMAGE_COPY_FILES.
my_image_copy_files :=
-$(foreach f,$(CUSTOM_IMAGE_COPY_FILES),\
+$(foreach f,$(CUSTOM_IMAGE_COPY_FILES) $(my_kernel_module_copy_files),\
$(eval pair := $(subst :,$(space),$(f)))\
$(eval src := $(word 1,$(pair)))\
$(eval my_image_copy_files += $(src))\
@@ -102,11 +108,6 @@
ifeq (true,$(CUSTOM_IMAGE_SUPPORT_VERITY_FEC))
$(my_built_custom_image): $(FEC)
endif
-my_custom_image_modules_var:=BOARD_$(strip $(call to-upper,$(my_custom_image_name)))_KERNEL_MODULES
-my_custom_image_modules:=$($(my_custom_image_modules_var))
-my_custom_image_modules_dep:=$(if $(my_custom_image_modules),$(my_custom_image_modules) $(DEPMOD),)
-$(my_built_custom_image): PRIVATE_KERNEL_MODULES := $(my_custom_image_modules)
-$(my_built_custom_image): PRIVATE_IMAGE_NAME := $(my_custom_image_name)
$(my_built_custom_image): $(INTERNAL_USERIMAGES_DEPS) $(my_built_modules) $(my_image_copy_files) $(my_custom_image_modules_dep) \
$(CUSTOM_IMAGE_DICT_FILE)
@echo "Build image $@"
@@ -117,8 +118,6 @@
$(eval pair := $(subst :,$(space),$(p)))\
mkdir -p $(dir $(word 2,$(pair)));\
cp -Rf $(word 1,$(pair)) $(word 2,$(pair));)
- $(if $(PRIVATE_KERNEL_MODULES), \
- $(call build-image-kernel-modules,$(PRIVATE_KERNEL_MODULES),$(PRIVATE_STAGING_DIR),$(PRIVATE_IMAGE_NAME)/,$(call intermediates-dir-for,PACKAGING,depmod_$(PRIVATE_IMAGE_NAME))))
$(if $($(PRIVATE_PICKUP_FILES)),$(hide) cp -Rf $(PRIVATE_PICKUP_FILES) $(PRIVATE_STAGING_DIR))
# Generate the dict.
$(hide) echo "# For all accepted properties, see BuildImage() in tools/releasetools/build_image.py" > $(PRIVATE_INTERMEDIATES)/image_info.txt
@@ -152,9 +151,9 @@
# Generate the image.
$(if $(filter oem,$(PRIVATE_MOUNT_POINT)), \
$(hide) echo "oem.buildnumber=$(BUILD_NUMBER_FROM_FILE)" >> $(PRIVATE_STAGING_DIR)/oem.prop)
- $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH \
- build/make/tools/releasetools/build_image.py \
- $(PRIVATE_STAGING_DIR) $(PRIVATE_INTERMEDIATES)/image_info.txt $@ $(TARGET_OUT)
+ $(hide) PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
+ $(BUILD_IMAGE) \
+ $(PRIVATE_STAGING_DIR) $(PRIVATE_INTERMEDIATES)/image_info.txt $@ $(TARGET_OUT)
my_installed_custom_image := $(PRODUCT_OUT)/$(notdir $(my_built_custom_image))
$(my_installed_custom_image) : $(my_built_custom_image)
diff --git a/core/tasks/tools/compatibility.mk b/core/tasks/tools/compatibility.mk
index 57a5cf9..f480300 100644
--- a/core/tasks/tools/compatibility.mk
+++ b/core/tasks/tools/compatibility.mk
@@ -53,8 +53,8 @@
$(hide) mkdir -p $(PRIVATE_OUT_DIR)/tools $(PRIVATE_OUT_DIR)/testcases
$(hide) echo $(BUILD_NUMBER_FROM_FILE) > $(PRIVATE_OUT_DIR)/tools/version.txt
# Copy tools
- $(hide) $(ACP) -fp $(PRIVATE_TOOLS) $(PRIVATE_OUT_DIR)/tools
- $(if $(PRIVATE_DYNAMIC_CONFIG),$(hide) $(ACP) -fp $(PRIVATE_DYNAMIC_CONFIG) $(PRIVATE_OUT_DIR)/testcases/$(PRIVATE_SUITE_NAME).dynamic)
+ $(hide) cp $(PRIVATE_TOOLS) $(PRIVATE_OUT_DIR)/tools
+ $(if $(PRIVATE_DYNAMIC_CONFIG),$(hide) cp $(PRIVATE_DYNAMIC_CONFIG) $(PRIVATE_OUT_DIR)/testcases/$(PRIVATE_SUITE_NAME).dynamic)
$(hide) find $(dir $@)/$(PRIVATE_NAME) | sort >$@.list
$(hide) $(SOONG_ZIP) -d -o $@ -C $(dir $@) -l $@.list
diff --git a/core/tasks/vts-core-tests.mk b/core/tasks/vts-core-tests.mk
new file mode 100644
index 0000000..919354c
--- /dev/null
+++ b/core/tasks/vts-core-tests.mk
@@ -0,0 +1,47 @@
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+.PHONY: vts-core
+
+vts-core-zip := $(PRODUCT_OUT)/vts-core-tests.zip
+# Create an artifact to include a list of test config files in vts-core.
+vts-core-list-zip := $(PRODUCT_OUT)/vts-core_list.zip
+# Create an artifact to include all test config files in vts-core.
+vts-core-configs-zip := $(PRODUCT_OUT)/vts-core_configs.zip
+my_host_shared_lib_for_vts_core := $(call copy-many-files,$(COMPATIBILITY.vts-core.HOST_SHARED_LIBRARY.FILES))
+$(vts-core-zip) : .KATI_IMPLICIT_OUTPUTS := $(vts-core-list-zip) $(vts-core-configs-zip)
+$(vts-core-zip) : PRIVATE_vts_core_list := $(PRODUCT_OUT)/vts-core_list
+$(vts-core-zip) : PRIVATE_HOST_SHARED_LIBS := $(my_host_shared_lib_for_vts_core)
+$(vts-core-zip) : $(COMPATIBILITY.vts-core.FILES) $(my_host_shared_lib_for_vts_core) $(SOONG_ZIP)
+ echo $(sort $(COMPATIBILITY.vts-core.FILES)) | tr " " "\n" > $@.list
+ grep $(HOST_OUT_TESTCASES) $@.list > $@-host.list || true
+ grep -e .*\\.config$$ $@-host.list > $@-host-test-configs.list || true
+ $(hide) for shared_lib in $(PRIVATE_HOST_SHARED_LIBS); do \
+ echo $$shared_lib >> $@-host.list; \
+ done
+ grep $(TARGET_OUT_TESTCASES) $@.list > $@-target.list || true
+ grep -e .*\\.config$$ $@-target.list > $@-target-test-configs.list || true
+ $(hide) $(SOONG_ZIP) -d -o $@ -P host -C $(HOST_OUT) -l $@-host.list -P target -C $(PRODUCT_OUT) -l $@-target.list
+ $(hide) $(SOONG_ZIP) -d -o $(vts-core-configs-zip) \
+ -P host -C $(HOST_OUT) -l $@-host-test-configs.list \
+ -P target -C $(PRODUCT_OUT) -l $@-target-test-configs.list
+ rm -f $(PRIVATE_vts_core_list)
+ $(hide) grep -e .*\\.config$$ $@-host.list | sed s%$(HOST_OUT)%host%g > $(PRIVATE_vts_core_list)
+ $(hide) grep -e .*\\.config$$ $@-target.list | sed s%$(PRODUCT_OUT)%target%g >> $(PRIVATE_vts_core_list)
+ $(hide) $(SOONG_ZIP) -d -o $(vts-core-list-zip) -C $(dir $@) -f $(PRIVATE_vts_core_list)
+ rm -f $@.list $@-host.list $@-target.list $@-host-test-configs.list $@-target-test-configs.list \
+ $(PRIVATE_vts_core_list)
+
+vts-core: $(vts-core-zip)
+$(call dist-for-goals, vts-core, $(vts-core-zip) $(vts-core-list-zip) $(vts-core-configs-zip))
diff --git a/core/version_defaults.mk b/core/version_defaults.mk
index b248fd3..efaacf5 100644
--- a/core/version_defaults.mk
+++ b/core/version_defaults.mk
@@ -73,11 +73,6 @@
# Update this value when the platform version changes (rather
# than overriding it somewhere else). Can be an arbitrary string.
-# When you add a new PLATFORM_VERSION which will result in a new
-# PLATFORM_SDK_VERSION please ensure you add a corresponding isAtLeast*
-# method in the following java file:
-# frameworks/support/compat/gingerbread/android/support/v4/os/BuildCompat.java
-
# When you change PLATFORM_VERSION for a given PLATFORM_SDK_VERSION
# please add that PLATFORM_VERSION as well as clean up obsolete PLATFORM_VERSION's
# in the following text file:
@@ -116,10 +111,6 @@
# SDK version the branch is based on and PLATFORM_VERSION_CODENAME holds
# the code-name of the new development work.
- # When you change PLATFORM_SDK_VERSION please ensure you also update the
- # corresponding methods for isAtLeast* in the following java file:
- # frameworks/support/compat/gingerbread/android/support/v4/os/BuildCompat.java
-
# When you increment the PLATFORM_SDK_VERSION please ensure you also
# clear out the following text file of all older PLATFORM_VERSION's:
# cts/tests/tests/os/assets/platform_versions.txt
@@ -261,7 +252,7 @@
# It must be of the form "YYYY-MM-DD" on production devices.
# It must match one of the Android Security Patch Level strings of the Public Security Bulletins.
# If there is no $PLATFORM_SECURITY_PATCH set, keep it empty.
- PLATFORM_SECURITY_PATCH := 2019-04-05
+ PLATFORM_SECURITY_PATCH := 2019-07-05
endif
.KATI_READONLY := PLATFORM_SECURITY_PATCH
diff --git a/envsetup.sh b/envsetup.sh
index 5292d38..0392e86 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -246,8 +246,11 @@
if [ -n "$ANDROID_TOOLCHAIN_2ND_ARCH" ]; then
ANDROID_BUILD_PATHS=$ANDROID_BUILD_PATHS:$ANDROID_TOOLCHAIN_2ND_ARCH
fi
- ANDROID_BUILD_PATHS=$ANDROID_BUILD_PATHS:$ANDROID_DEV_SCRIPTS:
- export ANDROID_BUILD_PATHS
+ ANDROID_BUILD_PATHS=$ANDROID_BUILD_PATHS:$ANDROID_DEV_SCRIPTS
+
+ # Append llvm binutils prebuilts path to ANDROID_BUILD_PATHS.
+ local ANDROID_LLVM_BINUTILS=$(get_abs_build_var ANDROID_CLANG_PREBUILTS)/llvm-binutils-stable
+ ANDROID_BUILD_PATHS=$ANDROID_BUILD_PATHS:$ANDROID_LLVM_BINUTILS
# If prebuilts/android-emulator/<system>/ exists, prepend it to our PATH
# to ensure that the corresponding 'emulator' binaries are used.
@@ -263,16 +266,16 @@
;;
esac
if [ -n "$ANDROID_EMULATOR_PREBUILTS" -a -d "$ANDROID_EMULATOR_PREBUILTS" ]; then
- ANDROID_BUILD_PATHS=$ANDROID_BUILD_PATHS$ANDROID_EMULATOR_PREBUILTS:
+ ANDROID_BUILD_PATHS=$ANDROID_BUILD_PATHS:$ANDROID_EMULATOR_PREBUILTS
export ANDROID_EMULATOR_PREBUILTS
fi
# Append asuite prebuilts path to ANDROID_BUILD_PATHS.
local os_arch=$(get_build_var HOST_PREBUILT_TAG)
- local ACLOUD_PATH="$T/prebuilts/asuite/acloud/$os_arch:"
- local AIDEGEN_PATH="$T/prebuilts/asuite/aidegen/$os_arch:"
- local ATEST_PATH="$T/prebuilts/asuite/atest/$os_arch:"
- export ANDROID_BUILD_PATHS=$ANDROID_BUILD_PATHS$ACLOUD_PATH$AIDEGEN_PATH$ATEST_PATH
+ local ACLOUD_PATH="$T/prebuilts/asuite/acloud/$os_arch"
+ local AIDEGEN_PATH="$T/prebuilts/asuite/aidegen/$os_arch"
+ local ATEST_PATH="$T/prebuilts/asuite/atest/$os_arch"
+ export ANDROID_BUILD_PATHS=$ANDROID_BUILD_PATHS:$ACLOUD_PATH:$AIDEGEN_PATH:$ATEST_PATH:
export PATH=$ANDROID_BUILD_PATHS$PATH
@@ -282,6 +285,9 @@
fi
# and in with the new
export ANDROID_PYTHONPATH=$T/development/python-packages:
+ if [ -n $VENDOR_PYTHONPATH ]; then
+ ANDROID_PYTHONPATH=$ANDROID_PYTHONPATH$VENDOR_PYTHONPATH
+ fi
export PYTHONPATH=$ANDROID_PYTHONPATH$PYTHONPATH
export ANDROID_JAVA_HOME=$(get_abs_build_var ANDROID_JAVA_HOME)
@@ -765,218 +771,6 @@
fi
}
-function m()
-{
- local T=$(gettop)
- if [ "$T" ]; then
- _wrap_build $T/build/soong/soong_ui.bash --make-mode $@
- else
- echo "Couldn't locate the top of the tree. Try setting TOP."
- return 1
- fi
-}
-
-function findmakefile()
-{
- local TOPFILE=build/make/core/envsetup.mk
- local HERE=$PWD
- if [ "$1" ]; then
- \cd $1
- fi;
- local T=
- while [ \( ! \( -f $TOPFILE \) \) -a \( $PWD != "/" \) ]; do
- T=`PWD= /bin/pwd`
- if [ -f "$T/Android.mk" -o -f "$T/Android.bp" ]; then
- echo $T/Android.mk
- \cd $HERE
- return
- fi
- \cd ..
- done
- \cd $HERE
- return 1
-}
-
-function mm()
-{
- local T=$(gettop)
- # If we're sitting in the root of the build tree, just do a
- # normal build.
- if [ -f build/soong/soong_ui.bash ]; then
- _wrap_build $T/build/soong/soong_ui.bash --make-mode $@
- else
- # Find the closest Android.mk file.
- local M=$(findmakefile)
- local MODULES=
- local GET_INSTALL_PATH=
- local ARGS=
- # Remove the path to top as the makefilepath needs to be relative
- local M=`echo $M|sed 's:'$T'/::'`
- if [ ! "$T" ]; then
- echo "Couldn't locate the top of the tree. Try setting TOP."
- return 1
- elif [ ! "$M" ]; then
- echo "Couldn't locate a makefile from the current directory."
- return 1
- else
- local ARG
- for ARG in $@; do
- case $ARG in
- GET-INSTALL-PATH) GET_INSTALL_PATH=$ARG;;
- esac
- done
- if [ -n "$GET_INSTALL_PATH" ]; then
- MODULES=
- ARGS=GET-INSTALL-PATH-IN-$(dirname ${M})
- ARGS=${ARGS//\//-}
- else
- MODULES=MODULES-IN-$(dirname ${M})
- # Convert "/" to "-".
- MODULES=${MODULES//\//-}
- ARGS=$@
- fi
- if [ "1" = "${WITH_TIDY_ONLY}" -o "true" = "${WITH_TIDY_ONLY}" ]; then
- MODULES=tidy_only
- fi
- ONE_SHOT_MAKEFILE=$M _wrap_build $T/build/soong/soong_ui.bash --make-mode $MODULES $ARGS
- fi
- fi
-}
-
-function mmm()
-{
- local T=$(gettop)
- if [ "$T" ]; then
- local MAKEFILE=
- local MODULES=
- local MODULES_IN_PATHS=
- local ARGS=
- local DIR TO_CHOP
- local DIR_MODULES
- local GET_INSTALL_PATH=
- local GET_INSTALL_PATHS=
- local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
- local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
- for DIR in $DIRS ; do
- DIR_MODULES=`echo $DIR | sed -n -e 's/.*:\(.*$\)/\1/p' | sed 's/,/ /'`
- DIR=`echo $DIR | sed -e 's/:.*//' -e 's:/$::'`
- # Remove the leading ./ and trailing / if any exists.
- DIR=${DIR#./}
- DIR=${DIR%/}
- local M
- if [ "$DIR_MODULES" = "" ]; then
- M=$(findmakefile $DIR)
- else
- # Only check the target directory if a module is specified.
- if [ -f $DIR/Android.mk -o -f $DIR/Android.bp ]; then
- local HERE=$PWD
- cd $DIR
- M=`PWD= /bin/pwd`
- M=$M/Android.mk
- cd $HERE
- fi
- fi
- if [ "$M" ]; then
- # Remove the path to top as the makefilepath needs to be relative
- local M=`echo $M|sed 's:'$T'/::'`
- if [ "$DIR_MODULES" = "" ]; then
- MODULES_IN_PATHS="$MODULES_IN_PATHS MODULES-IN-$(dirname ${M})"
- GET_INSTALL_PATHS="$GET_INSTALL_PATHS GET-INSTALL-PATH-IN-$(dirname ${M})"
- else
- MODULES="$MODULES $DIR_MODULES"
- fi
- MAKEFILE="$MAKEFILE $M"
- else
- case $DIR in
- showcommands | snod | dist | *=*) ARGS="$ARGS $DIR";;
- GET-INSTALL-PATH) GET_INSTALL_PATH=$DIR;;
- *) if [ -d $DIR ]; then
- echo "No Android.mk in $DIR.";
- else
- echo "Couldn't locate the directory $DIR";
- fi
- return 1;;
- esac
- fi
- done
- if [ -n "$GET_INSTALL_PATH" ]; then
- ARGS=${GET_INSTALL_PATHS//\//-}
- MODULES=
- MODULES_IN_PATHS=
- fi
- if [ "1" = "${WITH_TIDY_ONLY}" -o "true" = "${WITH_TIDY_ONLY}" ]; then
- MODULES=tidy_only
- MODULES_IN_PATHS=
- fi
- # Convert "/" to "-".
- MODULES_IN_PATHS=${MODULES_IN_PATHS//\//-}
- ONE_SHOT_MAKEFILE="$MAKEFILE" _wrap_build $T/build/soong/soong_ui.bash --make-mode $DASH_ARGS $MODULES $MODULES_IN_PATHS $ARGS
- else
- echo "Couldn't locate the top of the tree. Try setting TOP."
- return 1
- fi
-}
-
-function mma()
-{
- local T=$(gettop)
- if [ -f build/soong/soong_ui.bash ]; then
- _wrap_build $T/build/soong/soong_ui.bash --make-mode $@
- else
- if [ ! "$T" ]; then
- echo "Couldn't locate the top of the tree. Try setting TOP."
- return 1
- fi
- local M=$(findmakefile || echo $(realpath $PWD)/Android.mk)
- # Remove the path to top as the makefilepath needs to be relative
- local M=`echo $M|sed 's:'$T'/::'`
- local MODULES_IN_PATHS=MODULES-IN-$(dirname ${M})
- # Convert "/" to "-".
- MODULES_IN_PATHS=${MODULES_IN_PATHS//\//-}
- _wrap_build $T/build/soong/soong_ui.bash --make-mode $@ $MODULES_IN_PATHS
- fi
-}
-
-function mmma()
-{
- local T=$(gettop)
- if [ "$T" ]; then
- local DASH_ARGS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^-.*$/')
- local DIRS=$(echo "$@" | awk -v RS=" " -v ORS=" " '/^[^-].*$/')
- local MY_PWD=`PWD= /bin/pwd`
- if [ "$MY_PWD" = "$T" ]; then
- MY_PWD=
- else
- MY_PWD=`echo $MY_PWD|sed 's:'$T'/::'`
- fi
- local DIR=
- local MODULES_IN_PATHS=
- local ARGS=
- for DIR in $DIRS ; do
- if [ -d $DIR ]; then
- # Remove the leading ./ and trailing / if any exists.
- DIR=${DIR#./}
- DIR=${DIR%/}
- if [ "$MY_PWD" != "" ]; then
- DIR=$MY_PWD/$DIR
- fi
- MODULES_IN_PATHS="$MODULES_IN_PATHS MODULES-IN-$DIR"
- else
- case $DIR in
- showcommands | snod | dist | *=*) ARGS="$ARGS $DIR";;
- *) echo "Couldn't find directory $DIR"; return 1;;
- esac
- fi
- done
- # Convert "/" to "-".
- MODULES_IN_PATHS=${MODULES_IN_PATHS//\//-}
- _wrap_build $T/build/soong/soong_ui.bash --make-mode $DASH_ARGS $ARGS $MODULES_IN_PATHS
- else
- echo "Couldn't locate the top of the tree. Try setting TOP."
- return 1
- fi
-}
-
function croot()
{
local T=$(gettop)
@@ -1662,6 +1456,41 @@
return $ret
}
+function _trigger_build()
+(
+ local -r bc="$1"; shift
+ if T="$(gettop)"; then
+ _wrap_build "$T/build/soong/soong_ui.bash" --build-mode --${bc} --dir="$(pwd)" "$@"
+ else
+ echo "Couldn't locate the top of the tree. Try setting TOP."
+ fi
+)
+
+function m()
+(
+ _trigger_build "all-modules" "$@"
+)
+
+function mm()
+(
+ _trigger_build "modules-in-a-dir-no-deps" "$@"
+)
+
+function mmm()
+(
+ _trigger_build "modules-in-dirs-no-deps" "$@"
+)
+
+function mma()
+(
+ _trigger_build "modules-in-a-dir" "$@"
+)
+
+function mmma()
+(
+ _trigger_build "modules-in-dirs" "$@"
+)
+
function make()
{
_wrap_build $(get_make_command "$@") "$@"
@@ -1726,6 +1555,7 @@
#
# This allows loading only approved vendorsetup.sh files
function source_vendorsetup() {
+ unset VENDOR_PYTHONPATH
allowed=
for f in $(find -L device vendor product -maxdepth 4 -name 'allowed-vendorsetup_sh-files' 2>/dev/null | sort); do
if [ -n "$allowed" ]; then
diff --git a/help.sh b/help.sh
index be07344..b02b14c 100755
--- a/help.sh
+++ b/help.sh
@@ -40,8 +40,8 @@
Stands for "Vendor, NO Dependencies"
pnod Quickly rebuild the product image from built packages
Stands for "Product, NO Dependencies"
- psnod Quickly rebuild the product_services image from built packages
- Stands for "ProductServices, NO Dependencies"
+ senod Quickly rebuild the system_ext image from built packages
+ Stands for "SystemExt, NO Dependencies"
onod Quickly rebuild the odm image from built packages
Stands for "ODM, NO Dependencies"
diff --git a/target/board/Android.mk b/target/board/Android.mk
index 971a7b2..c8705c3 100644
--- a/target/board/Android.mk
+++ b/target/board/Android.mk
@@ -19,7 +19,7 @@
ifndef board_info_txt
board_info_txt := $(wildcard $(TARGET_DEVICE_DIR)/board-info.txt)
endif
-$(INSTALLED_ANDROID_INFO_TXT_TARGET): $(board_info_txt)
+$(INSTALLED_ANDROID_INFO_TXT_TARGET): $(board_info_txt) build/make/tools/check_radio_versions.py
$(hide) build/make/tools/check_radio_versions.py $< $(BOARD_INFO_CHECK)
$(call pretty,"Generated: ($@)")
ifdef board_info_txt
diff --git a/target/board/BoardConfigEmuCommon.mk b/target/board/BoardConfigEmuCommon.mk
index 3ab5f12..ac21918 100644
--- a/target/board/BoardConfigEmuCommon.mk
+++ b/target/board/BoardConfigEmuCommon.mk
@@ -41,6 +41,11 @@
# 3G
BOARD_EMULATOR_DYNAMIC_PARTITIONS_SIZE := 3221225472
+
+ # in build environment to speed up make -j
+ ifeq ($(QEMU_DISABLE_AVB),true)
+ BOARD_AVB_ENABLE := false
+ endif
else ifeq ($(PRODUCT_USE_DYNAMIC_PARTITION_SIZE),true)
# Enable dynamic system image size and reserved 64MB in it.
BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE := 67108864
diff --git a/target/board/BoardConfigGsiCommon.mk b/target/board/BoardConfigGsiCommon.mk
index 96fd07b..e4dd032 100644
--- a/target/board/BoardConfigGsiCommon.mk
+++ b/target/board/BoardConfigGsiCommon.mk
@@ -19,8 +19,9 @@
# Enable dynamic system image size and reserved 64MB in it.
BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE := 67108864
-# GSI forces product packages to /system for now.
+# GSI forces product and system_ext packages to /system for now.
TARGET_COPY_OUT_PRODUCT := system/product
+TARGET_COPY_OUT_SYSTEM_EXT := system/system_ext
BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE :=
# Creates metadata partition mount point under root for
@@ -50,6 +51,9 @@
BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216
+# Setup a vendor image to let PRODUCT_PROPERTY_OVERRIDES does not affect GSI
+BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
+
# Disable 64 bit mediadrmserver
TARGET_ENABLE_MEDIADRM_64 :=
diff --git a/target/board/BoardConfigMainlineCommon.mk b/target/board/BoardConfigMainlineCommon.mk
index be7c804..70cfe39 100644
--- a/target/board/BoardConfigMainlineCommon.mk
+++ b/target/board/BoardConfigMainlineCommon.mk
@@ -8,7 +8,8 @@
TARGET_USERIMAGES_USE_EXT4 := true
-# Mainline devices must have /vendor and /product partitions.
+# Mainline devices must have /system_ext, /vendor and /product partitions.
+TARGET_COPY_OUT_SYSTEM_EXT := system_ext
TARGET_COPY_OUT_VENDOR := vendor
TARGET_COPY_OUT_PRODUCT := product
@@ -39,5 +40,11 @@
# Enable system property split for Treble
BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
+# Include stats logging code in LMKD
+TARGET_LMKD_STATS_LOG := true
+
# Generate an APEX image for experiment b/119800099.
DEXPREOPT_GENERATE_APEX_IMAGE := true
+
+# Mainline devices support apex
+TARGET_FLATTEN_APEX := false
diff --git a/target/board/gsi_system.prop b/target/board/gsi_system.prop
index 780aadc..dd3227e 100644
--- a/target/board/gsi_system.prop
+++ b/target/board/gsi_system.prop
@@ -12,3 +12,8 @@
# TODO(b/78105955): disable privapp_permissions checking before the bug solved
ro.control_privapp_permissions=disable
+
+# TODO(b/136212765): the default for LMK
+ro.lmk.kill_heaviest_task=true
+ro.lmk.kill_timeout_ms=100
+ro.lmk.use_minfree_levels=true
diff --git a/target/board/gsi_system_user.prop b/target/board/gsi_system_user.prop
index 217bd01..db6d880 100644
--- a/target/board/gsi_system_user.prop
+++ b/target/board/gsi_system_user.prop
@@ -9,3 +9,8 @@
# TODO(b/78105955): disable privapp_permissions checking before the bug solved
ro.control_privapp_permissions=disable
+
+# TODO(b/136212765): the default for LMK
+ro.lmk.kill_heaviest_task=true
+ro.lmk.kill_timeout_ms=100
+ro.lmk.use_minfree_levels=true
diff --git a/target/product/aosp_arm.mk b/target/product/aosp_arm.mk
index 0fdd313..2ff2b20 100644
--- a/target/product/aosp_arm.mk
+++ b/target/product/aosp_arm.mk
@@ -23,19 +23,38 @@
# - VNDK enforcement
# - compatible property override enabled
-# GSI for system/product
-$(call inherit-product, $(SRC_TARGET_DIR)/product/gsi_common.mk)
+#
+# All components inherited here go to system image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
# Enable mainline checking for excat this product name
ifeq (aosp_arm,$(TARGET_PRODUCT))
PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
endif
-# Emulator for vendor
+PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
+
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# All components inherited here go to vendor image
+#
$(call inherit-product-if-exists, device/generic/goldfish/arm32-vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86/device.mk)
+#
+# Special settings for GSI releasing
+#
+ifeq (aosp_arm,$(TARGET_PRODUCT))
+$(call inherit-product, $(SRC_TARGET_DIR)/product/gsi_release.mk)
+endif
+
+
PRODUCT_NAME := aosp_arm
PRODUCT_DEVICE := generic
PRODUCT_BRAND := Android
diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk
index 8ef2023..cc4785a 100644
--- a/target/product/aosp_arm64.mk
+++ b/target/product/aosp_arm64.mk
@@ -28,14 +28,11 @@
# build quite specifically for the emulator, and might not be
# entirely appropriate to inherit from for on-device configurations.
-# GSI for system/product
+#
+# All components inherited here go to system image
+#
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/gsi_common.mk)
-
-# Emulator for vendor
-$(call inherit-product-if-exists, device/generic/goldfish/arm64-vendor.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
# Enable mainline checking for excat this product name
ifeq (aosp_arm64,$(TARGET_PRODUCT))
@@ -43,16 +40,27 @@
endif
PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
- root/init.zygote32_64.rc \
root/init.zygote64_32.rc \
-# Copy different zygote settings for vendor.img to select by setting property
-# ro.zygote=zygote64_32 or ro.zygote=zygote32_64:
-# 1. 64-bit primary, 32-bit secondary OR
-# 2. 32-bit primary, 64-bit secondary
-# init.zygote64_32.rc is in the core_64_bit.mk below
-PRODUCT_COPY_FILES += \
- system/core/rootdir/init.zygote32_64.rc:root/init.zygote32_64.rc
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# All components inherited here go to vendor image
+#
+$(call inherit-product-if-exists, device/generic/goldfish/arm64-vendor.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk)
+
+#
+# Special settings for GSI releasing
+#
+ifeq (aosp_arm64,$(TARGET_PRODUCT))
+$(call inherit-product, $(SRC_TARGET_DIR)/product/gsi_release.mk)
+endif
+
PRODUCT_NAME := aosp_arm64
PRODUCT_DEVICE := generic_arm64
diff --git a/target/product/aosp_product.mk b/target/product/aosp_product.mk
new file mode 100644
index 0000000..fa56779
--- /dev/null
+++ b/target/product/aosp_product.mk
@@ -0,0 +1,61 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+# Includes all AOSP product packages
+$(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_product.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_product.mk)
+
+# Default AOSP sounds
+$(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.mk)
+
+# TODO(b/133643923): Clean up the mainline whitelist
+PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
+ system/app/messaging/messaging.apk \
+ system/app/messaging/oat/% \
+ system/app/WAPPushManager/WAPPushManager.apk \
+ system/app/WAPPushManager/oat/% \
+ system/bin/healthd \
+ system/etc/init/healthd.rc \
+ system/etc/seccomp_policy/crash_dump.%.policy \
+ system/etc/seccomp_policy/mediacodec.policy \
+ system/etc/vintf/manifest/manifest_healthd.xml \
+ system/lib/libframesequence.so \
+ system/lib/libgiftranscode.so \
+ system/lib64/libframesequence.so \
+ system/lib64/libgiftranscode.so \
+
+
+# Additional settings used in all AOSP builds
+PRODUCT_PRODUCT_PROPERTIES += \
+ ro.config.ringtone=Ring_Synth_04.ogg \
+ ro.config.notification_sound=pixiedust.ogg \
+
+# More AOSP packages
+PRODUCT_PACKAGES += \
+ messaging \
+ PhotoTable \
+ WAPPushManager \
+ WallpaperPicker \
+
+# Telephony:
+# Provide a APN configuration to GSI product
+PRODUCT_COPY_FILES += \
+ device/sample/etc/apns-full-conf.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/apns-conf.xml
+
+# NFC:
+# Provide a libnfc-nci.conf to GSI product
+PRODUCT_COPY_FILES += \
+ device/generic/common/nfc/libnfc-nci.conf:$(TARGET_COPY_OUT_PRODUCT)/etc/libnfc-nci.conf
diff --git a/target/product/aosp_x86.mk b/target/product/aosp_x86.mk
index 1c71948..e557aa8 100644
--- a/target/product/aosp_x86.mk
+++ b/target/product/aosp_x86.mk
@@ -23,19 +23,37 @@
# - VNDK enforcement
# - compatible property override enabled
-# GSI for system/product
-$(call inherit-product, $(SRC_TARGET_DIR)/product/gsi_common.mk)
-
-# Emulator for vendor
-$(call inherit-product-if-exists, device/generic/goldfish/x86-vendor.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86/device.mk)
+#
+# All components inherited here go to system image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
# Enable mainline checking for excat this product name
ifeq (aosp_x86,$(TARGET_PRODUCT))
PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
endif
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# All components inherited here go to vendor image
+#
+$(call inherit-product-if-exists, device/generic/goldfish/x86-vendor.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86/device.mk)
+
+
+#
+# Special settings for GSI releasing
+#
+ifeq (aosp_x86,$(TARGET_PRODUCT))
+$(call inherit-product, $(SRC_TARGET_DIR)/product/gsi_release.mk)
+endif
+
+
PRODUCT_NAME := aosp_x86
PRODUCT_DEVICE := generic_x86
PRODUCT_BRAND := Android
diff --git a/target/product/aosp_x86_64.mk b/target/product/aosp_x86_64.mk
index 9dfa2f4..a471702 100644
--- a/target/product/aosp_x86_64.mk
+++ b/target/product/aosp_x86_64.mk
@@ -28,14 +28,11 @@
# build quite specifically for the emulator, and might not be
# entirely appropriate to inherit from for on-device configurations.
-# GSI for system/product
+#
+# All components inherited here go to system image
+#
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/gsi_common.mk)
-
-# Emulator for vendor
-$(call inherit-product-if-exists, device/generic/goldfish/x86_64-vendor.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86_64/device.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
# Enable mainline checking for excat this product name
ifeq (aosp_x86_64,$(TARGET_PRODUCT))
@@ -43,16 +40,27 @@
endif
PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
- root/init.zygote32_64.rc \
root/init.zygote64_32.rc \
-# Copy different zygote settings for vendor.img to select by setting property
-# ro.zygote=zygote64_32 or ro.zygote=zygote32_64:
-# 1. 64-bit primary, 32-bit secondary OR
-# 2. 32-bit primary, 64-bit secondary
-# init.zygote64_32.rc is in the core_64_bit.mk below
-PRODUCT_COPY_FILES += \
- system/core/rootdir/init.zygote32_64.rc:root/init.zygote32_64.rc
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# All components inherited here go to vendor image
+#
+$(call inherit-product-if-exists, device/generic/goldfish/x86_64-vendor.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator_vendor.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86_64/device.mk)
+
+#
+# Special settings for GSI releasing
+#
+ifeq (aosp_x86_64,$(TARGET_PRODUCT))
+$(call inherit-product, $(SRC_TARGET_DIR)/product/gsi_release.mk)
+endif
+
PRODUCT_NAME := aosp_x86_64
PRODUCT_DEVICE := generic_x86_64
diff --git a/target/product/base_product.mk b/target/product/base_product.mk
index 82557bf..749d2c2 100644
--- a/target/product/base_product.mk
+++ b/target/product/base_product.mk
@@ -16,7 +16,9 @@
# Base modules and settings for the product partition.
PRODUCT_PACKAGES += \
+ group_product \
healthd \
ModuleMetadata \
+ passwd_product \
product_compatibility_matrix.xml \
product_manifest.xml \
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 606a605..c256641 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -19,6 +19,9 @@
abb \
adbd \
am \
+ android.hardware.neuralnetworks@1.0 \
+ android.hardware.neuralnetworks@1.1 \
+ android.hardware.neuralnetworks@1.2 \
android.hidl.allocator@1.0-service \
android.hidl.base-V1.0-java \
android.hidl.manager-V1.0-java \
@@ -53,6 +56,7 @@
com.android.conscrypt \
com.android.location.provider \
com.android.resolv \
+ com.android.neuralnetworks \
com.android.tzdata \
ContactsProvider \
content \
@@ -77,6 +81,7 @@
fsck_msdos \
fs_config_files_system \
fs_config_dirs_system \
+ group_system \
gsid \
heapprofd \
heapprofd_client \
@@ -153,7 +158,6 @@
libnetd_client \
libnetlink \
libnetutils \
- libneuralnetworks \
libOpenMAXAL \
libOpenSLES \
libpdfium \
@@ -187,6 +191,7 @@
libwifi-service \
libwilhelm \
linker \
+ linkerconfig \
lmkd \
locksettings \
logcat \
@@ -209,6 +214,7 @@
NetworkStack \
org.apache.http.legacy \
otacerts \
+ passwd_system \
perfetto \
ping \
ping6 \
@@ -221,6 +227,7 @@
resize2fs \
rss_hwm_reset \
run-as \
+ sanitizer.libraries.txt \
schedtest \
screencap \
sdcard \
@@ -258,6 +265,8 @@
viewcompiler \
voip-common \
vold \
+ vndkcore.libraries.txt \
+ vndkprivate.libraries.txt \
WallpaperBackup \
watchdogd \
wificond \
@@ -281,6 +290,7 @@
fastboot \
flags_health_check \
icu-data_host_runtime_apex \
+ icu_tzdata.dat_host_tzdata_apex \
incident_report \
ld.mc \
lpdump \
@@ -298,10 +308,10 @@
unwind_symbols \
viewcompiler \
tzdata_host \
- tzdata_host_runtime_apex \
- tzlookup.xml_host_runtime_apex \
+ tzdata_host_tzdata_apex \
+ tzlookup.xml_host_tzdata_apex \
tz_version_host \
- tz_version_host_runtime_apex \
+ tz_version_host_tzdata_apex \
ifeq ($(TARGET_CORE_JARS),)
$(error TARGET_CORE_JARS is empty; cannot initialize PRODUCT_BOOT_JARS variable)
@@ -374,6 +384,9 @@
# Packages included only for eng/userdebug builds, when building with SANITIZE_TARGET=address
PRODUCT_PACKAGES_DEBUG_ASAN :=
+PRODUCT_PACKAGES_DEBUG_JAVA_COVERAGE := \
+ libdumpcoverage
+
PRODUCT_COPY_FILES += $(call add-to-product-copy-files-if-exists,\
frameworks/base/config/preloaded-classes:system/etc/preloaded-classes)
diff --git a/target/product/base_vendor.mk b/target/product/base_vendor.mk
index c45f870..4233c1c 100644
--- a/target/product/base_vendor.mk
+++ b/target/product/base_vendor.mk
@@ -47,8 +47,10 @@
fs_config_files_nonsystem \
fs_config_dirs_nonsystem \
gralloc.default \
- group \
+ group_odm \
+ group_vendor \
init_vendor \
+ libashmemd_hidl_client \
libbundlewrapper \
libclearkeycasplugin \
libdownmix \
@@ -61,7 +63,8 @@
libreverbwrapper \
libril \
libvisualizer \
- passwd \
+ passwd_odm \
+ passwd_vendor \
selinux_policy_nonsystem \
shell_and_utilities_vendor \
vndservice \
diff --git a/target/product/emulator_vendor.mk b/target/product/emulator_vendor.mk
index f0a5354..727987c 100644
--- a/target/product/emulator_vendor.mk
+++ b/target/product/emulator_vendor.mk
@@ -29,6 +29,7 @@
system/lib/egl/libGLES_android.so \
system/lib64/egl/libGLES_android.so \
system/priv-app/SdkSetup/SdkSetup.apk \
+ system/priv-app/SdkSetup/oat/% \
# Device modules
PRODUCT_PACKAGES += \
diff --git a/target/product/generic.mk b/target/product/generic.mk
index 6fe4818..68130e3 100644
--- a/target/product/generic.mk
+++ b/target/product/generic.mk
@@ -25,4 +25,5 @@
PRODUCT_DEVICE := generic
PRODUCT_NAME := generic
-$(call enforce-product-packages-exist,)
+whitelist := product_manifest.xml
+$(call enforce-product-packages-exist,$(whitelist))
diff --git a/target/product/gsi/Android.mk b/target/product/gsi/Android.mk
index eaaa051..1ef124b 100644
--- a/target/product/gsi/Android.mk
+++ b/target/product/gsi/Android.mk
@@ -38,6 +38,7 @@
droidcore: check-vndk-list
check-vndk-list-timestamp := $(call intermediates-dir-for,PACKAGING,vndk)/check-list-timestamp
+check-vndk-abi-dump-list-timestamp := $(call intermediates-dir-for,PACKAGING,vndk)/check-abi-dump-list-timestamp
ifeq ($(TARGET_IS_64_BIT)|$(TARGET_2ND_ARCH),true|)
# TODO(b/110429754) remove this condition when we support 64-bit-only device
@@ -46,8 +47,13 @@
# b/118634643: don't check VNDK lib list when building PDK. Some libs (libandroid_net.so
# and some render-script related ones) can't be built in PDK due to missing frameworks/base.
check-vndk-list: ;
+else ifeq ($(TARGET_SKIP_CURRENT_VNDK),true)
+check-vndk-list: ;
else
check-vndk-list: $(check-vndk-list-timestamp)
+ifneq ($(SKIP_ABI_CHECKS),true)
+check-vndk-list: $(check-vndk-abi-dump-list-timestamp)
+endif
endif
_vndk_check_failure_message := " error: VNDK library list has been changed.\n"
@@ -95,16 +101,55 @@
endif
@chmod a+x $@
+#####################################################################
+# Check that all ABI reference dumps have corresponding NDK/VNDK
+# libraries.
+
+# $(1): The directory containing ABI dumps.
+# Return a list of ABI dump paths ending with .so.lsdump.
+define find-abi-dump-paths
+$(if $(wildcard $(1)), \
+ $(addprefix $(1)/, \
+ $(call find-files-in-subdirs,$(1),"*.so.lsdump" -and -type f,.)))
+endef
+
+VNDK_ABI_DUMP_DIR := prebuilts/abi-dumps/vndk/$(PLATFORM_VNDK_VERSION)
+NDK_ABI_DUMP_DIR := prebuilts/abi-dumps/ndk/$(PLATFORM_VNDK_VERSION)
+VNDK_ABI_DUMPS := $(call find-abi-dump-paths,$(VNDK_ABI_DUMP_DIR))
+NDK_ABI_DUMPS := $(call find-abi-dump-paths,$(NDK_ABI_DUMP_DIR))
+
+$(check-vndk-abi-dump-list-timestamp): $(VNDK_ABI_DUMPS) $(NDK_ABI_DUMPS)
+ $(eval added_vndk_abi_dumps := $(strip $(sort $(filter-out \
+ $(addsuffix .so.lsdump,$(VNDK_SAMEPROCESS_LIBRARIES) $(VNDK_CORE_LIBRARIES)), \
+ $(notdir $(VNDK_ABI_DUMPS))))))
+ $(if $(added_vndk_abi_dumps), \
+ echo -e "Found ABI reference dumps for non-VNDK libraries. Run \`find \$${ANDROID_BUILD_TOP}/$(VNDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_vndk_abi_dumps)) ')' -delete\` to delete the dumps.")
+
+ $(eval added_ndk_abi_dumps := $(strip $(sort $(filter-out \
+ $(addsuffix .so.lsdump,$(NDK_MIGRATED_LIBS) $(LLNDK_LIBRARIES)), \
+ $(notdir $(NDK_ABI_DUMPS))))))
+ $(if $(added_ndk_abi_dumps), \
+ echo -e "Found ABI reference dumps for non-NDK libraries. Run \`find \$${ANDROID_BUILD_TOP}/$(NDK_ABI_DUMP_DIR) '(' -name $(subst $(space), -or -name ,$(added_ndk_abi_dumps)) ')' -delete\` to delete the dumps.")
+
+ $(if $(added_vndk_abi_dumps)$(added_ndk_abi_dumps),exit 1)
+ $(hide) mkdir -p $(dir $@)
+ $(hide) touch $@
+
+#####################################################################
+# VNDK package and snapshot.
+
ifneq ($(BOARD_VNDK_VERSION),)
include $(CLEAR_VARS)
LOCAL_MODULE := vndk_package
+# Filter LLNDK libs moved to APEX to avoid pulling them into /system/LIB
LOCAL_REQUIRED_MODULES := \
- $(LLNDK_LIBRARIES) \
- llndk.libraries.txt \
- vndksp.libraries.txt
+ $(filter-out $(LLNDK_MOVED_TO_APEX_LIBRARIES),$(LLNDK_LIBRARIES)))
+
ifneq ($(TARGET_SKIP_CURRENT_VNDK),true)
LOCAL_REQUIRED_MODULES += \
+ llndk.libraries.txt \
+ vndksp.libraries.txt \
$(addsuffix .vendor,$(VNDK_CORE_LIBRARIES)) \
$(addsuffix .vendor,$(VNDK_SAMEPROCESS_LIBRARIES))
endif
diff --git a/target/product/gsi/current.txt b/target/product/gsi/current.txt
index 584a0ca..d954e9f 100644
--- a/target/product/gsi/current.txt
+++ b/target/product/gsi/current.txt
@@ -4,6 +4,7 @@
LLNDK: libGLESv3.so
LLNDK: libRS.so
LLNDK: libandroid_net.so
+LLNDK: libbinder_ndk.so
LLNDK: libc.so
LLNDK: libcgrouprc.so
LLNDK: libdl.so
@@ -169,6 +170,7 @@
VNDK-core: android.hidl.memory.block@1.0.so
VNDK-core: android.hidl.token@1.0.so
VNDK-core: android.hidl.token@1.0-utils.so
+VNDK-core: android.system.ashmem@1.0.so
VNDK-core: android.system.net.netd@1.0.so
VNDK-core: android.system.net.netd@1.1.so
VNDK-core: android.system.suspend@1.0.so
@@ -193,7 +195,6 @@
VNDK-core: libgui.so
VNDK-core: libhardware_legacy.so
VNDK-core: libhidlallocatorutils.so
-VNDK-core: libhidlcache.so
VNDK-core: libjpeg.so
VNDK-core: libkeymaster_messages.so
VNDK-core: libkeymaster_portable.so
diff --git a/target/product/gsi/skip_mount.cfg b/target/product/gsi/skip_mount.cfg
index 549767e..3f812cb 100644
--- a/target/product/gsi/skip_mount.cfg
+++ b/target/product/gsi/skip_mount.cfg
@@ -1,2 +1,2 @@
/product
-/product_services
+/system_ext
diff --git a/target/product/gsi_arm64.mk b/target/product/gsi_arm64.mk
index b711d88..09fb633 100644
--- a/target/product/gsi_arm64.mk
+++ b/target/product/gsi_arm64.mk
@@ -14,22 +14,28 @@
# limitations under the License.
#
+#
+# All components inherited here go to system image
+#
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
-$(call inherit-product, $(SRC_TARGET_DIR)/product/gsi_common.mk)
+$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline_system.mk)
# Enable mainline checking
PRODUCT_ENFORCE_ARTIFACT_PATH_REQUIREMENTS := relaxed
+
PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
- root/init.zygote32_64.rc \
root/init.zygote64_32.rc \
-# Copy different zygote settings for vendor.img to select by setting property
-# ro.zygote=zygote64_32 or ro.zygote=zygote32_64:
-# 1. 64-bit primary, 32-bit secondary OR
-# 2. 32-bit primary, 64-bit secondary
-# init.zygote64_32.rc is in the core_64_bit.mk below
-PRODUCT_COPY_FILES += \
- system/core/rootdir/init.zygote32_64.rc:root/init.zygote32_64.rc
+#
+# All components inherited here go to product image
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_product.mk)
+
+#
+# Special settings for GSI releasing
+#
+$(call inherit-product, $(SRC_TARGET_DIR)/product/gsi_release.mk)
+
PRODUCT_NAME := gsi_arm64
PRODUCT_DEVICE := gsi_arm64
diff --git a/target/product/gsi_common.mk b/target/product/gsi_common.mk
index c38dd80..1b5cd55 100644
--- a/target/product/gsi_common.mk
+++ b/target/product/gsi_common.mk
@@ -23,10 +23,15 @@
# Default AOSP sounds
$(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.mk)
+# GSI doesn't support apex for now.
+# Properties set in product take precedence over those in vendor.
+PRODUCT_PRODUCT_PROPERTIES += \
+ ro.apex.updatable=false
+
# Additional settings used in all AOSP builds
-PRODUCT_PROPERTY_OVERRIDES += \
+PRODUCT_PRODUCT_PROPERTIES += \
ro.config.ringtone=Ring_Synth_04.ogg \
- ro.config.notification_sound=pixiedust.ogg
+ ro.config.notification_sound=pixiedust.ogg \
# The mainline checking whitelist, should be clean up
PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
@@ -41,7 +46,6 @@
system/lib/libgiftranscode.so \
system/lib64/libframesequence.so \
system/lib64/libgiftranscode.so \
- system/priv-app/Dialer/Dialer.apk \
# Some GSI builds enable dexpreopt, whitelist these preopt files
PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += %.odex %.vdex %.art
@@ -51,10 +55,10 @@
system/etc/init/config/skip_mount.cfg \
system/etc/init/init.gsi.rc \
-# Exclude all files under system/product and system/product_services
+# Exclude all files under system/product and system/system_ext
PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
system/product/% \
- system/product_services/%
+ system/system_ext/%
# Split selinux policy
@@ -74,14 +78,12 @@
# Support addtional P vendor interface
PRODUCT_EXTRA_VNDK_VERSIONS := 28
-# Default AOSP packages
+# More AOSP packages
PRODUCT_PACKAGES += \
messaging \
-
-# Default AOSP packages
-PRODUCT_PACKAGES += \
PhotoTable \
WAPPushManager \
+ WallpaperPicker \
# Telephony:
# Provide a APN configuration to GSI product
diff --git a/target/product/gsi_release.mk b/target/product/gsi_release.mk
new file mode 100644
index 0000000..4c471db
--- /dev/null
+++ b/target/product/gsi_release.mk
@@ -0,0 +1,74 @@
+#
+# Copyright (C) 2019 The Android Open-Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+#
+# The makefile contains the special settings for GSI releasing.
+# This makefile is used for the build targets which used for releasing GSI.
+#
+# For example:
+# - Released GSI contains skip_mount.cfg to skip mounting prodcut paritition
+# - Released GSI contains more VNDK packages to support old version vendors
+# - etc.
+#
+
+# Exclude GSI specific files
+PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
+ system/etc/init/config/skip_mount.cfg \
+ system/etc/init/init.gsi.rc \
+
+# Exclude all files under system/product and system/system_ext
+PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
+ system/product/% \
+ system/system_ext/%
+
+
+# GSI doesn't support apex for now.
+# Properties set in product take precedence over those in vendor.
+PRODUCT_PRODUCT_PROPERTIES += \
+ ro.apex.updatable=false
+
+# Split selinux policy
+PRODUCT_FULL_TREBLE_OVERRIDE := true
+
+# Enable dynamic partition size
+PRODUCT_USE_DYNAMIC_PARTITION_SIZE := true
+
+# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
+PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
+
+# GSI specific tasks on boot
+PRODUCT_COPY_FILES += \
+ build/make/target/product/gsi/skip_mount.cfg:system/etc/init/config/skip_mount.cfg \
+ build/make/target/product/gsi/init.gsi.rc:system/etc/init/init.gsi.rc \
+
+# Support addtional P VNDK packages
+PRODUCT_EXTRA_VNDK_VERSIONS := 28
+
+# The 64 bits GSI build targets inhiert core_64_bit.mk to enable 64 bits and
+# include the init.zygote64_32.rc.
+# 64 bits GSI for releasing need to includes different zygote settings for
+# vendor.img to select by setting property ro.zygote=zygote64_32 or
+# ro.zygote=zygote32_64:
+# 1. 64-bit primary, 32-bit secondary, or
+# 2. 32-bit primary, 64-bit secondary
+# Here includes the init.zygote32_64.rc if it had inhierted core_64_bit.mk.
+ifeq (true|true,$(TARGET_SUPPORTS_32_BIT_APPS)|$(TARGET_SUPPORTS_64_BIT_APPS))
+PRODUCT_COPY_FILES += \
+ system/core/rootdir/init.zygote32_64.rc:root/init.zygote32_64.rc
+
+PRODUCT_ARTIFACT_PATH_REQUIREMENT_WHITELIST += \
+ root/init.zygote32_64.rc
+endif
diff --git a/target/product/mainline_arm64.mk b/target/product/mainline_arm64.mk
index 6050924..c098c9f 100644
--- a/target/product/mainline_arm64.mk
+++ b/target/product/mainline_arm64.mk
@@ -16,7 +16,8 @@
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/mainline.mk)
-$(call enforce-product-packages-exist,)
+whitelist := product_manifest.xml
+$(call enforce-product-packages-exist,$(whitelist))
PRODUCT_NAME := mainline_arm64
PRODUCT_DEVICE := mainline_arm64
diff --git a/target/product/mainline_system.mk b/target/product/mainline_system.mk
index 87393d4..8bcc212 100644
--- a/target/product/mainline_system.mk
+++ b/target/product/mainline_system.mk
@@ -97,11 +97,6 @@
PRODUCT_HOST_PACKAGES += \
tinyplay
-# Enable stats logging in LMKD
-TARGET_LMKD_STATS_LOG := true
-PRODUCT_SYSTEM_DEFAULT_PROPERTIES += \
- ro.lmk.log_stats=true
-
# Enable dynamic partition size
PRODUCT_USE_DYNAMIC_PARTITION_SIZE := true
diff --git a/target/product/mainline_system_arm64.mk b/target/product/mainline_system_arm64.mk
index f01cc54..b9ac1e3 100644
--- a/target/product/mainline_system_arm64.mk
+++ b/target/product/mainline_system_arm64.mk
@@ -21,7 +21,7 @@
PRODUCT_BUILD_CACHE_IMAGE := false
PRODUCT_BUILD_ODM_IMAGE := false
PRODUCT_BUILD_PRODUCT_IMAGE := false
-PRODUCT_BUILD_PRODUCT_SERVICES_IMAGE := false
+PRODUCT_BUILD_SYSTEM_EXT_IMAGE := false
PRODUCT_BUILD_RAMDISK_IMAGE := false
PRODUCT_BUILD_SYSTEM_IMAGE := true
PRODUCT_BUILD_SYSTEM_OTHER_IMAGE := false
diff --git a/tools/check_builds.sh b/tools/check_builds.sh
deleted file mode 100644
index 7e4ea7c..0000000
--- a/tools/check_builds.sh
+++ /dev/null
@@ -1,92 +0,0 @@
-# Copyright (C) 2009 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the 'License');
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an 'AS IS' BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-#
-# Usage:
-#
-# Source this file into your environment. Then:
-#
-# $ golden_builds sdk-sdk generic-eng generic-userdebug dream-eng
-#
-# will build a set of combos. This might take a while. Then you can
-# go make changes, and run:
-#
-# $ check_builds sdk-sdk generic-eng generic-userdebug dream-eng
-#
-# Go get dinner, and when you get back, there will be a file
-# test-builds/sizes.html that has a pretty chart of which files are
-# in which tree, and how big they are. In that chart, cells for files
-# that are missing are red, and rows where the file sizes are not all
-# the same will be blue.
-#
-
-TEST_BUILD_DIR=test-builds
-
-function do_builds
-{
- PREFIX=$1
- shift
- while [ -n "$1" ]
- do
- rm -rf $TEST_BUILD_DIR/$PREFIX-$1
- make PRODUCT-$(echo $1 | sed "s/-.*//" )-installclean
- make -j16 PRODUCT-$1 dist DIST_DIR=$TEST_BUILD_DIR/$PREFIX-$1
- if [ $? -ne 0 ] ; then
- echo FAILED
- return
- fi
- shift
- done
-}
-
-function golden_builds
-{
- rm -rf $TEST_BUILD_DIR/golden-* $TEST_BUILD_DIR/dist-*
- do_builds golden "$@"
-}
-
-function compare_builds
-{
- local inputs=
- while [ -n "$1" ]
- do
- inputs="$inputs $TEST_BUILD_DIR/golden-$1/installed-files.txt"
- inputs="$inputs $TEST_BUILD_DIR/dist-$1/installed-files.txt"
- shift
- done
- build/make/tools/compare_fileslist.py $inputs > $TEST_BUILD_DIR/sizes.html
-}
-
-function check_builds
-{
- rm -rf $TEST_BUILD_DIR/dist-*
- do_builds dist "$@"
- compare_builds "$@"
-}
-
-function diff_builds
-{
- local inputs=
- while [ -n "$1" ]
- do
- diff $TEST_BUILD_DIR/golden-$1/installed-files.txt $TEST_BUILD_DIR/dist-$1/installed-files.txt &> /dev/null
- if [ $? != 0 ]; then
- echo =========== $1 ===========
- diff $TEST_BUILD_DIR/golden-$1/installed-files.txt $TEST_BUILD_DIR/dist-$1/installed-files.txt
- fi
- shift
- done
- build/make/tools/compare_fileslist.py $inputs > $TEST_BUILD_DIR/sizes.html
-}
-
diff --git a/tools/check_link_type.py b/tools/check_link_type.py
deleted file mode 100755
index 40754ad..0000000
--- a/tools/check_link_type.py
+++ /dev/null
@@ -1,80 +0,0 @@
-#!/usr/bin/env python
-#
-# Copyright (C) 2016 The Android Open Source Project
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-"""Utility to verify modules link against acceptable module types"""
-
-from __future__ import print_function
-import argparse
-import os
-import sys
-
-WARNING_MSG = ('\033[1m%(makefile)s: \033[35mwarning:\033[0m\033[1m '
- '%(module)s (%(type)s) should not link to %(dep_name)s (%(dep_type)s)'
- '\033[0m')
-ERROR_MSG = ('\033[1m%(makefile)s: \033[31merror:\033[0m\033[1m '
- '%(module)s (%(type)s) should not link to %(dep_name)s (%(dep_type)s)'
- '\033[0m')
-
-def parse_args():
- """Parse commandline arguments."""
- parser = argparse.ArgumentParser(description='Check link types')
- parser.add_argument('--makefile', help='Makefile defining module')
- parser.add_argument('--module', help='The module being checked')
- parser.add_argument('--type', help='The link type of module')
- parser.add_argument('--allowed', help='Allow deps to use these types',
- action='append', default=[], metavar='TYPE')
- parser.add_argument('--warn', help='Warn if deps use these types',
- action='append', default=[], metavar='TYPE')
- parser.add_argument('deps', help='The dependencies to check',
- metavar='DEP', nargs='*')
- return parser.parse_args()
-
-def print_msg(msg, args, dep_name, dep_type):
- """Print a warning or error message"""
- print(msg % {
- "makefile": args.makefile,
- "module": args.module,
- "type": args.type,
- "dep_name": dep_name,
- "dep_type": dep_type}, file=sys.stderr)
-
-def main():
- """Program entry point."""
- args = parse_args()
-
- failed = False
- for dep in args.deps:
- dep_name = os.path.basename(os.path.dirname(dep))
- if dep_name.endswith('_intermediates'):
- dep_name = dep_name[:len(dep_name)-len('_intermediates')]
-
- with open(dep, 'r') as dep_file:
- dep_types = dep_file.read().strip().split(' ')
-
- for dep_type in dep_types:
- if dep_type in args.allowed:
- continue
- if dep_type in args.warn:
- print_msg(WARNING_MSG, args, dep_name, dep_type)
- else:
- print_msg(ERROR_MSG, args, dep_name, dep_type)
- failed = True
-
- if failed:
- sys.exit(1)
-
-if __name__ == '__main__':
- main()
diff --git a/tools/extract_kernel.py b/tools/extract_kernel.py
index 16ccb22..42561cf 100755
--- a/tools/extract_kernel.py
+++ b/tools/extract_kernel.py
@@ -47,7 +47,10 @@
null_idx = input_bytes.find('\x00', start_idx)
if null_idx < 0:
return None
- linux_banner = input_bytes[start_idx:null_idx].decode()
+ try:
+ linux_banner = input_bytes[start_idx:null_idx].decode()
+ except UnicodeDecodeError:
+ return None
mo = re.match(LINUX_BANNER_REGEX, linux_banner)
if mo:
return mo.group(1)
diff --git a/tools/fs_config/Android.bp b/tools/fs_config/Android.bp
index d9a48d7..8c69417 100644
--- a/tools/fs_config/Android.bp
+++ b/tools/fs_config/Android.bp
@@ -20,7 +20,7 @@
"soong-genrule",
],
srcs: [
- "fs_config.go"
+ "fs_config.go",
],
pluginFor: ["soong_build"],
}
@@ -56,13 +56,13 @@
export_generated_headers: ["oemaids_header_gen"],
}
-// Generate the vendor/etc/passwd text file for the target
-// This file may be empty if no AIDs are defined in
+// Generate the */etc/passwd text files for the target
+// These files may be empty if no AIDs are defined in
// TARGET_FS_CONFIG_GEN files.
genrule {
- name: "passwd_gen",
+ name: "passwd_gen_system",
tool_files: ["fs_config_generator.py"],
- cmd: "$(location fs_config_generator.py) passwd --required-prefix=vendor_ --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)",
+ cmd: "$(location fs_config_generator.py) passwd --partition=system --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)",
srcs: [
":target_fs_config_gen",
":android_filesystem_config_header",
@@ -71,18 +71,90 @@
}
prebuilt_etc {
- name: "passwd",
- vendor: true,
- src: ":passwd_gen",
+ name: "passwd_system",
+ filename: "passwd",
+ src: ":passwd_gen_system",
}
-// Generate the vendor/etc/group text file for the target
-// This file may be empty if no AIDs are defined in
+genrule {
+ name: "passwd_gen_vendor",
+ tool_files: ["fs_config_generator.py"],
+ cmd: "$(location fs_config_generator.py) passwd --partition=vendor --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)",
+ srcs: [
+ ":target_fs_config_gen",
+ ":android_filesystem_config_header",
+ ],
+ out: ["passwd"],
+}
+
+prebuilt_etc {
+ name: "passwd_vendor",
+ filename: "passwd",
+ vendor: true,
+ src: ":passwd_gen_vendor",
+}
+
+genrule {
+ name: "passwd_gen_odm",
+ tool_files: ["fs_config_generator.py"],
+ cmd: "$(location fs_config_generator.py) passwd --partition=odm --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)",
+ srcs: [
+ ":target_fs_config_gen",
+ ":android_filesystem_config_header",
+ ],
+ out: ["passwd"],
+}
+
+prebuilt_etc {
+ name: "passwd_odm",
+ filename: "passwd",
+ device_specific: true,
+ src: ":passwd_gen_odm",
+}
+
+genrule {
+ name: "passwd_gen_product",
+ tool_files: ["fs_config_generator.py"],
+ cmd: "$(location fs_config_generator.py) passwd --partition=product --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)",
+ srcs: [
+ ":target_fs_config_gen",
+ ":android_filesystem_config_header",
+ ],
+ out: ["passwd"],
+}
+
+prebuilt_etc {
+ name: "passwd_product",
+ filename: "passwd",
+ product_specific: true,
+ src: ":passwd_gen_product",
+}
+
+genrule {
+ name: "passwd_gen_system_ext",
+ tool_files: ["fs_config_generator.py"],
+ cmd: "$(location fs_config_generator.py) passwd --partition=system_ext --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)",
+ srcs: [
+ ":target_fs_config_gen",
+ ":android_filesystem_config_header",
+ ],
+ out: ["passwd"],
+}
+
+prebuilt_etc {
+ name: "passwd_system_ext",
+ filename: "passwd",
+ system_ext_specific: true,
+ src: ":passwd_gen_system_ext",
+}
+
+// Generate the */etc/group text files for the target
+// These files may be empty if no AIDs are defined in
// TARGET_FS_CONFIG_GEN files.
genrule {
- name: "group_gen",
+ name: "group_gen_system",
tool_files: ["fs_config_generator.py"],
- cmd: "$(location fs_config_generator.py) group --required-prefix=vendor_ --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)",
+ cmd: "$(location fs_config_generator.py) group --partition=system --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)",
srcs: [
":target_fs_config_gen",
":android_filesystem_config_header",
@@ -91,7 +163,79 @@
}
prebuilt_etc {
- name: "group",
+ name: "group_system",
+ filename: "group",
+ src: ":group_gen_system",
+}
+
+genrule {
+ name: "group_gen_vendor",
+ tool_files: ["fs_config_generator.py"],
+ cmd: "$(location fs_config_generator.py) group --partition=vendor --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)",
+ srcs: [
+ ":target_fs_config_gen",
+ ":android_filesystem_config_header",
+ ],
+ out: ["group"],
+}
+
+prebuilt_etc {
+ name: "group_vendor",
+ filename: "group",
vendor: true,
- src: ":group_gen",
+ src: ":group_gen_vendor",
+}
+
+genrule {
+ name: "group_gen_odm",
+ tool_files: ["fs_config_generator.py"],
+ cmd: "$(location fs_config_generator.py) group --partition=odm --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)",
+ srcs: [
+ ":target_fs_config_gen",
+ ":android_filesystem_config_header",
+ ],
+ out: ["group"],
+}
+
+prebuilt_etc {
+ name: "group_odm",
+ filename: "group",
+ device_specific: true,
+ src: ":group_gen_odm",
+}
+
+genrule {
+ name: "group_gen_product",
+ tool_files: ["fs_config_generator.py"],
+ cmd: "$(location fs_config_generator.py) group --partition=product --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)",
+ srcs: [
+ ":target_fs_config_gen",
+ ":android_filesystem_config_header",
+ ],
+ out: ["group"],
+}
+
+prebuilt_etc {
+ name: "group_product",
+ filename: "group",
+ product_specific: true,
+ src: ":group_gen_product",
+}
+
+genrule {
+ name: "group_gen_system_ext",
+ tool_files: ["fs_config_generator.py"],
+ cmd: "$(location fs_config_generator.py) group --partition=system_ext --aid-header=$(location :android_filesystem_config_header) $(locations :target_fs_config_gen) >$(out)",
+ srcs: [
+ ":target_fs_config_gen",
+ ":android_filesystem_config_header",
+ ],
+ out: ["group"],
+}
+
+prebuilt_etc {
+ name: "group_system_ext",
+ filename: "group",
+ system_ext_specific: true,
+ src: ":group_gen_system_ext",
}
diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk
index 96db0f3..64fabe6 100644
--- a/tools/fs_config/Android.mk
+++ b/tools/fs_config/Android.mk
@@ -27,13 +27,13 @@
system_android_filesystem_config := system/core/include/private/android_filesystem_config.h
system_capability_header := bionic/libc/kernel/uapi/linux/capability.h
-# List of supported vendor, oem, odm, product and product_services Partitions
+# List of supported vendor, oem, odm, product and system_ext Partitions
fs_config_generate_extra_partition_list := $(strip \
$(if $(BOARD_USES_VENDORIMAGE)$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),vendor) \
$(if $(BOARD_USES_OEMIMAGE)$(BOARD_OEMIMAGE_FILE_SYSTEM_TYPE),oem) \
$(if $(BOARD_USES_ODMIMAGE)$(BOARD_ODMIMAGE_FILE_SYSTEM_TYPE),odm) \
$(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),product) \
- $(if $(BOARD_PRODUCT_SERVICESIMAGE_FILE_SYSTEM_TYPE),product_services) \
+ $(if $(BOARD_SYSTEM_EXTIMAGE_FILE_SYSTEM_TYPE),system_ext) \
)
##################################
@@ -99,7 +99,7 @@
--aid-header $(PRIVATE_ANDROID_FS_HDR) \
--capability-header $(PRIVATE_ANDROID_CAP_HDR) \
--partition system \
- --all-partitions $(subst $(space),$(comma),$(PRIVATE_PARTITION_LIST)) \
+ --all-partitions "$(subst $(space),$(comma),$(PRIVATE_PARTITION_LIST))" \
--dirs \
--out_file $@ \
$(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null)
@@ -124,7 +124,7 @@
--aid-header $(PRIVATE_ANDROID_FS_HDR) \
--capability-header $(PRIVATE_ANDROID_CAP_HDR) \
--partition system \
- --all-partitions $(subst $(space),$(comma),$(PRIVATE_PARTITION_LIST)) \
+ --all-partitions "$(subst $(space),$(comma),$(PRIVATE_PARTITION_LIST))" \
--files \
--out_file $@ \
$(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null)
@@ -332,17 +332,17 @@
$(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null)
endif
-ifneq ($(filter product_services,$(fs_config_generate_extra_partition_list)),)
+ifneq ($(filter system_ext,$(fs_config_generate_extra_partition_list)),)
##################################
-# Generate the product_services/etc/fs_config_dirs binary file for the target
-# Add fs_config_dirs or fs_config_dirs_product_services to PRODUCT_PACKAGES in
+# Generate the system_ext/etc/fs_config_dirs binary file for the target
+# Add fs_config_dirs or fs_config_dirs_system_ext to PRODUCT_PACKAGES in
# the device make file to enable
include $(CLEAR_VARS)
-LOCAL_MODULE := fs_config_dirs_product_services
+LOCAL_MODULE := fs_config_dirs_system_ext
LOCAL_MODULE_CLASS := ETC
LOCAL_INSTALLED_MODULE_STEM := fs_config_dirs
-LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_SERVICES)/etc
+LOCAL_MODULE_PATH := $(TARGET_OUT_SYSTEM_EXT)/etc
include $(BUILD_SYSTEM)/base_rules.mk
$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config)
$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_CAP_HDR := $(system_capability_header)
@@ -352,21 +352,21 @@
$< fsconfig \
--aid-header $(PRIVATE_ANDROID_FS_HDR) \
--capability-header $(PRIVATE_ANDROID_CAP_HDR) \
- --partition product_services \
+ --partition system_ext \
--dirs \
--out_file $@ \
$(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null)
##################################
-# Generate the product_services/etc/fs_config_files binary file for the target
-# Add fs_config_files of fs_config_files_product_services to PRODUCT_PACKAGES in
+# Generate the system_ext/etc/fs_config_files binary file for the target
+# Add fs_config_files of fs_config_files_system_ext to PRODUCT_PACKAGES in
# the device make file to enable
include $(CLEAR_VARS)
-LOCAL_MODULE := fs_config_files_product_services
+LOCAL_MODULE := fs_config_files_system_ext
LOCAL_MODULE_CLASS := ETC
LOCAL_INSTALLED_MODULE_STEM := fs_config_files
-LOCAL_MODULE_PATH := $(TARGET_OUT_PRODUCT_SERVICES)/etc
+LOCAL_MODULE_PATH := $(TARGET_OUT_SYSTEM_EXT)/etc
include $(BUILD_SYSTEM)/base_rules.mk
$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config)
$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_CAP_HDR := $(system_capability_header)
@@ -376,7 +376,7 @@
$< fsconfig \
--aid-header $(PRIVATE_ANDROID_FS_HDR) \
--capability-header $(PRIVATE_ANDROID_CAP_HDR) \
- --partition product_services \
+ --partition system_ext \
--files \
--out_file $@ \
$(or $(PRIVATE_TARGET_FS_CONFIG_GEN),/dev/null)
diff --git a/tools/fs_config/README b/tools/fs_config/README
index f7d4deb..21bdeb8 100644
--- a/tools/fs_config/README
+++ b/tools/fs_config/README
@@ -3,16 +3,33 @@
| _ <| __|| _ || | || \/ || __|
\__|\_/\_____/\__|__/|_____/\__ \__/\_____/
-Generating the android_filesystem_config.h:
+The fs_config_generator.py tool uses the platform android_filesystem_config.h and the
+TARGET_FS_CONFIG_GEN files to generate the fs_config_dirs and fs_config_files files for each
+partition, as well as passwd and group files, and the generated_oem_aid.h header.
-To generate the android_filesystem_config.h file, one can set
-TARGET_FS_CONFIG_GEN, which can be a list of intermediate fs configuration
-files.
+The fs_config_dirs and fs_config_files binary files are interpreted by the libcutils fs_config()
+function, along with the built-in defaults, to serve as overrides to complete the results. The
+Target files are used by filesystem and adb tools to ensure that the file and directory properties
+are preserved during runtime operations. The host files in the ${OUT} directory are used in the
+final stages when building the filesystem images to set the file and directory properties.
-The parsing of the config file follows the Python ConfigParser specification,
-with the sections and fields as defined below. There are two types of sections,
-both sections require all options to be specified. The first section type is
-the "caps" section.
+See ./fs_config_generator.py fsconfig --help for how these files are generated.
+
+The passwd and group files are formatted as documented in man pages passwd(5) and group(5) and used
+by bionic for implementing getpwnam() and related functions.
+
+See ./fs_config_generator.py passwd --help and ./fs_config_generator.py group --help for how these
+files are generated.
+
+The generated_oem_aid.h creates identifiers for non-platform AIDs for developers wishing to use them
+in their native code. To do so, include the oemaids_headers header library in the corresponding
+makefile and #include "generated_oem_aid.h" in the code wishing to use these identifiers.
+
+See ./fs_config_generator.py oemaid --help for how this file is generated.
+
+The parsing of the TARGET_FS_CONFIG_GEN files follows the Python ConfigParser specification, with
+the sections and fields as defined below. There are two types of sections, both sections require all
+options to be specified. The first section type is the "caps" section.
The "caps" section follows the following syntax:
@@ -103,11 +120,6 @@
file and to line up files. Sync lines are placed with the source file as comments in the generated
header file.
-For OEMs wishing to use the define AIDs in their native code, one can access the generated header
-file like so:
- 1. In your C code just #include "generated_oem_aid.h" and start using the declared identifiers.
- 2. In your Makefile add this static library like so: LOCAL_HEADER_LIBRARIES := oemaids_headers
-
Unit Tests:
From within the fs_config directory, unit tests can be executed like so:
@@ -123,45 +135,3 @@
To add new tests, simply add a test_<xxx> method to the test class. It will automatically
get picked up and added to the test suite.
-
-Using the android_filesystem_config.h:
-
-The tool fs_config_generate is built as a dependency to fs_config_dirs and
-fs_config_files host targets, and #includes the above supplied or generated
-android_filesystem_config.h file, and can be instructed to generate the binary
-data that lands in the device target locations /system/etc/fs_config_dirs and
-/system/etc/fs_config_files and in the host's ${OUT} locations
-${OUT}/target/product/<device>/system/etc/fs_config_dirs and
-${OUT}/target/product/<device>/system/etc/fs_config_files. The binary files
-are interpreted by the libcutils fs_conf() function, along with the built-in
-defaults, to serve as overrides to complete the results. The Target files are
-used by filesystem and adb tools to ensure that the file and directory
-properties are preserved during runtime operations. The host files in the
-${OUT} directory are used in the final stages when building the filesystem
-images to set the file and directory properties.
-
-For systems with separate partition images, such as vendor or oem,
-fs_config_generate can be instructed to filter the specific file references
-to land in each partition's etc/fs_config_dirs or etc/fs_config_files
-locations. The filter can be instructed to blacklist a partition's data by
-providing the comma separated minus sign prefixed partition names. The filter
-can be instructed to whitelist partition data by providing the partition name.
-
-For example:
-- For system.img, but not vendor, oem or odm file references:
- -P -vendor,-oem,-odm
- This makes sure the results only contain content associated with the
- system, and not vendor, oem or odm, blacklisting their content.
-- For vendor.img file references: -P vendor
-- For oem.img file references: -P oem
-- For odm.img file references: -P odm
-
-fs_config_generate --help reports:
-
-Generate binary content for fs_config_dirs (-D) and fs_config_files (-F)
-from device-specific android_filesystem_config.h override. Filter based
-on a comma separated partition list (-P) whitelist or prefixed by a
-minus blacklist. Partitions are identified as path references to
-<partition>/ or system/<partition>
-
-Usage: fs_config_generate -D|-F [-P list] [-o output-file]
diff --git a/tools/fs_config/fs_config_generator.py b/tools/fs_config/fs_config_generator.py
index dccff92..2956b11 100755
--- a/tools/fs_config/fs_config_generator.py
+++ b/tools/fs_config/fs_config_generator.py
@@ -312,13 +312,12 @@
re.compile(r'%sUSER' % AID.PREFIX)
]
_AID_DEFINE = re.compile(r'\s*#define\s+%s.*' % AID.PREFIX)
- _OEM_START_KW = 'START'
- _OEM_END_KW = 'END'
- _OEM_RANGE = re.compile('%sOEM_RESERVED_[0-9]*_{0,1}(%s|%s)' %
- (AID.PREFIX, _OEM_START_KW, _OEM_END_KW))
+ _RESERVED_RANGE = re.compile(
+ r'#define AID_(.+)_RESERVED_\d*_*(START|END)\s+(\d+)')
+
# AID lines cannot end with _START or _END, ie AID_FOO is OK
# but AID_FOO_START is skiped. Note that AID_FOOSTART is NOT skipped.
- _AID_SKIP_RANGE = ['_' + _OEM_START_KW, '_' + _OEM_END_KW]
+ _AID_SKIP_RANGE = ['_START', '_END']
_COLLISION_OK = ['AID_APP', 'AID_APP_START', 'AID_USER', 'AID_USER_OFFSET']
def __init__(self, aid_header):
@@ -330,7 +329,7 @@
self._aid_header = aid_header
self._aid_name_to_value = {}
self._aid_value_to_name = {}
- self._oem_ranges = {}
+ self._ranges = {}
with open(aid_header) as open_file:
self._parse(open_file)
@@ -355,6 +354,23 @@
return 'Error "{}" in file: "{}" on line: {}'.format(
msg, self._aid_header, str(lineno))
+ range_match = self._RESERVED_RANGE.match(line)
+ if range_match:
+ partition = range_match.group(1).lower()
+ value = int(range_match.group(3), 0)
+
+ if partition == 'oem':
+ partition = 'vendor'
+
+ if partition in self._ranges:
+ if isinstance(self._ranges[partition][-1], int):
+ self._ranges[partition][-1] = (
+ self._ranges[partition][-1], value)
+ else:
+ self._ranges[partition].append(value)
+ else:
+ self._ranges[partition] = [value]
+
if AIDHeaderParser._AID_DEFINE.match(line):
chunks = line.split()
identifier = chunks[1]
@@ -366,9 +382,7 @@
continue
try:
- if AIDHeaderParser._is_oem_range(identifier):
- self._handle_oem_range(identifier, value)
- elif not any(
+ if not any(
identifier.endswith(x)
for x in AIDHeaderParser._AID_SKIP_RANGE):
self._handle_aid(identifier, value)
@@ -404,67 +418,6 @@
self._aid_name_to_value[aid.friendly] = aid
self._aid_value_to_name[value] = aid.friendly
- def _handle_oem_range(self, identifier, value):
- """Handle an OEM range C #define.
-
- When encountering special AID defines, notably for the OEM ranges
- this method handles sanity checking and adding them to the internal
- maps. For internal use only.
-
- Args:
- identifier (str): The name of the #define identifier.
- ie AID_OEM_RESERVED_START/END.
- value (str): The value associated with the identifier.
-
- Raises:
- ValueError: With message set to indicate the error.
- """
-
- try:
- int_value = int(value, 0)
- except ValueError:
- raise ValueError(
- 'Could not convert "%s" to integer value, got: "%s"' %
- (identifier, value))
-
- # convert AID_OEM_RESERVED_START or AID_OEM_RESERVED_<num>_START
- # to AID_OEM_RESERVED or AID_OEM_RESERVED_<num>
- is_start = identifier.endswith(AIDHeaderParser._OEM_START_KW)
-
- if is_start:
- tostrip = len(AIDHeaderParser._OEM_START_KW)
- else:
- tostrip = len(AIDHeaderParser._OEM_END_KW)
-
- # ending _
- tostrip = tostrip + 1
-
- strip = identifier[:-tostrip]
- if strip not in self._oem_ranges:
- self._oem_ranges[strip] = []
-
- if len(self._oem_ranges[strip]) > 2:
- raise ValueError('Too many same OEM Ranges "%s"' % identifier)
-
- if len(self._oem_ranges[strip]) == 1:
- tmp = self._oem_ranges[strip][0]
-
- if tmp == int_value:
- raise ValueError('START and END values equal %u' % int_value)
- elif is_start and tmp < int_value:
- raise ValueError(
- 'END value %u less than START value %u' % (tmp, int_value))
- elif not is_start and tmp > int_value:
- raise ValueError(
- 'END value %u less than START value %u' % (int_value, tmp))
-
- # Add START values to the head of the list and END values at the end.
- # Thus, the list is ordered with index 0 as START and index 1 as END.
- if is_start:
- self._oem_ranges[strip].insert(0, int_value)
- else:
- self._oem_ranges[strip].append(int_value)
-
def _process_and_check(self):
"""Process, check and populate internal data structures.
@@ -475,36 +428,32 @@
ValueError: With the message set to indicate the specific error.
"""
- # tuplefy the lists since range() does not like them mutable.
- self._oem_ranges = [
- AIDHeaderParser._convert_lst_to_tup(k, v)
- for k, v in self._oem_ranges.iteritems()
- ]
-
# Check for overlapping ranges
- for i, range1 in enumerate(self._oem_ranges):
- for range2 in self._oem_ranges[i + 1:]:
- if AIDHeaderParser._is_overlap(range1, range2):
- raise ValueError("Overlapping OEM Ranges found %s and %s" %
- (str(range1), str(range2)))
+ for ranges in self._ranges.values():
+ for i, range1 in enumerate(ranges):
+ for range2 in ranges[i + 1:]:
+ if AIDHeaderParser._is_overlap(range1, range2):
+ raise ValueError(
+ "Overlapping OEM Ranges found %s and %s" %
+ (str(range1), str(range2)))
# No core AIDs should be within any oem range.
for aid in self._aid_value_to_name:
-
- if Utils.in_any_range(aid, self._oem_ranges):
- name = self._aid_value_to_name[aid]
- raise ValueError(
- 'AID "%s" value: %u within reserved OEM Range: "%s"' %
- (name, aid, str(self._oem_ranges)))
+ for ranges in self._ranges.values():
+ if Utils.in_any_range(aid, ranges):
+ name = self._aid_value_to_name[aid]
+ raise ValueError(
+ 'AID "%s" value: %u within reserved OEM Range: "%s"' %
+ (name, aid, str(ranges)))
@property
- def oem_ranges(self):
+ def ranges(self):
"""Retrieves the OEM closed ranges as a list of tuples.
Returns:
A list of closed range tuples: [ (0, 42), (50, 105) ... ]
"""
- return self._oem_ranges
+ return self._ranges
@property
def aids(self):
@@ -516,39 +465,6 @@
return self._aid_name_to_value.values()
@staticmethod
- def _convert_lst_to_tup(name, lst):
- """Converts a mutable list to a non-mutable tuple.
-
- Used ONLY for ranges and thus enforces a length of 2.
-
- Args:
- lst (List): list that should be "tuplefied".
-
- Raises:
- ValueError if lst is not a list or len is not 2.
-
- Returns:
- Tuple(lst)
- """
- if not lst or len(lst) != 2:
- raise ValueError('Mismatched range for "%s"' % name)
-
- return tuple(lst)
-
- @staticmethod
- def _is_oem_range(aid):
- """Detects if a given aid is within the reserved OEM range.
-
- Args:
- aid (int): The aid to test
-
- Returns:
- True if it is within the range, False otherwise.
- """
-
- return AIDHeaderParser._OEM_RANGE.match(aid)
-
- @staticmethod
def _is_overlap(range_a, range_b):
"""Calculates the overlap of two range tuples.
@@ -588,12 +504,12 @@
_SECTIONS = [('_handle_aid', ('value', )),
('_handle_path', ('mode', 'user', 'group', 'caps'))]
- def __init__(self, config_files, oem_ranges):
+ def __init__(self, config_files, ranges):
"""
Args:
config_files ([str]): The list of config.fs files to parse.
Note the filename is not important.
- oem_ranges ([(),()]): range tuples indicating reserved OEM ranges.
+ ranges ({str,[()]): Dictionary of partitions and a list of tuples that correspond to their ranges
"""
self._files = []
@@ -604,7 +520,7 @@
# (name to file, value to aid)
self._seen_aids = ({}, {})
- self._oem_ranges = oem_ranges
+ self._ranges = ranges
self._config_files = config_files
@@ -669,6 +585,27 @@
# within the generated file.
self._aids.sort(key=lambda item: item.normalized_value)
+ def _verify_valid_range(self, aid):
+ """Verified an AID entry is in a valid range"""
+
+ ranges = None
+
+ partitions = self._ranges.keys()
+ partitions.sort(key=len, reverse=True)
+ for partition in partitions:
+ if aid.friendly.startswith(partition):
+ ranges = self._ranges[partition]
+ break
+
+ if ranges is None:
+ sys.exit('AID "%s" must be prefixed with a partition name' %
+ aid.friendly)
+
+ if not Utils.in_any_range(int(aid.value, 0), ranges):
+ emsg = '"value" for aid "%s" not in valid range %s, got: %s'
+ emsg = emsg % (aid.friendly, str(ranges), aid.value)
+ sys.exit(emsg)
+
def _handle_aid(self, file_name, section_name, config):
"""Verifies an AID entry and adds it to the aid list.
@@ -702,15 +639,11 @@
sys.exit(error_message('Found specified but unset "value"'))
try:
- aid = AID(section_name, value, file_name, '/vendor/bin/sh')
+ aid = AID(section_name, value, file_name, '/bin/sh')
except ValueError as exception:
sys.exit(error_message(exception))
- # Values must be within OEM range
- if not Utils.in_any_range(int(aid.value, 0), self._oem_ranges):
- emsg = '"value" not in valid range %s, got: %s'
- emsg = emsg % (str(self._oem_ranges), value)
- sys.exit(error_message(emsg))
+ self._verify_valid_range(aid)
# use the normalized int value in the dict and detect
# duplicate definitions of the same value
@@ -1000,14 +933,10 @@
args['capability_header'])
self._base_parser = AIDHeaderParser(args['aid_header'])
self._oem_parser = FSConfigFileParser(args['fsconfig'],
- self._base_parser.oem_ranges)
+ self._base_parser.ranges)
self._partition = args['partition']
self._all_partitions = args['all_partitions']
- if self._partition == 'system' and self._all_partitions is None:
- sys.exit(
- 'All other partitions must be provided if generating output'
- ' for the system partition')
self._out_file = args['out_file']
@@ -1108,7 +1037,7 @@
caps_split = caps.split(',')
for cap in caps_split:
if cap not in caps_dict:
- sys.exit('Unkonwn cap "%s" found!' % cap)
+ sys.exit('Unknown cap "%s" found!' % cap)
caps_value += 1 << caps_dict[cap]
path_length_with_null = len(path) + 1
@@ -1269,7 +1198,7 @@
hdr_parser = AIDHeaderParser(args['aid_header'])
- parser = FSConfigFileParser(args['fsconfig'], hdr_parser.oem_ranges)
+ parser = FSConfigFileParser(args['fsconfig'], hdr_parser.ranges)
print OEMAidGen._GENERATED
@@ -1317,17 +1246,19 @@
'to parse AIDs and OEM Ranges from')
opt_group.add_argument(
- '--required-prefix',
- required=False,
- help='A prefix that the names are required to contain.')
+ '--partition',
+ required=True,
+ help=
+ 'Filter the input file and only output entries for the given partition.'
+ )
def __call__(self, args):
hdr_parser = AIDHeaderParser(args['aid_header'])
- parser = FSConfigFileParser(args['fsconfig'], hdr_parser.oem_ranges)
+ parser = FSConfigFileParser(args['fsconfig'], hdr_parser.ranges)
- required_prefix = args['required_prefix']
+ filter_partition = args['partition']
aids = parser.aids
@@ -1335,13 +1266,22 @@
if not aids:
return
+ aids_by_partition = {}
+ partitions = hdr_parser.ranges.keys()
+ partitions.sort(key=len, reverse=True)
+
for aid in aids:
- if required_prefix is None or aid.friendly.startswith(
- required_prefix):
+ for partition in partitions:
+ if aid.friendly.startswith(partition):
+ if partition in aids_by_partition:
+ aids_by_partition[partition].append(aid)
+ else:
+ aids_by_partition[partition] = [aid]
+ break
+
+ if filter_partition in aids_by_partition:
+ for aid in aids_by_partition[filter_partition]:
self._print_formatted_line(aid)
- else:
- sys.exit("%s: AID '%s' must start with '%s'" %
- (args['fsconfig'], aid.friendly, required_prefix))
def _print_formatted_line(self, aid):
"""Prints the aid to stdout in the passwd format. Internal use only.
diff --git a/tools/generate-self-extracting-archive.py b/tools/generate-self-extracting-archive.py
new file mode 100755
index 0000000..f0b7568
--- /dev/null
+++ b/tools/generate-self-extracting-archive.py
@@ -0,0 +1,165 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""
+Generates a self extracting archive with a license click through.
+
+Usage:
+ generate-self-extracting-archive.py $OUTPUT_FILE $INPUT_ARCHIVE $COMMENT $LICENSE_FILE
+
+ The comment will be included at the beginning of the output archive file.
+
+Output:
+ The output of the script is a single executable file that when run will
+ display the provided license and if the user accepts extract the wrapped
+ archive.
+
+ The layout of the output file is roughly:
+ * Executable shell script that extracts the archive
+ * Actual archive contents
+ * Zip file containing the license
+"""
+
+import tempfile
+import sys
+import os
+import zipfile
+
+_HEADER_TEMPLATE = """#!/bin/sh
+#
+{comment_line}
+#
+# Usage is subject to the enclosed license agreement
+
+echo
+echo The license for this software will now be displayed.
+echo You must agree to this license before using this software.
+echo
+echo -n Press Enter to view the license
+read dummy
+echo
+more << EndOfLicense
+{license}
+EndOfLicense
+
+if test $? != 0
+then
+ echo "ERROR: Couldn't display license file" 1>&2
+ exit 1
+fi
+echo
+echo -n 'Type "I ACCEPT" if you agree to the terms of the license: '
+read typed
+if test "$typed" != "I ACCEPT"
+then
+ echo
+ echo "You didn't accept the license. Extraction aborted."
+ exit 2
+fi
+echo
+{extract_command}
+if test $? != 0
+then
+ echo
+ echo "ERROR: Couldn't extract files." 1>&2
+ exit 3
+else
+ echo
+ echo "Files extracted successfully."
+fi
+exit 0
+"""
+
+_PIPE_CHUNK_SIZE = 1048576
+def _pipe_bytes(src, dst):
+ while True:
+ b = src.read(_PIPE_CHUNK_SIZE)
+ if not b:
+ break
+ dst.write(b)
+
+_MAX_OFFSET_WIDTH = 8
+def _generate_extract_command(start, end, extract_name):
+ """Generate the extract command.
+
+ The length of this string must be constant no matter what the start and end
+ offsets are so that its length can be computed before the actual command is
+ generated.
+
+ Args:
+ start: offset in bytes of the start of the wrapped file
+ end: offset in bytes of the end of the wrapped file
+ extract_name: of the file to create when extracted
+
+ """
+ # start gets an extra character for the '+'
+ # for tail +1 is the start of the file, not +0
+ start_str = ('+%d' % (start + 1)).rjust(_MAX_OFFSET_WIDTH + 1)
+ if len(start_str) != _MAX_OFFSET_WIDTH + 1:
+ raise Exception('Start offset too large (%d)' % start)
+
+ end_str = ('%d' % end).rjust(_MAX_OFFSET_WIDTH)
+ if len(end_str) != _MAX_OFFSET_WIDTH:
+ raise Exception('End offset too large (%d)' % end)
+
+ return "tail -c %s $0 | head -c %s > %s\n" % (start_str, end_str, extract_name)
+
+
+def main(argv):
+ output_filename = argv[1]
+ input_archive_filename = argv[2]
+ comment = argv[3]
+ license_filename = argv[4]
+
+ input_archive_size = os.stat(input_archive_filename).st_size
+
+ with open(license_filename, 'r') as license_file:
+ license = license_file.read()
+
+ comment_line = '# %s\n' % comment
+ extract_name = os.path.basename(input_archive_filename)
+
+ # Compute the size of the header before writing the file out. This is required
+ # so that the extract command, which uses the contents offset, can be created
+ # and included inside the header.
+ header_for_size = _HEADER_TEMPLATE.format(
+ comment_line=comment_line,
+ license=license,
+ extract_command=_generate_extract_command(0, 0, extract_name),
+ )
+ header_size = len(header_for_size.encode('utf-8'))
+
+ # write the final output
+ with open(output_filename, 'wb') as output:
+ output.write(_HEADER_TEMPLATE.format(
+ comment_line=comment_line,
+ license=license,
+ extract_command=_generate_extract_command(header_size, input_archive_size, extract_name),
+ ).encode('utf-8'))
+
+ with open(input_archive_filename, 'rb') as input_file:
+ _pipe_bytes(input_file, output)
+
+ with tempfile.TemporaryFile() as trailing_zip:
+ with zipfile.ZipFile(trailing_zip, 'w') as myzip:
+ myzip.writestr('license.txt', license, compress_type=zipfile.ZIP_STORED)
+
+ # append the trailing zip to the end of the file
+ trailing_zip.seek(0)
+ _pipe_bytes(trailing_zip, output)
+
+if __name__ == "__main__":
+ main(sys.argv)
diff --git a/tools/makeparallel/.gitignore b/tools/makeparallel/.gitignore
deleted file mode 100644
index a7d6181..0000000
--- a/tools/makeparallel/.gitignore
+++ /dev/null
@@ -1,4 +0,0 @@
-makeparallel
-*.o
-*.d
-test.out
diff --git a/tools/makeparallel/Android.bp b/tools/makeparallel/Android.bp
deleted file mode 100644
index 898db68..0000000
--- a/tools/makeparallel/Android.bp
+++ /dev/null
@@ -1,21 +0,0 @@
-// Copyright 2016 Google Inc. All rights reserved
-//
-// 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.
-
-cc_binary_host {
- name: "makeparallel",
- srcs: [
- "makeparallel.cpp",
- ],
- cflags: ["-Wall", "-Werror"],
-}
diff --git a/tools/makeparallel/Makefile b/tools/makeparallel/Makefile
deleted file mode 100644
index 82a4abf..0000000
--- a/tools/makeparallel/Makefile
+++ /dev/null
@@ -1,93 +0,0 @@
-# Copyright 2015 Google Inc. All rights reserved
-#
-# 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.
-
-# Find source file location from path to this Makefile
-MAKEPARALLEL_SRC_PATH := $(patsubst %/,%,$(dir $(lastword $(MAKEFILE_LIST))))
-ifndef MAKEPARALLEL_SRC_PATH
- MAKEPARALLEL_SRC_PATH := .
-endif
-
-# Set defaults if they weren't set by the including Makefile
-MAKEPARALLEL_CXX ?= $(CXX)
-MAKEPARALLEL_LD ?= $(CXX)
-MAKEPARALLEL_INTERMEDIATES_PATH ?= .
-MAKEPARALLEL_BIN_PATH ?= .
-
-MAKEPARALLEL_CXX_SRCS := \
- makeparallel.cpp
-
-MAKEPARALLEL_CXXFLAGS := -Wall -Werror -MMD -MP
-
-MAKEPARALLEL_CXX_SRCS := $(addprefix $(MAKEPARALLEL_SRC_PATH)/,\
- $(MAKEPARALLEL_CXX_SRCS))
-
-MAKEPARALLEL_CXX_OBJS := $(patsubst $(MAKEPARALLEL_SRC_PATH)/%.cpp,$(MAKEPARALLEL_INTERMEDIATES_PATH)/%.o,$(MAKEPARALLEL_CXX_SRCS))
-
-MAKEPARALLEL := $(MAKEPARALLEL_BIN_PATH)/makeparallel
-
-ifeq ($(shell uname),Linux)
-MAKEPARALLEL_LIBS := -lrt -lpthread
-endif
-
-# Rule to build makeparallel into MAKEPARALLEL_BIN_PATH
-$(MAKEPARALLEL): $(MAKEPARALLEL_CXX_OBJS)
- @mkdir -p $(dir $@)
- $(MAKEPARALLEL_LD) -std=c++11 $(MAKEPARALLEL_CXXFLAGS) -o $@ $^ $(MAKEPARALLEL_LIBS)
-
-# Rule to build source files into object files in MAKEPARALLEL_INTERMEDIATES_PATH
-$(MAKEPARALLEL_CXX_OBJS): $(MAKEPARALLEL_INTERMEDIATES_PATH)/%.o: $(MAKEPARALLEL_SRC_PATH)/%.cpp
- @mkdir -p $(dir $@)
- $(MAKEPARALLEL_CXX) -c -std=c++11 $(MAKEPARALLEL_CXXFLAGS) -o $@ $<
-
-makeparallel_clean:
- rm -rf $(MAKEPARALLEL)
- rm -rf $(MAKEPARALLEL_INTERMEDIATES_PATH)/*.o
- rm -rf $(MAKEPARALLEL_INTERMEDIATES_PATH)/*.d
-
-.PHONY: makeparallel_clean
-
--include $(MAKEPARALLEL_INTERMEDIATES_PATH)/*.d
-
-.PHONY: makeparallel_test
-MAKEPARALLEL_TEST := MAKEFLAGS= MAKELEVEL= MAKEPARALLEL=$(MAKEPARALLEL) $(MAKE) -f Makefile.test test
-MAKEPARALLEL_NINJA_TEST := MAKEFLAGS= MAKELEVEL= MAKEPARALLEL="$(MAKEPARALLEL) --ninja" $(MAKE) -f Makefile.test test
-makeparallel_test: $(MAKEPARALLEL)
- @EXPECTED="-j1234" $(MAKEPARALLEL_TEST) -j1234
- @EXPECTED="-j123" $(MAKEPARALLEL_TEST) -j123
- @EXPECTED="" $(MAKEPARALLEL_TEST) -j1
- @EXPECTED="-j$$(($$(nproc) + 2))" $(MAKEPARALLEL_TEST) -j
- @EXPECTED="" $(MAKEPARALLEL_TEST)
-
- @EXPECTED="-j1234" $(MAKEPARALLEL_NINJA_TEST) -j1234
- @EXPECTED="-j123" $(MAKEPARALLEL_NINJA_TEST) -j123
- @EXPECTED="-j1" $(MAKEPARALLEL_NINJA_TEST) -j1
- @EXPECTED="-j1" $(MAKEPARALLEL_NINJA_TEST)
- @EXPECTED="" $(MAKEPARALLEL_NINJA_TEST) -j
- @EXPECTED="" $(MAKEPARALLEL_NINJA_TEST) -j -l
-
- @EXPECTED="-j1234" $(MAKEPARALLEL_TEST) --no-print-directory -j1234
- @EXPECTED="-j1234" $(MAKEPARALLEL_TEST) --no-print-directory -k -j1234
- @EXPECTED="-j1234" $(MAKEPARALLEL_TEST) -k -j1234
- @EXPECTED="-j1234" $(MAKEPARALLEL_TEST) -j1234 -k
- @EXPECTED="-j1234" $(MAKEPARALLEL_TEST) -kt -j1234
-
- @EXPECTED="-j1234" $(MAKEPARALLEL_NINJA_TEST) --no-print-directory -j1234
- @EXPECTED="-j1234 -k0" $(MAKEPARALLEL_NINJA_TEST) --no-print-directory -k -j1234
- @EXPECTED="-j1234 -k0" $(MAKEPARALLEL_NINJA_TEST) -k -j1234
- @EXPECTED="-j1234 -k0" $(MAKEPARALLEL_NINJA_TEST) -j1234 -k
- @EXPECTED="-j1234 -k0" $(MAKEPARALLEL_NINJA_TEST) -kt -j1234
-
- @EXPECTED="" $(MAKEPARALLEL_TEST) A=-j1234
-
- @EXPECTED="-j1234 args" ARGS="args" $(MAKEPARALLEL_TEST) -j1234
diff --git a/tools/makeparallel/Makefile.test b/tools/makeparallel/Makefile.test
deleted file mode 100644
index cf53684..0000000
--- a/tools/makeparallel/Makefile.test
+++ /dev/null
@@ -1,12 +0,0 @@
-MAKEPARALLEL ?= ./makeparallel
-
-.PHONY: test
-test:
- @+echo MAKEFLAGS=$${MAKEFLAGS}; \
- result=$$($(MAKEPARALLEL) echo $(ARGS)); \
- echo result: $${result}; \
- if [ "$${result}" = "$(EXPECTED)" ]; then \
- echo SUCCESS && echo; \
- else \
- echo FAILED expected $(EXPECTED) && false; \
- fi
diff --git a/tools/makeparallel/README.md b/tools/makeparallel/README.md
deleted file mode 100644
index 2e5fbf9..0000000
--- a/tools/makeparallel/README.md
+++ /dev/null
@@ -1,54 +0,0 @@
-<!---
-Copyright (C) 2015 The Android Open Source Project
-
-Licensed under the Apache License, Version 2.0 (the "License");
-you may not use this file except in compliance with the License.
-You may obtain a copy of the License at
-
- http://www.apache.org/licenses/LICENSE-2.0
-
-Unless required by applicable law or agreed to in writing, software
-distributed under the License is distributed on an "AS IS" BASIS,
-WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-See the License for the specific language governing permissions and
-limitations under the License.
--->
-
-makeparallel
-============
-makeparallel communicates with the [GNU make jobserver](http://make.mad-scientist.net/papers/jobserver-implementation/)
-in order claim all available jobs, and then passes the number of jobs
-claimed to a subprocess with `-j<jobs>`.
-
-The number of available jobs is determined by reading tokens from the jobserver
-until a read would block. If the makeparallel rule is the only one running the
-number of jobs will be the total size of the jobserver pool, i.e. the value
-passed to make with `-j`. Any jobs running in parallel with with the
-makeparellel rule will reduce the measured value, and thus reduce the
-parallelism available to the subprocess.
-
-To run a multi-thread or multi-process binary inside GNU make using
-makeparallel, add
-```Makefile
- +makeparallel subprocess arguments
-```
-to a rule. For example, to wrap ninja in make, use something like:
-```Makefile
- +makeparallel ninja -f build.ninja
-```
-
-To determine the size of the jobserver pool, add
-```Makefile
- +makeparallel echo > make.jobs
-```
-to a rule that is guarantee to run alone (i.e. all other rules are either
-dependencies of the makeparallel rule, or the depend on the makeparallel
-rule. The output file will contain the `-j<num>` flag passed to the parent
-make process, or `-j1` if no flag was found. Since GNU make will run
-makeparallel during the execution phase, after all variables have been
-set and evaluated, it is not possible to get the output of makeparallel
-into a make variable. Instead, use a shell substitution to read the output
-file directly in a recipe. For example:
-```Makefile
- echo Make was started with $$(cat make.jobs)
-```
diff --git a/tools/makeparallel/makeparallel.cpp b/tools/makeparallel/makeparallel.cpp
deleted file mode 100644
index 66babdf..0000000
--- a/tools/makeparallel/makeparallel.cpp
+++ /dev/null
@@ -1,421 +0,0 @@
-// Copyright (C) 2015 The Android Open Source Project
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// http://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-
-// makeparallel communicates with the GNU make jobserver
-// (http://make.mad-scientist.net/papers/jobserver-implementation/)
-// in order claim all available jobs, and then passes the number of jobs
-// claimed to a subprocess with -j<jobs>.
-
-#include <errno.h>
-#include <fcntl.h>
-#include <getopt.h>
-#include <poll.h>
-#include <signal.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-#include <sys/resource.h>
-#include <sys/time.h>
-#include <sys/types.h>
-#include <sys/wait.h>
-
-#include <string>
-#include <vector>
-
-#ifdef __linux__
-#include <error.h>
-#endif
-
-#ifdef __APPLE__
-#include <err.h>
-#define error(code, eval, fmt, ...) errc(eval, code, fmt, ##__VA_ARGS__)
-// Darwin does not interrupt syscalls by default.
-#define TEMP_FAILURE_RETRY(exp) (exp)
-#endif
-
-// Throw an error if fd is not valid.
-static void CheckFd(int fd) {
- int ret = fcntl(fd, F_GETFD);
- if (ret < 0) {
- if (errno == EBADF) {
- error(errno, 0, "no jobserver pipe, prefix recipe command with '+'");
- } else {
- error(errno, errno, "fnctl failed");
- }
- }
-}
-
-// Extract flags from MAKEFLAGS that need to be propagated to subproccess
-static std::vector<std::string> ReadMakeflags() {
- std::vector<std::string> args;
-
- const char* makeflags_env = getenv("MAKEFLAGS");
- if (makeflags_env == nullptr) {
- return args;
- }
-
- // The MAKEFLAGS format is pretty useless. The first argument might be empty
- // (starts with a leading space), or it might be a set of one-character flags
- // merged together with no leading space, or it might be a variable
- // definition.
-
- std::string makeflags = makeflags_env;
-
- // Split makeflags into individual args on spaces. Multiple spaces are
- // elided, but an initial space will result in a blank arg.
- size_t base = 0;
- size_t found;
- do {
- found = makeflags.find_first_of(" ", base);
- args.push_back(makeflags.substr(base, found - base));
- base = found + 1;
- } while (found != makeflags.npos);
-
- // Drop the first argument if it is empty
- while (args.size() > 0 && args[0].size() == 0) {
- args.erase(args.begin());
- }
-
- // Prepend a - to the first argument if it does not have one and is not a
- // variable definition
- if (args.size() > 0 && args[0][0] != '-') {
- if (args[0].find('=') == makeflags.npos) {
- args[0] = '-' + args[0];
- }
- }
-
- return args;
-}
-
-static bool ParseMakeflags(std::vector<std::string>& args,
- int* in_fd, int* out_fd, bool* parallel, bool* keep_going) {
-
- std::vector<char*> getopt_argv;
- // getopt starts reading at argv[1]
- getopt_argv.reserve(args.size() + 1);
- getopt_argv.push_back(strdup(""));
- for (std::string& v : args) {
- getopt_argv.push_back(strdup(v.c_str()));
- }
-
- opterr = 0;
- optind = 1;
- while (1) {
- const static option longopts[] = {
- {"jobserver-fds", required_argument, 0, 0},
- {0, 0, 0, 0},
- };
- int longopt_index = 0;
-
- int c = getopt_long(getopt_argv.size(), getopt_argv.data(), "kj",
- longopts, &longopt_index);
-
- if (c == -1) {
- break;
- }
-
- switch (c) {
- case 0:
- switch (longopt_index) {
- case 0:
- {
- // jobserver-fds
- if (sscanf(optarg, "%d,%d", in_fd, out_fd) != 2) {
- error(EXIT_FAILURE, 0, "incorrect format for --jobserver-fds: %s", optarg);
- }
- // TODO: propagate in_fd, out_fd
- break;
- }
- default:
- abort();
- }
- break;
- case 'j':
- *parallel = true;
- break;
- case 'k':
- *keep_going = true;
- break;
- case '?':
- // ignore unknown arguments
- break;
- default:
- abort();
- }
- }
-
- for (char *v : getopt_argv) {
- free(v);
- }
-
- return true;
-}
-
-// Read a single byte from fd, with timeout in milliseconds. Returns true if
-// a byte was read, false on timeout. Throws away the read value.
-// Non-reentrant, uses timer and signal handler global state, plus static
-// variable to communicate with signal handler.
-//
-// Uses a SIGALRM timer to fire a signal after timeout_ms that will interrupt
-// the read syscall if it hasn't yet completed. If the timer fires before the
-// read the read could block forever, so read from a dup'd fd and close it from
-// the signal handler, which will cause the read to return EBADF if it occurs
-// after the signal.
-// The dup/read/close combo is very similar to the system described to avoid
-// a deadlock between SIGCHLD and read at
-// http://make.mad-scientist.net/papers/jobserver-implementation/
-static bool ReadByteTimeout(int fd, int timeout_ms) {
- // global variable to communicate with the signal handler
- static int dup_fd = -1;
-
- // dup the fd so the signal handler can close it without losing the real one
- dup_fd = dup(fd);
- if (dup_fd < 0) {
- error(errno, errno, "dup failed");
- }
-
- // set up a signal handler that closes dup_fd on SIGALRM
- struct sigaction action = {};
- action.sa_flags = SA_SIGINFO,
- action.sa_sigaction = [](int, siginfo_t*, void*) {
- close(dup_fd);
- };
- struct sigaction oldaction = {};
- int ret = sigaction(SIGALRM, &action, &oldaction);
- if (ret < 0) {
- error(errno, errno, "sigaction failed");
- }
-
- // queue a SIGALRM after timeout_ms
- const struct itimerval timeout = {{}, {0, timeout_ms * 1000}};
- ret = setitimer(ITIMER_REAL, &timeout, NULL);
- if (ret < 0) {
- error(errno, errno, "setitimer failed");
- }
-
- // start the blocking read
- char buf;
- int read_ret = read(dup_fd, &buf, 1);
- int read_errno = errno;
-
- // cancel the alarm in case it hasn't fired yet
- const struct itimerval cancel = {};
- ret = setitimer(ITIMER_REAL, &cancel, NULL);
- if (ret < 0) {
- error(errno, errno, "reset setitimer failed");
- }
-
- // remove the signal handler
- ret = sigaction(SIGALRM, &oldaction, NULL);
- if (ret < 0) {
- error(errno, errno, "reset sigaction failed");
- }
-
- // clean up the dup'd fd in case the signal never fired
- close(dup_fd);
- dup_fd = -1;
-
- if (read_ret == 0) {
- error(EXIT_FAILURE, 0, "EOF on jobserver pipe");
- } else if (read_ret > 0) {
- return true;
- } else if (read_errno == EINTR || read_errno == EBADF) {
- return false;
- } else {
- error(read_errno, read_errno, "read failed");
- }
- abort();
-}
-
-// Measure the size of the jobserver pool by reading from in_fd until it blocks
-static int GetJobserverTokens(int in_fd) {
- int tokens = 0;
- pollfd pollfds[] = {{in_fd, POLLIN, 0}};
- int ret;
- while ((ret = TEMP_FAILURE_RETRY(poll(pollfds, 1, 0))) != 0) {
- if (ret < 0) {
- error(errno, errno, "poll failed");
- } else if (pollfds[0].revents != POLLIN) {
- error(EXIT_FAILURE, 0, "unexpected event %d\n", pollfds[0].revents);
- }
-
- // There is probably a job token in the jobserver pipe. There is a chance
- // another process reads it first, which would cause a blocking read to
- // block forever (or until another process put a token back in the pipe).
- // The file descriptor can't be set to O_NONBLOCK as that would affect
- // all users of the pipe, including the parent make process.
- // ReadByteTimeout emulates a non-blocking read on a !O_NONBLOCK socket
- // using a SIGALRM that fires after a short timeout.
- bool got_token = ReadByteTimeout(in_fd, 10);
- if (!got_token) {
- // No more tokens
- break;
- } else {
- tokens++;
- }
- }
-
- // This process implicitly gets a token, so pool size is measured size + 1
- return tokens;
-}
-
-// Return tokens to the jobserver pool.
-static void PutJobserverTokens(int out_fd, int tokens) {
- // Return all the tokens to the pipe
- char buf = '+';
- for (int i = 0; i < tokens; i++) {
- int ret = TEMP_FAILURE_RETRY(write(out_fd, &buf, 1));
- if (ret < 0) {
- error(errno, errno, "write failed");
- } else if (ret == 0) {
- error(EXIT_FAILURE, 0, "EOF on jobserver pipe");
- }
- }
-}
-
-int main(int argc, char* argv[]) {
- int in_fd = -1;
- int out_fd = -1;
- bool parallel = false;
- bool keep_going = false;
- bool ninja = false;
- int tokens = 0;
-
- if (argc > 1 && strcmp(argv[1], "--ninja") == 0) {
- ninja = true;
- argv++;
- argc--;
- }
-
- if (argc < 2) {
- error(EXIT_FAILURE, 0, "expected command to run");
- }
-
- const char* path = argv[1];
- std::vector<char*> args({argv[1]});
-
- std::vector<std::string> makeflags = ReadMakeflags();
- if (ParseMakeflags(makeflags, &in_fd, &out_fd, ¶llel, &keep_going)) {
- if (in_fd >= 0 && out_fd >= 0) {
- CheckFd(in_fd);
- CheckFd(out_fd);
- fcntl(in_fd, F_SETFD, FD_CLOEXEC);
- fcntl(out_fd, F_SETFD, FD_CLOEXEC);
- tokens = GetJobserverTokens(in_fd);
- }
- }
-
- std::string jarg;
- if (parallel) {
- if (tokens == 0) {
- if (ninja) {
- // ninja is parallel by default
- jarg = "";
- } else {
- // make -j with no argument, guess a reasonable parallelism like ninja does
- jarg = "-j" + std::to_string(sysconf(_SC_NPROCESSORS_ONLN) + 2);
- }
- } else {
- jarg = "-j" + std::to_string(tokens + 1);
- }
- }
-
-
- if (ninja) {
- if (!parallel) {
- // ninja is parallel by default, pass -j1 to disable parallelism if make wasn't parallel
- args.push_back(strdup("-j1"));
- } else {
- if (jarg != "") {
- args.push_back(strdup(jarg.c_str()));
- }
- }
- if (keep_going) {
- args.push_back(strdup("-k0"));
- }
- } else {
- if (jarg != "") {
- args.push_back(strdup(jarg.c_str()));
- }
- }
-
- args.insert(args.end(), &argv[2], &argv[argc]);
-
- args.push_back(nullptr);
-
- static pid_t pid;
-
- // Set up signal handlers to forward SIGTERM to child.
- // Assume that all other signals are sent to the entire process group,
- // and that we'll wait for our child to exit instead of handling them.
- struct sigaction action = {};
- action.sa_flags = SA_RESTART;
- action.sa_handler = [](int signal) {
- if (signal == SIGTERM && pid > 0) {
- kill(pid, signal);
- }
- };
-
- int ret = 0;
- if (!ret) ret = sigaction(SIGHUP, &action, NULL);
- if (!ret) ret = sigaction(SIGINT, &action, NULL);
- if (!ret) ret = sigaction(SIGQUIT, &action, NULL);
- if (!ret) ret = sigaction(SIGTERM, &action, NULL);
- if (!ret) ret = sigaction(SIGALRM, &action, NULL);
- if (ret < 0) {
- error(errno, errno, "sigaction failed");
- }
-
- pid = fork();
- if (pid < 0) {
- error(errno, errno, "fork failed");
- } else if (pid == 0) {
- // child
- unsetenv("MAKEFLAGS");
- unsetenv("MAKELEVEL");
-
- // make 3.81 sets the stack ulimit to unlimited, which may cause problems
- // for child processes
- struct rlimit rlim{};
- if (getrlimit(RLIMIT_STACK, &rlim) == 0 && rlim.rlim_cur == RLIM_INFINITY) {
- rlim.rlim_cur = 8*1024*1024;
- setrlimit(RLIMIT_STACK, &rlim);
- }
-
- int ret = execvp(path, args.data());
- if (ret < 0) {
- error(errno, errno, "exec %s failed", path);
- }
- abort();
- }
-
- // parent
-
- siginfo_t status = {};
- int exit_status = 0;
- ret = waitid(P_PID, pid, &status, WEXITED);
- if (ret < 0) {
- error(errno, errno, "waitpid failed");
- } else if (status.si_code == CLD_EXITED) {
- exit_status = status.si_status;
- } else {
- exit_status = -(status.si_status);
- }
-
- if (tokens > 0) {
- PutJobserverTokens(out_fd, tokens);
- }
- exit(exit_status);
-}
diff --git a/tools/mktarball.sh b/tools/mktarball.sh
deleted file mode 100755
index ef0fe86..0000000
--- a/tools/mktarball.sh
+++ /dev/null
@@ -1,59 +0,0 @@
-#!/bin/bash
-
-# $1: path to fs_get_stats program
-# $2: start dir
-# $3: subdir to tar up (from $2)
-# $4: target tar name
-# $5: target tarball name (usually $(3).bz2)
-# $6: TARGET_OUT path to query device specific FS configs
-
-if [ $# -ne 6 ]; then
- echo "Error: wrong number of arguments in cmd: $0 $* "
- exit 1
-fi
-
-fs_get_stats=`readlink -f $1`
-start_dir=`readlink -f $2`
-dir_to_tar=$3
-target_tar=`readlink -f $4`
-target_tarball=`readlink -f $5`
-target_out=`readlink -f $6`
-
-cd $2
-
-#tar --no-recursion -cvf ${target_tar} ${dir_to_tar}
-rm ${target_tar} > /dev/null 2>&1
-
-# do dirs first
-subdirs=`find ${dir_to_tar} -type d -print`
-files=`find ${dir_to_tar} \! -type d -print`
-for f in ${subdirs} ${files} ; do
- curr_perms=`stat -c 0%a $f`
- [ -d "$f" ] && is_dir=1 || is_dir=0
- new_info=`${fs_get_stats} ${curr_perms} ${is_dir} ${f} ${target_out}`
- new_uid=`echo ${new_info} | awk '{print $1;}'`
- new_gid=`echo ${new_info} | awk '{print $2;}'`
- new_perms=`echo ${new_info} | awk '{print $3;}'`
-# echo "$f: dir: $is_dir curr: $curr_perms uid: $new_uid gid: $new_gid "\
-# "perms: $new_perms"
- tar --no-recursion --numeric-owner --owner $new_uid \
- --group $new_gid --mode $new_perms -p -rf ${target_tar} ${f}
-done
-
-if [ $? -eq 0 ] ; then
- case "${target_tarball}" in
- *.bz2 )
- bzip2 -c ${target_tar} > ${target_tarball}
- ;;
- *.gz )
- gzip -c ${target_tar} > ${target_tarball}
- ;;
- esac
- success=$?
- [ $success -eq 0 ] || rm -f ${target_tarball}
- rm -f ${target_tar}
- exit $success
-fi
-
-rm -f ${target_tar}
-exit 1
diff --git a/tools/releasetools/Android.bp b/tools/releasetools/Android.bp
index b5ae009..80c233b 100644
--- a/tools/releasetools/Android.bp
+++ b/tools/releasetools/Android.bp
@@ -13,54 +13,182 @@
// limitations under the License.
python_defaults {
- name: "releasetools_test_defaults",
+ name: "releasetools_library_defaults",
version: {
py2: {
enabled: true,
- embedded_launcher: false,
},
py3: {
- enabled: false,
+ enabled: true,
},
},
}
python_library_host {
- name: "releasetools_lib",
- defaults: ["releasetools_test_defaults"],
+ name: "releasetools_build_super_image",
+ defaults: ["releasetools_library_defaults"],
+ srcs: [
+ "build_super_image.py",
+ ],
+}
+
+python_library_host {
+ name: "releasetools_common",
+ defaults: ["releasetools_library_defaults"],
+ srcs: [
+ "blockimgdiff.py",
+ "common.py",
+ "images.py",
+ "rangelib.py",
+ "sparse_img.py",
+ ],
+ // Only the tools that are referenced directly are listed as required modules. For example,
+ // `avbtool` is not here, as the script always uses the one from info_dict['avb_avbtool'].
+ required: [
+ "aapt",
+ "boot_signer",
+ "brotli",
+ "bsdiff",
+ "imgdiff",
+ "minigzip",
+ "mkbootfs",
+ ],
+}
+
+python_library_host {
+ name: "releasetools_verity_utils",
+ defaults: ["releasetools_library_defaults"],
+ srcs: [
+ "verity_utils.py",
+ ],
+ required: [
+ "append2simg",
+ "build_verity_metadata",
+ "build_verity_tree",
+ "fec",
+ ],
+}
+
+python_defaults {
+ name: "releasetools_binary_defaults",
+ version: {
+ py2: {
+ enabled: true,
+ embedded_launcher: true,
+ },
+ py3: {
+ enabled: false,
+ embedded_launcher: false,
+ },
+ },
+}
+
+python_binary_host {
+ name: "build_image",
+ defaults: ["releasetools_binary_defaults"],
+ srcs: [
+ "build_image.py",
+ ],
+ main: "build_image.py",
+ libs: [
+ "releasetools_common",
+ "releasetools_verity_utils",
+ ],
+ required: [
+ "blk_alloc_to_base_fs",
+ "e2fsck",
+ "simg2img",
+ "tune2fs",
+ ],
+}
+
+python_binary_host {
+ name: "build_super_image",
+ defaults: ["releasetools_binary_defaults"],
+ srcs: [
+ "build_super_image.py",
+ ],
+ main: "build_super_image.py",
+ libs: [
+ "releasetools_common",
+ ],
+}
+
+python_binary_host {
+ name: "make_recovery_patch",
+ defaults: ["releasetools_binary_defaults"],
+ srcs: [
+ "make_recovery_patch.py",
+ ],
+ libs: [
+ "releasetools_common",
+ ],
+}
+
+python_binary_host {
+ name: "merge_builds",
+ defaults: ["releasetools_binary_defaults"],
+ srcs: [
+ "merge_builds.py",
+ ],
+ main: "merge_builds.py",
+ libs: [
+ "releasetools_build_super_image",
+ "releasetools_common",
+ ],
+}
+
+python_binary_host {
+ name: "ota_from_target_files",
+ defaults: ["releasetools_binary_defaults"],
+ srcs: [
+ "edify_generator.py",
+ "ota_from_target_files.py",
+ ],
+ libs: [
+ "releasetools_common",
+ "releasetools_verity_utils",
+ ],
+ required: [
+ "brillo_update_payload",
+ ],
+}
+
+python_binary_host {
+ name: "sparse_img",
+ defaults: ["releasetools_binary_defaults"],
+ srcs: [
+ "rangelib.py",
+ "sparse_img.py",
+ ],
+ main: "sparse_img.py",
+}
+
+python_defaults {
+ name: "releasetools_test_defaults",
srcs: [
"add_img_to_target_files.py",
"apex_utils.py",
- "blockimgdiff.py",
"build_image.py",
- "build_super_image.py",
"check_ota_package_signature.py",
"check_target_files_signatures.py",
- "common.py",
"edify_generator.py",
"img_from_target_files.py",
"make_recovery_patch.py",
"merge_target_files.py",
"ota_from_target_files.py",
"ota_package_parser.py",
- "rangelib.py",
+ "sign_apex.py",
"sign_target_files_apks.py",
- "sparse_img.py",
"target_files_diff.py",
"validate_target_files.py",
- "verity_utils.py",
- ],
-}
-python_test_host {
- name: "releasetools_test",
- defaults: ["releasetools_test_defaults"],
- main: "test_utils.py",
- srcs: [
"test_*.py",
],
libs: [
- "releasetools_lib",
+ "releasetools_build_super_image",
+ "releasetools_common",
+ "releasetools_verity_utils",
],
data: [
"testdata/*",
@@ -68,5 +196,41 @@
required: [
"otatools",
],
+}
+
+python_test_host {
+ name: "releasetools_test",
+ defaults: ["releasetools_test_defaults"],
+ main: "test_utils.py",
+ version: {
+ py2: {
+ enabled: true,
+ // When using embedded launcher, atest will try (but may fail) to load libc++.so from
+ // host, because the test executable won't be able to find the needed libs via its
+ // runpath.
+ embedded_launcher: false,
+ },
+ py3: {
+ enabled: false,
+ embedded_launcher: false,
+ },
+ },
+ test_suites: ["general-tests"],
+}
+
+python_test_host {
+ name: "releasetools_py3_test",
+ defaults: ["releasetools_test_defaults"],
+ main: "test_utils.py",
+ version: {
+ py2: {
+ enabled: false,
+ embedded_launcher: false,
+ },
+ py3: {
+ enabled: true,
+ embedded_launcher: false,
+ },
+ },
test_suites: ["general-tests"],
}
diff --git a/tools/releasetools/TEST_MAPPING b/tools/releasetools/TEST_MAPPING
index 77cef07..0af0f04 100644
--- a/tools/releasetools/TEST_MAPPING
+++ b/tools/releasetools/TEST_MAPPING
@@ -3,6 +3,10 @@
{
"name": "releasetools_test",
"host": true
+ },
+ {
+ "name": "releasetools_py3_test",
+ "host": true
}
]
}
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index 4156c8b..23ae29f 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -28,7 +28,8 @@
-r (--rebuild_recovery)
Rebuild the recovery patch and write it to the system image. Only
- meaningful when system image needs to be rebuilt.
+ meaningful when system image needs to be rebuilt and there're separate
+ boot / recovery images.
--replace_verity_private_key
Replace the private key used for verity signing. (same as the option
@@ -125,7 +126,7 @@
if not image_size:
return None
- image_blocks = int(image_size) / 4096 - 1
+ image_blocks = int(image_size) // 4096 - 1
assert image_blocks > 0, "blocks for {} must be positive".format(which)
# For sparse images, we will only check the blocks that are listed in the care
@@ -153,18 +154,19 @@
return img.name
def output_sink(fn, data):
- ofile = open(os.path.join(OPTIONS.input_tmp, "SYSTEM", fn), "w")
- ofile.write(data)
- ofile.close()
+ output_file = os.path.join(OPTIONS.input_tmp, "SYSTEM", fn)
+ with open(output_file, "wb") as ofile:
+ ofile.write(data)
if output_zip:
arc_name = "SYSTEM/" + fn
if arc_name in output_zip.namelist():
OPTIONS.replace_updated_files_list.append(arc_name)
else:
- common.ZipWrite(output_zip, ofile.name, arc_name)
+ common.ZipWrite(output_zip, output_file, arc_name)
- if OPTIONS.rebuild_recovery:
+ if (OPTIONS.rebuild_recovery and recovery_img is not None and
+ boot_img is not None):
logger.info("Building new recovery patch")
common.MakeRecoveryPatch(OPTIONS.input_tmp, output_sink, recovery_img,
boot_img, info_dict=OPTIONS.info_dict)
@@ -220,20 +222,20 @@
return img.name
-def AddProductServices(output_zip):
- """Turn the contents of PRODUCT_SERVICES into a product_services image and
- store it in output_zip."""
+def AddSystemExt(output_zip):
+ """Turn the contents of SYSTEM_EXT into a system_ext image and store it in
+ output_zip."""
img = OutputFile(output_zip, OPTIONS.input_tmp, "IMAGES",
- "product_services.img")
+ "system_ext.img")
if os.path.exists(img.name):
- logger.info("product_services.img already exists; no need to rebuild...")
+ logger.info("system_ext.img already exists; no need to rebuild...")
return img.name
block_list = OutputFile(
- output_zip, OPTIONS.input_tmp, "IMAGES", "product_services.map")
+ output_zip, OPTIONS.input_tmp, "IMAGES", "system_ext.map")
CreateImage(
- OPTIONS.input_tmp, OPTIONS.info_dict, "product_services", img,
+ OPTIONS.input_tmp, OPTIONS.info_dict, "system_ext", img,
block_list=block_list)
return img.name
@@ -288,7 +290,7 @@
def CreateImage(input_dir, info_dict, what, output_file, block_list=None):
- logger.info("creating " + what + ".img...")
+ logger.info("creating %s.img...", what)
image_props = build_image.ImagePropFromGlobalDict(info_dict, what)
fstab = info_dict["fstab"]
@@ -389,28 +391,6 @@
img.Write()
-def AppendVBMetaArgsForPartition(cmd, partition, image):
- """Appends the VBMeta arguments for partition.
-
- It sets up the VBMeta argument by including the partition descriptor from the
- given 'image', or by configuring the partition as a chained partition.
-
- Args:
- cmd: A list of command args that will be used to generate the vbmeta image.
- The argument for the partition will be appended to the list.
- partition: The name of the partition (e.g. "system").
- image: The path to the partition image.
- """
- # Check if chain partition is used.
- key_path = OPTIONS.info_dict.get("avb_" + partition + "_key_path")
- if key_path:
- chained_partition_arg = common.GetAvbChainedPartitionArg(
- partition, OPTIONS.info_dict)
- cmd.extend(["--chain_partition", chained_partition_arg])
- else:
- cmd.extend(["--include_descriptors_from_image", image])
-
-
def AddVBMeta(output_zip, partitions, name, needed_partitions):
"""Creates a VBMeta image and stores it in output_zip.
@@ -440,45 +420,7 @@
logger.info("%s.img already exists; not rebuilding...", name)
return img.name
- avbtool = OPTIONS.info_dict["avb_avbtool"]
- cmd = [avbtool, "make_vbmeta_image", "--output", img.name]
- common.AppendAVBSigningArgs(cmd, name)
-
- for partition, path in partitions.items():
- if partition not in needed_partitions:
- continue
- assert (partition in common.AVB_PARTITIONS or
- partition.startswith('vbmeta_')), \
- 'Unknown partition: {}'.format(partition)
- assert os.path.exists(path), \
- 'Failed to find {} for {}'.format(path, partition)
- AppendVBMetaArgsForPartition(cmd, partition, path)
-
- args = OPTIONS.info_dict.get("avb_{}_args".format(name))
- if args and args.strip():
- split_args = shlex.split(args)
- for index, arg in enumerate(split_args[:-1]):
- # Sanity check that the image file exists. Some images might be defined
- # as a path relative to source tree, which may not be available at the
- # same location when running this script (we have the input target_files
- # zip only). For such cases, we additionally scan other locations (e.g.
- # IMAGES/, RADIO/, etc) before bailing out.
- if arg == '--include_descriptors_from_image':
- image_path = split_args[index + 1]
- if os.path.exists(image_path):
- continue
- found = False
- for dir_name in ['IMAGES', 'RADIO', 'PREBUILT_IMAGES']:
- alt_path = os.path.join(
- OPTIONS.input_tmp, dir_name, os.path.basename(image_path))
- if os.path.exists(alt_path):
- split_args[index + 1] = alt_path
- found = True
- break
- assert found, 'Failed to find {}'.format(image_path)
- cmd.extend(split_args)
-
- common.RunAndCheckOutput(cmd)
+ common.BuildVBMeta(img.name, partitions, name, needed_partitions)
img.Write()
return img.name
@@ -732,10 +674,10 @@
has_recovery = OPTIONS.info_dict.get("no_recovery") != "true"
has_boot = OPTIONS.info_dict.get("no_boot") != "true"
- # {vendor,odm,product,product_services}.img are unlike system.img or
+ # {vendor,odm,product,system_ext}.img are unlike system.img or
# system_other.img. Because it could be built from source, or dropped into
# target_files.zip as a prebuilt blob. We consider either of them as
- # {vendor,product,product_services}.img being available, which could be
+ # {vendor,product,system_ext}.img being available, which could be
# used when generating vbmeta.img for AVB.
has_vendor = (os.path.isdir(os.path.join(OPTIONS.input_tmp, "VENDOR")) or
os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES",
@@ -746,11 +688,11 @@
has_product = (os.path.isdir(os.path.join(OPTIONS.input_tmp, "PRODUCT")) or
os.path.exists(os.path.join(OPTIONS.input_tmp, "IMAGES",
"product.img")))
- has_product_services = (os.path.isdir(os.path.join(OPTIONS.input_tmp,
- "PRODUCT_SERVICES")) or
- os.path.exists(os.path.join(OPTIONS.input_tmp,
- "IMAGES",
- "product_services.img")))
+ has_system_ext = (os.path.isdir(os.path.join(OPTIONS.input_tmp,
+ "SYSTEM_EXT")) or
+ os.path.exists(os.path.join(OPTIONS.input_tmp,
+ "IMAGES",
+ "system_ext.img")))
has_system = os.path.isdir(os.path.join(OPTIONS.input_tmp, "SYSTEM"))
has_system_other = os.path.isdir(os.path.join(OPTIONS.input_tmp,
"SYSTEM_OTHER"))
@@ -776,7 +718,7 @@
partitions = dict()
def banner(s):
- logger.info("\n\n++++ " + s + " ++++\n\n")
+ logger.info("\n\n++++ %s ++++\n\n", s)
boot_image = None
if has_boot:
@@ -808,11 +750,11 @@
banner("recovery (two-step image)")
# The special recovery.img for two-step package use.
recovery_two_step_image = common.GetBootableImage(
- "IMAGES/recovery-two-step.img", "recovery-two-step.img",
+ "OTA/recovery-two-step.img", "recovery-two-step.img",
OPTIONS.input_tmp, "RECOVERY", two_step_image=True)
assert recovery_two_step_image, "Failed to create recovery-two-step.img."
recovery_two_step_image_path = os.path.join(
- OPTIONS.input_tmp, "IMAGES", "recovery-two-step.img")
+ OPTIONS.input_tmp, "OTA", "recovery-two-step.img")
if not os.path.exists(recovery_two_step_image_path):
recovery_two_step_image.WriteToDir(OPTIONS.input_tmp)
if output_zip:
@@ -831,9 +773,9 @@
banner("product")
partitions['product'] = AddProduct(output_zip)
- if has_product_services:
- banner("product_services")
- partitions['product_services'] = AddProductServices(output_zip)
+ if has_system_ext:
+ banner("system_ext")
+ partitions['system_ext'] = AddSystemExt(output_zip)
if has_odm:
banner("odm")
@@ -886,10 +828,11 @@
banner("vbmeta")
AddVBMeta(output_zip, partitions, "vbmeta", vbmeta_partitions)
- if OPTIONS.info_dict.get("build_super_partition") == "true":
+ if OPTIONS.info_dict.get("use_dynamic_partitions") == "true":
banner("super_empty")
AddSuperEmpty(output_zip)
+ if OPTIONS.info_dict.get("build_super_partition") == "true":
if OPTIONS.info_dict.get(
"build_retrofit_dynamic_partitions_ota_package") == "true":
banner("super split images")
@@ -899,7 +842,7 @@
ab_partitions_txt = os.path.join(OPTIONS.input_tmp, "META",
"ab_partitions.txt")
if os.path.exists(ab_partitions_txt):
- with open(ab_partitions_txt, 'r') as f:
+ with open(ab_partitions_txt) as f:
ab_partitions = f.readlines()
# For devices using A/B update, make sure we have all the needed images
@@ -914,7 +857,7 @@
pack_radioimages_txt = os.path.join(
OPTIONS.input_tmp, "META", "pack_radioimages.txt")
if os.path.exists(pack_radioimages_txt):
- with open(pack_radioimages_txt, 'r') as f:
+ with open(pack_radioimages_txt) as f:
AddPackRadioImages(output_zip, f.readlines())
if output_zip:
diff --git a/tools/releasetools/apex_utils.py b/tools/releasetools/apex_utils.py
index fb4ca76..6eaa12f 100644
--- a/tools/releasetools/apex_utils.py
+++ b/tools/releasetools/apex_utils.py
@@ -18,7 +18,6 @@
import os.path
import re
import shlex
-import sys
import zipfile
import common
@@ -42,11 +41,11 @@
Exception.__init__(self, message)
-def SignApexPayload(payload_file, payload_key_path, payload_key_name, algorithm,
- salt, signing_args=None):
+def SignApexPayload(avbtool, payload_file, payload_key_path, payload_key_name,
+ algorithm, salt, signing_args=None):
"""Signs a given payload_file with the payload key."""
# Add the new footer. Old footer, if any, will be replaced by avbtool.
- cmd = ['avbtool', 'add_hashtree_footer',
+ cmd = [avbtool, 'add_hashtree_footer',
'--do_not_generate_fec',
'--algorithm', algorithm,
'--key', payload_key_path,
@@ -59,31 +58,32 @@
try:
common.RunAndCheckOutput(cmd)
except common.ExternalError as e:
- raise ApexSigningError, \
+ raise ApexSigningError(
'Failed to sign APEX payload {} with {}:\n{}'.format(
- payload_file, payload_key_path, e), sys.exc_info()[2]
+ payload_file, payload_key_path, e))
# Verify the signed payload image with specified public key.
logger.info('Verifying %s', payload_file)
- VerifyApexPayload(payload_file, payload_key_path)
+ VerifyApexPayload(avbtool, payload_file, payload_key_path)
-def VerifyApexPayload(payload_file, payload_key):
+def VerifyApexPayload(avbtool, payload_file, payload_key):
"""Verifies the APEX payload signature with the given key."""
- cmd = ['avbtool', 'verify_image', '--image', payload_file,
+ cmd = [avbtool, 'verify_image', '--image', payload_file,
'--key', payload_key]
try:
common.RunAndCheckOutput(cmd)
except common.ExternalError as e:
- raise ApexSigningError, \
+ raise ApexSigningError(
'Failed to validate payload signing for {} with {}:\n{}'.format(
- payload_file, payload_key, e), sys.exc_info()[2]
+ payload_file, payload_key, e))
-def ParseApexPayloadInfo(payload_path):
+def ParseApexPayloadInfo(avbtool, payload_path):
"""Parses the APEX payload info.
Args:
+ avbtool: The AVB tool to use.
payload_path: The path to the payload image.
Raises:
@@ -96,13 +96,13 @@
if not os.path.exists(payload_path):
raise ApexInfoError('Failed to find image: {}'.format(payload_path))
- cmd = ['avbtool', 'info_image', '--image', payload_path]
+ cmd = [avbtool, 'info_image', '--image', payload_path]
try:
output = common.RunAndCheckOutput(cmd)
except common.ExternalError as e:
- raise ApexInfoError, \
+ raise ApexInfoError(
'Failed to get APEX payload info for {}:\n{}'.format(
- payload_path, e), sys.exc_info()[2]
+ payload_path, e))
# Extract the Algorithm / Salt / Prop info from payload (i.e. an image signed
# with avbtool). For example,
@@ -150,7 +150,7 @@
return payload_info
-def SignApex(apex_data, payload_key, container_key, container_pw,
+def SignApex(avbtool, apex_data, payload_key, container_key, container_pw,
codename_to_api_level_map, signing_args=None):
"""Signs the current APEX with the given payload/container keys.
@@ -178,8 +178,9 @@
with zipfile.ZipFile(apex_file) as apex_fd:
payload_file = apex_fd.extract(APEX_PAYLOAD_IMAGE, payload_dir)
- payload_info = ParseApexPayloadInfo(payload_file)
+ payload_info = ParseApexPayloadInfo(avbtool, payload_file)
SignApexPayload(
+ avbtool,
payload_file,
payload_key,
payload_info['apex.key'],
@@ -188,7 +189,7 @@
signing_args)
# 1b. Update the embedded payload public key.
- payload_public_key = common.ExtractAvbPublicKey(payload_key)
+ payload_public_key = common.ExtractAvbPublicKey(avbtool, payload_key)
common.ZipDelete(apex_file, APEX_PAYLOAD_IMAGE)
common.ZipDelete(apex_file, APEX_PUBKEY)
diff --git a/tools/releasetools/blockimgdiff.py b/tools/releasetools/blockimgdiff.py
index b23eef1..72f065d 100644
--- a/tools/releasetools/blockimgdiff.py
+++ b/tools/releasetools/blockimgdiff.py
@@ -28,12 +28,12 @@
import threading
import zlib
from collections import deque, namedtuple, OrderedDict
-from hashlib import sha1
import common
+from images import EmptyImage
from rangelib import RangeSet
-__all__ = ["EmptyImage", "DataImage", "BlockImageDiff"]
+__all__ = ["BlockImageDiff"]
logger = logging.getLogger(__name__)
@@ -60,210 +60,6 @@
return PatchInfo(imgdiff, f.read())
-class Image(object):
- def RangeSha1(self, ranges):
- raise NotImplementedError
-
- def ReadRangeSet(self, ranges):
- raise NotImplementedError
-
- def TotalSha1(self, include_clobbered_blocks=False):
- raise NotImplementedError
-
- def WriteRangeDataToFd(self, ranges, fd):
- raise NotImplementedError
-
-
-class EmptyImage(Image):
- """A zero-length image."""
-
- def __init__(self):
- self.blocksize = 4096
- self.care_map = RangeSet()
- self.clobbered_blocks = RangeSet()
- self.extended = RangeSet()
- self.total_blocks = 0
- self.file_map = {}
- self.hashtree_info = None
-
- def RangeSha1(self, ranges):
- return sha1().hexdigest()
-
- def ReadRangeSet(self, ranges):
- return ()
-
- def TotalSha1(self, include_clobbered_blocks=False):
- # EmptyImage always carries empty clobbered_blocks, so
- # include_clobbered_blocks can be ignored.
- assert self.clobbered_blocks.size() == 0
- return sha1().hexdigest()
-
- def WriteRangeDataToFd(self, ranges, fd):
- raise ValueError("Can't write data from EmptyImage to file")
-
-
-class DataImage(Image):
- """An image wrapped around a single string of data."""
-
- def __init__(self, data, trim=False, pad=False):
- self.data = data
- self.blocksize = 4096
-
- assert not (trim and pad)
-
- partial = len(self.data) % self.blocksize
- padded = False
- if partial > 0:
- if trim:
- self.data = self.data[:-partial]
- elif pad:
- self.data += '\0' * (self.blocksize - partial)
- padded = True
- else:
- raise ValueError(("data for DataImage must be multiple of %d bytes "
- "unless trim or pad is specified") %
- (self.blocksize,))
-
- assert len(self.data) % self.blocksize == 0
-
- self.total_blocks = len(self.data) / self.blocksize
- self.care_map = RangeSet(data=(0, self.total_blocks))
- # When the last block is padded, we always write the whole block even for
- # incremental OTAs. Because otherwise the last block may get skipped if
- # unchanged for an incremental, but would fail the post-install
- # verification if it has non-zero contents in the padding bytes.
- # Bug: 23828506
- if padded:
- clobbered_blocks = [self.total_blocks-1, self.total_blocks]
- else:
- clobbered_blocks = []
- self.clobbered_blocks = clobbered_blocks
- self.extended = RangeSet()
-
- zero_blocks = []
- nonzero_blocks = []
- reference = '\0' * self.blocksize
-
- for i in range(self.total_blocks-1 if padded else self.total_blocks):
- d = self.data[i*self.blocksize : (i+1)*self.blocksize]
- if d == reference:
- zero_blocks.append(i)
- zero_blocks.append(i+1)
- else:
- nonzero_blocks.append(i)
- nonzero_blocks.append(i+1)
-
- assert zero_blocks or nonzero_blocks or clobbered_blocks
-
- self.file_map = dict()
- if zero_blocks:
- self.file_map["__ZERO"] = RangeSet(data=zero_blocks)
- if nonzero_blocks:
- self.file_map["__NONZERO"] = RangeSet(data=nonzero_blocks)
- if clobbered_blocks:
- self.file_map["__COPY"] = RangeSet(data=clobbered_blocks)
-
- def _GetRangeData(self, ranges):
- for s, e in ranges:
- yield self.data[s*self.blocksize:e*self.blocksize]
-
- def RangeSha1(self, ranges):
- h = sha1()
- for data in self._GetRangeData(ranges): # pylint: disable=not-an-iterable
- h.update(data)
- return h.hexdigest()
-
- def ReadRangeSet(self, ranges):
- return list(self._GetRangeData(ranges))
-
- def TotalSha1(self, include_clobbered_blocks=False):
- if not include_clobbered_blocks:
- return self.RangeSha1(self.care_map.subtract(self.clobbered_blocks))
- else:
- return sha1(self.data).hexdigest()
-
- def WriteRangeDataToFd(self, ranges, fd):
- for data in self._GetRangeData(ranges): # pylint: disable=not-an-iterable
- fd.write(data)
-
-
-class FileImage(Image):
- """An image wrapped around a raw image file."""
-
- def __init__(self, path, hashtree_info_generator=None):
- self.path = path
- self.blocksize = 4096
- self._file_size = os.path.getsize(self.path)
- self._file = open(self.path, 'r')
-
- if self._file_size % self.blocksize != 0:
- raise ValueError("Size of file %s must be multiple of %d bytes, but is %d"
- % self.path, self.blocksize, self._file_size)
-
- self.total_blocks = self._file_size / self.blocksize
- self.care_map = RangeSet(data=(0, self.total_blocks))
- self.clobbered_blocks = RangeSet()
- self.extended = RangeSet()
-
- self.generator_lock = threading.Lock()
-
- self.hashtree_info = None
- if hashtree_info_generator:
- self.hashtree_info = hashtree_info_generator.Generate(self)
-
- zero_blocks = []
- nonzero_blocks = []
- reference = '\0' * self.blocksize
-
- for i in range(self.total_blocks):
- d = self._file.read(self.blocksize)
- if d == reference:
- zero_blocks.append(i)
- zero_blocks.append(i+1)
- else:
- nonzero_blocks.append(i)
- nonzero_blocks.append(i+1)
-
- assert zero_blocks or nonzero_blocks
-
- self.file_map = {}
- if zero_blocks:
- self.file_map["__ZERO"] = RangeSet(data=zero_blocks)
- if nonzero_blocks:
- self.file_map["__NONZERO"] = RangeSet(data=nonzero_blocks)
- if self.hashtree_info:
- self.file_map["__HASHTREE"] = self.hashtree_info.hashtree_range
-
- def __del__(self):
- self._file.close()
-
- def _GetRangeData(self, ranges):
- # Use a lock to protect the generator so that we will not run two
- # instances of this generator on the same object simultaneously.
- with self.generator_lock:
- for s, e in ranges:
- self._file.seek(s * self.blocksize)
- for _ in range(s, e):
- yield self._file.read(self.blocksize)
-
- def RangeSha1(self, ranges):
- h = sha1()
- for data in self._GetRangeData(ranges): # pylint: disable=not-an-iterable
- h.update(data)
- return h.hexdigest()
-
- def ReadRangeSet(self, ranges):
- return list(self._GetRangeData(ranges))
-
- def TotalSha1(self, include_clobbered_blocks=False):
- assert not self.clobbered_blocks
- return self.RangeSha1(self.care_map)
-
- def WriteRangeDataToFd(self, ranges, fd):
- for data in self._GetRangeData(ranges): # pylint: disable=not-an-iterable
- fd.write(data)
-
-
class Transfer(object):
def __init__(self, tgt_name, src_name, tgt_ranges, src_ranges, tgt_sha1,
src_sha1, style, by_id):
@@ -391,7 +187,7 @@
def print_header(header, separator):
logger.info(header)
- logger.info(separator * len(header) + '\n')
+ logger.info('%s\n', separator * len(header))
print_header(' Imgdiff Stats Report ', '=')
for key in self.REASONS:
@@ -779,7 +575,7 @@
out.insert(2, "0\n")
out.insert(3, str(max_stashed_blocks) + "\n")
- with open(prefix + ".transfer.list", "wb") as f:
+ with open(prefix + ".transfer.list", "w") as f:
for i in out:
f.write(i)
@@ -1009,7 +805,7 @@
# - we write every block we care about exactly once.
# Start with no blocks having been touched yet.
- touched = array.array("B", "\0" * self.tgt.total_blocks)
+ touched = array.array("B", b"\0" * self.tgt.total_blocks)
# Imagine processing the transfers in order.
for xf in self.transfers:
@@ -1671,8 +1467,8 @@
split_tgt_size = int(info[1])
assert split_tgt_size % 4096 == 0
- assert split_tgt_size / 4096 <= tgt_remain.size()
- split_tgt_ranges = tgt_remain.first(split_tgt_size / 4096)
+ assert split_tgt_size // 4096 <= tgt_remain.size()
+ split_tgt_ranges = tgt_remain.first(split_tgt_size // 4096)
tgt_remain = tgt_remain.subtract(split_tgt_ranges)
# Find the split_src_ranges within the image file from its relative
@@ -1744,7 +1540,7 @@
lines)
for index, (patch_start, patch_length, split_tgt_ranges,
split_src_ranges) in enumerate(split_info_list):
- with open(patch_file) as f:
+ with open(patch_file, 'rb') as f:
f.seek(patch_start)
patch_content = f.read(patch_length)
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 4136ed4..af508fe 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -18,7 +18,7 @@
Builds output_image from the given input_directory, properties_file,
and writes the image to target_output_directory.
-Usage: build_image.py input_directory properties_file output_image \\
+Usage: build_image input_directory properties_file output_image \\
target_output_directory
"""
@@ -519,7 +519,6 @@
common_props = (
"extfs_sparse_flag",
"squashfs_sparse_flag",
- "selinux_fc",
"skip_fsck",
"ext_mkuserimg",
"verity",
@@ -564,6 +563,7 @@
if not copy_prop("system_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
copy_prop("system_reserved_size", "partition_reserved_size")
+ copy_prop("system_selinux_fc", "selinux_fc")
elif mount_point == "system_other":
# We inherit the selinux policies of /system since we contain some of its
# files.
@@ -587,6 +587,7 @@
if not copy_prop("system_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
copy_prop("system_reserved_size", "partition_reserved_size")
+ copy_prop("system_selinux_fc", "selinux_fc")
elif mount_point == "data":
# Copy the generic fs type first, override with specific one if available.
copy_prop("fs_type", "fs_type")
@@ -594,9 +595,11 @@
copy_prop("userdata_size", "partition_size")
copy_prop("flash_logical_block_size", "flash_logical_block_size")
copy_prop("flash_erase_block_size", "flash_erase_block_size")
+ copy_prop("userdata_selinux_fc", "selinux_fc")
elif mount_point == "cache":
copy_prop("cache_fs_type", "fs_type")
copy_prop("cache_size", "partition_size")
+ copy_prop("cache_selinux_fc", "selinux_fc")
elif mount_point == "vendor":
copy_prop("avb_vendor_hashtree_enable", "avb_hashtree_enable")
copy_prop("avb_vendor_add_hashtree_footer_args",
@@ -618,6 +621,7 @@
if not copy_prop("vendor_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
copy_prop("vendor_reserved_size", "partition_reserved_size")
+ copy_prop("vendor_selinux_fc", "selinux_fc")
elif mount_point == "product":
copy_prop("avb_product_hashtree_enable", "avb_hashtree_enable")
copy_prop("avb_product_add_hashtree_footer_args",
@@ -639,29 +643,31 @@
if not copy_prop("product_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
copy_prop("product_reserved_size", "partition_reserved_size")
- elif mount_point == "product_services":
- copy_prop("avb_product_services_hashtree_enable", "avb_hashtree_enable")
- copy_prop("avb_product_services_add_hashtree_footer_args",
+ copy_prop("product_selinux_fc", "selinux_fc")
+ elif mount_point == "system_ext":
+ copy_prop("avb_system_ext_hashtree_enable", "avb_hashtree_enable")
+ copy_prop("avb_system_ext_add_hashtree_footer_args",
"avb_add_hashtree_footer_args")
- copy_prop("avb_product_services_key_path", "avb_key_path")
- copy_prop("avb_product_services_algorithm", "avb_algorithm")
- copy_prop("product_services_fs_type", "fs_type")
- copy_prop("product_services_size", "partition_size")
- if not copy_prop("product_services_journal_size", "journal_size"):
+ copy_prop("avb_system_ext_key_path", "avb_key_path")
+ copy_prop("avb_system_ext_algorithm", "avb_algorithm")
+ copy_prop("system_ext_fs_type", "fs_type")
+ copy_prop("system_ext_size", "partition_size")
+ if not copy_prop("system_ext_journal_size", "journal_size"):
d["journal_size"] = "0"
- copy_prop("product_services_verity_block_device", "verity_block_device")
+ copy_prop("system_ext_verity_block_device", "verity_block_device")
copy_prop("ext4_share_dup_blocks", "ext4_share_dup_blocks")
- copy_prop("product_services_squashfs_compressor", "squashfs_compressor")
- copy_prop("product_services_squashfs_compressor_opt",
+ copy_prop("system_ext_squashfs_compressor", "squashfs_compressor")
+ copy_prop("system_ext_squashfs_compressor_opt",
"squashfs_compressor_opt")
- copy_prop("product_services_squashfs_block_size", "squashfs_block_size")
- copy_prop("product_services_squashfs_disable_4k_align",
+ copy_prop("system_ext_squashfs_block_size", "squashfs_block_size")
+ copy_prop("system_ext_squashfs_disable_4k_align",
"squashfs_disable_4k_align")
- copy_prop("product_services_base_fs_file", "base_fs_file")
- copy_prop("product_services_extfs_inode_count", "extfs_inode_count")
- if not copy_prop("product_services_extfs_rsv_pct", "extfs_rsv_pct"):
+ copy_prop("system_ext_base_fs_file", "base_fs_file")
+ copy_prop("system_ext_extfs_inode_count", "extfs_inode_count")
+ if not copy_prop("system_ext_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
- copy_prop("product_services_reserved_size", "partition_reserved_size")
+ copy_prop("system_ext_reserved_size", "partition_reserved_size")
+ copy_prop("system_ext_selinux_fc", "selinux_fc")
elif mount_point == "odm":
copy_prop("avb_odm_hashtree_enable", "avb_hashtree_enable")
copy_prop("avb_odm_add_hashtree_footer_args",
@@ -683,6 +689,7 @@
if not copy_prop("odm_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
copy_prop("odm_reserved_size", "partition_reserved_size")
+ copy_prop("odm_selinux_fc", "selinux_fc")
elif mount_point == "oem":
copy_prop("fs_type", "fs_type")
copy_prop("oem_size", "partition_size")
@@ -692,6 +699,7 @@
copy_prop("ext4_share_dup_blocks", "ext4_share_dup_blocks")
if not copy_prop("oem_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
+ copy_prop("oem_selinux_fc", "selinux_fc")
d["partition_name"] = mount_point
return d
@@ -728,8 +736,8 @@
copy_prop("partition_size", "odm_size")
elif mount_point == "product":
copy_prop("partition_size", "product_size")
- elif mount_point == "product_services":
- copy_prop("partition_size", "product_services_size")
+ elif mount_point == "system_ext":
+ copy_prop("partition_size", "system_ext_size")
return d
@@ -769,8 +777,8 @@
mount_point = "oem"
elif image_filename == "product.img":
mount_point = "product"
- elif image_filename == "product_services.img":
- mount_point = "product_services"
+ elif image_filename == "system_ext.img":
+ mount_point = "system_ext"
else:
logger.error("Unknown image file name %s", image_filename)
sys.exit(1)
diff --git a/tools/releasetools/check_ota_package_signature.py b/tools/releasetools/check_ota_package_signature.py
index 7d3424b..0d990f1 100755
--- a/tools/releasetools/check_ota_package_signature.py
+++ b/tools/releasetools/check_ota_package_signature.py
@@ -38,8 +38,7 @@
"""Check if the cert uses SHA-256 hashing algorithm."""
cmd = ['openssl', 'x509', '-text', '-noout', '-in', cert]
- p1 = common.Run(cmd, stdout=subprocess.PIPE)
- cert_dump, _ = p1.communicate()
+ cert_dump = common.RunAndCheckOutput(cmd, stdout=subprocess.PIPE)
algorithm = re.search(r'Signature Algorithm: ([a-zA-Z0-9]+)', cert_dump)
assert algorithm, "Failed to identify the signature algorithm."
@@ -69,13 +68,13 @@
print('Certificate: %s' % (cert,))
# Read in the package.
- with open(package) as package_file:
+ with open(package, 'rb') as package_file:
package_bytes = package_file.read()
length = len(package_bytes)
assert length >= 6, "Not big enough to contain footer."
- footer = [ord(x) for x in package_bytes[-6:]]
+ footer = bytearray(package_bytes[-6:])
assert footer[2] == 0xff and footer[3] == 0xff, "Footer is wrong."
signature_start_from_end = (footer[1] << 8) + footer[0]
@@ -111,31 +110,25 @@
# Parse the signature and get the hash.
cmd = ['openssl', 'asn1parse', '-inform', 'DER', '-in', sig_file]
- p1 = common.Run(cmd, stdout=subprocess.PIPE)
- sig, _ = p1.communicate()
- assert p1.returncode == 0, "Failed to parse the signature."
+ sig = common.RunAndCheckOutput(cmd, stdout=subprocess.PIPE)
- digest_line = sig.strip().split('\n')[-1]
+ digest_line = sig.rstrip().split('\n')[-1]
digest_string = digest_line.split(':')[3]
digest_file = common.MakeTempFile(prefix='digest-')
with open(digest_file, 'wb') as f:
- f.write(digest_string.decode('hex'))
+ f.write(bytearray.fromhex(digest_string))
# Verify the digest by outputing the decrypted result in ASN.1 structure.
decrypted_file = common.MakeTempFile(prefix='decrypted-')
cmd = ['openssl', 'rsautl', '-verify', '-certin', '-inkey', cert,
'-in', digest_file, '-out', decrypted_file]
- p1 = common.Run(cmd, stdout=subprocess.PIPE)
- p1.communicate()
- assert p1.returncode == 0, "Failed to run openssl rsautl -verify."
+ common.RunAndCheckOutput(cmd, stdout=subprocess.PIPE)
# Parse the output ASN.1 structure.
cmd = ['openssl', 'asn1parse', '-inform', 'DER', '-in', decrypted_file]
- p1 = common.Run(cmd, stdout=subprocess.PIPE)
- decrypted_output, _ = p1.communicate()
- assert p1.returncode == 0, "Failed to parse the output."
+ decrypted_output = common.RunAndCheckOutput(cmd, stdout=subprocess.PIPE)
- digest_line = decrypted_output.strip().split('\n')[-1]
+ digest_line = decrypted_output.rstrip().split('\n')[-1]
digest_string = digest_line.split(':')[3].lower()
# Verify that the two digest strings match.
@@ -156,7 +149,7 @@
# Dump pubkey from the certificate.
pubkey = common.MakeTempFile(prefix="key-", suffix=".pem")
- with open(pubkey, 'wb') as pubkey_fp:
+ with open(pubkey, 'w') as pubkey_fp:
pubkey_fp.write(common.ExtractPublicKey(cert))
package_dir = common.MakeTempDir(prefix='package-')
@@ -166,11 +159,7 @@
cmd = ['delta_generator',
'--in_file=' + payload_file,
'--public_key=' + pubkey]
- proc = common.Run(cmd)
- stdoutdata, _ = proc.communicate()
- assert proc.returncode == 0, \
- 'Failed to verify payload with delta_generator: {}\n{}'.format(
- package, stdoutdata)
+ common.RunAndCheckOutput(cmd)
common.ZipClose(package_zip)
# Verified successfully upon reaching here.
diff --git a/tools/releasetools/check_target_files_signatures.py b/tools/releasetools/check_target_files_signatures.py
index 4b0d4c7..60200a3 100755
--- a/tools/releasetools/check_target_files_signatures.py
+++ b/tools/releasetools/check_target_files_signatures.py
@@ -39,8 +39,11 @@
"""
+from __future__ import print_function
+
import logging
import os
+import os.path
import re
import subprocess
import sys
@@ -49,7 +52,7 @@
import common
if sys.hexversion < 0x02070000:
- print >> sys.stderr, "Python 2.7 or newer is required."
+ print("Python 2.7 or newer is required.", file=sys.stderr)
sys.exit(1)
@@ -65,8 +68,10 @@
class MyZipInfo(zipfile.ZipInfo):
def _decodeExtra(self):
pass
+
zipfile.ZipInfo = MyZipInfo
+
OPTIONS = common.OPTIONS
OPTIONS.text = False
@@ -76,28 +81,34 @@
PROBLEMS = []
PROBLEM_PREFIX = []
+
def AddProblem(msg):
PROBLEMS.append(" ".join(PROBLEM_PREFIX) + " " + msg)
+
+
def Push(msg):
PROBLEM_PREFIX.append(msg)
+
+
def Pop():
PROBLEM_PREFIX.pop()
def Banner(msg):
- print "-" * 70
- print " ", msg
- print "-" * 70
+ print("-" * 70)
+ print(" ", msg)
+ print("-" * 70)
def GetCertSubject(cert):
p = common.Run(["openssl", "x509", "-inform", "DER", "-text"],
stdin=subprocess.PIPE,
- stdout=subprocess.PIPE)
+ stdout=subprocess.PIPE,
+ universal_newlines=False)
out, err = p.communicate(cert)
if err and not err.strip():
return "(error reading cert subject)"
- for line in out.split("\n"):
+ for line in out.decode().split("\n"):
line = line.strip()
if line.startswith("Subject:"):
return line[8:].strip()
@@ -105,6 +116,7 @@
class CertDB(object):
+
def __init__(self):
self.certs = {}
@@ -132,13 +144,13 @@
to_load.extend(certs)
for i in to_load:
- f = open(i)
- cert = common.ParseCertificate(f.read())
- f.close()
+ with open(i) as f:
+ cert = common.ParseCertificate(f.read())
name, _ = os.path.splitext(i)
name, _ = os.path.splitext(name)
self.Add(cert, name)
+
ALL_CERTS = CertDB()
@@ -152,13 +164,14 @@
"-outform", "PEM",
"-print_certs"],
stdin=subprocess.PIPE,
- stdout=subprocess.PIPE)
+ stdout=subprocess.PIPE,
+ universal_newlines=False)
out, err = p.communicate(data)
if err and not err.strip():
- AddProblem("error reading cert:\n" + err)
+ AddProblem("error reading cert:\n" + err.decode())
return None
- cert = common.ParseCertificate(out)
+ cert = common.ParseCertificate(out.decode())
if not cert:
AddProblem("error parsing cert output")
return None
@@ -184,22 +197,20 @@
def RecordCerts(self, full_filename):
out = set()
- try:
- f = open(full_filename)
- apk = zipfile.ZipFile(f, "r")
+ with zipfile.ZipFile(full_filename) as apk:
pkcs7 = None
for info in apk.infolist():
- if info.filename.startswith("META-INF/") and \
- (info.filename.endswith(".DSA") or info.filename.endswith(".RSA")):
- pkcs7 = apk.read(info.filename)
- cert = CertFromPKCS7(pkcs7, info.filename)
+ filename = info.filename
+ if (filename.startswith("META-INF/") and
+ info.filename.endswith((".DSA", ".RSA"))):
+ pkcs7 = apk.read(filename)
+ cert = CertFromPKCS7(pkcs7, filename)
out.add(cert)
ALL_CERTS.Add(cert)
if not pkcs7:
AddProblem("no signature")
- finally:
- f.close()
- self.certs = frozenset(out)
+
+ self.certs = frozenset(out)
def ReadManifest(self, full_filename):
p = common.Run(["aapt", "dump", "xmltree", full_filename,
@@ -247,8 +258,8 @@
# This is the list of wildcards of files we extract from |filename|.
apk_extensions = ['*.apk', '*.apex']
- self.certmap, compressed_extension = common.ReadApkCerts(
- zipfile.ZipFile(filename))
+ with zipfile.ZipFile(filename) as input_zip:
+ self.certmap, compressed_extension = common.ReadApkCerts(input_zip)
if compressed_extension:
apk_extensions.append('*.apk' + compressed_extension)
@@ -287,7 +298,7 @@
"""Look for any instances where packages signed with different
certs request the same sharedUserId."""
apks_by_uid = {}
- for apk in self.apks.itervalues():
+ for apk in self.apks.values():
if apk.shared_uid:
apks_by_uid.setdefault(apk.shared_uid, []).append(apk)
@@ -302,15 +313,15 @@
AddProblem("different cert sets for packages with uid %s" % (uid,))
- print "uid %s is shared by packages with different cert sets:" % (uid,)
+ print("uid %s is shared by packages with different cert sets:" % (uid,))
for apk in apks:
- print "%-*s [%s]" % (self.max_pkg_len, apk.package, apk.filename)
+ print("%-*s [%s]" % (self.max_pkg_len, apk.package, apk.filename))
for cert in apk.certs:
- print " ", ALL_CERTS.Get(cert)
- print
+ print(" ", ALL_CERTS.Get(cert))
+ print()
def CheckExternalSignatures(self):
- for apk_filename, certname in self.certmap.iteritems():
+ for apk_filename, certname in self.certmap.items():
if certname == "EXTERNAL":
# Apps marked EXTERNAL should be signed with the test key
# during development, then manually re-signed after
@@ -326,25 +337,25 @@
def PrintCerts(self):
"""Display a table of packages grouped by cert."""
by_cert = {}
- for apk in self.apks.itervalues():
+ for apk in self.apks.values():
for cert in apk.certs:
by_cert.setdefault(cert, []).append((apk.package, apk))
- order = [(-len(v), k) for (k, v) in by_cert.iteritems()]
+ order = [(-len(v), k) for (k, v) in by_cert.items()]
order.sort()
for _, cert in order:
- print "%s:" % (ALL_CERTS.Get(cert),)
+ print("%s:" % (ALL_CERTS.Get(cert),))
apks = by_cert[cert]
apks.sort()
for _, apk in apks:
if apk.shared_uid:
- print " %-*s %-*s [%s]" % (self.max_fn_len, apk.filename,
+ print(" %-*s %-*s [%s]" % (self.max_fn_len, apk.filename,
self.max_pkg_len, apk.package,
- apk.shared_uid)
+ apk.shared_uid))
else:
- print " %-*s %s" % (self.max_fn_len, apk.filename, apk.package)
- print
+ print(" %-*s %s" % (self.max_fn_len, apk.filename, apk.package))
+ print()
def CompareWith(self, other):
"""Look for instances where a given package that exists in both
@@ -365,12 +376,12 @@
by_certpair.setdefault((other.apks[i].certs,
self.apks[i].certs), []).append(i)
else:
- print "%s [%s]: new APK (not in comparison target_files)" % (
- i, self.apks[i].filename)
+ print("%s [%s]: new APK (not in comparison target_files)" % (
+ i, self.apks[i].filename))
else:
if i in other.apks:
- print "%s [%s]: removed APK (only in comparison target_files)" % (
- i, other.apks[i].filename)
+ print("%s [%s]: removed APK (only in comparison target_files)" % (
+ i, other.apks[i].filename))
if by_certpair:
AddProblem("some APKs changed certs")
@@ -378,23 +389,23 @@
for (old, new), packages in sorted(by_certpair.items()):
for i, o in enumerate(old):
if i == 0:
- print "was", ALL_CERTS.Get(o)
+ print("was", ALL_CERTS.Get(o))
else:
- print " ", ALL_CERTS.Get(o)
+ print(" ", ALL_CERTS.Get(o))
for i, n in enumerate(new):
if i == 0:
- print "now", ALL_CERTS.Get(n)
+ print("now", ALL_CERTS.Get(n))
else:
- print " ", ALL_CERTS.Get(n)
+ print(" ", ALL_CERTS.Get(n))
for i in sorted(packages):
old_fn = other.apks[i].filename
new_fn = self.apks[i].filename
if old_fn == new_fn:
- print " %-*s [%s]" % (max_pkg_len, i, old_fn)
+ print(" %-*s [%s]" % (max_pkg_len, i, old_fn))
else:
- print " %-*s [was: %s; now: %s]" % (max_pkg_len, i,
- old_fn, new_fn)
- print
+ print(" %-*s [was: %s; now: %s]" % (max_pkg_len, i,
+ old_fn, new_fn))
+ print()
def main(argv):
@@ -451,9 +462,9 @@
target_files.CompareWith(compare_files)
if PROBLEMS:
- print "%d problem(s) found:\n" % (len(PROBLEMS),)
+ print("%d problem(s) found:\n" % (len(PROBLEMS),))
for p in PROBLEMS:
- print p
+ print(p)
return 1
return 0
@@ -464,9 +475,7 @@
r = main(sys.argv[1:])
sys.exit(r)
except common.ExternalError as e:
- print
- print " ERROR: %s" % (e,)
- print
+ print("\n ERROR: %s\n" % (e,))
sys.exit(1)
finally:
common.Cleanup()
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index e642297..2401e46 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -14,6 +14,7 @@
from __future__ import print_function
+import base64
import collections
import copy
import errno
@@ -30,7 +31,6 @@
import re
import shlex
import shutil
-import string
import subprocess
import sys
import tempfile
@@ -39,8 +39,9 @@
import zipfile
from hashlib import sha1, sha256
-import blockimgdiff
+import images
import sparse_img
+from blockimgdiff import BlockImageDiff
logger = logging.getLogger(__name__)
@@ -54,7 +55,9 @@
base_search_path = os.path.join(base_out_path,
os.path.basename(os.getcwd()))
+ # Python >= 3.3 returns 'linux', whereas Python 2.7 gives 'linux2'.
platform_search_path = {
+ "linux": os.path.join(base_search_path, "host/linux-x86"),
"linux2": os.path.join(base_search_path, "host/linux-x86"),
"darwin": os.path.join(base_search_path, "host/darwin-x86"),
}
@@ -96,12 +99,14 @@
# The partitions allowed to be signed by AVB (Android Verified Boot 2.0). Note
# that system_other is not in the list because we don't want to include its
# descriptor into vbmeta.img.
-AVB_PARTITIONS = ('boot', 'dtbo', 'odm', 'product', 'product_services',
- 'recovery', 'system', 'vendor')
+AVB_PARTITIONS = ('boot', 'dtbo', 'odm', 'product', 'recovery', 'system',
+ 'system_ext', 'vendor')
+
+# Chained VBMeta partitions.
+AVB_VBMETA_PARTITIONS = ('vbmeta_system', 'vbmeta_vendor')
# Partitions that should have their care_map added to META/care_map.pb
-PARTITIONS_WITH_CARE_MAP = ('system', 'vendor', 'product', 'product_services',
- 'odm')
+PARTITIONS_WITH_CARE_MAP = ('system', 'vendor', 'product', 'system_ext', 'odm')
class ErrorCode(object):
@@ -187,6 +192,8 @@
kwargs: Any additional args to be passed to subprocess.Popen(), such as env,
stdin, etc. stdout and stderr will default to subprocess.PIPE and
subprocess.STDOUT respectively unless caller specifies any of them.
+ universal_newlines will default to True, as most of the users in
+ releasetools expect string output.
Returns:
A subprocess.Popen object.
@@ -194,6 +201,8 @@
if 'stdout' not in kwargs and 'stderr' not in kwargs:
kwargs['stdout'] = subprocess.PIPE
kwargs['stderr'] = subprocess.STDOUT
+ if 'universal_newlines' not in kwargs:
+ kwargs['universal_newlines'] = True
# Don't log any if caller explicitly says so.
if verbose != False:
logger.info(" Running: \"%s\"", " ".join(args))
@@ -242,6 +251,8 @@
"""
proc = Run(args, verbose=verbose, **kwargs)
output, _ = proc.communicate()
+ if output is None:
+ output = ""
# Don't log any if caller explicitly says so.
if verbose != False:
logger.info("%s", output.rstrip())
@@ -311,7 +322,7 @@
def read_helper(fn):
if isinstance(input_file, zipfile.ZipFile):
- return input_file.read(fn)
+ return input_file.read(fn).decode()
else:
path = os.path.join(input_file, *fn.split("/"))
try:
@@ -332,13 +343,15 @@
raise ValueError("Failed to find 'fstab_version'")
if repacking:
- # "selinux_fc" should point to the file_contexts file (file_contexts.bin)
- # under META/.
- fc_basename = os.path.basename(d.get("selinux_fc", "file_contexts"))
- fc_config = os.path.join(input_file, "META", fc_basename)
- assert os.path.exists(fc_config)
+ # "selinux_fc" properties should point to the file_contexts files
+ # (file_contexts.bin) under META/.
+ for key in d:
+ if key.endswith("selinux_fc"):
+ fc_basename = os.path.basename(d[key])
+ fc_config = os.path.join(input_file, "META", fc_basename)
+ assert os.path.exists(fc_config)
- d["selinux_fc"] = fc_config
+ d[key] = fc_config
# Similarly we need to redirect "root_dir", and "root_fs_config".
d["root_dir"] = os.path.join(input_file, "ROOT")
@@ -415,8 +428,14 @@
# Tries to load the build props for all partitions with care_map, including
# system and vendor.
for partition in PARTITIONS_WITH_CARE_MAP:
- d["{}.build.prop".format(partition)] = LoadBuildProp(
+ partition_prop = "{}.build.prop".format(partition)
+ d[partition_prop] = LoadBuildProp(
read_helper, "{}/build.prop".format(partition.upper()))
+ # Some partition might use /<partition>/etc/build.prop as the new path.
+ # TODO: try new path first when majority of them switch to the new path.
+ if not d[partition_prop]:
+ d[partition_prop] = LoadBuildProp(
+ read_helper, "{}/etc/build.prop".format(partition.upper()))
d["build.prop"] = d["system.build.prop"]
# Set up the salt (based on fingerprint or thumbprint) that will be used when
@@ -444,6 +463,16 @@
return LoadDictionaryFromLines(data.split("\n"))
+def LoadListFromFile(file_path):
+ with open(file_path) as f:
+ return f.read().splitlines()
+
+
+def LoadDictionaryFromFile(file_path):
+ lines = LoadListFromFile(file_path)
+ return LoadDictionaryFromLines(lines)
+
+
def LoadDictionaryFromLines(lines):
d = {}
for line in lines:
@@ -515,7 +544,7 @@
# system. Other areas assume system is always at "/system" so point /system
# at /.
if system_root_image:
- assert not d.has_key("/system") and d.has_key("/")
+ assert '/system' not in d and '/' in d
d["/system"] = d["/"]
return d
@@ -525,6 +554,64 @@
logger.info("%-25s = (%s) %s", k, type(v).__name__, v)
+def MergeDynamicPartitionInfoDicts(framework_dict,
+ vendor_dict,
+ include_dynamic_partition_list=True,
+ size_prefix="",
+ size_suffix="",
+ list_prefix="",
+ list_suffix=""):
+ """Merges dynamic partition info variables.
+
+ Args:
+ framework_dict: The dictionary of dynamic partition info variables from the
+ partial framework target files.
+ vendor_dict: The dictionary of dynamic partition info variables from the
+ partial vendor target files.
+ include_dynamic_partition_list: If true, merges the dynamic_partition_list
+ variable. Not all use cases need this variable merged.
+ size_prefix: The prefix in partition group size variables that precedes the
+ name of the partition group. For example, partition group 'group_a' with
+ corresponding size variable 'super_group_a_group_size' would have the
+ size_prefix 'super_'.
+ size_suffix: Similar to size_prefix but for the variable's suffix. For
+ example, 'super_group_a_group_size' would have size_suffix '_group_size'.
+ list_prefix: Similar to size_prefix but for the partition group's
+ partition_list variable.
+ list_suffix: Similar to size_suffix but for the partition group's
+ partition_list variable.
+
+ Returns:
+ The merged dynamic partition info dictionary.
+ """
+ merged_dict = {}
+ # Partition groups and group sizes are defined by the vendor dict because
+ # these values may vary for each board that uses a shared system image.
+ merged_dict["super_partition_groups"] = vendor_dict["super_partition_groups"]
+ if include_dynamic_partition_list:
+ framework_dynamic_partition_list = framework_dict.get(
+ "dynamic_partition_list", "")
+ vendor_dynamic_partition_list = vendor_dict.get("dynamic_partition_list",
+ "")
+ merged_dict["dynamic_partition_list"] = (
+ "%s %s" % (framework_dynamic_partition_list,
+ vendor_dynamic_partition_list)).strip()
+ for partition_group in merged_dict["super_partition_groups"].split(" "):
+ # Set the partition group's size using the value from the vendor dict.
+ key = "%s%s%s" % (size_prefix, partition_group, size_suffix)
+ if key not in vendor_dict:
+ raise ValueError("Vendor dict does not contain required key %s." % key)
+ merged_dict[key] = vendor_dict[key]
+
+ # Set the partition group's partition list using a concatenation of the
+ # framework and vendor partition lists.
+ key = "%s%s%s" % (list_prefix, partition_group, list_suffix)
+ merged_dict[key] = (
+ "%s %s" %
+ (framework_dict.get(key, ""), vendor_dict.get(key, ""))).strip()
+ return merged_dict
+
+
def AppendAVBSigningArgs(cmd, partition):
"""Append signing arguments for avbtool."""
# e.g., "--key path/to/signing_key --algorithm SHA256_RSA4096"
@@ -538,6 +625,33 @@
cmd.extend(["--salt", avb_salt])
+def GetAvbPartitionArg(partition, image, info_dict = None):
+ """Returns the VBMeta arguments for partition.
+
+ It sets up the VBMeta argument by including the partition descriptor from the
+ given 'image', or by configuring the partition as a chained partition.
+
+ Args:
+ partition: The name of the partition (e.g. "system").
+ image: The path to the partition image.
+ info_dict: A dict returned by common.LoadInfoDict(). Will use
+ OPTIONS.info_dict if None has been given.
+
+ Returns:
+ A list of VBMeta arguments.
+ """
+ if info_dict is None:
+ info_dict = OPTIONS.info_dict
+
+ # Check if chain partition is used.
+ key_path = info_dict.get("avb_" + partition + "_key_path")
+ if key_path:
+ chained_partition_arg = GetAvbChainedPartitionArg(partition, info_dict)
+ return ["--chain_partition", chained_partition_arg]
+ else:
+ return ["--include_descriptors_from_image", image]
+
+
def GetAvbChainedPartitionArg(partition, info_dict, key=None):
"""Constructs and returns the arg to build or verify a chained partition.
@@ -554,12 +668,71 @@
"""
if key is None:
key = info_dict["avb_" + partition + "_key_path"]
- pubkey_path = ExtractAvbPublicKey(key)
+ pubkey_path = ExtractAvbPublicKey(info_dict["avb_avbtool"], key)
rollback_index_location = info_dict[
"avb_" + partition + "_rollback_index_location"]
return "{}:{}:{}".format(partition, rollback_index_location, pubkey_path)
+def BuildVBMeta(image_path, partitions, name, needed_partitions):
+ """Creates a VBMeta image.
+
+ It generates the requested VBMeta image. The requested image could be for
+ top-level or chained VBMeta image, which is determined based on the name.
+
+ Args:
+ image_path: The output path for the new VBMeta image.
+ partitions: A dict that's keyed by partition names with image paths as
+ values. Only valid partition names are accepted, as listed in
+ common.AVB_PARTITIONS.
+ name: Name of the VBMeta partition, e.g. 'vbmeta', 'vbmeta_system'.
+ needed_partitions: Partitions whose descriptors should be included into the
+ generated VBMeta image.
+
+ Raises:
+ AssertionError: On invalid input args.
+ """
+ avbtool = OPTIONS.info_dict["avb_avbtool"]
+ cmd = [avbtool, "make_vbmeta_image", "--output", image_path]
+ AppendAVBSigningArgs(cmd, name)
+
+ for partition, path in partitions.items():
+ if partition not in needed_partitions:
+ continue
+ assert (partition in AVB_PARTITIONS or
+ partition in AVB_VBMETA_PARTITIONS), \
+ 'Unknown partition: {}'.format(partition)
+ assert os.path.exists(path), \
+ 'Failed to find {} for {}'.format(path, partition)
+ cmd.extend(GetAvbPartitionArg(partition, path))
+
+ args = OPTIONS.info_dict.get("avb_{}_args".format(name))
+ if args and args.strip():
+ split_args = shlex.split(args)
+ for index, arg in enumerate(split_args[:-1]):
+ # Sanity check that the image file exists. Some images might be defined
+ # as a path relative to source tree, which may not be available at the
+ # same location when running this script (we have the input target_files
+ # zip only). For such cases, we additionally scan other locations (e.g.
+ # IMAGES/, RADIO/, etc) before bailing out.
+ if arg == '--include_descriptors_from_image':
+ image_path = split_args[index + 1]
+ if os.path.exists(image_path):
+ continue
+ found = False
+ for dir_name in ['IMAGES', 'RADIO', 'PREBUILT_IMAGES']:
+ alt_path = os.path.join(
+ OPTIONS.input_tmp, dir_name, os.path.basename(image_path))
+ if os.path.exists(alt_path):
+ split_args[index + 1] = alt_path
+ found = True
+ break
+ assert found, 'Failed to find {}'.format(image_path)
+ cmd.extend(split_args)
+
+ RunAndCheckOutput(cmd)
+
+
def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,
has_ramdisk=False, two_step_image=False):
"""Build a bootable image from the specified sourcedir.
@@ -852,7 +1025,7 @@
A Image object. If it is a sparse image and reset_file_map is False, the
image will have file_map info loaded.
"""
- if info_dict == None:
+ if info_dict is None:
info_dict = LoadInfoDict(input_zip)
is_sparse = info_dict.get("extfs_sparse_flag")
@@ -892,8 +1065,8 @@
# ota_from_target_files.py (since LMP).
assert os.path.exists(path) and os.path.exists(mappath)
- return blockimgdiff.FileImage(path, hashtree_info_generator=
- hashtree_info_generator)
+ return images.FileImage(path, hashtree_info_generator=hashtree_info_generator)
+
def GetSparseImage(which, tmpdir, input_zip, allow_shared_blocks,
hashtree_info_generator=None):
@@ -942,7 +1115,7 @@
# filename listed in system.map may contain an additional leading slash
# (i.e. "//system/framework/am.jar"). Using lstrip to get consistent
# results.
- arcname = string.replace(entry, which, which.upper(), 1).lstrip('/')
+ arcname = entry.replace(which, which.upper(), 1).lstrip('/')
# Special handling another case, where files not under /system
# (e.g. "/sbin/charger") are packed under ROOT/ in a target_files.zip.
@@ -1212,7 +1385,7 @@
if basename:
installed_files.add(basename)
- for line in tf_zip.read("META/apkcerts.txt").split("\n"):
+ for line in tf_zip.read('META/apkcerts.txt').decode().split('\n'):
line = line.strip()
if not line:
continue
@@ -1422,6 +1595,8 @@
if not first:
print("key file %s still missing some passwords." % (self.pwfile,))
+ if sys.version_info[0] >= 3:
+ raw_input = input # pylint: disable=redefined-builtin
answer = raw_input("try to edit again? [y]> ").strip()
if answer and answer[0] not in 'yY':
raise RuntimeError("key passwords unavailable")
@@ -1435,7 +1610,7 @@
values.
"""
result = {}
- for k, v in sorted(current.iteritems()):
+ for k, v in sorted(current.items()):
if v:
result[k] = v
else:
@@ -1456,7 +1631,7 @@
f.write("# (Additional spaces are harmless.)\n\n")
first_line = None
- sorted_list = sorted([(not v, k, v) for (k, v) in current.iteritems()])
+ sorted_list = sorted([(not v, k, v) for (k, v) in current.items()])
for i, (_, k, v) in enumerate(sorted_list):
f.write("[[[ %s ]]] %s\n" % (v, k))
if not v and first_line is None:
@@ -1557,6 +1732,15 @@
perms = 0o100644
else:
zinfo = zinfo_or_arcname
+ # Python 2 and 3 behave differently when calling ZipFile.writestr() with
+ # zinfo.external_attr being 0. Python 3 uses `0o600 << 16` as the value for
+ # such a case (since
+ # https://github.com/python/cpython/commit/18ee29d0b870caddc0806916ca2c823254f1a1f9),
+ # which seems to make more sense. Otherwise the entry will have 0o000 as the
+ # permission bits. We follow the logic in Python 3 to get consistent
+ # behavior between using the two versions.
+ if not zinfo.external_attr:
+ zinfo.external_attr = 0o600 << 16
# If compress_type is given, it overrides the value in zinfo.
if compress_type is not None:
@@ -1589,7 +1773,7 @@
Raises:
AssertionError: In case of non-zero return from 'zip'.
"""
- if isinstance(entries, basestring):
+ if isinstance(entries, str):
entries = [entries]
cmd = ["zip", "-d", zip_filename] + entries
RunAndCheckOutput(cmd)
@@ -1613,7 +1797,7 @@
"""Keyword arguments to the constructor become attributes of this
object, which is passed to all functions in the device-specific
module."""
- for k, v in kwargs.iteritems():
+ for k, v in kwargs.items():
setattr(self, k, v)
self.extras = OPTIONS.extras
@@ -1882,9 +2066,9 @@
assert version >= 3
self.version = version
- b = blockimgdiff.BlockImageDiff(tgt, src, threads=OPTIONS.worker_threads,
- version=self.version,
- disable_imgdiff=self.disable_imgdiff)
+ b = BlockImageDiff(tgt, src, threads=OPTIONS.worker_threads,
+ version=self.version,
+ disable_imgdiff=self.disable_imgdiff)
self.path = os.path.join(MakeTempDir(), partition)
b.Compute(self.path)
self._required_cache = b.max_stashed_size
@@ -2138,8 +2322,10 @@
return ctx.hexdigest()
-DataImage = blockimgdiff.DataImage
-EmptyImage = blockimgdiff.EmptyImage
+# Expose these two classes to support vendor-specific scripts
+DataImage = images.DataImage
+EmptyImage = images.EmptyImage
+
# map recovery.fstab's fs_types to mount/format "partition types"
PARTITION_TYPES = {
@@ -2165,7 +2351,7 @@
This gives the same result as `openssl x509 -in <filename> -outform DER`.
Returns:
- The decoded certificate string.
+ The decoded certificate bytes.
"""
cert_buffer = []
save = False
@@ -2176,7 +2362,7 @@
cert_buffer.append(line)
if "--BEGIN CERTIFICATE--" in line:
save = True
- cert = "".join(cert_buffer).decode('base64')
+ cert = base64.b64decode("".join(cert_buffer))
return cert
@@ -2204,10 +2390,11 @@
return pubkey
-def ExtractAvbPublicKey(key):
+def ExtractAvbPublicKey(avbtool, key):
"""Extracts the AVB public key from the given public or private key.
Args:
+ avbtool: The AVB tool to use.
key: The input key file, which should be PEM-encoded public or private key.
Returns:
@@ -2215,7 +2402,7 @@
"""
output = MakeTempFile(prefix='avb-', suffix='.avbpubkey')
RunAndCheckOutput(
- ['avbtool', 'extract_public_key', "--key", key, "--output", output])
+ [avbtool, 'extract_public_key', "--key", key, "--output", output])
return output
@@ -2318,7 +2505,7 @@
logger.info("putting script in %s", sh_location)
- output_sink(sh_location, sh)
+ output_sink(sh_location, sh.encode())
class DynamicPartitionUpdate(object):
@@ -2359,14 +2546,16 @@
def __init__(self, info_dict, block_diffs, progress_dict=None,
source_info_dict=None):
if progress_dict is None:
- progress_dict = dict()
+ progress_dict = {}
self._remove_all_before_apply = False
if source_info_dict is None:
self._remove_all_before_apply = True
- source_info_dict = dict()
+ source_info_dict = {}
- block_diff_dict = {e.partition:e for e in block_diffs}
+ block_diff_dict = collections.OrderedDict(
+ [(e.partition, e) for e in block_diffs])
+
assert len(block_diff_dict) == len(block_diffs), \
"Duplicated BlockDifference object for {}".format(
[partition for partition, count in
diff --git a/tools/releasetools/images.py b/tools/releasetools/images.py
new file mode 100644
index 0000000..a24148a
--- /dev/null
+++ b/tools/releasetools/images.py
@@ -0,0 +1,223 @@
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific
+
+import os
+import threading
+from hashlib import sha1
+
+from rangelib import RangeSet
+
+__all__ = ["EmptyImage", "DataImage", "FileImage"]
+
+
+class Image(object):
+ def RangeSha1(self, ranges):
+ raise NotImplementedError
+
+ def ReadRangeSet(self, ranges):
+ raise NotImplementedError
+
+ def TotalSha1(self, include_clobbered_blocks=False):
+ raise NotImplementedError
+
+ def WriteRangeDataToFd(self, ranges, fd):
+ raise NotImplementedError
+
+
+class EmptyImage(Image):
+ """A zero-length image."""
+
+ def __init__(self):
+ self.blocksize = 4096
+ self.care_map = RangeSet()
+ self.clobbered_blocks = RangeSet()
+ self.extended = RangeSet()
+ self.total_blocks = 0
+ self.file_map = {}
+ self.hashtree_info = None
+
+ def RangeSha1(self, ranges):
+ return sha1().hexdigest()
+
+ def ReadRangeSet(self, ranges):
+ return ()
+
+ def TotalSha1(self, include_clobbered_blocks=False):
+ # EmptyImage always carries empty clobbered_blocks, so
+ # include_clobbered_blocks can be ignored.
+ assert self.clobbered_blocks.size() == 0
+ return sha1().hexdigest()
+
+ def WriteRangeDataToFd(self, ranges, fd):
+ raise ValueError("Can't write data from EmptyImage to file")
+
+
+class DataImage(Image):
+ """An image wrapped around a single string of data."""
+
+ def __init__(self, data, trim=False, pad=False):
+ self.data = data
+ self.blocksize = 4096
+
+ assert not (trim and pad)
+
+ partial = len(self.data) % self.blocksize
+ padded = False
+ if partial > 0:
+ if trim:
+ self.data = self.data[:-partial]
+ elif pad:
+ self.data += '\0' * (self.blocksize - partial)
+ padded = True
+ else:
+ raise ValueError(("data for DataImage must be multiple of %d bytes "
+ "unless trim or pad is specified") %
+ (self.blocksize,))
+
+ assert len(self.data) % self.blocksize == 0
+
+ self.total_blocks = len(self.data) // self.blocksize
+ self.care_map = RangeSet(data=(0, self.total_blocks))
+ # When the last block is padded, we always write the whole block even for
+ # incremental OTAs. Because otherwise the last block may get skipped if
+ # unchanged for an incremental, but would fail the post-install
+ # verification if it has non-zero contents in the padding bytes.
+ # Bug: 23828506
+ if padded:
+ clobbered_blocks = [self.total_blocks-1, self.total_blocks]
+ else:
+ clobbered_blocks = []
+ self.clobbered_blocks = clobbered_blocks
+ self.extended = RangeSet()
+
+ zero_blocks = []
+ nonzero_blocks = []
+ reference = '\0' * self.blocksize
+
+ for i in range(self.total_blocks-1 if padded else self.total_blocks):
+ d = self.data[i*self.blocksize : (i+1)*self.blocksize]
+ if d == reference:
+ zero_blocks.append(i)
+ zero_blocks.append(i+1)
+ else:
+ nonzero_blocks.append(i)
+ nonzero_blocks.append(i+1)
+
+ assert zero_blocks or nonzero_blocks or clobbered_blocks
+
+ self.file_map = dict()
+ if zero_blocks:
+ self.file_map["__ZERO"] = RangeSet(data=zero_blocks)
+ if nonzero_blocks:
+ self.file_map["__NONZERO"] = RangeSet(data=nonzero_blocks)
+ if clobbered_blocks:
+ self.file_map["__COPY"] = RangeSet(data=clobbered_blocks)
+
+ def _GetRangeData(self, ranges):
+ for s, e in ranges:
+ yield self.data[s*self.blocksize:e*self.blocksize]
+
+ def RangeSha1(self, ranges):
+ h = sha1()
+ for data in self._GetRangeData(ranges): # pylint: disable=not-an-iterable
+ h.update(data)
+ return h.hexdigest()
+
+ def ReadRangeSet(self, ranges):
+ return list(self._GetRangeData(ranges))
+
+ def TotalSha1(self, include_clobbered_blocks=False):
+ if not include_clobbered_blocks:
+ return self.RangeSha1(self.care_map.subtract(self.clobbered_blocks))
+ return sha1(self.data).hexdigest()
+
+ def WriteRangeDataToFd(self, ranges, fd):
+ for data in self._GetRangeData(ranges): # pylint: disable=not-an-iterable
+ fd.write(data)
+
+
+class FileImage(Image):
+ """An image wrapped around a raw image file."""
+
+ def __init__(self, path, hashtree_info_generator=None):
+ self.path = path
+ self.blocksize = 4096
+ self._file_size = os.path.getsize(self.path)
+ self._file = open(self.path, 'rb')
+
+ if self._file_size % self.blocksize != 0:
+ raise ValueError("Size of file %s must be multiple of %d bytes, but is %d"
+ % self.path, self.blocksize, self._file_size)
+
+ self.total_blocks = self._file_size // self.blocksize
+ self.care_map = RangeSet(data=(0, self.total_blocks))
+ self.clobbered_blocks = RangeSet()
+ self.extended = RangeSet()
+
+ self.generator_lock = threading.Lock()
+
+ self.hashtree_info = None
+ if hashtree_info_generator:
+ self.hashtree_info = hashtree_info_generator.Generate(self)
+
+ zero_blocks = []
+ nonzero_blocks = []
+ reference = '\0' * self.blocksize
+
+ for i in range(self.total_blocks):
+ d = self._file.read(self.blocksize)
+ if d == reference:
+ zero_blocks.append(i)
+ zero_blocks.append(i+1)
+ else:
+ nonzero_blocks.append(i)
+ nonzero_blocks.append(i+1)
+
+ assert zero_blocks or nonzero_blocks
+
+ self.file_map = {}
+ if zero_blocks:
+ self.file_map["__ZERO"] = RangeSet(data=zero_blocks)
+ if nonzero_blocks:
+ self.file_map["__NONZERO"] = RangeSet(data=nonzero_blocks)
+ if self.hashtree_info:
+ self.file_map["__HASHTREE"] = self.hashtree_info.hashtree_range
+
+ def __del__(self):
+ self._file.close()
+
+ def _GetRangeData(self, ranges):
+ # Use a lock to protect the generator so that we will not run two
+ # instances of this generator on the same object simultaneously.
+ with self.generator_lock:
+ for s, e in ranges:
+ self._file.seek(s * self.blocksize)
+ for _ in range(s, e):
+ yield self._file.read(self.blocksize)
+
+ def RangeSha1(self, ranges):
+ h = sha1()
+ for data in self._GetRangeData(ranges): # pylint: disable=not-an-iterable
+ h.update(data)
+ return h.hexdigest()
+
+ def ReadRangeSet(self, ranges):
+ return list(self._GetRangeData(ranges))
+
+ def TotalSha1(self, include_clobbered_blocks=False):
+ assert not self.clobbered_blocks
+ return self.RangeSha1(self.care_map)
+
+ def WriteRangeDataToFd(self, ranges, fd):
+ for data in self._GetRangeData(ranges): # pylint: disable=not-an-iterable
+ fd.write(data)
diff --git a/tools/releasetools/img_from_target_files.py b/tools/releasetools/img_from_target_files.py
index 8fb9871..4b94ad8 100755
--- a/tools/releasetools/img_from_target_files.py
+++ b/tools/releasetools/img_from_target_files.py
@@ -15,17 +15,12 @@
# limitations under the License.
"""
-Given target-files, produces an image zipfile suitable for use
-with 'fastboot update'.
+Given an input target-files, produces an image zipfile suitable for use with
+'fastboot update'.
Usage: img_from_target_files [flags] input_target_files output_image_zip
-input_target_files: one of the following:
- - directory containing extracted target files. It will load info from
- OTA/android-info.txt, META/misc_info.txt and build the image zipfile using
- images from IMAGES/.
- - target files package. Same as above, but extracts the archive before
- building the image zipfile.
+input_target_files: Path to the input target_files zip.
Flags:
-z (--bootable_zip)
@@ -38,7 +33,6 @@
import logging
import os
-import shutil
import sys
import zipfile
@@ -55,12 +49,10 @@
def LoadOptions(input_file):
- """
- Load information from input_file to OPTIONS.
+ """Loads information from input_file to OPTIONS.
Args:
- input_file: A Zipfile instance of input zip file, or path to the directory
- of extracted zip.
+ input_file: Path to the root dir of an extracted target_files zip.
"""
info = OPTIONS.info_dict = common.LoadInfoDict(input_file)
@@ -75,15 +67,14 @@
def CopyInfo(input_tmp, output_zip):
- """Copy the android-info.txt file from the input to the output."""
+ """Copies the android-info.txt file from the input to the output."""
common.ZipWrite(
output_zip, os.path.join(input_tmp, "OTA", "android-info.txt"),
"android-info.txt")
def CopyUserImages(input_tmp, output_zip):
- """
- Copy user images from the unzipped input and write to output_zip.
+ """Copies user images from the unzipped input and write to output_zip.
Args:
input_tmp: path to the unzipped input.
@@ -103,8 +94,6 @@
continue
if not image.endswith(".img"):
continue
- if image == "recovery-two-step.img":
- continue
if OPTIONS.put_super:
if image == "super_empty.img":
continue
@@ -115,9 +104,9 @@
def WriteSuperImages(input_tmp, output_zip):
- """
- Write super images from the unzipped input and write to output_zip. This is
- only done if super_image_in_update_package is set to "true".
+ """Writes super images from the unzipped input into output_zip.
+
+ This is only done if super_image_in_update_package is set to "true".
- For retrofit dynamic partition devices, copy split super images from target
files package.
@@ -150,6 +139,40 @@
common.ZipWrite(output_zip, super_file, "super.img")
+def ImgFromTargetFiles(input_file, output_file):
+ """Creates an image archive from the input target_files zip.
+
+ Args:
+ input_file: Path to the input target_files zip.
+ output_file: Output filename.
+
+ Raises:
+ ValueError: On invalid input.
+ """
+ if not zipfile.is_zipfile(input_file):
+ raise ValueError("%s is not a valid zipfile" % input_file)
+
+ logger.info("Building image zip from target files zip.")
+
+ # We need files under IMAGES/, OTA/, META/ for img_from_target_files.py.
+ # However, common.LoadInfoDict() may read additional files under BOOT/,
+ # RECOVERY/ and ROOT/. So unzip everything from the target_files.zip.
+ input_tmp = common.UnzipTemp(input_file)
+
+ LoadOptions(input_tmp)
+ output_zip = zipfile.ZipFile(
+ output_file, "w", compression=zipfile.ZIP_DEFLATED,
+ allowZip64=not OPTIONS.sparse_userimages)
+
+ try:
+ CopyInfo(input_tmp, output_zip)
+ CopyUserImages(input_tmp, output_zip)
+ WriteSuperImages(input_tmp, output_zip)
+ finally:
+ logger.info("cleaning up...")
+ common.ZipClose(output_zip)
+
+
def main(argv):
# This allows modifying the value from inner function.
bootable_only_array = [False]
@@ -174,30 +197,7 @@
common.InitLogging()
- target_files = args[0]
- if os.path.isdir(target_files):
- logger.info("Building image zip from extracted target files.")
- OPTIONS.input_tmp = target_files
- elif zipfile.is_zipfile(target_files):
- logger.info("Building image zip from target files zip.")
- # We need files under IMAGES/, OTA/, META/ for img_from_target_files.py.
- # However, common.LoadInfoDict() may read additional files under BOOT/,
- # RECOVERY/ and ROOT/. So unzip everything from the target_files.zip.
- OPTIONS.input_tmp = common.UnzipTemp(target_files)
- else:
- raise ValueError("%s is not a valid path." % target_files)
-
- LoadOptions(OPTIONS.input_tmp)
- output_zip = zipfile.ZipFile(args[1], "w", compression=zipfile.ZIP_DEFLATED,
- allowZip64=not OPTIONS.sparse_userimages)
-
- try:
- CopyInfo(OPTIONS.input_tmp, output_zip)
- CopyUserImages(OPTIONS.input_tmp, output_zip)
- WriteSuperImages(OPTIONS.input_tmp, output_zip)
- finally:
- logger.info("cleaning up...")
- common.ZipClose(output_zip)
+ ImgFromTargetFiles(args[0], args[1])
logger.info("done.")
diff --git a/tools/releasetools/make_recovery_patch b/tools/releasetools/make_recovery_patch
deleted file mode 120000
index 45cec08..0000000
--- a/tools/releasetools/make_recovery_patch
+++ /dev/null
@@ -1 +0,0 @@
-make_recovery_patch.py
\ No newline at end of file
diff --git a/tools/releasetools/make_recovery_patch.py b/tools/releasetools/make_recovery_patch.py
old mode 100755
new mode 100644
diff --git a/tools/releasetools/merge_builds.py b/tools/releasetools/merge_builds.py
new file mode 100644
index 0000000..ca348cf
--- /dev/null
+++ b/tools/releasetools/merge_builds.py
@@ -0,0 +1,197 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License"); you may not
+# use this file except in compliance with the License. You may obtain a copy of
+# the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
+# License for the specific language governing permissions and limitations under
+# the License.
+#
+"""Merges two non-dist partial builds together.
+
+Given two partial builds, a framework build and a vendor build, merge the builds
+together so that the images can be flashed using 'fastboot flashall'.
+
+To support both DAP and non-DAP vendor builds with a single framework partial
+build, the framework partial build should always be built with DAP enabled. The
+vendor partial build determines whether the merged result supports DAP.
+
+This script does not require builds to be built with 'make dist'.
+This script regenerates super_empty.img and vbmeta.img if necessary. Other
+images are assumed to not require regeneration.
+
+Usage: merge_builds.py [args]
+
+ --framework_images comma_separated_image_list
+ Comma-separated list of image names that should come from the framework
+ build.
+
+ --product_out_framework product_out_framework_path
+ Path to out/target/product/<framework build>.
+
+ --product_out_vendor product_out_vendor_path
+ Path to out/target/product/<vendor build>.
+
+ --build_vbmeta
+ If provided, vbmeta.img will be regenerated in out/target/product/<vendor
+ build>.
+
+ --framework_misc_info_keys
+ The optional path to a newline-separated config file containing keys to
+ obtain from the framework instance of misc_info.txt, used for creating
+ vbmeta.img. The remaining keys come from the vendor instance.
+"""
+from __future__ import print_function
+
+import logging
+import os
+import sys
+
+import build_super_image
+import common
+
+logger = logging.getLogger(__name__)
+
+OPTIONS = common.OPTIONS
+OPTIONS.framework_images = ("system",)
+OPTIONS.product_out_framework = None
+OPTIONS.product_out_vendor = None
+OPTIONS.build_vbmeta = False
+OPTIONS.framework_misc_info_keys = None
+
+
+def CreateImageSymlinks():
+ for image in OPTIONS.framework_images:
+ image_path = os.path.join(OPTIONS.product_out_framework, "%s.img" % image)
+ symlink_path = os.path.join(OPTIONS.product_out_vendor, "%s.img" % image)
+ if os.path.exists(symlink_path):
+ if os.path.islink(symlink_path):
+ os.remove(symlink_path)
+ else:
+ raise ValueError("Attempting to overwrite built image: %s" %
+ symlink_path)
+ os.symlink(image_path, symlink_path)
+
+
+def BuildSuperEmpty():
+ framework_dict = common.LoadDictionaryFromFile(
+ os.path.join(OPTIONS.product_out_framework, "misc_info.txt"))
+ vendor_dict = common.LoadDictionaryFromFile(
+ os.path.join(OPTIONS.product_out_vendor, "misc_info.txt"))
+ # Regenerate super_empty.img if both partial builds enable DAP. If only the
+ # the vendor build enables DAP, the vendor build's existing super_empty.img
+ # will be reused. If only the framework build should enable DAP, super_empty
+ # should be included in the --framework_images flag to copy the existing
+ # super_empty.img from the framework build.
+ if (framework_dict.get("use_dynamic_partitions") == "true") and (
+ vendor_dict.get("use_dynamic_partitions") == "true"):
+ logger.info("Building super_empty.img.")
+ merged_dict = dict(vendor_dict)
+ merged_dict.update(
+ common.MergeDynamicPartitionInfoDicts(
+ framework_dict=framework_dict,
+ vendor_dict=vendor_dict,
+ size_prefix="super_",
+ size_suffix="_group_size",
+ list_prefix="super_",
+ list_suffix="_partition_list"))
+ output_super_empty_path = os.path.join(OPTIONS.product_out_vendor,
+ "super_empty.img")
+ build_super_image.BuildSuperImage(merged_dict, output_super_empty_path)
+
+
+def BuildVBMeta():
+ logger.info("Building vbmeta.img.")
+
+ framework_dict = common.LoadDictionaryFromFile(
+ os.path.join(OPTIONS.product_out_framework, "misc_info.txt"))
+ vendor_dict = common.LoadDictionaryFromFile(
+ os.path.join(OPTIONS.product_out_vendor, "misc_info.txt"))
+ merged_dict = dict(vendor_dict)
+ if OPTIONS.framework_misc_info_keys:
+ for key in common.LoadListFromFile(OPTIONS.framework_misc_info_keys):
+ merged_dict[key] = framework_dict[key]
+
+ # Build vbmeta.img using partitions in product_out_vendor.
+ partitions = {}
+ for partition in common.AVB_PARTITIONS:
+ partition_path = os.path.join(OPTIONS.product_out_vendor,
+ "%s.img" % partition)
+ if os.path.exists(partition_path):
+ partitions[partition] = partition_path
+
+ # vbmeta_partitions includes the partitions that should be included into
+ # top-level vbmeta.img, which are the ones that are not included in any
+ # chained VBMeta image plus the chained VBMeta images themselves.
+ vbmeta_partitions = common.AVB_PARTITIONS[:]
+ for partition in common.AVB_VBMETA_PARTITIONS:
+ chained_partitions = merged_dict.get("avb_%s" % partition, "").strip()
+ if chained_partitions:
+ partitions[partition] = os.path.join(OPTIONS.product_out_vendor,
+ "%s.img" % partition)
+ vbmeta_partitions = [
+ item for item in vbmeta_partitions
+ if item not in chained_partitions.split()
+ ]
+ vbmeta_partitions.append(partition)
+
+ output_vbmeta_path = os.path.join(OPTIONS.product_out_vendor, "vbmeta.img")
+ OPTIONS.info_dict = merged_dict
+ common.BuildVBMeta(output_vbmeta_path, partitions, "vbmeta",
+ vbmeta_partitions)
+
+
+def MergeBuilds():
+ CreateImageSymlinks()
+ BuildSuperEmpty()
+ if OPTIONS.build_vbmeta:
+ BuildVBMeta()
+
+
+def main():
+ common.InitLogging()
+
+ def option_handler(o, a):
+ if o == "--framework_images":
+ OPTIONS.framework_images = [i.strip() for i in a.split(",")]
+ elif o == "--product_out_framework":
+ OPTIONS.product_out_framework = a
+ elif o == "--product_out_vendor":
+ OPTIONS.product_out_vendor = a
+ elif o == "--build_vbmeta":
+ OPTIONS.build_vbmeta = True
+ elif o == "--framework_misc_info_keys":
+ OPTIONS.framework_misc_info_keys = a
+ else:
+ return False
+ return True
+
+ args = common.ParseOptions(
+ sys.argv[1:],
+ __doc__,
+ extra_long_opts=[
+ "framework_images=",
+ "product_out_framework=",
+ "product_out_vendor=",
+ "build_vbmeta",
+ "framework_misc_info_keys=",
+ ],
+ extra_option_handler=option_handler)
+
+ if (args or OPTIONS.product_out_framework is None or
+ OPTIONS.product_out_vendor is None):
+ common.Usage(__doc__)
+ sys.exit(1)
+
+ MergeBuilds()
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/releasetools/merge_target_files.py b/tools/releasetools/merge_target_files.py
index f03cc1e..cfffbc7 100755
--- a/tools/releasetools/merge_target_files.py
+++ b/tools/releasetools/merge_target_files.py
@@ -13,33 +13,34 @@
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
# License for the specific language governing permissions and limitations under
# the License.
+#
"""This script merges two partial target files packages.
-One package contains system files, and the other contains non-system files.
+One package contains framework files, and the other contains vendor files.
It produces a complete target files package that can be used to generate an
OTA package.
Usage: merge_target_files.py [args]
- --system-target-files system-target-files-zip-archive
- The input target files package containing system bits. This is a zip
+ --framework-target-files framework-target-files-zip-archive
+ The input target files package containing framework bits. This is a zip
archive.
- --system-item-list system-item-list-file
+ --framework-item-list framework-item-list-file
The optional path to a newline-separated config file that replaces the
- contents of default_system_item_list if provided.
+ contents of DEFAULT_FRAMEWORK_ITEM_LIST if provided.
- --system-misc-info-keys system-misc-info-keys-file
+ --framework-misc-info-keys framework-misc-info-keys-file
The optional path to a newline-separated config file that replaces the
- contents of default_system_misc_info_keys if provided.
+ contents of DEFAULT_FRAMEWORK_MISC_INFO_KEYS if provided.
- --other-target-files other-target-files-zip-archive
- The input target files package containing other bits. This is a zip
+ --vendor-target-files vendor-target-files-zip-archive
+ The input target files package containing vendor bits. This is a zip
archive.
- --other-item-list other-item-list-file
+ --vendor-item-list vendor-item-list-file
The optional path to a newline-separated config file that replaces the
- contents of default_other_item_list if provided.
+ contents of DEFAULT_VENDOR_ITEM_LIST if provided.
--output-target-files output-target-files-package
If provided, the output merged target files package. Also a zip archive.
@@ -91,13 +92,13 @@
import ota_from_target_files
logger = logging.getLogger(__name__)
+
OPTIONS = common.OPTIONS
-OPTIONS.verbose = True
-OPTIONS.system_target_files = None
-OPTIONS.system_item_list = None
-OPTIONS.system_misc_info_keys = None
-OPTIONS.other_target_files = None
-OPTIONS.other_item_list = None
+OPTIONS.framework_target_files = None
+OPTIONS.framework_item_list = None
+OPTIONS.framework_misc_info_keys = None
+OPTIONS.vendor_target_files = None
+OPTIONS.vendor_item_list = None
OPTIONS.output_target_files = None
OPTIONS.output_dir = None
OPTIONS.output_item_list = None
@@ -107,12 +108,12 @@
OPTIONS.rebuild_recovery = False
OPTIONS.keep_tmp = False
-# default_system_item_list is a list of items to extract from the partial
-# system target files package as is, meaning these items will land in the
+# DEFAULT_FRAMEWORK_ITEM_LIST is a list of items to extract from the partial
+# framework target files package as is, meaning these items will land in the
# output target files package exactly as they appear in the input partial
-# system target files package.
+# framework target files package.
-default_system_item_list = [
+DEFAULT_FRAMEWORK_ITEM_LIST = (
'META/apkcerts.txt',
'META/filesystem_config.txt',
'META/root_filesystem_config.txt',
@@ -122,21 +123,20 @@
'PRODUCT/*',
'ROOT/*',
'SYSTEM/*',
-]
+)
-# system_extract_special_item_list is a list of items to extract from the
-# partial system target files package that need some special processing, such
-# as some sort of combination with items from the partial other target files
+# FRAMEWORK_EXTRACT_SPECIAL_ITEM_LIST is a list of items to extract from the
+# partial framework target files package that need some special processing, such
+# as some sort of combination with items from the partial vendor target files
# package.
-system_extract_special_item_list = [
- 'META/*',
-]
+FRAMEWORK_EXTRACT_SPECIAL_ITEM_LIST = ('META/*',)
-# default_system_misc_info_keys is a list of keys to obtain from the system
-# instance of META/misc_info.txt. The remaining keys from the other instance.
+# DEFAULT_FRAMEWORK_MISC_INFO_KEYS is a list of keys to obtain from the
+# framework instance of META/misc_info.txt. The remaining keys from the
+# vendor instance.
-default_system_misc_info_keys = [
+DEFAULT_FRAMEWORK_MISC_INFO_KEYS = (
'avb_system_hashtree_enable',
'avb_system_add_hashtree_footer_args',
'avb_system_key_path',
@@ -144,23 +144,22 @@
'avb_system_rollback_index_location',
'avb_product_hashtree_enable',
'avb_product_add_hashtree_footer_args',
- 'avb_product_services_hashtree_enable',
- 'avb_product_services_add_hashtree_footer_args',
+ 'avb_system_ext_hashtree_enable',
+ 'avb_system_ext_add_hashtree_footer_args',
'system_root_image',
'root_dir',
'ab_update',
'default_system_dev_certificate',
'system_size',
-]
+)
-# default_other_item_list is a list of items to extract from the partial
-# other target files package as is, meaning these items will land in the output
-# target files package exactly as they appear in the input partial other target
+# DEFAULT_VENDOR_ITEM_LIST is a list of items to extract from the partial
+# vendor target files package as is, meaning these items will land in the output
+# target files package exactly as they appear in the input partial vendor target
# files package.
-default_other_item_list = [
+DEFAULT_VENDOR_ITEM_LIST = (
'META/boot_filesystem_config.txt',
- 'META/file_contexts.bin',
'META/otakeys.txt',
'META/releasetools.py',
'META/vendor_filesystem_config.txt',
@@ -173,20 +172,55 @@
'PREBUILT_IMAGES/*',
'RADIO/*',
'VENDOR/*',
-]
+)
-# other_extract_special_item_list is a list of items to extract from the
-# partial other target files package that need some special processing, such as
-# some sort of combination with items from the partial system target files
+# VENDOR_EXTRACT_SPECIAL_ITEM_LIST is a list of items to extract from the
+# partial vendor target files package that need some special processing, such as
+# some sort of combination with items from the partial framework target files
# package.
-other_extract_special_item_list = [
- 'META/*',
-]
+VENDOR_EXTRACT_SPECIAL_ITEM_LIST = ('META/*',)
+
+# The merge config lists should not attempt to extract items from both
+# builds for any of the following partitions. The partitions in
+# SINGLE_BUILD_PARTITIONS should come entirely from a single build (either
+# framework or vendor, but not both).
+
+SINGLE_BUILD_PARTITIONS = (
+ 'BOOT/',
+ 'DATA/',
+ 'ODM/',
+ 'PRODUCT/',
+ 'SYSTEM_EXT/',
+ 'RADIO/',
+ 'RECOVERY/',
+ 'ROOT/',
+ 'SYSTEM/',
+ 'SYSTEM_OTHER/',
+ 'VENDOR/',
+)
+
+
+def write_sorted_data(data, path):
+ """Writes the sorted contents of either a list or dict to file.
+
+ This function sorts the contents of the list or dict and then writes the
+ resulting sorted contents to a file specified by path.
+
+ Args:
+ data: The list or dict to sort and write.
+ path: Path to the file to write the sorted values to. The file at path will
+ be overridden if it exists.
+ """
+ with open(path, 'w') as output:
+ for entry in sorted(data):
+ out_str = '{}={}\n'.format(entry, data[entry]) if isinstance(
+ data, dict) else '{}\n'.format(entry)
+ output.write(out_str)
def extract_items(target_files, target_files_temp_dir, extract_item_list):
- """Extract items from target files to temporary directory.
+ """Extracts items from target files to temporary directory.
This function extracts from the specified target files zip archive into the
specified temporary directory, the items specified in the extract item list.
@@ -203,8 +237,7 @@
# Filter the extract_item_list to remove any items that do not exist in the
# zip file. Otherwise, the extraction step will fail.
- with zipfile.ZipFile(
- target_files, 'r', allowZip64=True) as target_files_zipfile:
+ with zipfile.ZipFile(target_files, allowZip64=True) as target_files_zipfile:
target_files_namelist = target_files_zipfile.namelist()
filtered_extract_item_list = []
@@ -246,41 +279,29 @@
shutil.copyfile(original_file_path, copied_file_path)
-def read_config_list(config_file_path):
- """Reads a config file into a list of strings.
-
- Expects the file to be newline-separated.
-
- Args:
- config_file_path: The path to the config file to open and read.
-
- Returns:
- The list of strings in the config file.
- """
- with open(config_file_path) as config_file:
- return config_file.read().splitlines()
-
-
-def validate_config_lists(system_item_list, system_misc_info_keys,
- other_item_list):
+def validate_config_lists(framework_item_list, framework_misc_info_keys,
+ vendor_item_list):
"""Performs validations on the merge config lists.
Args:
- system_item_list: The list of items to extract from the partial system
+ framework_item_list: The list of items to extract from the partial framework
target files package as is.
- system_misc_info_keys: A list of keys to obtain from the system instance of
- META/misc_info.txt. The remaining keys from the other instance.
- other_item_list: The list of items to extract from the partial other target
- files package as is.
+ framework_misc_info_keys: A list of keys to obtain from the framework
+ instance of META/misc_info.txt. The remaining keys from the vendor
+ instance.
+ vendor_item_list: The list of items to extract from the partial vendor
+ target files package as is.
Returns:
False if a validation fails, otherwise true.
"""
- default_combined_item_set = set(default_system_item_list)
- default_combined_item_set.update(default_other_item_list)
+ has_error = False
- combined_item_set = set(system_item_list)
- combined_item_set.update(other_item_list)
+ default_combined_item_set = set(DEFAULT_FRAMEWORK_ITEM_LIST)
+ default_combined_item_set.update(DEFAULT_VENDOR_ITEM_LIST)
+
+ combined_item_set = set(framework_item_list)
+ combined_item_set.update(vendor_item_list)
# Check that the merge config lists are not missing any item specified
# by the default config lists.
@@ -288,69 +309,77 @@
if difference:
logger.error('Missing merge config items: %s', list(difference))
logger.error('Please ensure missing items are in either the '
- 'system-item-list or other-item-list files provided to '
+ 'framework-item-list or vendor-item-list files provided to '
'this script.')
- return False
+ has_error = True
- if ('dynamic_partition_list' in system_misc_info_keys) or (
- 'super_partition_groups' in system_misc_info_keys):
+ for partition in SINGLE_BUILD_PARTITIONS:
+ in_framework = any(
+ item.startswith(partition) for item in framework_item_list)
+ in_vendor = any(item.startswith(partition) for item in vendor_item_list)
+ if in_framework and in_vendor:
+ logger.error(
+ 'Cannot extract items from %s for both the framework and vendor'
+ ' builds. Please ensure only one merge config item list'
+ ' includes %s.', partition, partition)
+ has_error = True
+
+ if ('dynamic_partition_list' in framework_misc_info_keys) or (
+ 'super_partition_groups' in framework_misc_info_keys):
logger.error('Dynamic partition misc info keys should come from '
- 'the other instance of META/misc_info.txt.')
- return False
+ 'the vendor instance of META/misc_info.txt.')
+ has_error = True
- return True
+ return not has_error
-def process_ab_partitions_txt(system_target_files_temp_dir,
- other_target_files_temp_dir,
+def process_ab_partitions_txt(framework_target_files_temp_dir,
+ vendor_target_files_temp_dir,
output_target_files_temp_dir):
- """Perform special processing for META/ab_partitions.txt.
+ """Performs special processing for META/ab_partitions.txt.
- This function merges the contents of the META/ab_partitions.txt files from
- the system directory and the other directory, placing the merged result in
- the output directory. The precondition in that the files are already
- extracted. The post condition is that the output META/ab_partitions.txt
- contains the merged content. The format for each ab_partitions.txt a one
- partition name per line. The output file contains the union of the parition
- names.
+ This function merges the contents of the META/ab_partitions.txt files from the
+ framework directory and the vendor directory, placing the merged result in the
+ output directory. The precondition in that the files are already extracted.
+ The post condition is that the output META/ab_partitions.txt contains the
+ merged content. The format for each ab_partitions.txt a one partition name per
+ line. The output file contains the union of the parition names.
Args:
- system_target_files_temp_dir: The name of a directory containing the special
- items extracted from the system target files package.
- other_target_files_temp_dir: The name of a directory containing the special
- items extracted from the other target files package.
+ framework_target_files_temp_dir: The name of a directory containing the
+ special items extracted from the framework target files package.
+ vendor_target_files_temp_dir: The name of a directory containing the special
+ items extracted from the vendor target files package.
output_target_files_temp_dir: The name of a directory that will be used to
create the output target files package after all the special cases are
processed.
"""
- system_ab_partitions_txt = os.path.join(system_target_files_temp_dir, 'META',
+ framework_ab_partitions_txt = os.path.join(framework_target_files_temp_dir,
+ 'META', 'ab_partitions.txt')
+
+ vendor_ab_partitions_txt = os.path.join(vendor_target_files_temp_dir, 'META',
'ab_partitions.txt')
- other_ab_partitions_txt = os.path.join(other_target_files_temp_dir, 'META',
- 'ab_partitions.txt')
+ with open(framework_ab_partitions_txt) as f:
+ framework_ab_partitions = f.read().splitlines()
- with open(system_ab_partitions_txt) as f:
- system_ab_partitions = f.read().splitlines()
+ with open(vendor_ab_partitions_txt) as f:
+ vendor_ab_partitions = f.read().splitlines()
- with open(other_ab_partitions_txt) as f:
- other_ab_partitions = f.read().splitlines()
-
- output_ab_partitions = set(system_ab_partitions + other_ab_partitions)
+ output_ab_partitions = set(framework_ab_partitions + vendor_ab_partitions)
output_ab_partitions_txt = os.path.join(output_target_files_temp_dir, 'META',
'ab_partitions.txt')
- with open(output_ab_partitions_txt, 'w') as output:
- for partition in sorted(output_ab_partitions):
- output.write('%s\n' % partition)
+ write_sorted_data(data=output_ab_partitions, path=output_ab_partitions_txt)
def append_recovery_to_filesystem_config(output_target_files_temp_dir):
- """Perform special processing for META/filesystem_config.txt.
+ """Performs special processing for META/filesystem_config.txt.
- This function appends recovery information to META/filesystem_config.txt
- so that recovery patch regeneration will succeed.
+ This function appends recovery information to META/filesystem_config.txt so
+ that recovery patch regeneration will succeed.
Args:
output_target_files_temp_dir: The name of a directory that will be used to
@@ -372,165 +401,115 @@
'selabel=u:object_r:install_recovery_exec:s0 capabilities=0x0\n')
-def merge_dynamic_partition_info_dicts(system_dict,
- other_dict,
- include_dynamic_partition_list=True,
- size_prefix='',
- size_suffix='',
- list_prefix='',
- list_suffix=''):
- """Merges dynamic partition info variables.
-
- Args:
- system_dict: The dictionary of dynamic partition info variables from the
- partial system target files.
- other_dict: The dictionary of dynamic partition info variables from the
- partial other target files.
- include_dynamic_partition_list: If true, merges the dynamic_partition_list
- variable. Not all use cases need this variable merged.
- size_prefix: The prefix in partition group size variables that precedes the
- name of the partition group. For example, partition group 'group_a' with
- corresponding size variable 'super_group_a_group_size' would have the
- size_prefix 'super_'.
- size_suffix: Similar to size_prefix but for the variable's suffix. For
- example, 'super_group_a_group_size' would have size_suffix '_group_size'.
- list_prefix: Similar to size_prefix but for the partition group's
- partition_list variable.
- list_suffix: Similar to size_suffix but for the partition group's
- partition_list variable.
-
- Returns:
- The merged dynamic partition info dictionary.
- """
- merged_dict = {}
- # Partition groups and group sizes are defined by the other (non-system)
- # dict because these values may vary for each board that uses a shared system
- # image.
- merged_dict['super_partition_groups'] = other_dict['super_partition_groups']
- if include_dynamic_partition_list:
- system_dynamic_partition_list = system_dict.get('dynamic_partition_list',
- '')
- other_dynamic_partition_list = other_dict.get('dynamic_partition_list', '')
- merged_dict['dynamic_partition_list'] = (
- '%s %s' %
- (system_dynamic_partition_list, other_dynamic_partition_list)).strip()
- for partition_group in merged_dict['super_partition_groups'].split(' '):
- # Set the partition group's size using the value from the other dict.
- key = '%s%s%s' % (size_prefix, partition_group, size_suffix)
- if key not in other_dict:
- raise ValueError('Other dict does not contain required key %s.' % key)
- merged_dict[key] = other_dict[key]
-
- # Set the partition group's partition list using a concatenation of the
- # system and other partition lists.
- key = '%s%s%s' % (list_prefix, partition_group, list_suffix)
- merged_dict[key] = (
- '%s %s' % (system_dict.get(key, ''), other_dict.get(key, ''))).strip()
- return merged_dict
-
-
-def process_misc_info_txt(system_target_files_temp_dir,
- other_target_files_temp_dir,
- output_target_files_temp_dir, system_misc_info_keys):
- """Perform special processing for META/misc_info.txt.
+def process_misc_info_txt(framework_target_files_temp_dir,
+ vendor_target_files_temp_dir,
+ output_target_files_temp_dir,
+ framework_misc_info_keys):
+ """Performs special processing for META/misc_info.txt.
This function merges the contents of the META/misc_info.txt files from the
- system directory and the other directory, placing the merged result in the
+ framework directory and the vendor directory, placing the merged result in the
output directory. The precondition in that the files are already extracted.
The post condition is that the output META/misc_info.txt contains the merged
content.
Args:
- system_target_files_temp_dir: The name of a directory containing the special
- items extracted from the system target files package.
- other_target_files_temp_dir: The name of a directory containing the special
- items extracted from the other target files package.
+ framework_target_files_temp_dir: The name of a directory containing the
+ special items extracted from the framework target files package.
+ vendor_target_files_temp_dir: The name of a directory containing the special
+ items extracted from the vendor target files package.
output_target_files_temp_dir: The name of a directory that will be used to
create the output target files package after all the special cases are
processed.
- system_misc_info_keys: A list of keys to obtain from the system instance of
- META/misc_info.txt. The remaining keys from the other instance.
+ framework_misc_info_keys: A list of keys to obtain from the framework
+ instance of META/misc_info.txt. The remaining keys from the vendor
+ instance.
"""
- def read_helper(d):
- misc_info_txt = os.path.join(d, 'META', 'misc_info.txt')
- with open(misc_info_txt) as f:
- return list(f.read().splitlines())
+ misc_info_path = ['META', 'misc_info.txt']
+ framework_dict = common.LoadDictionaryFromFile(
+ os.path.join(framework_target_files_temp_dir, *misc_info_path))
- system_info_dict = common.LoadDictionaryFromLines(
- read_helper(system_target_files_temp_dir))
+ # We take most of the misc info from the vendor target files.
- # We take most of the misc info from the other target files.
+ merged_dict = common.LoadDictionaryFromFile(
+ os.path.join(vendor_target_files_temp_dir, *misc_info_path))
- merged_info_dict = common.LoadDictionaryFromLines(
- read_helper(other_target_files_temp_dir))
+ # Replace certain values in merged_dict with values from
+ # framework_dict.
- # Replace certain values in merged_info_dict with values from
- # system_info_dict.
-
- for key in system_misc_info_keys:
- merged_info_dict[key] = system_info_dict[key]
+ for key in framework_misc_info_keys:
+ merged_dict[key] = framework_dict[key]
# Merge misc info keys used for Dynamic Partitions.
- if (merged_info_dict.get('use_dynamic_partitions') == 'true') and (
- system_info_dict.get('use_dynamic_partitions') == 'true'):
- merged_dynamic_partitions_dict = merge_dynamic_partition_info_dicts(
- system_dict=system_info_dict,
- other_dict=merged_info_dict,
+ if (merged_dict.get('use_dynamic_partitions') == 'true') and (
+ framework_dict.get('use_dynamic_partitions') == 'true'):
+ merged_dynamic_partitions_dict = common.MergeDynamicPartitionInfoDicts(
+ framework_dict=framework_dict,
+ vendor_dict=merged_dict,
size_prefix='super_',
size_suffix='_group_size',
list_prefix='super_',
list_suffix='_partition_list')
- merged_info_dict.update(merged_dynamic_partitions_dict)
+ merged_dict.update(merged_dynamic_partitions_dict)
+ # Ensure that add_img_to_target_files rebuilds super split images for
+ # devices that retrofit dynamic partitions. This flag may have been set to
+ # false in the partial builds to prevent duplicate building of super.img.
+ merged_dict['build_super_partition'] = 'true'
+
+ # Replace <image>_selinux_fc values with framework or vendor file_contexts.bin
+ # depending on which dictionary the key came from.
+ # Only the file basename is required because all selinux_fc properties are
+ # replaced with the full path to the file under META/ when misc_info.txt is
+ # loaded from target files for repacking. See common.py LoadInfoDict().
+ for key in merged_dict:
+ if key.endswith('_selinux_fc'):
+ merged_dict[key] = 'vendor_file_contexts.bin'
+ for key in framework_dict:
+ if key.endswith('_selinux_fc'):
+ merged_dict[key] = 'framework_file_contexts.bin'
output_misc_info_txt = os.path.join(output_target_files_temp_dir, 'META',
'misc_info.txt')
- with open(output_misc_info_txt, 'w') as output:
- sorted_keys = sorted(merged_info_dict.keys())
- for key in sorted_keys:
- output.write('{}={}\n'.format(key, merged_info_dict[key]))
+ write_sorted_data(data=merged_dict, path=output_misc_info_txt)
-def process_dynamic_partitions_info_txt(system_target_files_dir,
- other_target_files_dir,
+def process_dynamic_partitions_info_txt(framework_target_files_dir,
+ vendor_target_files_dir,
output_target_files_dir):
- """Perform special processing for META/dynamic_partitions_info.txt.
+ """Performs special processing for META/dynamic_partitions_info.txt.
This function merges the contents of the META/dynamic_partitions_info.txt
- files from the system directory and the other directory, placing the merged
- result in the output directory.
+ files from the framework directory and the vendor directory, placing the
+ merged result in the output directory.
- This function does nothing if META/dynamic_partitions_info.txt from the other
+ This function does nothing if META/dynamic_partitions_info.txt from the vendor
directory does not exist.
Args:
- system_target_files_dir: The name of a directory containing the special
- items extracted from the system target files package.
- other_target_files_dir: The name of a directory containing the special items
- extracted from the other target files package.
+ framework_target_files_dir: The name of a directory containing the special
+ items extracted from the framework target files package.
+ vendor_target_files_dir: The name of a directory containing the special
+ items extracted from the vendor target files package.
output_target_files_dir: The name of a directory that will be used to create
the output target files package after all the special cases are processed.
"""
if not os.path.exists(
- os.path.join(other_target_files_dir, 'META',
+ os.path.join(vendor_target_files_dir, 'META',
'dynamic_partitions_info.txt')):
return
- def read_helper(d):
- dynamic_partitions_info_txt = os.path.join(d, 'META',
- 'dynamic_partitions_info.txt')
- with open(dynamic_partitions_info_txt) as f:
- return list(f.read().splitlines())
+ dynamic_partitions_info_path = ['META', 'dynamic_partitions_info.txt']
- system_dynamic_partitions_dict = common.LoadDictionaryFromLines(
- read_helper(system_target_files_dir))
- other_dynamic_partitions_dict = common.LoadDictionaryFromLines(
- read_helper(other_target_files_dir))
+ framework_dynamic_partitions_dict = common.LoadDictionaryFromFile(
+ os.path.join(framework_target_files_dir, *dynamic_partitions_info_path))
+ vendor_dynamic_partitions_dict = common.LoadDictionaryFromFile(
+ os.path.join(vendor_target_files_dir, *dynamic_partitions_info_path))
- merged_dynamic_partitions_dict = merge_dynamic_partition_info_dicts(
- system_dict=system_dynamic_partitions_dict,
- other_dict=other_dynamic_partitions_dict,
+ merged_dynamic_partitions_dict = common.MergeDynamicPartitionInfoDicts(
+ framework_dict=framework_dynamic_partitions_dict,
+ vendor_dict=vendor_dynamic_partitions_dict,
# META/dynamic_partitions_info.txt does not use dynamic_partition_list.
include_dynamic_partition_list=False,
size_suffix='_size',
@@ -538,143 +517,239 @@
output_dynamic_partitions_info_txt = os.path.join(
output_target_files_dir, 'META', 'dynamic_partitions_info.txt')
- with open(output_dynamic_partitions_info_txt, 'w') as output:
- sorted_keys = sorted(merged_dynamic_partitions_dict.keys())
- for key in sorted_keys:
- output.write('{}={}\n'.format(key, merged_dynamic_partitions_dict[key]))
+ write_sorted_data(
+ data=merged_dynamic_partitions_dict,
+ path=output_dynamic_partitions_info_txt)
-def process_special_cases(system_target_files_temp_dir,
- other_target_files_temp_dir,
- output_target_files_temp_dir, system_misc_info_keys,
- rebuild_recovery):
- """Perform special-case processing for certain target files items.
+def process_apex_keys_apk_certs_common(framework_target_files_dir,
+ vendor_target_files_dir,
+ output_target_files_dir, file_name):
+ """Performs special processing for META/apexkeys.txt or META/apkcerts.txt.
+
+ This function merges the contents of the META/apexkeys.txt or
+ META/apkcerts.txt files from the framework directory and the vendor directory,
+ placing the merged result in the output directory. The precondition in that
+ the files are already extracted. The post condition is that the output
+ META/apexkeys.txt or META/apkcerts.txt contains the merged content.
+
+ Args:
+ framework_target_files_dir: The name of a directory containing the special
+ items extracted from the framework target files package.
+ vendor_target_files_dir: The name of a directory containing the special
+ items extracted from the vendor target files package.
+ output_target_files_dir: The name of a directory that will be used to create
+ the output target files package after all the special cases are processed.
+ file_name: The name of the file to merge. One of apkcerts.txt or
+ apexkeys.txt.
+ """
+
+ def read_helper(d):
+ temp = {}
+ file_path = os.path.join(d, 'META', file_name)
+ with open(file_path) as f:
+ for line in f:
+ if line.strip():
+ temp[line.split()[0]] = line.strip()
+ return temp
+
+ framework_dict = read_helper(framework_target_files_dir)
+ vendor_dict = read_helper(vendor_target_files_dir)
+
+ for key in framework_dict:
+ if key in vendor_dict and vendor_dict[key] != framework_dict[key]:
+ raise ValueError('Conflicting entries found in %s:\n %s and\n %s' %
+ (file_name, framework_dict[key], vendor_dict[key]))
+ vendor_dict[key] = framework_dict[key]
+
+ output_file = os.path.join(output_target_files_dir, 'META', file_name)
+
+ write_sorted_data(data=vendor_dict.values(), path=output_file)
+
+
+def copy_file_contexts(framework_target_files_dir, vendor_target_files_dir,
+ output_target_files_dir):
+ """Creates named copies of each build's file_contexts.bin in output META/."""
+ framework_fc_path = os.path.join(framework_target_files_dir, 'META',
+ 'framework_file_contexts.bin')
+ if not os.path.exists(framework_fc_path):
+ framework_fc_path = os.path.join(framework_target_files_dir, 'META',
+ 'file_contexts.bin')
+ if not os.path.exists(framework_fc_path):
+ raise ValueError('Missing framework file_contexts.bin.')
+ shutil.copyfile(
+ framework_fc_path,
+ os.path.join(output_target_files_dir, 'META',
+ 'framework_file_contexts.bin'))
+
+ vendor_fc_path = os.path.join(vendor_target_files_dir, 'META',
+ 'vendor_file_contexts.bin')
+ if not os.path.exists(vendor_fc_path):
+ vendor_fc_path = os.path.join(vendor_target_files_dir, 'META',
+ 'file_contexts.bin')
+ if not os.path.exists(vendor_fc_path):
+ raise ValueError('Missing vendor file_contexts.bin.')
+ shutil.copyfile(
+ vendor_fc_path,
+ os.path.join(output_target_files_dir, 'META', 'vendor_file_contexts.bin'))
+
+
+def process_special_cases(framework_target_files_temp_dir,
+ vendor_target_files_temp_dir,
+ output_target_files_temp_dir,
+ framework_misc_info_keys, rebuild_recovery):
+ """Performs special-case processing for certain target files items.
Certain files in the output target files package require special-case
processing. This function performs all that special-case processing.
Args:
- system_target_files_temp_dir: The name of a directory containing the special
- items extracted from the system target files package.
- other_target_files_temp_dir: The name of a directory containing the special
- items extracted from the other target files package.
+ framework_target_files_temp_dir: The name of a directory containing the
+ special items extracted from the framework target files package.
+ vendor_target_files_temp_dir: The name of a directory containing the special
+ items extracted from the vendor target files package.
output_target_files_temp_dir: The name of a directory that will be used to
create the output target files package after all the special cases are
processed.
- system_misc_info_keys: A list of keys to obtain from the system instance of
- META/misc_info.txt. The remaining keys from the other instance.
+ framework_misc_info_keys: A list of keys to obtain from the framework
+ instance of META/misc_info.txt. The remaining keys from the vendor
+ instance.
rebuild_recovery: If true, rebuild the recovery patch used by non-A/B
devices and write it to the system image.
"""
- if 'ab_update' in system_misc_info_keys:
+ if 'ab_update' in framework_misc_info_keys:
process_ab_partitions_txt(
- system_target_files_temp_dir=system_target_files_temp_dir,
- other_target_files_temp_dir=other_target_files_temp_dir,
+ framework_target_files_temp_dir=framework_target_files_temp_dir,
+ vendor_target_files_temp_dir=vendor_target_files_temp_dir,
output_target_files_temp_dir=output_target_files_temp_dir)
if rebuild_recovery:
append_recovery_to_filesystem_config(
output_target_files_temp_dir=output_target_files_temp_dir)
- process_misc_info_txt(
- system_target_files_temp_dir=system_target_files_temp_dir,
- other_target_files_temp_dir=other_target_files_temp_dir,
- output_target_files_temp_dir=output_target_files_temp_dir,
- system_misc_info_keys=system_misc_info_keys)
-
- process_dynamic_partitions_info_txt(
- system_target_files_dir=system_target_files_temp_dir,
- other_target_files_dir=other_target_files_temp_dir,
+ copy_file_contexts(
+ framework_target_files_dir=framework_target_files_temp_dir,
+ vendor_target_files_dir=vendor_target_files_temp_dir,
output_target_files_dir=output_target_files_temp_dir)
+ process_misc_info_txt(
+ framework_target_files_temp_dir=framework_target_files_temp_dir,
+ vendor_target_files_temp_dir=vendor_target_files_temp_dir,
+ output_target_files_temp_dir=output_target_files_temp_dir,
+ framework_misc_info_keys=framework_misc_info_keys)
-def merge_target_files(temp_dir, system_target_files, system_item_list,
- system_misc_info_keys, other_target_files,
- other_item_list, output_target_files, output_dir,
- output_item_list, output_ota, output_img,
- output_super_empty, rebuild_recovery):
- """Merge two target files packages together.
+ process_dynamic_partitions_info_txt(
+ framework_target_files_dir=framework_target_files_temp_dir,
+ vendor_target_files_dir=vendor_target_files_temp_dir,
+ output_target_files_dir=output_target_files_temp_dir)
- This function takes system and other target files packages as input, performs
- various file extractions, special case processing, and finally creates a
- merged zip archive as output.
+ process_apex_keys_apk_certs_common(
+ framework_target_files_dir=framework_target_files_temp_dir,
+ vendor_target_files_dir=vendor_target_files_temp_dir,
+ output_target_files_dir=output_target_files_temp_dir,
+ file_name='apkcerts.txt')
+
+ process_apex_keys_apk_certs_common(
+ framework_target_files_dir=framework_target_files_temp_dir,
+ vendor_target_files_dir=vendor_target_files_temp_dir,
+ output_target_files_dir=output_target_files_temp_dir,
+ file_name='apexkeys.txt')
+
+
+def files_from_path(target_path, extra_args=None):
+ """Gets files under given path.
+
+ Get (sub)files from given target path and return sorted list.
+
+ Args:
+ target_path: Target path to get subfiles.
+ extra_args: List of extra argument for find command. Optional.
+
+ Returns:
+ Sorted files and directories list.
+ """
+
+ find_command = ['find', target_path] + (extra_args or [])
+ find_process = common.Run(find_command, stdout=subprocess.PIPE, verbose=False)
+ return common.RunAndCheckOutput(['sort'],
+ stdin=find_process.stdout,
+ verbose=False)
+
+
+def create_merged_package(temp_dir, framework_target_files, framework_item_list,
+ vendor_target_files, vendor_item_list,
+ framework_misc_info_keys, rebuild_recovery):
+ """Merges two target files packages into one target files structure.
Args:
temp_dir: The name of a directory we use when we extract items from the
input target files packages, and also a scratch directory that we use for
temporary files.
- system_target_files: The name of the zip archive containing the system
+ framework_target_files: The name of the zip archive containing the framework
partial target files package.
- system_item_list: The list of items to extract from the partial system
+ framework_item_list: The list of items to extract from the partial framework
target files package as is, meaning these items will land in the output
- target files package exactly as they appear in the input partial system
+ target files package exactly as they appear in the input partial framework
target files package.
- system_misc_info_keys: The list of keys to obtain from the system instance
- of META/misc_info.txt. The remaining keys from the other instance.
- other_target_files: The name of the zip archive containing the other partial
+ vendor_target_files: The name of the zip archive containing the vendor
+ partial target files package.
+ vendor_item_list: The list of items to extract from the partial vendor
+ target files package as is, meaning these items will land in the output
+ target files package exactly as they appear in the input partial vendor
target files package.
- other_item_list: The list of items to extract from the partial other target
- files package as is, meaning these items will land in the output target
- files package exactly as they appear in the input partial other target
- files package.
- output_target_files: The name of the output zip archive target files package
- created by merging system and other.
- output_dir: The destination directory for saving merged files.
- output_item_list: The list of items to copy into the output_dir.
- output_ota: The name of the output zip archive ota package.
- output_img: The name of the output zip archive img package.
- output_super_empty: If provided, creates a super_empty.img file from the
- merged target files package and saves it at this path.
+ framework_misc_info_keys: The list of keys to obtain from the framework
+ instance of META/misc_info.txt. The remaining keys from the vendor
+ instance.
rebuild_recovery: If true, rebuild the recovery patch used by non-A/B
devices and write it to the system image.
+
+ Returns:
+ Path to merged package under temp directory.
"""
- logger.info('starting: merge system %s and other %s into output %s',
- system_target_files, other_target_files, output_target_files)
+ # Create directory names that we'll use when we extract files from framework,
+ # and vendor, and for zipping the final output.
- # Create directory names that we'll use when we extract files from system,
- # and other, and for zipping the final output.
-
- system_target_files_temp_dir = os.path.join(temp_dir, 'system')
- other_target_files_temp_dir = os.path.join(temp_dir, 'other')
+ framework_target_files_temp_dir = os.path.join(temp_dir, 'framework')
+ vendor_target_files_temp_dir = os.path.join(temp_dir, 'vendor')
output_target_files_temp_dir = os.path.join(temp_dir, 'output')
- # Extract "as is" items from the input system partial target files package.
+ # Extract "as is" items from the input framework partial target files package.
# We extract them directly into the output temporary directory since the
# items do not need special case processing.
extract_items(
- target_files=system_target_files,
+ target_files=framework_target_files,
target_files_temp_dir=output_target_files_temp_dir,
- extract_item_list=system_item_list)
+ extract_item_list=framework_item_list)
- # Extract "as is" items from the input other partial target files package. We
+ # Extract "as is" items from the input vendor partial target files package. We
# extract them directly into the output temporary directory since the items
# do not need special case processing.
extract_items(
- target_files=other_target_files,
+ target_files=vendor_target_files,
target_files_temp_dir=output_target_files_temp_dir,
- extract_item_list=other_item_list)
+ extract_item_list=vendor_item_list)
- # Extract "special" items from the input system partial target files package.
+ # Extract "special" items from the input framework partial target files
+ # package. We extract these items to different directory since they require
+ # special processing before they will end up in the output directory.
+
+ extract_items(
+ target_files=framework_target_files,
+ target_files_temp_dir=framework_target_files_temp_dir,
+ extract_item_list=FRAMEWORK_EXTRACT_SPECIAL_ITEM_LIST)
+
+ # Extract "special" items from the input vendor partial target files package.
# We extract these items to different directory since they require special
# processing before they will end up in the output directory.
extract_items(
- target_files=system_target_files,
- target_files_temp_dir=system_target_files_temp_dir,
- extract_item_list=system_extract_special_item_list)
-
- # Extract "special" items from the input other partial target files package.
- # We extract these items to different directory since they require special
- # processing before they will end up in the output directory.
-
- extract_items(
- target_files=other_target_files,
- target_files_temp_dir=other_target_files_temp_dir,
- extract_item_list=other_extract_special_item_list)
+ target_files=vendor_target_files,
+ target_files_temp_dir=vendor_target_files_temp_dir,
+ extract_item_list=VENDOR_EXTRACT_SPECIAL_ITEM_LIST)
# Now that the temporary directories contain all the extracted files, perform
# special case processing on any items that need it. After this function
@@ -682,39 +757,58 @@
# files package are in place.
process_special_cases(
- system_target_files_temp_dir=system_target_files_temp_dir,
- other_target_files_temp_dir=other_target_files_temp_dir,
+ framework_target_files_temp_dir=framework_target_files_temp_dir,
+ vendor_target_files_temp_dir=vendor_target_files_temp_dir,
output_target_files_temp_dir=output_target_files_temp_dir,
- system_misc_info_keys=system_misc_info_keys,
+ framework_misc_info_keys=framework_misc_info_keys,
rebuild_recovery=rebuild_recovery)
- # Regenerate IMAGES in the temporary directory.
+ return output_target_files_temp_dir
+
+
+def generate_images(target_files_dir, rebuild_recovery):
+ """Generate images from target files.
+
+ This function takes merged output temporary directory and create images
+ from it.
+
+ Args:
+ target_files_dir: Path to merged temp directory.
+ rebuild_recovery: If true, rebuild the recovery patch used by non-A/B
+ devices and write it to the system image.
+ """
+
+ # Regenerate IMAGES in the target directory.
add_img_args = ['--verbose']
if rebuild_recovery:
add_img_args.append('--rebuild_recovery')
- add_img_args.append(output_target_files_temp_dir)
+ add_img_args.append(target_files_dir)
add_img_to_target_files.main(add_img_args)
+
+def generate_super_empty_image(target_dir, output_super_empty):
+ """Generates super_empty image from target package.
+
+ Args:
+ target_dir: Path to the target file package which contains misc_info.txt for
+ detailed information for super image.
+ output_super_empty: If provided, copies a super_empty.img file from the
+ target files package to this path.
+ """
# Create super_empty.img using the merged misc_info.txt.
- misc_info_txt = os.path.join(output_target_files_temp_dir, 'META',
- 'misc_info.txt')
+ misc_info_txt = os.path.join(target_dir, 'META', 'misc_info.txt')
- def read_helper():
- with open(misc_info_txt) as f:
- return list(f.read().splitlines())
-
- use_dynamic_partitions = common.LoadDictionaryFromLines(
- read_helper()).get('use_dynamic_partitions')
+ use_dynamic_partitions = common.LoadDictionaryFromFile(misc_info_txt).get(
+ 'use_dynamic_partitions')
if use_dynamic_partitions != 'true' and output_super_empty:
raise ValueError(
'Building super_empty.img requires use_dynamic_partitions=true.')
elif use_dynamic_partitions == 'true':
- super_empty_img = os.path.join(output_target_files_temp_dir, 'IMAGES',
- 'super_empty.img')
+ super_empty_img = os.path.join(target_dir, 'IMAGES', 'super_empty.img')
build_super_image_args = [
misc_info_txt,
super_empty_img,
@@ -725,15 +819,104 @@
if output_super_empty:
shutil.copyfile(super_empty_img, output_super_empty)
- # Create the IMG package from the merged target files (before zipping, in
- # order to avoid an unnecessary unzip and copy).
+
+def create_target_files_archive(output_file, source_dir, temp_dir):
+ """Creates archive from target package.
+
+ Args:
+ output_file: The name of the zip archive target files package.
+ source_dir: The target directory contains package to be archived.
+ temp_dir: Path to temporary directory for any intermediate files.
+ """
+ output_target_files_list = os.path.join(temp_dir, 'output.list')
+ output_zip = os.path.abspath(output_file)
+ output_target_files_meta_dir = os.path.join(source_dir, 'META')
+
+ meta_content = files_from_path(output_target_files_meta_dir)
+ other_content = files_from_path(
+ source_dir,
+ ['-path', output_target_files_meta_dir, '-prune', '-o', '-print'])
+
+ with open(output_target_files_list, 'w') as f:
+ f.write(meta_content)
+ f.write(other_content)
+
+ command = [
+ 'soong_zip',
+ '-d',
+ '-o',
+ output_zip,
+ '-C',
+ source_dir,
+ '-l',
+ output_target_files_list,
+ ]
+
+ logger.info('creating %s', output_file)
+ common.RunAndWait(command, verbose=True)
+ logger.info('finished creating %s', output_file)
+
+ return output_zip
+
+
+def merge_target_files(temp_dir, framework_target_files, framework_item_list,
+ framework_misc_info_keys, vendor_target_files,
+ vendor_item_list, output_target_files, output_dir,
+ output_item_list, output_ota, output_img,
+ output_super_empty, rebuild_recovery):
+ """Merges two target files packages together.
+
+ This function takes framework and vendor target files packages as input,
+ performs various file extractions, special case processing, and finally
+ creates a merged zip archive as output.
+
+ Args:
+ temp_dir: The name of a directory we use when we extract items from the
+ input target files packages, and also a scratch directory that we use for
+ temporary files.
+ framework_target_files: The name of the zip archive containing the framework
+ partial target files package.
+ framework_item_list: The list of items to extract from the partial framework
+ target files package as is, meaning these items will land in the output
+ target files package exactly as they appear in the input partial framework
+ target files package.
+ framework_misc_info_keys: The list of keys to obtain from the framework
+ instance of META/misc_info.txt. The remaining keys from the vendor
+ instance.
+ vendor_target_files: The name of the zip archive containing the vendor
+ partial target files package.
+ vendor_item_list: The list of items to extract from the partial vendor
+ target files package as is, meaning these items will land in the output
+ target files package exactly as they appear in the input partial vendor
+ target files package.
+ output_target_files: The name of the output zip archive target files package
+ created by merging framework and vendor.
+ output_dir: The destination directory for saving merged files.
+ output_item_list: The list of items to copy into the output_dir.
+ output_ota: The name of the output zip archive ota package.
+ output_img: The name of the output zip archive img package.
+ output_super_empty: If provided, creates a super_empty.img file from the
+ merged target files package and saves it at this path.
+ rebuild_recovery: If true, rebuild the recovery patch used by non-A/B
+ devices and write it to the system image.
+ """
+
+ logger.info('starting: merge framework %s and vendor %s into output %s',
+ framework_target_files, vendor_target_files, output_target_files)
+
+ output_target_files_temp_dir = create_merged_package(
+ temp_dir, framework_target_files, framework_item_list,
+ vendor_target_files, vendor_item_list, framework_misc_info_keys,
+ rebuild_recovery)
+
+ generate_images(output_target_files_temp_dir, rebuild_recovery)
+
+ generate_super_empty_image(output_target_files_temp_dir, output_super_empty)
if output_img:
- img_from_target_files_args = [
- output_target_files_temp_dir,
- output_img,
- ]
- img_from_target_files.main(img_from_target_files_args)
+ # Create the IMG package from the merged target files (before zipping, in
+ # order to avoid an unnecessary unzip and copy).
+ img_from_target_files.main([output_target_files_temp_dir, output_img])
# Finally, create the output target files zip archive and/or copy the
# output items to the output target files directory.
@@ -744,58 +927,18 @@
if not output_target_files:
return
- output_zip = os.path.abspath(output_target_files)
- output_target_files_list = os.path.join(temp_dir, 'output.list')
- output_target_files_meta_dir = os.path.join(output_target_files_temp_dir,
- 'META')
-
- find_command = [
- 'find',
- output_target_files_meta_dir,
- ]
- find_process = common.Run(find_command, stdout=subprocess.PIPE, verbose=False)
- meta_content = common.RunAndCheckOutput(['sort'],
- stdin=find_process.stdout,
- verbose=False)
-
- find_command = [
- 'find', output_target_files_temp_dir, '-path',
- output_target_files_meta_dir, '-prune', '-o', '-print'
- ]
- find_process = common.Run(find_command, stdout=subprocess.PIPE, verbose=False)
- other_content = common.RunAndCheckOutput(['sort'],
- stdin=find_process.stdout,
- verbose=False)
-
- with open(output_target_files_list, 'wb') as f:
- f.write(meta_content)
- f.write(other_content)
-
- command = [
- 'soong_zip',
- '-d',
- '-o',
- output_zip,
- '-C',
- output_target_files_temp_dir,
- '-l',
- output_target_files_list,
- ]
- logger.info('creating %s', output_target_files)
- common.RunAndWait(command, verbose=True)
+ output_zip = create_target_files_archive(output_target_files,
+ output_target_files_temp_dir,
+ temp_dir)
# Create the OTA package from the merged target files package.
if output_ota:
- ota_from_target_files_args = [
- output_zip,
- output_ota,
- ]
- ota_from_target_files.main(ota_from_target_files_args)
+ ota_from_target_files.main([output_zip, output_ota])
def call_func_with_temp_dir(func, keep_tmp):
- """Manage the creation and cleanup of the temporary directory.
+ """Manages the creation and cleanup of the temporary directory.
This function calls the given function after first creating a temporary
directory. It also cleans up the temporary directory.
@@ -814,8 +957,6 @@
try:
func(temp_dir)
- except:
- raise
finally:
if keep_tmp:
logger.info('keeping %s', temp_dir)
@@ -834,15 +975,34 @@
def option_handler(o, a):
if o == '--system-target-files':
- OPTIONS.system_target_files = a
+ logger.warning(
+ '--system-target-files has been renamed to --framework-target-files')
+ OPTIONS.framework_target_files = a
+ elif o == '--framework-target-files':
+ OPTIONS.framework_target_files = a
elif o == '--system-item-list':
- OPTIONS.system_item_list = a
+ logger.warning(
+ '--system-item-list has been renamed to --framework-item-list')
+ OPTIONS.framework_item_list = a
+ elif o == '--framework-item-list':
+ OPTIONS.framework_item_list = a
elif o == '--system-misc-info-keys':
- OPTIONS.system_misc_info_keys = a
+ logger.warning('--system-misc-info-keys has been renamed to '
+ '--framework-misc-info-keys')
+ OPTIONS.framework_misc_info_keys = a
+ elif o == '--framework-misc-info-keys':
+ OPTIONS.framework_misc_info_keys = a
elif o == '--other-target-files':
- OPTIONS.other_target_files = a
+ logger.warning(
+ '--other-target-files has been renamed to --vendor-target-files')
+ OPTIONS.vendor_target_files = a
+ elif o == '--vendor-target-files':
+ OPTIONS.vendor_target_files = a
elif o == '--other-item-list':
- OPTIONS.other_item_list = a
+ logger.warning('--other-item-list has been renamed to --vendor-item-list')
+ OPTIONS.vendor_item_list = a
+ elif o == '--vendor-item-list':
+ OPTIONS.vendor_item_list = a
elif o == '--output-target-files':
OPTIONS.output_target_files = a
elif o == '--output-dir':
@@ -868,10 +1028,15 @@
__doc__,
extra_long_opts=[
'system-target-files=',
+ 'framework-target-files=',
'system-item-list=',
+ 'framework-item-list=',
'system-misc-info-keys=',
+ 'framework-misc-info-keys=',
'other-target-files=',
+ 'vendor-target-files=',
'other-item-list=',
+ 'vendor-item-list=',
'output-target-files=',
'output-dir=',
'output-item-list=',
@@ -883,47 +1048,52 @@
],
extra_option_handler=option_handler)
- if (args or OPTIONS.system_target_files is None or
- OPTIONS.other_target_files is None or
+ # pylint: disable=too-many-boolean-expressions
+ if (args or OPTIONS.framework_target_files is None or
+ OPTIONS.vendor_target_files is None or
(OPTIONS.output_target_files is None and OPTIONS.output_dir is None) or
(OPTIONS.output_dir is not None and OPTIONS.output_item_list is None)):
common.Usage(__doc__)
sys.exit(1)
- if OPTIONS.system_item_list:
- system_item_list = read_config_list(OPTIONS.system_item_list)
- else:
- system_item_list = default_system_item_list
+ # Always turn on verbose logging.
+ OPTIONS.verbose = True
- if OPTIONS.system_misc_info_keys:
- system_misc_info_keys = read_config_list(OPTIONS.system_misc_info_keys)
+ if OPTIONS.framework_item_list:
+ framework_item_list = common.LoadListFromFile(OPTIONS.framework_item_list)
else:
- system_misc_info_keys = default_system_misc_info_keys
+ framework_item_list = DEFAULT_FRAMEWORK_ITEM_LIST
- if OPTIONS.other_item_list:
- other_item_list = read_config_list(OPTIONS.other_item_list)
+ if OPTIONS.framework_misc_info_keys:
+ framework_misc_info_keys = common.LoadListFromFile(
+ OPTIONS.framework_misc_info_keys)
else:
- other_item_list = default_other_item_list
+ framework_misc_info_keys = DEFAULT_FRAMEWORK_MISC_INFO_KEYS
+
+ if OPTIONS.vendor_item_list:
+ vendor_item_list = common.LoadListFromFile(OPTIONS.vendor_item_list)
+ else:
+ vendor_item_list = DEFAULT_VENDOR_ITEM_LIST
if OPTIONS.output_item_list:
- output_item_list = read_config_list(OPTIONS.output_item_list)
+ output_item_list = common.LoadListFromFile(OPTIONS.output_item_list)
else:
output_item_list = None
if not validate_config_lists(
- system_item_list=system_item_list,
- system_misc_info_keys=system_misc_info_keys,
- other_item_list=other_item_list):
+ framework_item_list=framework_item_list,
+ framework_misc_info_keys=framework_misc_info_keys,
+ vendor_item_list=vendor_item_list):
sys.exit(1)
call_func_with_temp_dir(
lambda temp_dir: merge_target_files(
temp_dir=temp_dir,
- system_target_files=OPTIONS.system_target_files,
- system_item_list=system_item_list,
- system_misc_info_keys=system_misc_info_keys,
- other_target_files=OPTIONS.other_target_files,
- other_item_list=other_item_list,
+ framework_target_files=OPTIONS.framework_target_files,
+ framework_item_list=framework_item_list,
+ framework_misc_info_keys=framework_misc_info_keys,
+ vendor_target_files=OPTIONS.vendor_target_files,
+ vendor_item_list=vendor_item_list,
output_target_files=OPTIONS.output_target_files,
output_dir=OPTIONS.output_dir,
output_item_list=output_item_list,
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index f686ca0..1a4f7e1 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -38,8 +38,8 @@
-k (--package_key) <key>
Key to use to sign the package (default is the value of
default_system_dev_certificate from the input target-files's
- META/misc_info.txt, or "build/make/target/product/security/testkey" if that
- value is not specified).
+ META/misc_info.txt, or "build/make/target/product/security/testkey" if
+ that value is not specified).
For incremental OTAs, the default value is based on the source
target-file, not the target build.
@@ -240,7 +240,7 @@
POSTINSTALL_CONFIG = 'META/postinstall_config.txt'
DYNAMIC_PARTITION_INFO = 'META/dynamic_partitions_info.txt'
AB_PARTITIONS = 'META/ab_partitions.txt'
-UNZIP_PATTERN = ['IMAGES/*', 'META/*', 'RADIO/*']
+UNZIP_PATTERN = ['IMAGES/*', 'META/*', 'OTA/*', 'RADIO/*']
RETROFIT_DAP_UNZIP_PATTERN = ['OTA/super_*.img', AB_PARTITIONS]
@@ -276,8 +276,8 @@
_RO_PRODUCT_RESOLVE_PROPS = ["ro.product.brand", "ro.product.device",
"ro.product.manufacturer", "ro.product.model",
"ro.product.name"]
- _RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER = ["product", "product_services",
- "odm", "vendor", "system"]
+ _RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER = ["product", "odm", "vendor",
+ "system_ext", "system"]
def __init__(self, info_dict, oem_dicts):
"""Initializes a BuildInfo instance with the given dicts.
@@ -371,7 +371,7 @@
return prop_val
source_order_val = self.info_dict.get("build.prop", {}).get(
- "ro.product.property_source_order")
+ "ro.product.property_source_order")
if source_order_val:
source_order = source_order_val.split(",")
else:
@@ -381,13 +381,13 @@
if any([x not in BuildInfo._RO_PRODUCT_PROPS_DEFAULT_SOURCE_ORDER
for x in source_order]):
raise common.ExternalError(
- "Invalid ro.product.property_source_order '{}'".format(source_order))
+ "Invalid ro.product.property_source_order '{}'".format(source_order))
for source in source_order:
- source_prop = prop.replace("ro.product", "ro.product.{}".format(source),
- 1)
- prop_val = self.info_dict.get("{}.build.prop".format(source), {}).get(
- source_prop)
+ source_prop = prop.replace(
+ "ro.product", "ro.product.{}".format(source), 1)
+ prop_val = self.info_dict.get(
+ "{}.build.prop".format(source), {}).get(source_prop)
if prop_val:
return prop_val
@@ -412,14 +412,14 @@
return self.GetBuildProp("ro.build.fingerprint")
except common.ExternalError:
return "{}/{}/{}:{}/{}/{}:{}/{}".format(
- self.GetBuildProp("ro.product.brand"),
- self.GetBuildProp("ro.product.name"),
- self.GetBuildProp("ro.product.device"),
- self.GetBuildProp("ro.build.version.release"),
- self.GetBuildProp("ro.build.id"),
- self.GetBuildProp("ro.build.version.incremental"),
- self.GetBuildProp("ro.build.type"),
- self.GetBuildProp("ro.build.tags"))
+ self.GetBuildProp("ro.product.brand"),
+ self.GetBuildProp("ro.product.name"),
+ self.GetBuildProp("ro.product.device"),
+ self.GetBuildProp("ro.build.version.release"),
+ self.GetBuildProp("ro.build.id"),
+ self.GetBuildProp("ro.build.version.incremental"),
+ self.GetBuildProp("ro.build.type"),
+ self.GetBuildProp("ro.build.tags"))
return "%s/%s/%s:%s" % (
self.GetOemProperty("ro.product.brand"),
self.GetOemProperty("ro.product.name"),
@@ -508,7 +508,7 @@
MODULUS_PREFIX = "Modulus="
assert modulus_string.startswith(MODULUS_PREFIX)
modulus_string = modulus_string[len(MODULUS_PREFIX):]
- key_size = len(modulus_string) / 2
+ key_size = len(modulus_string) // 2
assert key_size == 256 or key_size == 512, \
"Unsupported key size {}".format(key_size)
return key_size
@@ -539,6 +539,15 @@
self.payload_properties = None
self.secondary = secondary
+ def _Run(self, cmd):
+ # Don't pipe (buffer) the output if verbose is set. Let
+ # brillo_update_payload write to stdout/stderr directly, so its progress can
+ # be monitored.
+ if OPTIONS.verbose:
+ common.RunAndCheckOutput(cmd, stdout=None, stderr=None)
+ else:
+ common.RunAndCheckOutput(cmd)
+
def Generate(self, target_file, source_file=None, additional_args=None):
"""Generates a payload from the given target-files zip(s).
@@ -559,7 +568,7 @@
if source_file is not None:
cmd.extend(["--source_image", source_file])
cmd.extend(additional_args)
- common.RunAndCheckOutput(cmd)
+ self._Run(cmd)
self.payload_file = payload_file
self.payload_properties = None
@@ -583,7 +592,7 @@
"--signature_size", str(payload_signer.key_size),
"--metadata_hash_file", metadata_sig_file,
"--payload_hash_file", payload_sig_file]
- common.RunAndCheckOutput(cmd)
+ self._Run(cmd)
# 2. Sign the hashes.
signed_payload_sig_file = payload_signer.Sign(payload_sig_file)
@@ -598,7 +607,7 @@
"--signature_size", str(payload_signer.key_size),
"--metadata_signature_file", signed_metadata_sig_file,
"--payload_signature_file", signed_payload_sig_file]
- common.RunAndCheckOutput(cmd)
+ self._Run(cmd)
# 4. Dump the signed payload properties.
properties_file = common.MakeTempFile(prefix="payload-properties-",
@@ -606,7 +615,7 @@
cmd = ["brillo_update_payload", "properties",
"--payload", signed_payload_file,
"--properties_file", properties_file]
- common.RunAndCheckOutput(cmd)
+ self._Run(cmd)
if self.secondary:
with open(properties_file, "a") as f:
@@ -681,13 +690,12 @@
recovery_two_step_img_name = "recovery-two-step.img"
recovery_two_step_img_path = os.path.join(
- OPTIONS.input_tmp, "IMAGES", recovery_two_step_img_name)
+ OPTIONS.input_tmp, "OTA", recovery_two_step_img_name)
if os.path.exists(recovery_two_step_img_path):
- recovery_two_step_img = common.GetBootableImage(
- recovery_two_step_img_name, recovery_two_step_img_name,
- OPTIONS.input_tmp, "RECOVERY")
- common.ZipWriteStr(
- output_zip, recovery_two_step_img_name, recovery_two_step_img.data)
+ common.ZipWrite(
+ output_zip,
+ recovery_two_step_img_path,
+ arcname=recovery_two_step_img_name)
logger.info(
"two-step package: using %s in stage 1/3", recovery_two_step_img_name)
script.WriteRawImage("/boot", recovery_two_step_img_name)
@@ -1051,7 +1059,7 @@
output: A ZipFile object or a string of the output file path.
"""
- value = "".join(["%s=%s\n" % kv for kv in sorted(metadata.iteritems())])
+ value = "".join(["%s=%s\n" % kv for kv in sorted(metadata.items())])
if isinstance(output, zipfile.ZipFile):
common.ZipWriteStr(output, METADATA_NAME, value,
compress_type=zipfile.ZIP_STORED)
@@ -1067,7 +1075,7 @@
post_timestamp = target_info.GetBuildProp("ro.build.date.utc")
pre_timestamp = source_info.GetBuildProp("ro.build.date.utc")
- is_downgrade = long(post_timestamp) < long(pre_timestamp)
+ is_downgrade = int(post_timestamp) < int(pre_timestamp)
if OPTIONS.downgrade:
if not is_downgrade:
@@ -1392,7 +1400,7 @@
payload_offset += len(payload_info.extra) + len(payload_info.filename)
payload_size = payload_info.file_size
- with input_zip.open('payload.bin', 'r') as payload_fp:
+ with input_zip.open('payload.bin') as payload_fp:
header_bin = payload_fp.read(24)
# network byte order (big-endian)
@@ -1864,7 +1872,6 @@
with zipfile.ZipFile(input_file, 'r') as input_zip:
infolist = input_zip.infolist()
- namelist = input_zip.namelist()
input_tmp = common.UnzipTemp(input_file, UNZIP_PATTERN)
for info in infolist:
@@ -1939,7 +1946,7 @@
target_file = common.MakeTempFile(prefix="targetfiles-", suffix=".zip")
shutil.copyfile(input_file, target_file)
- with zipfile.ZipFile(input_file, 'r') as input_zip:
+ with zipfile.ZipFile(input_file) as input_zip:
namelist = input_zip.namelist()
input_tmp = common.UnzipTemp(input_file, RETROFIT_DAP_UNZIP_PATTERN)
@@ -1963,8 +1970,8 @@
for partition in ab_partitions:
if (partition in dynamic_partition_list and
partition not in super_block_devices):
- logger.info("Dropping %s from ab_partitions.txt", partition)
- continue
+ logger.info("Dropping %s from ab_partitions.txt", partition)
+ continue
f.write(partition + "\n")
to_delete = [AB_PARTITIONS]
@@ -1976,7 +1983,7 @@
to_delete += [DYNAMIC_PARTITION_INFO]
# Remove the existing partition images as well as the map files.
- to_delete += replace.values()
+ to_delete += list(replace.values())
to_delete += ['IMAGES/{}.map'.format(dev) for dev in super_block_devices]
common.ZipDelete(target_file, to_delete)
@@ -1986,7 +1993,7 @@
# Write super_{foo}.img as {foo}.img.
for src, dst in replace.items():
assert src in namelist, \
- 'Missing {} in {}; {} cannot be written'.format(src, input_file, dst)
+ 'Missing {} in {}; {} cannot be written'.format(src, input_file, dst)
unzipped_file = os.path.join(input_tmp, *src.split('/'))
common.ZipWrite(target_zip, unzipped_file, arcname=dst)
@@ -2291,7 +2298,8 @@
OPTIONS.cache_size = cache_size
if OPTIONS.extra_script is not None:
- OPTIONS.extra_script = open(OPTIONS.extra_script).read()
+ with open(OPTIONS.extra_script) as fp:
+ OPTIONS.extra_script = fp.read()
if OPTIONS.extracted_input is not None:
OPTIONS.input_tmp = OPTIONS.extracted_input
diff --git a/tools/releasetools/rangelib.py b/tools/releasetools/rangelib.py
index 36becf4..9d6e9fb 100644
--- a/tools/releasetools/rangelib.py
+++ b/tools/releasetools/rangelib.py
@@ -52,9 +52,12 @@
def __ne__(self, other):
return self.data != other.data
- def __nonzero__(self):
+ def __bool__(self):
return bool(self.data)
+ # Python 2 uses __nonzero__, while Python 3 uses __bool__.
+ __nonzero__ = __bool__
+
def __str__(self):
if not self.data:
return "empty"
diff --git a/tools/releasetools/sign_apex.py b/tools/releasetools/sign_apex.py
index 1778615..2516e15 100755
--- a/tools/releasetools/sign_apex.py
+++ b/tools/releasetools/sign_apex.py
@@ -19,6 +19,9 @@
Usage: sign_apex [flags] input_apex_file output_apex_file
+ --avbtool <avbtool>
+ Optional flag that specifies the AVB tool to use. Defaults to `avbtool`.
+
--container_key <key>
Mandatory flag that specifies the container signing key.
@@ -40,12 +43,30 @@
logger = logging.getLogger(__name__)
+def SignApexFile(avbtool, apex_file, payload_key, container_key,
+ signing_args=None):
+ """Signs the given apex file."""
+ with open(apex_file, 'rb') as input_fp:
+ apex_data = input_fp.read()
+
+ return apex_utils.SignApex(
+ avbtool,
+ apex_data,
+ payload_key=payload_key,
+ container_key=container_key,
+ container_pw=None,
+ codename_to_api_level_map=None,
+ signing_args=signing_args)
+
+
def main(argv):
options = {}
def option_handler(o, a):
- if o == '--container_key':
+ if o == '--avbtool':
+ options['avbtool'] = a
+ elif o == '--container_key':
# Strip the suffix if any, as common.SignFile expects no suffix.
DEFAULT_CONTAINER_KEY_SUFFIX = '.x509.pem'
if a.endswith(DEFAULT_CONTAINER_KEY_SUFFIX):
@@ -63,6 +84,7 @@
argv, __doc__,
extra_opts='',
extra_long_opts=[
+ 'avbtool=',
'container_key=',
'payload_extra_args=',
'payload_key=',
@@ -76,20 +98,13 @@
common.InitLogging()
- input_zip = args[0]
- output_zip = args[1]
- with open(input_zip) as input_fp:
- apex_data = input_fp.read()
-
- signed_apex = apex_utils.SignApex(
- apex_data,
- payload_key=options['payload_key'],
- container_key=options['container_key'],
- container_pw=None,
- codename_to_api_level_map=None,
- signing_args=options.get('payload_extra_args'))
-
- shutil.copyfile(signed_apex, output_zip)
+ signed_apex = SignApexFile(
+ options.get('avbtool', 'avbtool'),
+ args[0],
+ options['payload_key'],
+ options['container_key'],
+ options.get('payload_extra_args'))
+ shutil.copyfile(signed_apex, args[1])
logger.info("done.")
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index 7de0978..3119afa 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -111,6 +111,7 @@
import copy
import errno
import gzip
+import io
import itertools
import logging
import os
@@ -154,11 +155,11 @@
def GetApkCerts(certmap):
# apply the key remapping to the contents of the file
- for apk, cert in certmap.iteritems():
+ for apk, cert in certmap.items():
certmap[apk] = OPTIONS.key_map.get(cert, cert)
# apply all the -e options, overriding anything in the file
- for apk, cert in OPTIONS.extra_apks.iteritems():
+ for apk, cert in OPTIONS.extra_apks.items():
if not cert:
cert = "PRESIGNED"
certmap[apk] = OPTIONS.key_map.get(cert, cert)
@@ -188,6 +189,9 @@
for apex, key in OPTIONS.extra_apex_payload_keys.items():
if not key:
key = 'PRESIGNED'
+ if apex not in keys_info:
+ logger.warning('Failed to find %s in target_files; Ignored', apex)
+ continue
keys_info[apex] = (key, keys_info[apex][1])
# Apply the key remapping to container keys.
@@ -419,7 +423,8 @@
if filename.startswith("IMAGES/"):
continue
- # Skip split super images, which will be re-generated during signing.
+ # Skip OTA-specific images (e.g. split super images), which will be
+ # re-generated during signing.
if filename.startswith("OTA/") and filename.endswith(".img"):
continue
@@ -468,6 +473,7 @@
maxsize, name, payload_key))
signed_apex = apex_utils.SignApex(
+ misc_info['avb_avbtool'],
data,
payload_key,
container_key,
@@ -488,33 +494,45 @@
continue
# System properties.
- elif filename in ("SYSTEM/build.prop",
- "VENDOR/build.prop",
- "SYSTEM/vendor/build.prop",
- "ODM/build.prop",
- "VENDOR/odm/build.prop",
- "PRODUCT/build.prop",
- "SYSTEM/product/build.prop",
- "PRODUCT_SERVICES/build.prop",
- "SYSTEM/product_services/build.prop",
- "SYSTEM/etc/prop.default",
- "BOOT/RAMDISK/prop.default",
- "BOOT/RAMDISK/default.prop", # legacy
- "ROOT/default.prop", # legacy
- "RECOVERY/RAMDISK/prop.default",
- "RECOVERY/RAMDISK/default.prop"): # legacy
+ elif filename in (
+ "SYSTEM/build.prop",
+
+ "VENDOR/build.prop",
+ "SYSTEM/vendor/build.prop",
+
+ "ODM/etc/build.prop",
+ "VENDOR/odm/etc/build.prop",
+
+ "PRODUCT/build.prop",
+ "SYSTEM/product/build.prop",
+
+ "SYSTEM_EXT/build.prop",
+ "SYSTEM/system_ext/build.prop",
+
+ "SYSTEM/etc/prop.default",
+ "BOOT/RAMDISK/prop.default",
+ "RECOVERY/RAMDISK/prop.default",
+
+ # ROOT/default.prop is a legacy path, but may still exist for upgrading
+ # devices that don't support `property_overrides_split_enabled`.
+ "ROOT/default.prop",
+
+ # RECOVERY/RAMDISK/default.prop is a legacy path, but will always exist
+ # as a symlink in the current code. So it's a no-op here. Keeping the
+ # path here for clarity.
+ "RECOVERY/RAMDISK/default.prop"):
print("Rewriting %s:" % (filename,))
if stat.S_ISLNK(info.external_attr >> 16):
new_data = data
else:
- new_data = RewriteProps(data)
+ new_data = RewriteProps(data.decode())
common.ZipWriteStr(output_tf_zip, out_info, new_data)
# Replace the certs in *mac_permissions.xml (there could be multiple, such
# as {system,vendor}/etc/selinux/{plat,nonplat}_mac_permissions.xml).
elif filename.endswith("mac_permissions.xml"):
print("Rewriting %s with new keys." % (filename,))
- new_data = ReplaceCerts(data)
+ new_data = ReplaceCerts(data.decode())
common.ZipWriteStr(output_tf_zip, out_info, new_data)
# Ask add_img_to_target_files to rebuild the recovery patch if needed.
@@ -560,7 +578,8 @@
# key is specified via --avb_system_other_key.
signing_key = OPTIONS.avb_keys.get("system_other")
if signing_key:
- public_key = common.ExtractAvbPublicKey(signing_key)
+ public_key = common.ExtractAvbPublicKey(
+ misc_info['avb_avbtool'], signing_key)
print(" Rewriting AVB public key of system_other in /product")
common.ZipWrite(output_tf_zip, public_key, filename)
@@ -618,17 +637,17 @@
Raises:
AssertionError: On finding duplicate entries.
"""
- for old, new in OPTIONS.key_map.iteritems():
+ for old, new in OPTIONS.key_map.items():
if OPTIONS.verbose:
print(" Replacing %s.x509.pem with %s.x509.pem" % (old, new))
try:
with open(old + ".x509.pem") as old_fp:
old_cert16 = base64.b16encode(
- common.ParseCertificate(old_fp.read())).lower()
+ common.ParseCertificate(old_fp.read())).decode().lower()
with open(new + ".x509.pem") as new_fp:
new_cert16 = base64.b16encode(
- common.ParseCertificate(new_fp.read())).lower()
+ common.ParseCertificate(new_fp.read())).decode().lower()
except IOError as e:
if OPTIONS.verbose or e.errno != errno.ENOENT:
print(" Error accessing %s: %s.\nSkip replacing %s.x509.pem with "
@@ -729,12 +748,7 @@
filename: The archive name in the output zip.
keys: A list of public keys to use during OTA package verification.
"""
-
- try:
- from StringIO import StringIO
- except ImportError:
- from io import StringIO
- temp_file = StringIO()
+ temp_file = io.BytesIO()
certs_zip = zipfile.ZipFile(temp_file, "w")
for k in keys:
common.ZipWrite(certs_zip, k)
@@ -846,7 +860,7 @@
writable.
key_path: The path to the PEM encoded X.509 certificate.
"""
- in_cmdline = input_zip.read("BOOT/cmdline")
+ in_cmdline = input_zip.read("BOOT/cmdline").decode()
# Copy in_cmdline to output_zip if veritykeyid is not present.
if "veritykeyid" not in in_cmdline:
common.ZipWriteStr(output_zip, "BOOT/cmdline", in_cmdline)
@@ -879,7 +893,7 @@
current in-memory dict contains additional items computed at runtime.
"""
misc_info_old = common.LoadDictionaryFromLines(
- input_zip.read('META/misc_info.txt').split('\n'))
+ input_zip.read('META/misc_info.txt').decode().split('\n'))
items = []
for key in sorted(misc_info):
if key in misc_info_old:
@@ -945,7 +959,7 @@
def GetApiLevelAndCodename(input_tf_zip):
- data = input_tf_zip.read("SYSTEM/build.prop")
+ data = input_tf_zip.read("SYSTEM/build.prop").decode()
api_level = None
codename = None
for line in data.split("\n"):
@@ -967,7 +981,7 @@
def GetCodenameToApiLevelMap(input_tf_zip):
- data = input_tf_zip.read("SYSTEM/build.prop")
+ data = input_tf_zip.read("SYSTEM/build.prop").decode()
api_level = None
codenames = None
for line in data.split("\n"):
@@ -985,7 +999,7 @@
if codenames is None:
raise ValueError("No ro.build.version.all_codenames in SYSTEM/build.prop")
- result = dict()
+ result = {}
for codename in codenames:
codename = codename.strip()
if codename:
@@ -1009,7 +1023,7 @@
key.
"""
keys = {}
- for line in tf_zip.read("META/apexkeys.txt").split("\n"):
+ for line in tf_zip.read('META/apexkeys.txt').decode().split('\n'):
line = line.strip()
if not line:
continue
diff --git a/tools/releasetools/sparse_img.py b/tools/releasetools/sparse_img.py
old mode 100755
new mode 100644
diff --git a/tools/releasetools/test_add_img_to_target_files.py b/tools/releasetools/test_add_img_to_target_files.py
index 08e0190..3d0766f 100644
--- a/tools/releasetools/test_add_img_to_target_files.py
+++ b/tools/releasetools/test_add_img_to_target_files.py
@@ -21,7 +21,7 @@
import common
import test_utils
from add_img_to_target_files import (
- AddCareMapForAbOta, AddPackRadioImages, AppendVBMetaArgsForPartition,
+ AddCareMapForAbOta, AddPackRadioImages,
CheckAbOtaImages, GetCareMap)
from rangelib import RangeSet
@@ -379,32 +379,6 @@
# The existing entry should be scheduled to be replaced.
self.assertIn('META/care_map.pb', OPTIONS.replace_updated_files_list)
- def test_AppendVBMetaArgsForPartition(self):
- OPTIONS.info_dict = {}
- cmd = []
- AppendVBMetaArgsForPartition(cmd, 'system', '/path/to/system.img')
- self.assertEqual(
- ['--include_descriptors_from_image', '/path/to/system.img'], cmd)
-
- @test_utils.SkipIfExternalToolsUnavailable()
- def test_AppendVBMetaArgsForPartition_vendorAsChainedPartition(self):
- testdata_dir = test_utils.get_testdata_dir()
- pubkey = os.path.join(testdata_dir, 'testkey.pubkey.pem')
- OPTIONS.info_dict = {
- 'avb_avbtool': 'avbtool',
- 'avb_vendor_key_path': pubkey,
- 'avb_vendor_rollback_index_location': 5,
- }
- cmd = []
- AppendVBMetaArgsForPartition(cmd, 'vendor', '/path/to/vendor.img')
- self.assertEqual(2, len(cmd))
- self.assertEqual('--chain_partition', cmd[0])
- chained_partition_args = cmd[1].split(':')
- self.assertEqual(3, len(chained_partition_args))
- self.assertEqual('vendor', chained_partition_args[0])
- self.assertEqual('5', chained_partition_args[1])
- self.assertTrue(os.path.exists(chained_partition_args[2]))
-
def test_GetCareMap(self):
sparse_image = test_utils.construct_sparse_image([
(0xCAC1, 6),
diff --git a/tools/releasetools/test_apex_utils.py b/tools/releasetools/test_apex_utils.py
index c7d5807..e9c26f0 100644
--- a/tools/releasetools/test_apex_utils.py
+++ b/tools/releasetools/test_apex_utils.py
@@ -43,8 +43,9 @@
def test_ParseApexPayloadInfo(self):
payload_file = self._GetTestPayload()
apex_utils.SignApexPayload(
- payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048', self.SALT)
- payload_info = apex_utils.ParseApexPayloadInfo(payload_file)
+ 'avbtool', payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048',
+ self.SALT)
+ payload_info = apex_utils.ParseApexPayloadInfo('avbtool', payload_file)
self.assertEqual('SHA256_RSA2048', payload_info['Algorithm'])
self.assertEqual(self.SALT, payload_info['Salt'])
self.assertEqual('testkey', payload_info['apex.key'])
@@ -53,8 +54,9 @@
def test_SignApexPayload(self):
payload_file = self._GetTestPayload()
apex_utils.SignApexPayload(
- payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048', self.SALT)
- apex_utils.VerifyApexPayload(payload_file, self.payload_key)
+ 'avbtool', payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048',
+ self.SALT)
+ apex_utils.VerifyApexPayload('avbtool', payload_file, self.payload_key)
@test_utils.SkipIfExternalToolsUnavailable()
def test_SignApexPayload_withSignerHelper(self):
@@ -64,17 +66,19 @@
payload_signer_args = '--signing_helper_with_files {}'.format(
signing_helper)
apex_utils.SignApexPayload(
+ 'avbtool',
payload_file,
self.payload_key,
'testkey', 'SHA256_RSA2048', self.SALT,
payload_signer_args)
- apex_utils.VerifyApexPayload(payload_file, self.payload_key)
+ apex_utils.VerifyApexPayload('avbtool', payload_file, self.payload_key)
@test_utils.SkipIfExternalToolsUnavailable()
def test_SignApexPayload_invalidKey(self):
self.assertRaises(
apex_utils.ApexSigningError,
apex_utils.SignApexPayload,
+ 'avbtool',
self._GetTestPayload(),
os.path.join(self.testdata_dir, 'testkey.x509.pem'),
'testkey',
@@ -85,10 +89,12 @@
def test_VerifyApexPayload_wrongKey(self):
payload_file = self._GetTestPayload()
apex_utils.SignApexPayload(
- payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048', self.SALT)
- apex_utils.VerifyApexPayload(payload_file, self.payload_key)
+ 'avbtool', payload_file, self.payload_key, 'testkey', 'SHA256_RSA2048',
+ self.SALT)
+ apex_utils.VerifyApexPayload('avbtool', payload_file, self.payload_key)
self.assertRaises(
apex_utils.ApexSigningError,
apex_utils.VerifyApexPayload,
+ 'avbtool',
payload_file,
os.path.join(self.testdata_dir, 'testkey_with_passwd.key'))
diff --git a/tools/releasetools/test_blockimgdiff.py b/tools/releasetools/test_blockimgdiff.py
index b6d47d4..0987dcf 100644
--- a/tools/releasetools/test_blockimgdiff.py
+++ b/tools/releasetools/test_blockimgdiff.py
@@ -18,9 +18,8 @@
from hashlib import sha1
import common
-from blockimgdiff import (
- BlockImageDiff, DataImage, EmptyImage, FileImage, HeapItem, ImgdiffStats,
- Transfer)
+from blockimgdiff import BlockImageDiff, HeapItem, ImgdiffStats, Transfer
+from images import DataImage, EmptyImage, FileImage
from rangelib import RangeSet
from test_utils import ReleaseToolsTestCase
@@ -268,6 +267,7 @@
class DataImageTest(ReleaseToolsTestCase):
+
def test_read_range_set(self):
data = "file" + ('\0' * 4092)
image = DataImage(data)
@@ -275,10 +275,11 @@
class FileImageTest(ReleaseToolsTestCase):
+
def setUp(self):
self.file_path = common.MakeTempFile()
self.data = os.urandom(4096 * 4)
- with open(self.file_path, 'w') as f:
+ with open(self.file_path, 'wb') as f:
f.write(self.data)
self.file = FileImage(self.file_path)
@@ -292,18 +293,18 @@
expected_data = self.data[s * blocksize : e * blocksize]
rs = RangeSet([s, e])
- data = "".join(self.file.ReadRangeSet(rs))
+ data = b''.join(self.file.ReadRangeSet(rs))
self.assertEqual(expected_data, data)
sha1sum = self.file.RangeSha1(rs)
self.assertEqual(sha1(expected_data).hexdigest(), sha1sum)
tmpfile = common.MakeTempFile()
- with open(tmpfile, 'w') as f:
+ with open(tmpfile, 'wb') as f:
self.file.WriteRangeDataToFd(rs, f)
- with open(tmpfile, 'r') as f:
+ with open(tmpfile, 'rb') as f:
self.assertEqual(expected_data, f.read())
def test_read_all(self):
- data = "".join(self.file.ReadRangeSet(self.file.care_map))
+ data = b''.join(self.file.ReadRangeSet(self.file.care_map))
self.assertEqual(self.data, data)
diff --git a/tools/releasetools/test_common.py b/tools/releasetools/test_common.py
index 9b76734..ceb023f 100644
--- a/tools/releasetools/test_common.py
+++ b/tools/releasetools/test_common.py
@@ -25,9 +25,9 @@
import common
import test_utils
import validate_target_files
+from images import EmptyImage, DataImage
from rangelib import RangeSet
-from blockimgdiff import EmptyImage, DataImage
KiB = 1024
MiB = 1024 * KiB
@@ -41,7 +41,7 @@
# Generate a long string with holes, e.g. 'xyz\x00abc\x00...'.
for _ in range(0, size, step_size):
yield os.urandom(block_size)
- yield '\0' * (step_size - block_size)
+ yield b'\0' * (step_size - block_size)
class CommonZipTest(test_utils.ReleaseToolsTestCase):
@@ -72,7 +72,7 @@
# Verify the zip contents.
entry = zip_file.open(arcname)
sha1_hash = sha1()
- for chunk in iter(lambda: entry.read(4 * MiB), ''):
+ for chunk in iter(lambda: entry.read(4 * MiB), b''):
sha1_hash.update(chunk)
self.assertEqual(expected_hash, sha1_hash.hexdigest())
self.assertIsNone(zip_file.testzip())
@@ -97,8 +97,8 @@
try:
sha1_hash = sha1()
for data in contents:
- sha1_hash.update(data)
- test_file.write(data)
+ sha1_hash.update(bytes(data))
+ test_file.write(bytes(data))
test_file.close()
expected_stat = os.stat(test_file_name)
@@ -136,8 +136,11 @@
expected_mode = extra_args.get("perms", 0o644)
else:
arcname = zinfo_or_arcname.filename
- expected_mode = extra_args.get("perms",
- zinfo_or_arcname.external_attr >> 16)
+ if zinfo_or_arcname.external_attr:
+ zinfo_perms = zinfo_or_arcname.external_attr >> 16
+ else:
+ zinfo_perms = 0o600
+ expected_mode = extra_args.get("perms", zinfo_perms)
common.ZipWriteStr(zip_file, zinfo_or_arcname, contents, **extra_args)
common.ZipClose(zip_file)
@@ -262,6 +265,10 @@
"perms": 0o600,
"compress_type": zipfile.ZIP_STORED,
})
+ self._test_ZipWriteStr(zinfo, random_string, {
+ "perms": 0o000,
+ "compress_type": zipfile.ZIP_STORED,
+ })
def test_ZipWriteStr_large_file(self):
# zipfile.writestr() doesn't work when the str size is over 2GiB even with
@@ -274,9 +281,9 @@
})
def test_ZipWriteStr_resets_ZIP64_LIMIT(self):
- self._test_reset_ZIP64_LIMIT(self._test_ZipWriteStr, "foo", "")
+ self._test_reset_ZIP64_LIMIT(self._test_ZipWriteStr, 'foo', b'')
zinfo = zipfile.ZipInfo(filename="foo")
- self._test_reset_ZIP64_LIMIT(self._test_ZipWriteStr, zinfo, "")
+ self._test_reset_ZIP64_LIMIT(self._test_ZipWriteStr, zinfo, b'')
def test_bug21309935(self):
zip_file = tempfile.NamedTemporaryFile(delete=False)
@@ -572,7 +579,7 @@
def test_ExtractPublicKey(self):
cert = os.path.join(self.testdata_dir, 'testkey.x509.pem')
pubkey = os.path.join(self.testdata_dir, 'testkey.pubkey.pem')
- with open(pubkey, 'rb') as pubkey_fp:
+ with open(pubkey) as pubkey_fp:
self.assertEqual(pubkey_fp.read(), common.ExtractPublicKey(cert))
def test_ExtractPublicKey_invalidInput(self):
@@ -583,15 +590,18 @@
def test_ExtractAvbPublicKey(self):
privkey = os.path.join(self.testdata_dir, 'testkey.key')
pubkey = os.path.join(self.testdata_dir, 'testkey.pubkey.pem')
- with open(common.ExtractAvbPublicKey(privkey)) as privkey_fp, \
- open(common.ExtractAvbPublicKey(pubkey)) as pubkey_fp:
+ extracted_from_privkey = common.ExtractAvbPublicKey('avbtool', privkey)
+ extracted_from_pubkey = common.ExtractAvbPublicKey('avbtool', pubkey)
+ with open(extracted_from_privkey, 'rb') as privkey_fp, \
+ open(extracted_from_pubkey, 'rb') as pubkey_fp:
self.assertEqual(privkey_fp.read(), pubkey_fp.read())
def test_ParseCertificate(self):
cert = os.path.join(self.testdata_dir, 'testkey.x509.pem')
cmd = ['openssl', 'x509', '-in', cert, '-outform', 'DER']
- proc = common.Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ proc = common.Run(cmd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,
+ universal_newlines=False)
expected, _ = proc.communicate()
self.assertEqual(0, proc.returncode)
@@ -902,12 +912,29 @@
'recovery_as_boot': 'true',
}
+ def test_LoadListFromFile(self):
+ file_path = os.path.join(self.testdata_dir,
+ 'merge_config_framework_item_list')
+ contents = common.LoadListFromFile(file_path)
+ expected_contents = [
+ 'META/apkcerts.txt',
+ 'META/filesystem_config.txt',
+ 'META/root_filesystem_config.txt',
+ 'META/system_manifest.xml',
+ 'META/system_matrix.xml',
+ 'META/update_engine_config.txt',
+ 'PRODUCT/*',
+ 'ROOT/*',
+ 'SYSTEM/*',
+ ]
+ self.assertEqual(sorted(contents), sorted(expected_contents))
+
@staticmethod
def _test_LoadInfoDict_createTargetFiles(info_dict, fstab_path):
target_files = common.MakeTempFile(prefix='target_files-', suffix='.zip')
with zipfile.ZipFile(target_files, 'w') as target_files_zip:
info_values = ''.join(
- ['{}={}\n'.format(k, v) for k, v in sorted(info_dict.iteritems())])
+ ['{}={}\n'.format(k, v) for k, v in sorted(info_dict.items())])
common.ZipWriteStr(target_files_zip, 'META/misc_info.txt', info_values)
FSTAB_TEMPLATE = "/dev/block/system {} ext4 ro,barrier=1 defaults"
@@ -1047,6 +1074,93 @@
self.assertRaises(
AssertionError, common.LoadInfoDict, target_files_zip, True)
+ def test_MergeDynamicPartitionInfoDicts_ReturnsMergedDict(self):
+ framework_dict = {
+ 'super_partition_groups': 'group_a',
+ 'dynamic_partition_list': 'system',
+ 'super_group_a_list': 'system',
+ }
+ vendor_dict = {
+ 'super_partition_groups': 'group_a group_b',
+ 'dynamic_partition_list': 'vendor product',
+ 'super_group_a_list': 'vendor',
+ 'super_group_a_size': '1000',
+ 'super_group_b_list': 'product',
+ 'super_group_b_size': '2000',
+ }
+ merged_dict = common.MergeDynamicPartitionInfoDicts(
+ framework_dict=framework_dict,
+ vendor_dict=vendor_dict,
+ size_prefix='super_',
+ size_suffix='_size',
+ list_prefix='super_',
+ list_suffix='_list')
+ expected_merged_dict = {
+ 'super_partition_groups': 'group_a group_b',
+ 'dynamic_partition_list': 'system vendor product',
+ 'super_group_a_list': 'system vendor',
+ 'super_group_a_size': '1000',
+ 'super_group_b_list': 'product',
+ 'super_group_b_size': '2000',
+ }
+ self.assertEqual(merged_dict, expected_merged_dict)
+
+ def test_MergeDynamicPartitionInfoDicts_IgnoringFrameworkGroupSize(self):
+ framework_dict = {
+ 'super_partition_groups': 'group_a',
+ 'dynamic_partition_list': 'system',
+ 'super_group_a_list': 'system',
+ 'super_group_a_size': '5000',
+ }
+ vendor_dict = {
+ 'super_partition_groups': 'group_a group_b',
+ 'dynamic_partition_list': 'vendor product',
+ 'super_group_a_list': 'vendor',
+ 'super_group_a_size': '1000',
+ 'super_group_b_list': 'product',
+ 'super_group_b_size': '2000',
+ }
+ merged_dict = common.MergeDynamicPartitionInfoDicts(
+ framework_dict=framework_dict,
+ vendor_dict=vendor_dict,
+ size_prefix='super_',
+ size_suffix='_size',
+ list_prefix='super_',
+ list_suffix='_list')
+ expected_merged_dict = {
+ 'super_partition_groups': 'group_a group_b',
+ 'dynamic_partition_list': 'system vendor product',
+ 'super_group_a_list': 'system vendor',
+ 'super_group_a_size': '1000',
+ 'super_group_b_list': 'product',
+ 'super_group_b_size': '2000',
+ }
+ self.assertEqual(merged_dict, expected_merged_dict)
+
+ def test_GetAvbPartitionArg(self):
+ info_dict = {}
+ cmd = common.GetAvbPartitionArg('system', '/path/to/system.img', info_dict)
+ self.assertEqual(
+ ['--include_descriptors_from_image', '/path/to/system.img'], cmd)
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_AppendVBMetaArgsForPartition_vendorAsChainedPartition(self):
+ testdata_dir = test_utils.get_testdata_dir()
+ pubkey = os.path.join(testdata_dir, 'testkey.pubkey.pem')
+ info_dict = {
+ 'avb_avbtool': 'avbtool',
+ 'avb_vendor_key_path': pubkey,
+ 'avb_vendor_rollback_index_location': 5,
+ }
+ cmd = common.GetAvbPartitionArg('vendor', '/path/to/vendor.img', info_dict)
+ self.assertEqual(2, len(cmd))
+ self.assertEqual('--chain_partition', cmd[0])
+ chained_partition_args = cmd[1].split(':')
+ self.assertEqual(3, len(chained_partition_args))
+ self.assertEqual('vendor', chained_partition_args[0])
+ self.assertEqual('5', chained_partition_args[1])
+ self.assertTrue(os.path.exists(chained_partition_args[2]))
+
class InstallRecoveryScriptFormatTest(test_utils.ReleaseToolsTestCase):
"""Checks the format of install-recovery.sh.
@@ -1078,7 +1192,7 @@
loc = os.path.join(self._tempdir, prefix, name)
if not os.path.exists(os.path.dirname(loc)):
os.makedirs(os.path.dirname(loc))
- with open(loc, "w+") as f:
+ with open(loc, "wb") as f:
f.write(data)
def test_full_recovery(self):
@@ -1103,7 +1217,7 @@
validate_target_files.ValidateInstallRecoveryScript(self._tempdir,
self._info)
# Validate 'recovery-from-boot' with bonus argument.
- self._out_tmp_sink("etc/recovery-resource.dat", "bonus", "SYSTEM")
+ self._out_tmp_sink("etc/recovery-resource.dat", b"bonus", "SYSTEM")
common.MakeRecoveryPatch(self._tempdir, self._out_tmp_sink,
recovery_image, boot_image, self._info)
validate_target_files.ValidateInstallRecoveryScript(self._tempdir,
@@ -1111,25 +1225,30 @@
class MockScriptWriter(object):
- """A class that mocks edify_generator.EdifyGenerator.
- """
+ """A class that mocks edify_generator.EdifyGenerator."""
+
def __init__(self, enable_comments=False):
self.lines = []
self.enable_comments = enable_comments
+
def Comment(self, comment):
if self.enable_comments:
- self.lines.append("# {}".format(comment))
+ self.lines.append('# {}'.format(comment))
+
def AppendExtra(self, extra):
self.lines.append(extra)
+
def __str__(self):
- return "\n".join(self.lines)
+ return '\n'.join(self.lines)
class MockBlockDifference(object):
+
def __init__(self, partition, tgt, src=None):
self.partition = partition
self.tgt = tgt
self.src = src
+
def WriteScript(self, script, _, progress=None,
write_verify_script=False):
if progress:
@@ -1137,11 +1256,13 @@
script.AppendExtra("patch({});".format(self.partition))
if write_verify_script:
self.WritePostInstallVerifyScript(script)
+
def WritePostInstallVerifyScript(self, script):
script.AppendExtra("verify({});".format(self.partition))
class FakeSparseImage(object):
+
def __init__(self, size):
self.blocksize = 4096
self.total_blocks = size // 4096
@@ -1149,12 +1270,13 @@
class DynamicPartitionsDifferenceTest(test_utils.ReleaseToolsTestCase):
+
@staticmethod
def get_op_list(output_path):
- with zipfile.ZipFile(output_path, 'r') as output_zip:
- with output_zip.open("dynamic_partitions_op_list") as op_list:
- return [line.strip() for line in op_list.readlines()
- if not line.startswith("#")]
+ with zipfile.ZipFile(output_path) as output_zip:
+ with output_zip.open('dynamic_partitions_op_list') as op_list:
+ return [line.decode().strip() for line in op_list.readlines()
+ if not line.startswith(b'#')]
def setUp(self):
self.script = MockScriptWriter()
@@ -1176,12 +1298,12 @@
self.assertEqual(str(self.script).strip(), """
assert(update_dynamic_partitions(package_extract_file("dynamic_partitions_op_list")));
-patch(vendor);
-verify(vendor);
-unmap_partition("vendor");
patch(system);
verify(system);
unmap_partition("system");
+patch(vendor);
+verify(vendor);
+unmap_partition("vendor");
""".strip())
lines = self.get_op_list(self.output_path)
@@ -1229,16 +1351,17 @@
grown = lines.index("resize_group group_baz 4294967296")
added = lines.index("add_group group_qux 1073741824")
- self.assertLess(max(removed, shrunk) < min(grown, added),
+ self.assertLess(max(removed, shrunk),
+ min(grown, added),
"ops that remove / shrink partitions must precede ops that "
"grow / add partitions")
def test_incremental(self):
source_info = common.LoadDictionaryFromLines("""
-dynamic_partition_list=system vendor product product_services
+dynamic_partition_list=system vendor product system_ext
super_partition_groups=group_foo
super_group_foo_group_size={group_foo_size}
-super_group_foo_partition_list=system vendor product product_services
+super_group_foo_partition_list=system vendor product system_ext
""".format(group_foo_size=4 * GiB).split("\n"))
target_info = common.LoadDictionaryFromLines("""
dynamic_partition_list=system vendor product odm
@@ -1255,7 +1378,7 @@
src=FakeSparseImage(1024 * MiB)),
MockBlockDifference("product", FakeSparseImage(1024 * MiB),
src=FakeSparseImage(1024 * MiB)),
- MockBlockDifference("product_services", None,
+ MockBlockDifference("system_ext", None,
src=FakeSparseImage(1024 * MiB)),
MockBlockDifference("odm", FakeSparseImage(1024 * MiB),
src=None)]
@@ -1278,11 +1401,11 @@
self.assertLess(patch_idx, verify_idx,
"Should verify {} after patching".format(p))
- self.assertNotIn("patch(product_services);", self.script.lines)
+ self.assertNotIn("patch(system_ext);", self.script.lines)
lines = self.get_op_list(self.output_path)
- remove = lines.index("remove product_services")
+ remove = lines.index("remove system_ext")
move_product_out = lines.index("move product default")
shrink = lines.index("resize vendor 536870912")
shrink_group = lines.index("resize_group group_foo 3221225472")
diff --git a/tools/releasetools/test_merge_target_files.py b/tools/releasetools/test_merge_target_files.py
index 3f15d8f..1abe83c 100644
--- a/tools/releasetools/test_merge_target_files.py
+++ b/tools/releasetools/test_merge_target_files.py
@@ -18,11 +18,11 @@
import common
import test_utils
-from merge_target_files import (read_config_list, validate_config_lists,
- default_system_item_list,
- default_other_item_list,
- default_system_misc_info_keys, copy_items,
- merge_dynamic_partition_info_dicts)
+from merge_target_files import (validate_config_lists,
+ DEFAULT_FRAMEWORK_ITEM_LIST,
+ DEFAULT_VENDOR_ITEM_LIST,
+ DEFAULT_FRAMEWORK_MISC_INFO_KEYS, copy_items,
+ process_apex_keys_apk_certs_common)
class MergeTargetFilesTest(test_utils.ReleaseToolsTestCase):
@@ -82,81 +82,97 @@
self.assertEqual(
os.readlink(os.path.join(output_dir, 'a_link.cpp')), 'a.cpp')
- def test_read_config_list(self):
- system_item_list_file = os.path.join(self.testdata_dir,
- 'merge_config_system_item_list')
- system_item_list = read_config_list(system_item_list_file)
- expected_system_item_list = [
- 'META/apkcerts.txt',
- 'META/filesystem_config.txt',
- 'META/root_filesystem_config.txt',
- 'META/system_manifest.xml',
- 'META/system_matrix.xml',
- 'META/update_engine_config.txt',
- 'PRODUCT/*',
- 'ROOT/*',
- 'SYSTEM/*',
- ]
- self.assertItemsEqual(system_item_list, expected_system_item_list)
-
def test_validate_config_lists_ReturnsFalseIfMissingDefaultItem(self):
- system_item_list = default_system_item_list[:]
- system_item_list.remove('SYSTEM/*')
+ framework_item_list = list(DEFAULT_FRAMEWORK_ITEM_LIST)
+ framework_item_list.remove('SYSTEM/*')
self.assertFalse(
- validate_config_lists(system_item_list, default_system_misc_info_keys,
- default_other_item_list))
+ validate_config_lists(framework_item_list,
+ DEFAULT_FRAMEWORK_MISC_INFO_KEYS,
+ DEFAULT_VENDOR_ITEM_LIST))
def test_validate_config_lists_ReturnsTrueIfDefaultItemInDifferentList(self):
- system_item_list = default_system_item_list[:]
- system_item_list.remove('ROOT/*')
- other_item_list = default_other_item_list[:]
- other_item_list.append('ROOT/*')
+ framework_item_list = list(DEFAULT_FRAMEWORK_ITEM_LIST)
+ framework_item_list.remove('ROOT/*')
+ vendor_item_list = list(DEFAULT_VENDOR_ITEM_LIST)
+ vendor_item_list.append('ROOT/*')
self.assertTrue(
- validate_config_lists(system_item_list, default_system_misc_info_keys,
- other_item_list))
+ validate_config_lists(framework_item_list,
+ DEFAULT_FRAMEWORK_MISC_INFO_KEYS,
+ vendor_item_list))
def test_validate_config_lists_ReturnsTrueIfExtraItem(self):
- system_item_list = default_system_item_list[:]
- system_item_list.append('MY_NEW_PARTITION/*')
+ framework_item_list = list(DEFAULT_FRAMEWORK_ITEM_LIST)
+ framework_item_list.append('MY_NEW_PARTITION/*')
self.assertTrue(
- validate_config_lists(system_item_list, default_system_misc_info_keys,
- default_other_item_list))
+ validate_config_lists(framework_item_list,
+ DEFAULT_FRAMEWORK_MISC_INFO_KEYS,
+ DEFAULT_VENDOR_ITEM_LIST))
+
+ def test_validate_config_lists_ReturnsFalseIfSharedExtractedPartition(self):
+ vendor_item_list = list(DEFAULT_VENDOR_ITEM_LIST)
+ vendor_item_list.append('SYSTEM/my_system_file')
+ self.assertFalse(
+ validate_config_lists(DEFAULT_FRAMEWORK_ITEM_LIST,
+ DEFAULT_FRAMEWORK_MISC_INFO_KEYS,
+ vendor_item_list))
def test_validate_config_lists_ReturnsFalseIfBadSystemMiscInfoKeys(self):
for bad_key in ['dynamic_partition_list', 'super_partition_groups']:
- system_misc_info_keys = default_system_misc_info_keys[:]
- system_misc_info_keys.append(bad_key)
+ framework_misc_info_keys = list(DEFAULT_FRAMEWORK_MISC_INFO_KEYS)
+ framework_misc_info_keys.append(bad_key)
self.assertFalse(
- validate_config_lists(default_system_item_list, system_misc_info_keys,
- default_other_item_list))
+ validate_config_lists(DEFAULT_FRAMEWORK_ITEM_LIST,
+ framework_misc_info_keys,
+ DEFAULT_VENDOR_ITEM_LIST))
- def test_merge_dynamic_partition_info_dicts_ReturnsMergedDict(self):
- system_dict = {
- 'super_partition_groups': 'group_a',
- 'dynamic_partition_list': 'system',
- 'super_group_a_list': 'system',
- }
- other_dict = {
- 'super_partition_groups': 'group_a group_b',
- 'dynamic_partition_list': 'vendor product',
- 'super_group_a_list': 'vendor',
- 'super_group_a_size': '1000',
- 'super_group_b_list': 'product',
- 'super_group_b_size': '2000',
- }
- merged_dict = merge_dynamic_partition_info_dicts(
- system_dict=system_dict,
- other_dict=other_dict,
- size_prefix='super_',
- size_suffix='_size',
- list_prefix='super_',
- list_suffix='_list')
- expected_merged_dict = {
- 'super_partition_groups': 'group_a group_b',
- 'dynamic_partition_list': 'system vendor product',
- 'super_group_a_list': 'system vendor',
- 'super_group_a_size': '1000',
- 'super_group_b_list': 'product',
- 'super_group_b_size': '2000',
- }
- self.assertEqual(merged_dict, expected_merged_dict)
+ def test_process_apex_keys_apk_certs_ReturnsTrueIfNoConflicts(self):
+ output_dir = common.MakeTempDir()
+ os.makedirs(os.path.join(output_dir, 'META'))
+
+ framework_dir = common.MakeTempDir()
+ os.makedirs(os.path.join(framework_dir, 'META'))
+ os.symlink(
+ os.path.join(self.testdata_dir, 'apexkeys_framework.txt'),
+ os.path.join(framework_dir, 'META', 'apexkeys.txt'))
+
+ vendor_dir = common.MakeTempDir()
+ os.makedirs(os.path.join(vendor_dir, 'META'))
+ os.symlink(
+ os.path.join(self.testdata_dir, 'apexkeys_vendor.txt'),
+ os.path.join(vendor_dir, 'META', 'apexkeys.txt'))
+
+ process_apex_keys_apk_certs_common(framework_dir, vendor_dir, output_dir,
+ 'apexkeys.txt')
+
+ merged_entries = []
+ merged_path = os.path.join(self.testdata_dir, 'apexkeys_merge.txt')
+
+ with open(merged_path) as f:
+ merged_entries = f.read().split('\n')
+
+ output_entries = []
+ output_path = os.path.join(output_dir, 'META', 'apexkeys.txt')
+
+ with open(output_path) as f:
+ output_entries = f.read().split('\n')
+
+ return self.assertEqual(merged_entries, output_entries)
+
+ def test_process_apex_keys_apk_certs_ReturnsFalseIfConflictsPresent(self):
+ output_dir = common.MakeTempDir()
+ os.makedirs(os.path.join(output_dir, 'META'))
+
+ framework_dir = common.MakeTempDir()
+ os.makedirs(os.path.join(framework_dir, 'META'))
+ os.symlink(
+ os.path.join(self.testdata_dir, 'apexkeys_framework.txt'),
+ os.path.join(framework_dir, 'META', 'apexkeys.txt'))
+
+ conflict_dir = common.MakeTempDir()
+ os.makedirs(os.path.join(conflict_dir, 'META'))
+ os.symlink(
+ os.path.join(self.testdata_dir, 'apexkeys_framework_conflict.txt'),
+ os.path.join(conflict_dir, 'META', 'apexkeys.txt'))
+
+ self.assertRaises(ValueError, process_apex_keys_apk_certs_common,
+ framework_dir, conflict_dir, output_dir, 'apexkeys.txt')
diff --git a/tools/releasetools/test_sign_apex.py b/tools/releasetools/test_sign_apex.py
new file mode 100644
index 0000000..b4ef127
--- /dev/null
+++ b/tools/releasetools/test_sign_apex.py
@@ -0,0 +1,42 @@
+#
+# Copyright (C) 2019 The Android Open Source Project
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+import os.path
+
+import common
+import sign_apex
+import test_utils
+
+
+class SignApexTest(test_utils.ReleaseToolsTestCase):
+
+ def setUp(self):
+ self.testdata_dir = test_utils.get_testdata_dir()
+ self.assertTrue(os.path.exists(self.testdata_dir))
+
+ common.OPTIONS.search_path = test_utils.get_search_path()
+
+ @test_utils.SkipIfExternalToolsUnavailable()
+ def test_SignApexFile(self):
+ foo_apex = os.path.join(self.testdata_dir, 'foo.apex')
+ payload_key = os.path.join(self.testdata_dir, 'testkey_RSA4096.key')
+ container_key = os.path.join(self.testdata_dir, 'testkey')
+ signed_foo_apex = sign_apex.SignApexFile(
+ 'avbtool',
+ foo_apex,
+ payload_key,
+ container_key)
+ self.assertTrue(os.path.exists(signed_foo_apex))
diff --git a/tools/releasetools/test_sign_target_files_apks.py b/tools/releasetools/test_sign_target_files_apks.py
index e142ebb..70c147e 100644
--- a/tools/releasetools/test_sign_target_files_apks.py
+++ b/tools/releasetools/test_sign_target_files_apks.py
@@ -15,6 +15,7 @@
#
import base64
+import io
import os.path
import zipfile
@@ -22,7 +23,7 @@
import test_utils
from sign_target_files_apks import (
CheckApkAndApexKeysAvailable, EditTags, GetApkFileInfo, ReadApexKeysInfo,
- ReplaceCerts, ReplaceVerityKeyId, RewriteProps)
+ ReplaceCerts, ReplaceVerityKeyId, RewriteProps, WriteOtacerts)
class SignTargetFilesApksTest(test_utils.ReleaseToolsTestCase):
@@ -70,10 +71,10 @@
'ro.product.build.fingerprint=foo/bar/release-keys'),
('ro.product.build.thumbprint=foo/bar/dev-keys',
'ro.product.build.thumbprint=foo/bar/release-keys'),
- ('ro.product_services.build.fingerprint=foo/bar/test-keys',
- 'ro.product_services.build.fingerprint=foo/bar/release-keys'),
- ('ro.product_services.build.thumbprint=foo/bar/test-keys',
- 'ro.product_services.build.thumbprint=foo/bar/release-keys'),
+ ('ro.system_ext.build.fingerprint=foo/bar/test-keys',
+ 'ro.system_ext.build.fingerprint=foo/bar/release-keys'),
+ ('ro.system_ext.build.thumbprint=foo/bar/test-keys',
+ 'ro.system_ext.build.thumbprint=foo/bar/release-keys'),
('# comment line 1', '# comment line 1'),
('ro.bootimage.build.fingerprint=foo/bar/dev-keys',
'ro.bootimage.build.fingerprint=foo/bar/release-keys'),
@@ -91,8 +92,8 @@
'ro.odm.build.tags=release-keys'),
('ro.product.build.tags=dev-keys',
'ro.product.build.tags=release-keys'),
- ('ro.product_services.build.tags=dev-keys',
- 'ro.product_services.build.tags=release-keys'),
+ ('ro.system_ext.build.tags=dev-keys',
+ 'ro.system_ext.build.tags=release-keys'),
('# comment line 2', '# comment line 2'),
('ro.build.display.id=OPR6.170623.012 dev-keys',
'ro.build.display.id=OPR6.170623.012'),
@@ -136,7 +137,7 @@
ReplaceVerityKeyId(input_zip, output_zip, cert_file)
with zipfile.ZipFile(output_file) as output_zip:
- self.assertEqual(BOOT_CMDLINE1, output_zip.read('BOOT/cmdline'))
+ self.assertEqual(BOOT_CMDLINE1, output_zip.read('BOOT/cmdline').decode())
# Test with the second certificate.
cert_file = os.path.join(self.testdata_dir, 'testkey.x509.pem')
@@ -146,7 +147,7 @@
ReplaceVerityKeyId(input_zip, output_zip, cert_file)
with zipfile.ZipFile(output_file) as output_zip:
- self.assertEqual(BOOT_CMDLINE2, output_zip.read('BOOT/cmdline'))
+ self.assertEqual(BOOT_CMDLINE2, output_zip.read('BOOT/cmdline').decode())
def test_ReplaceVerityKeyId_no_veritykeyid(self):
BOOT_CMDLINE = (
@@ -164,7 +165,7 @@
ReplaceVerityKeyId(input_zip, output_zip, None)
with zipfile.ZipFile(output_file) as output_zip:
- self.assertEqual(BOOT_CMDLINE, output_zip.read('BOOT/cmdline'))
+ self.assertEqual(BOOT_CMDLINE, output_zip.read('BOOT/cmdline').decode())
def test_ReplaceCerts(self):
cert1_path = os.path.join(self.testdata_dir, 'platform.x509.pem')
@@ -236,6 +237,22 @@
}
self.assertEqual(output_xml, ReplaceCerts(input_xml))
+ def test_WriteOtacerts(self):
+ certs = [
+ os.path.join(self.testdata_dir, 'platform.x509.pem'),
+ os.path.join(self.testdata_dir, 'media.x509.pem'),
+ os.path.join(self.testdata_dir, 'testkey.x509.pem'),
+ ]
+ entry_name = 'SYSTEM/etc/security/otacerts.zip'
+ output_file = common.MakeTempFile(suffix='.zip')
+ with zipfile.ZipFile(output_file, 'w') as output_zip:
+ WriteOtacerts(output_zip, entry_name, certs)
+ with zipfile.ZipFile(output_file) as input_zip:
+ self.assertIn(entry_name, input_zip.namelist())
+ otacerts_file = io.BytesIO(input_zip.read(entry_name))
+ with zipfile.ZipFile(otacerts_file) as otacerts_zip:
+ self.assertEqual(3, len(otacerts_zip.namelist()))
+
def test_CheckApkAndApexKeysAvailable(self):
input_file = common.MakeTempFile(suffix='.zip')
with zipfile.ZipFile(input_file, 'w') as input_zip:
diff --git a/tools/releasetools/test_utils.py b/tools/releasetools/test_utils.py
index 1e919f7..2445671 100755
--- a/tools/releasetools/test_utils.py
+++ b/tools/releasetools/test_utils.py
@@ -32,9 +32,12 @@
logging.basicConfig(stream=sys.stdout)
# Use ANDROID_BUILD_TOP as an indicator to tell if the needed tools (e.g.
-# avbtool, mke2fs) are available while running the tests. Not having the var or
-# having empty string means we can't run the tests that require external tools.
-EXTERNAL_TOOLS_UNAVAILABLE = not os.environ.get("ANDROID_BUILD_TOP")
+# avbtool, mke2fs) are available while running the tests, unless
+# FORCE_RUN_RELEASETOOLS is set to '1'. Not having the required vars means we
+# can't run the tests that require external tools.
+EXTERNAL_TOOLS_UNAVAILABLE = (
+ not os.environ.get('ANDROID_BUILD_TOP') and
+ os.environ.get('FORCE_RUN_RELEASETOOLS') != '1')
def SkipIfExternalToolsUnavailable():
diff --git a/tools/releasetools/test_validate_target_files.py b/tools/releasetools/test_validate_target_files.py
index 70e3b49..0f0d773 100644
--- a/tools/releasetools/test_validate_target_files.py
+++ b/tools/releasetools/test_validate_target_files.py
@@ -98,7 +98,7 @@
with open(boot_image, 'r+b') as boot_fp:
boot_fp.seek(-1, os.SEEK_END)
last_byte = boot_fp.read(1)
- last_byte = chr(255 - ord(last_byte))
+ last_byte = bytes([255 - ord(last_byte)])
boot_fp.seek(-1, os.SEEK_END)
boot_fp.write(last_byte)
diff --git a/tools/releasetools/test_verity_utils.py b/tools/releasetools/test_verity_utils.py
index 1cc539f..d02bc7f 100644
--- a/tools/releasetools/test_verity_utils.py
+++ b/tools/releasetools/test_verity_utils.py
@@ -47,25 +47,22 @@
}
self.hash_algorithm = "sha256"
- self.fixed_salt = \
- "aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7"
- self.expected_root_hash = \
- "0b7c4565e87b1026e11fbab91c0bc29e185c847a5b44d40e6e86e461e8adf80d"
+ self.fixed_salt = (
+ "aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7")
+ self.expected_root_hash = (
+ "0b7c4565e87b1026e11fbab91c0bc29e185c847a5b44d40e6e86e461e8adf80d")
- def _create_simg(self, raw_data):
+ def _CreateSimg(self, raw_data): # pylint: disable=no-self-use
output_file = common.MakeTempFile()
raw_image = common.MakeTempFile()
with open(raw_image, 'wb') as f:
f.write(raw_data)
cmd = ["img2simg", raw_image, output_file, '4096']
- p = common.Run(cmd)
- p.communicate()
- self.assertEqual(0, p.returncode)
-
+ common.RunAndCheckOutput(cmd)
return output_file
- def _generate_image(self):
+ def _GenerateImage(self):
partition_size = 1024 * 1024
prop_dict = {
'partition_size': str(partition_size),
@@ -79,11 +76,11 @@
self.assertIsNotNone(verity_image_builder)
adjusted_size = verity_image_builder.CalculateMaxImageSize()
- raw_image = ""
+ raw_image = bytearray(adjusted_size)
for i in range(adjusted_size):
- raw_image += str(i % 10)
+ raw_image[i] = ord('0') + i % 10
- output_file = self._create_simg(raw_image)
+ output_file = self._CreateSimg(raw_image)
# Append the verity metadata.
verity_image_builder.Build(output_file)
@@ -92,7 +89,7 @@
@SkipIfExternalToolsUnavailable()
def test_CreateHashtreeInfoGenerator(self):
- image_file = sparse_img.SparseImage(self._generate_image())
+ image_file = sparse_img.SparseImage(self._GenerateImage())
generator = CreateHashtreeInfoGenerator(
'system', image_file, self.prop_dict)
@@ -103,7 +100,7 @@
@SkipIfExternalToolsUnavailable()
def test_DecomposeSparseImage(self):
- image_file = sparse_img.SparseImage(self._generate_image())
+ image_file = sparse_img.SparseImage(self._GenerateImage())
generator = VerifiedBootVersion1HashtreeInfoGenerator(
self.partition_size, 4096, True)
@@ -114,7 +111,7 @@
@SkipIfExternalToolsUnavailable()
def test_ParseHashtreeMetadata(self):
- image_file = sparse_img.SparseImage(self._generate_image())
+ image_file = sparse_img.SparseImage(self._GenerateImage())
generator = VerifiedBootVersion1HashtreeInfoGenerator(
self.partition_size, 4096, True)
generator.DecomposeSparseImage(image_file)
@@ -131,12 +128,12 @@
def test_ValidateHashtree_smoke(self):
generator = VerifiedBootVersion1HashtreeInfoGenerator(
self.partition_size, 4096, True)
- generator.image = sparse_img.SparseImage(self._generate_image())
+ generator.image = sparse_img.SparseImage(self._GenerateImage())
generator.hashtree_info = info = HashtreeInfo()
- info.filesystem_range = RangeSet(data=[0, 991232 / 4096])
+ info.filesystem_range = RangeSet(data=[0, 991232 // 4096])
info.hashtree_range = RangeSet(
- data=[991232 / 4096, (991232 + 12288) / 4096])
+ data=[991232 // 4096, (991232 + 12288) // 4096])
info.hash_algorithm = self.hash_algorithm
info.salt = self.fixed_salt
info.root_hash = self.expected_root_hash
@@ -147,12 +144,12 @@
def test_ValidateHashtree_failure(self):
generator = VerifiedBootVersion1HashtreeInfoGenerator(
self.partition_size, 4096, True)
- generator.image = sparse_img.SparseImage(self._generate_image())
+ generator.image = sparse_img.SparseImage(self._GenerateImage())
generator.hashtree_info = info = HashtreeInfo()
- info.filesystem_range = RangeSet(data=[0, 991232 / 4096])
+ info.filesystem_range = RangeSet(data=[0, 991232 // 4096])
info.hashtree_range = RangeSet(
- data=[991232 / 4096, (991232 + 12288) / 4096])
+ data=[991232 // 4096, (991232 + 12288) // 4096])
info.hash_algorithm = self.hash_algorithm
info.salt = self.fixed_salt
info.root_hash = "a" + self.expected_root_hash[1:]
@@ -161,12 +158,12 @@
@SkipIfExternalToolsUnavailable()
def test_Generate(self):
- image_file = sparse_img.SparseImage(self._generate_image())
+ image_file = sparse_img.SparseImage(self._GenerateImage())
generator = CreateHashtreeInfoGenerator('system', 4096, self.prop_dict)
info = generator.Generate(image_file)
- self.assertEqual(RangeSet(data=[0, 991232 / 4096]), info.filesystem_range)
- self.assertEqual(RangeSet(data=[991232 / 4096, (991232 + 12288) / 4096]),
+ self.assertEqual(RangeSet(data=[0, 991232 // 4096]), info.filesystem_range)
+ self.assertEqual(RangeSet(data=[991232 // 4096, (991232 + 12288) // 4096]),
info.hashtree_range)
self.assertEqual(self.hash_algorithm, info.hash_algorithm)
self.assertEqual(self.fixed_salt, info.salt)
diff --git a/tools/releasetools/testdata/apexkeys_framework.txt b/tools/releasetools/testdata/apexkeys_framework.txt
new file mode 100644
index 0000000..2346668
--- /dev/null
+++ b/tools/releasetools/testdata/apexkeys_framework.txt
@@ -0,0 +1,2 @@
+name="com.android.runtime.debug.apex" public_key="art/build/apex/com.android.runtime.avbpubkey" private_key="art/build/apex/com.android.runtime.pem" container_certificate="art/build/apex/com.android.runtime.debug.x509.pem" container_private_key="art/build/apex/com.android.runtime.debug.pk8"
+name="com.android.conscrypt.apex" public_key="external/conscrypt/apex/com.android.conscrypt.avbpubkey" private_key="external/conscrypt/apex/com.android.conscrypt.pem" container_certificate="external/conscrypt/apex/com.android.conscrypt.x509.pem" container_private_key="external/conscrypt/apex/com.android.conscrypt.pk8"
diff --git a/tools/releasetools/testdata/apexkeys_framework_conflict.txt b/tools/releasetools/testdata/apexkeys_framework_conflict.txt
new file mode 100644
index 0000000..caa21c2
--- /dev/null
+++ b/tools/releasetools/testdata/apexkeys_framework_conflict.txt
@@ -0,0 +1 @@
+name="com.android.runtime.debug.apex" public_key="art/build/apex/com.android.runtime.avbpubkey" private_key="art/build/apex/com.android.runtime.pem" container_certificate="art/build/apex/com.android.runtime.release.x509.pem" container_private_key="art/build/apex/com.android.runtime.debug.pk8"
diff --git a/tools/releasetools/testdata/apexkeys_merge.txt b/tools/releasetools/testdata/apexkeys_merge.txt
new file mode 100644
index 0000000..48e789f
--- /dev/null
+++ b/tools/releasetools/testdata/apexkeys_merge.txt
@@ -0,0 +1,4 @@
+name="com.android.conscrypt.apex" public_key="external/conscrypt/apex/com.android.conscrypt.avbpubkey" private_key="external/conscrypt/apex/com.android.conscrypt.pem" container_certificate="external/conscrypt/apex/com.android.conscrypt.x509.pem" container_private_key="external/conscrypt/apex/com.android.conscrypt.pk8"
+name="com.android.runtime.debug.apex" public_key="art/build/apex/com.android.runtime.avbpubkey" private_key="art/build/apex/com.android.runtime.pem" container_certificate="art/build/apex/com.android.runtime.debug.x509.pem" container_private_key="art/build/apex/com.android.runtime.debug.pk8"
+name="com.android.runtime.release.apex" public_key="art/build/apex/com.android.runtime.avbpubkey" private_key="art/build/apex/com.android.runtime.pem" container_certificate="art/build/apex/com.android.runtime.release.x509.pem" container_private_key="art/build/apex/com.android.runtime.release.pk8"
+name="com.android.support.apexer.apex" public_key="system/apex/apexer/etc/com.android.support.apexer.avbpubkey" private_key="system/apex/apexer/etc/com.android.support.apexer.pem" container_certificate="build/target/product/security/testkey.x509.pem" container_private_key="build/target/product/security/testkey.pk8"
diff --git a/tools/releasetools/testdata/apexkeys_vendor.txt b/tools/releasetools/testdata/apexkeys_vendor.txt
new file mode 100644
index 0000000..b751227
--- /dev/null
+++ b/tools/releasetools/testdata/apexkeys_vendor.txt
@@ -0,0 +1,3 @@
+name="com.android.runtime.release.apex" public_key="art/build/apex/com.android.runtime.avbpubkey" private_key="art/build/apex/com.android.runtime.pem" container_certificate="art/build/apex/com.android.runtime.release.x509.pem" container_private_key="art/build/apex/com.android.runtime.release.pk8"
+name="com.android.support.apexer.apex" public_key="system/apex/apexer/etc/com.android.support.apexer.avbpubkey" private_key="system/apex/apexer/etc/com.android.support.apexer.pem" container_certificate="build/target/product/security/testkey.x509.pem" container_private_key="build/target/product/security/testkey.pk8"
+name="com.android.runtime.debug.apex" public_key="art/build/apex/com.android.runtime.avbpubkey" private_key="art/build/apex/com.android.runtime.pem" container_certificate="art/build/apex/com.android.runtime.debug.x509.pem" container_private_key="art/build/apex/com.android.runtime.debug.pk8"
diff --git a/tools/releasetools/testdata/foo.apex b/tools/releasetools/testdata/foo.apex
new file mode 100644
index 0000000..42e0adb
--- /dev/null
+++ b/tools/releasetools/testdata/foo.apex
Binary files differ
diff --git a/tools/releasetools/testdata/merge_config_system_item_list b/tools/releasetools/testdata/merge_config_framework_item_list
similarity index 100%
rename from tools/releasetools/testdata/merge_config_system_item_list
rename to tools/releasetools/testdata/merge_config_framework_item_list
diff --git a/tools/releasetools/validate_target_files.py b/tools/releasetools/validate_target_files.py
index 1c856a8..d189499 100755
--- a/tools/releasetools/validate_target_files.py
+++ b/tools/releasetools/validate_target_files.py
@@ -44,7 +44,7 @@
"""Constructs and returns a File object. Rounds up its size if needed."""
assert os.path.exists(unpacked_name)
- with open(unpacked_name, 'r') as f:
+ with open(unpacked_name, 'rb') as f:
file_data = f.read()
file_size = len(file_data)
if round_up:
@@ -257,7 +257,10 @@
if verity_key is None:
verity_key = info_dict['verity_key'] + '.x509.pem'
for image in ('boot.img', 'recovery.img', 'recovery-two-step.img'):
- image_path = os.path.join(input_tmp, 'IMAGES', image)
+ if image == 'recovery-two-step.img':
+ image_path = os.path.join(input_tmp, 'OTA', image)
+ else:
+ image_path = os.path.join(input_tmp, 'IMAGES', image)
if not os.path.exists(image_path):
continue
@@ -324,14 +327,18 @@
# avbtool verifies all the images that have descriptors listed in vbmeta.
image = os.path.join(input_tmp, 'IMAGES', 'vbmeta.img')
- cmd = ['avbtool', 'verify_image', '--image', image, '--key', key]
+ cmd = [info_dict['avb_avbtool'], 'verify_image', '--image', image,
+ '--key', key]
# Append the args for chained partitions if any.
- for partition in common.AVB_PARTITIONS:
+ for partition in common.AVB_PARTITIONS + common.AVB_VBMETA_PARTITIONS:
key_name = 'avb_' + partition + '_key_path'
if info_dict.get(key_name) is not None:
+ # Use the key file from command line if specified; otherwise fall back
+ # to the one in info dict.
+ key_file = options.get(key_name, info_dict[key_name])
chained_partition_arg = common.GetAvbChainedPartitionArg(
- partition, info_dict, options[key_name])
+ partition, info_dict, key_file)
cmd.extend(["--expected_chain_partition", chained_partition_arg])
proc = common.Run(cmd)
@@ -357,7 +364,7 @@
help='the verity public key to verify the bootable images (Verified '
'Boot 1.0), or the vbmeta image (Verified Boot 2.0, aka AVB), where '
'applicable')
- for partition in common.AVB_PARTITIONS:
+ for partition in common.AVB_PARTITIONS + common.AVB_VBMETA_PARTITIONS:
parser.add_argument(
'--avb_' + partition + '_key_path',
help='the public or private key in PEM format to verify AVB chained '
diff --git a/tools/releasetools/verity_utils.py b/tools/releasetools/verity_utils.py
index 3063800..e7f84f5 100644
--- a/tools/releasetools/verity_utils.py
+++ b/tools/releasetools/verity_utils.py
@@ -131,7 +131,8 @@
BuildVerityImageError: On error.
"""
try:
- with open(target, "a") as out_file, open(file_to_append, "r") as input_file:
+ with open(target, 'ab') as out_file, \
+ open(file_to_append, 'rb') as input_file:
for line in input_file:
out_file.write(line)
except IOError:
@@ -178,6 +179,8 @@
# key_path and algorithm are only available when chain partition is used.
key_path = prop_dict.get("avb_key_path")
algorithm = prop_dict.get("avb_algorithm")
+
+ # Image uses hash footer.
if prop_dict.get("avb_hash_enable") == "true":
return VerifiedBootVersion2VerityImageBuilder(
prop_dict["partition_name"],
@@ -188,16 +191,17 @@
algorithm,
prop_dict.get("avb_salt"),
prop_dict["avb_add_hash_footer_args"])
- else:
- return VerifiedBootVersion2VerityImageBuilder(
- prop_dict["partition_name"],
- partition_size,
- VerifiedBootVersion2VerityImageBuilder.AVB_HASHTREE_FOOTER,
- prop_dict["avb_avbtool"],
- key_path,
- algorithm,
- prop_dict.get("avb_salt"),
- prop_dict["avb_add_hashtree_footer_args"])
+
+ # Image uses hashtree footer.
+ return VerifiedBootVersion2VerityImageBuilder(
+ prop_dict["partition_name"],
+ partition_size,
+ VerifiedBootVersion2VerityImageBuilder.AVB_HASHTREE_FOOTER,
+ prop_dict["avb_avbtool"],
+ key_path,
+ algorithm,
+ prop_dict.get("avb_salt"),
+ prop_dict["avb_add_hashtree_footer_args"])
return None
@@ -605,19 +609,19 @@
self.metadata_size = metadata_size
self.hashtree_info.filesystem_range = RangeSet(
- data=[0, adjusted_size / self.block_size])
+ data=[0, adjusted_size // self.block_size])
self.hashtree_info.hashtree_range = RangeSet(
- data=[adjusted_size / self.block_size,
- (adjusted_size + verity_tree_size) / self.block_size])
+ data=[adjusted_size // self.block_size,
+ (adjusted_size + verity_tree_size) // self.block_size])
def _ParseHashtreeMetadata(self):
"""Parses the hash_algorithm, root_hash, salt from the metadata block."""
metadata_start = self.filesystem_size + self.hashtree_size
metadata_range = RangeSet(
- data=[metadata_start / self.block_size,
- (metadata_start + self.metadata_size) / self.block_size])
- meta_data = ''.join(self.image.ReadRangeSet(metadata_range))
+ data=[metadata_start // self.block_size,
+ (metadata_start + self.metadata_size) // self.block_size])
+ meta_data = b''.join(self.image.ReadRangeSet(metadata_range))
# More info about the metadata structure available in:
# system/extras/verity/build_verity_metadata.py
@@ -640,9 +644,9 @@
assert (int(table_entries[5]) * self.block_size == self.filesystem_size and
int(table_entries[6]) * self.block_size == self.filesystem_size)
- self.hashtree_info.hash_algorithm = table_entries[7]
- self.hashtree_info.root_hash = table_entries[8]
- self.hashtree_info.salt = table_entries[9]
+ self.hashtree_info.hash_algorithm = table_entries[7].decode()
+ self.hashtree_info.root_hash = table_entries[8].decode()
+ self.hashtree_info.salt = table_entries[9].decode()
def ValidateHashtree(self):
"""Checks that we can reconstruct the verity hash tree."""
@@ -669,8 +673,8 @@
# Reads the generated hash tree and checks if it has the exact same bytes
# as the one in the sparse image.
- with open(generated_verity_tree, "rb") as fd:
- return fd.read() == ''.join(self.image.ReadRangeSet(
+ with open(generated_verity_tree, 'rb') as fd:
+ return fd.read() == b''.join(self.image.ReadRangeSet(
self.hashtree_info.hashtree_range))
def Generate(self, image):
diff --git a/tools/signapk/src/com/android/signapk/SignApk.java b/tools/signapk/src/com/android/signapk/SignApk.java
index 57973ec..9809ed4 100644
--- a/tools/signapk/src/com/android/signapk/SignApk.java
+++ b/tools/signapk/src/com/android/signapk/SignApk.java
@@ -381,9 +381,8 @@
byte[] buffer = new byte[4096];
int num;
- List<Pattern> pinPatterns = extractPinPatterns(in);
+ List<Hints.PatternWithRange> pinPatterns = extractPinPatterns(in);
ArrayList<Hints.ByteRange> pinByteRanges = pinPatterns == null ? null : new ArrayList<>();
- HashSet<String> namesToPin = new HashSet<>();
ArrayList<String> names = new ArrayList<String>();
for (Enumeration<JarEntry> e = in.entries(); e.hasMoreElements();) {
@@ -399,13 +398,6 @@
if (Hints.PIN_BYTE_RANGE_ZIP_ENTRY_NAME.equals(entryName)) {
continue; // We regenerate it below.
}
- if (pinPatterns != null) {
- for (Pattern pinPattern : pinPatterns) {
- if (pinPattern.matcher(entryName).matches()) {
- namesToPin.add(entryName);
- }
- }
- }
names.add(entryName);
}
Collections.sort(names);
@@ -485,6 +477,7 @@
DataSink entryDataSink =
(inspectEntryRequest != null) ? inspectEntryRequest.getDataSink() : null;
+ long entryDataStart = outCounter.getWrittenBytes();
try (InputStream data = in.getInputStream(inEntry)) {
while ((num = data.read(buffer)) > 0) {
out.write(buffer, 0, num);
@@ -500,11 +493,27 @@
inspectEntryRequest.done();
}
- if (namesToPin.contains(name)) {
- pinByteRanges.add(
- new Hints.ByteRange(
- entryHeaderStart,
- outCounter.getWrittenBytes()));
+ if (pinPatterns != null) {
+ boolean pinFileHeader = false;
+ for (Hints.PatternWithRange pinPattern : pinPatterns) {
+ if (!pinPattern.matcher(name).matches()) {
+ continue;
+ }
+ Hints.ByteRange dataRange =
+ new Hints.ByteRange(
+ entryDataStart,
+ outCounter.getWrittenBytes());
+ Hints.ByteRange pinRange =
+ pinPattern.ClampToAbsoluteByteRange(dataRange);
+ if (pinRange != null) {
+ pinFileHeader = true;
+ pinByteRanges.add(pinRange);
+ }
+ }
+ if (pinFileHeader) {
+ pinByteRanges.add(new Hints.ByteRange(entryHeaderStart,
+ entryDataStart));
+ }
}
}
@@ -528,6 +537,7 @@
DataSink entryDataSink =
(inspectEntryRequest != null) ? inspectEntryRequest.getDataSink() : null;
+ long entryDataStart = outCounter.getWrittenBytes();
InputStream data = in.getInputStream(inEntry);
while ((num = data.read(buffer)) > 0) {
out.write(buffer, 0, num);
@@ -541,11 +551,27 @@
inspectEntryRequest.done();
}
- if (namesToPin.contains(name)) {
- pinByteRanges.add(
- new Hints.ByteRange(
- entryHeaderStart,
- outCounter.getWrittenBytes()));
+ if (pinPatterns != null) {
+ boolean pinFileHeader = false;
+ for (Hints.PatternWithRange pinPattern : pinPatterns) {
+ if (!pinPattern.matcher(name).matches()) {
+ continue;
+ }
+ Hints.ByteRange dataRange =
+ new Hints.ByteRange(
+ entryDataStart,
+ outCounter.getWrittenBytes());
+ Hints.ByteRange pinRange =
+ pinPattern.ClampToAbsoluteByteRange(dataRange);
+ if (pinRange != null) {
+ pinFileHeader = true;
+ pinByteRanges.add(pinRange);
+ }
+ }
+ if (pinFileHeader) {
+ pinByteRanges.add(new Hints.ByteRange(entryHeaderStart,
+ entryDataStart));
+ }
}
}
@@ -558,7 +584,7 @@
}
}
- private static List<Pattern> extractPinPatterns(JarFile in) throws IOException {
+ private static List<Hints.PatternWithRange> extractPinPatterns(JarFile in) throws IOException {
ZipEntry pinMetaEntry = in.getEntry(Hints.PIN_HINT_ASSET_ZIP_ENTRY_NAME);
if (pinMetaEntry == null) {
return null;
diff --git a/tools/warn.py b/tools/warn.py
index c710164..48feb49 100755
--- a/tools/warn.py
+++ b/tools/warn.py
@@ -1,5 +1,5 @@
#!/usr/bin/python
-# This file uses the following encoding: utf-8
+# Prefer python3 but work also with python2.
"""Grep warnings messages and output HTML tables or warning counts in CSV.
@@ -74,9 +74,11 @@
# escape_string, strip_escape_string, emit_warning_arrays
# emit_js_data():
+from __future__ import print_function
import argparse
import cgi
import csv
+import io
import multiprocessing
import os
import re
@@ -540,7 +542,7 @@
{'category': 'java',
'severity': Severity.LOW,
'description':
- 'Java: Use Java\'s utility functional interfaces instead of Function\u003cA, B> for primitive types.',
+ u'Java: Use Java\'s utility functional interfaces instead of Function\u003cA, B> for primitive types.',
'patterns': [r".*: warning: \[LambdaFunctionalInterface\] .+"]},
{'category': 'java',
'severity': Severity.LOW,
@@ -1270,7 +1272,7 @@
{'category': 'java',
'severity': Severity.MEDIUM,
'description':
- 'Java: Prefer the short-circuiting boolean operators \u0026\u0026 and || to \u0026 and |.',
+ u'Java: Prefer the short-circuiting boolean operators \u0026\u0026 and || to \u0026 and |.',
'patterns': [r".*: warning: \[ShortCircuitBoolean\] .+"]},
{'category': 'java',
'severity': Severity.MEDIUM,
@@ -1535,7 +1537,7 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: Implementing \'Comparable\u003cT>\' where T is not compatible with the implementing class.',
+ u'Java: Implementing \'Comparable\u003cT>\' where T is not compatible with the implementing class.',
'patterns': [r".*: warning: \[ComparableType\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
@@ -1790,7 +1792,7 @@
{'category': 'java',
'severity': Severity.HIGH,
'description':
- 'Java: Path implements Iterable\u003cPath>; prefer Collection\u003cPath> for clarity',
+ u'Java: Path implements Iterable\u003cPath>; prefer Collection\u003cPath> for clarity',
'patterns': [r".*: warning: \[IterablePathParameter\] .+"]},
{'category': 'java',
'severity': Severity.HIGH,
@@ -2814,7 +2816,6 @@
simple_project_pattern('system/extras/memory_replay'),
simple_project_pattern('system/extras/mmap-perf'),
simple_project_pattern('system/extras/multinetwork'),
- simple_project_pattern('system/extras/perfprofd'),
simple_project_pattern('system/extras/procrank'),
simple_project_pattern('system/extras/runconuid'),
simple_project_pattern('system/extras/showmap'),
@@ -2922,17 +2923,17 @@
def dump_html_prologue(title):
- print '<html>\n<head>'
- print '<title>' + title + '</title>'
- print html_head_scripts
+ print('<html>\n<head>')
+ print('<title>' + title + '</title>')
+ print(html_head_scripts)
emit_stats_by_project()
- print '</head>\n<body>'
- print html_big(title)
- print '<p>'
+ print('</head>\n<body>')
+ print(html_big(title))
+ print('<p>')
def dump_html_epilogue():
- print '</body>\n</head>\n</html>'
+ print('</body>\n</head>\n</html>')
def sort_warnings():
@@ -2943,6 +2944,7 @@
def emit_stats_by_project():
"""Dump a google chart table of warnings per project and severity."""
# warnings[p][s] is number of warnings in project p of severity s.
+ # pylint:disable=g-complex-comprehension
warnings = {p: {s: 0 for s in Severity.range} for p in project_names}
for i in warn_patterns:
s = i['severity']
@@ -2988,11 +2990,11 @@
total_all_severities += total_by_severity[s]
one_row.append(total_all_projects)
stats_rows.append(one_row)
- print '<script>'
+ print('<script>')
emit_const_string_array('StatsHeader', stats_header)
emit_const_object_array('StatsRows', stats_rows)
- print draw_table_javascript
- print '</script>'
+ print(draw_table_javascript)
+ print('</script>')
def dump_stats():
@@ -3008,14 +3010,14 @@
skipped += len(i['members'])
else:
known += len(i['members'])
- print 'Number of classified warnings: <b>' + str(known) + '</b><br>'
- print 'Number of skipped warnings: <b>' + str(skipped) + '</b><br>'
- print 'Number of unclassified warnings: <b>' + str(unknown) + '</b><br>'
+ print('Number of classified warnings: <b>' + str(known) + '</b><br>')
+ print('Number of skipped warnings: <b>' + str(skipped) + '</b><br>')
+ print('Number of unclassified warnings: <b>' + str(unknown) + '</b><br>')
total = unknown + known + skipped
extra_msg = ''
if total < 1000:
extra_msg = ' (low count may indicate incremental build)'
- print 'Total number of warnings: <b>' + str(total) + '</b>' + extra_msg
+ print('Total number of warnings: <b>' + str(total) + '</b>' + extra_msg)
# New base table of warnings, [severity, warn_id, project, warning_message]
@@ -3029,14 +3031,14 @@
# id for each warning pattern
# sort by project, severity, warn_id, warning_message
def emit_buttons():
- print ('<button class="button" onclick="expandCollapse(1);">'
- 'Expand all warnings</button>\n'
- '<button class="button" onclick="expandCollapse(0);">'
- 'Collapse all warnings</button>\n'
- '<button class="button" onclick="groupBySeverity();">'
- 'Group warnings by severity</button>\n'
- '<button class="button" onclick="groupByProject();">'
- 'Group warnings by project</button><br>')
+ print('<button class="button" onclick="expandCollapse(1);">'
+ 'Expand all warnings</button>\n'
+ '<button class="button" onclick="expandCollapse(0);">'
+ 'Collapse all warnings</button>\n'
+ '<button class="button" onclick="groupBySeverity();">'
+ 'Group warnings by severity</button>\n'
+ '<button class="button" onclick="groupByProject();">'
+ 'Group warnings by project</button><br>')
def all_patterns(category):
@@ -3051,14 +3053,14 @@
"""Show which warnings no longer occur."""
anchor = 'fixed_warnings'
mark = anchor + '_mark'
- print ('\n<br><p style="background-color:lightblue"><b>'
- '<button id="' + mark + '" '
- 'class="bt" onclick="expand(\'' + anchor + '\');">'
- '⊕</button> Fixed warnings. '
- 'No more occurrences. Please consider turning these into '
- 'errors if possible, before they are reintroduced in to the build'
- ':</b></p>')
- print '<blockquote>'
+ print('\n<br><p style="background-color:lightblue"><b>'
+ '<button id="' + mark + '" '
+ 'class="bt" onclick="expand(\'' + anchor + '\');">'
+ '⊕</button> Fixed warnings. '
+ 'No more occurrences. Please consider turning these into '
+ 'errors if possible, before they are reintroduced in to the build'
+ ':</b></p>')
+ print('<blockquote>')
fixed_patterns = []
for i in warn_patterns:
if not i['members']:
@@ -3066,16 +3068,16 @@
all_patterns(i) + ')')
if i['option']:
fixed_patterns.append(' ' + i['option'])
- fixed_patterns.sort()
- print '<div id="' + anchor + '" style="display:none;"><table>'
+ fixed_patterns = sorted(fixed_patterns)
+ print('<div id="' + anchor + '" style="display:none;"><table>')
cur_row_class = 0
for text in fixed_patterns:
cur_row_class = 1 - cur_row_class
# remove last '\n'
t = text[:-1] if text[-1] == '\n' else text
- print '<tr><td class="c' + str(cur_row_class) + '">' + t + '</td></tr>'
- print '</table></div>'
- print '</blockquote>'
+ print('<tr><td class="c' + str(cur_row_class) + '">' + t + '</td></tr>')
+ print('</table></div>')
+ print('</blockquote>')
def find_project_index(line):
@@ -3187,8 +3189,9 @@
def normalize_warning_line(line):
"""Normalize file path relative to android_root in a warning line."""
# replace fancy quotes with plain ol' quotes
- line = line.replace('‘', "'")
- line = line.replace('’', "'")
+ line = re.sub(u'[\u2018\u2019]', '\'', line)
+ # replace non-ASCII chars to spaces
+ line = re.sub(u'[^\x00-\x7f]', ' ', line)
line = line.strip()
first_column = line.find(':')
if first_column > 0:
@@ -3246,21 +3249,22 @@
def emit_warning_array(name):
- print 'var warning_{} = ['.format(name)
+ print('var warning_{} = ['.format(name))
for i in range(len(warn_patterns)):
- print '{},'.format(warn_patterns[i][name])
- print '];'
+ print('{},'.format(warn_patterns[i][name]))
+ print('];')
def emit_warning_arrays():
emit_warning_array('severity')
- print 'var warning_description = ['
+ print('var warning_description = [')
for i in range(len(warn_patterns)):
if warn_patterns[i]['members']:
- print '"{}",'.format(escape_string(warn_patterns[i]['description']))
+ print('"{}",'.format(escape_string(warn_patterns[i]['description'])))
else:
- print '"",' # no such warning
- print '];'
+ print('"",') # no such warning
+ print('];')
+
scripts_for_warning_groups = """
function compareMessages(x1, x2) { // of the same warning type
@@ -3393,39 +3397,42 @@
# Emit a JavaScript const string
def emit_const_string(name, value):
- print 'const ' + name + ' = "' + escape_string(value) + '";'
+ print('const ' + name + ' = "' + escape_string(value) + '";')
# Emit a JavaScript const integer array.
def emit_const_int_array(name, array):
- print 'const ' + name + ' = ['
+ print('const ' + name + ' = [')
for n in array:
- print str(n) + ','
- print '];'
+ print(str(n) + ',')
+ print('];')
# Emit a JavaScript const string array.
def emit_const_string_array(name, array):
- print 'const ' + name + ' = ['
+ print('const ' + name + ' = [')
for s in array:
- print '"' + strip_escape_string(s) + '",'
- print '];'
+ print('"' + strip_escape_string(s) + '",')
+ print('];')
# Emit a JavaScript const string array for HTML.
def emit_const_html_string_array(name, array):
- print 'const ' + name + ' = ['
+ print('const ' + name + ' = [')
for s in array:
- print '"' + cgi.escape(strip_escape_string(s)) + '",'
- print '];'
+ # Not using html.escape yet, to work for both python 2 and 3,
+ # until all users switch to python 3.
+ # pylint:disable=deprecated-method
+ print('"' + cgi.escape(strip_escape_string(s)) + '",')
+ print('];')
# Emit a JavaScript const object array.
def emit_const_object_array(name, array):
- print 'const ' + name + ' = ['
+ print('const ' + name + ' = [')
for x in array:
- print str(x) + ','
- print '];'
+ print(str(x) + ',')
+ print('];')
def emit_js_data():
@@ -3471,18 +3478,18 @@
dump_html_prologue('Warnings for ' + platform_version + ' - ' +
target_product + ' - ' + target_variant)
dump_stats()
- print '<br><div id="stats_table"></div><br>'
- print '\n<script>'
+ print('<br><div id="stats_table"></div><br>')
+ print('\n<script>')
emit_js_data()
- print scripts_for_warning_groups
- print '</script>'
+ print(scripts_for_warning_groups)
+ print('</script>')
emit_buttons()
# Warning messages are grouped by severities or project names.
- print '<br><div id="warning_groups"></div>'
+ print('<br><div id="warning_groups"></div>')
if args.byproject:
- print '<script>groupByProject();</script>'
+ print('<script>groupByProject();</script>')
else:
- print '<script>groupBySeverity();</script>'
+ print('<script>groupBySeverity();</script>')
dump_fixed()
dump_html_epilogue()
@@ -3506,8 +3513,7 @@
warning = kind + ': ' + description_for_csv(i)
writer.writerow([n, '', warning])
# print number of warnings for each project, ordered by project name.
- projects = i['projects'].keys()
- projects.sort()
+ projects = sorted(i['projects'].keys())
for p in projects:
writer.writerow([i['projects'][p], p, warning])
writer.writerow([total, '', kind + ' warnings'])
@@ -3526,7 +3532,9 @@
def main():
- warning_lines = parse_input_file(open(args.buildlog, 'r'))
+ # We must use 'utf-8' codec to parse some non-ASCII code in warnings.
+ warning_lines = parse_input_file(
+ io.open(args.buildlog, mode='r', encoding='utf-8'))
parallel_classify_warnings(warning_lines)
# If a user pases a csv path, save the fileoutput to the path
# If the user also passed gencsv write the output to stdout