aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--CleanSpec.mk2
-rw-r--r--core/Makefile584
-rw-r--r--core/base_rules.mk2
-rw-r--r--core/binary.mk41
-rw-r--r--core/ccache.mk10
-rw-r--r--core/clear_vars.mk4
-rw-r--r--core/combo/HOST_EXTRA_wsl-x86_64.mk18
-rw-r--r--core/combo/HOST_darwin-x86.mk7
-rw-r--r--core/combo/HOST_linux-x86_64.mk5
-rw-r--r--core/config.mk81
-rw-r--r--core/definitions.mk16
-rw-r--r--core/dex_preopt.mk2
-rw-r--r--core/dex_preopt_libart.mk4
-rw-r--r--core/envsetup.mk10
-rw-r--r--core/main.mk31
-rw-r--r--core/package_internal.mk14
-rw-r--r--core/pathmap.mk2
-rw-r--r--core/product.mk13
-rw-r--r--core/product_config.mk30
-rw-r--r--core/soong_app_prebuilt.mk2
-rw-r--r--core/soong_config.mk2
-rw-r--r--core/tasks/deps_licenses.mk2
-rw-r--r--core/tasks/oem_image.mk2
-rw-r--r--core/tasks/vendor_module_check.mk2
-rw-r--r--envsetup.sh83
-rw-r--r--target/board/BoardConfigEmuCommon.mk41
-rw-r--r--target/board/BoardConfigGsiCommon.mk57
-rw-r--r--target/board/generic/BoardConfig.mk81
-rw-r--r--target/board/generic/device.mk8
-rw-r--r--target/board/generic_arm64/BoardConfig.mk74
-rw-r--r--target/board/generic_arm64/device.mk8
-rw-r--r--target/board/generic_arm64_ab/BoardConfig.mk4
-rw-r--r--target/board/generic_arm_64b_a/BoardConfig.mk31
-rw-r--r--target/board/generic_arm_64b_ab/BoardConfig.mk35
-rw-r--r--target/board/generic_arm_a/BoardConfig.mk3
-rw-r--r--target/board/generic_arm_ab/BoardConfig.mk7
-rw-r--r--target/board/generic_x86/BoardConfig.mk97
-rw-r--r--target/board/generic_x86/device.mk8
-rwxr-xr-xtarget/board/generic_x86_64/BoardConfig.mk92
-rwxr-xr-xtarget/board/generic_x86_64/device.mk8
-rw-r--r--target/board/treble_common.mk28
-rw-r--r--target/board/treble_common_32.mk4
-rw-r--r--target/board/treble_common_64.mk3
-rw-r--r--target/product/AndroidProducts.mk2
-rw-r--r--target/product/aosp_arm.mk21
-rw-r--r--target/product/aosp_arm64.mk21
-rw-r--r--target/product/aosp_arm64_ab.mk12
-rw-r--r--target/product/aosp_arm_64b_a.mk27
-rw-r--r--target/product/aosp_arm_64b_ab.mk27
-rw-r--r--target/product/aosp_arm_ab.mk12
-rw-r--r--target/product/aosp_x86.mk21
-rw-r--r--target/product/aosp_x86_64.mk21
-rw-r--r--target/product/aosp_x86_64_ab.mk12
-rw-r--r--target/product/aosp_x86_ab.mk12
-rw-r--r--target/product/core.mk1
-rw-r--r--target/product/core_base.mk5
-rw-r--r--target/product/core_minimal.mk2
-rw-r--r--target/product/full_base.mk17
-rw-r--r--target/product/full_base_telephony.mk7
-rw-r--r--target/product/generic_no_telephony.mk1
-rw-r--r--target/product/languages_full.mk6
-rw-r--r--target/product/treble_common.mk16
-rwxr-xr-xtools/buildinfo.sh2
-rw-r--r--tools/fs_config/Android.mk14
-rwxr-xr-xtools/fs_config/fs_config_generator.py40
-rwxr-xr-xtools/post_process_props.py6
-rwxr-xr-xtools/releasetools/add_img_to_target_files.py26
-rwxr-xr-xtools/releasetools/build_image.py350
-rw-r--r--tools/releasetools/common.py56
-rw-r--r--tools/releasetools/edify_generator.py51
-rwxr-xr-xtools/releasetools/ota_from_target_files.py75
-rwxr-xr-xtools/releasetools/sign_zip.py69
-rw-r--r--tools/releasetools/test_add_img_to_target_files.py4
-rw-r--r--tools/releasetools/test_build_image.py159
-rwxr-xr-xtools/uuidgen.py29
-rwxr-xr-xtools/vendor_buildinfo.sh7
76 files changed, 1963 insertions, 726 deletions
diff --git a/CleanSpec.mk b/CleanSpec.mk
index 7677261..13122e3 100644
--- a/CleanSpec.mk
+++ b/CleanSpec.mk
@@ -488,6 +488,8 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/app/Launcher3)
$(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/priv-app/Launcher3)
$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/Launcher3_intermediates)
+$(call add-clean-step, find $(PRODUCT_OUT) -type f -name "vr_hwc*" -print0 | xargs -0 rm -f)
+
# ************************************************
# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST
# ************************************************
diff --git a/core/Makefile b/core/Makefile
index 0a2f6e3..1311167 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -331,6 +331,7 @@ endif
$(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
TARGET_DEVICE="$(TARGET_DEVICE)" \
+ LINEAGE_DEVICE="$(TARGET_DEVICE)" \
PRODUCT_NAME="$(TARGET_PRODUCT)" \
PRODUCT_BRAND="$(PRODUCT_BRAND)" \
PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
@@ -361,6 +362,7 @@ endif
TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
TARGET_AAPT_CHARACTERISTICS="$(TARGET_AAPT_CHARACTERISTICS)" \
+ $(PRODUCT_BUILD_PROP_OVERRIDES) \
bash $(BUILDINFO_SH) >> $@
$(hide) $(foreach file,$(system_prop_file), \
if [ -f "$(file)" ]; then \
@@ -421,7 +423,13 @@ $(INSTALLED_VENDOR_BUILD_PROP_TARGET): $(VENDOR_BUILDINFO_SH) $(intermediate_sys
$(hide) echo ro.vendor.product.cpu.abilist="$(TARGET_CPU_ABI_LIST)">>$@
$(hide) echo ro.vendor.product.cpu.abilist32="$(TARGET_CPU_ABI_LIST_32_BIT)">>$@
$(hide) echo ro.vendor.product.cpu.abilist64="$(TARGET_CPU_ABI_LIST_64_BIT)">>$@
- $(hide) TARGET_DEVICE="$(TARGET_DEVICE)" \
+ $(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
+ BUILD_ID="$(BUILD_ID)" \
+ BUILD_NUMBER="$(BUILD_NUMBER_FROM_FILE)" \
+ PLATFORM_VERSION="$(PLATFORM_VERSION)" \
+ PLATFORM_SDK_VERSION="$(PLATFORM_SDK_VERSION)" \
+ BUILD_VERSION_TAGS="$(BUILD_VERSION_TAGS)" \
+ TARGET_DEVICE="$(TARGET_DEVICE)" \
PRODUCT_NAME="$(TARGET_PRODUCT)" \
PRODUCT_BRAND="$(PRODUCT_BRAND)" \
PRODUCT_MODEL="$(PRODUCT_MODEL)" \
@@ -444,7 +452,7 @@ INSTALLED_PRODUCT_BUILD_PROP_TARGET := $(TARGET_OUT_PRODUCT)/build.prop
ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_PRODUCT_BUILD_PROP_TARGET)
FINAL_PRODUCT_PROPERTIES += \
- $(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES))
+ $(call collapse-pairs, $(PRODUCT_PRODUCT_PROPERTIES) $(ADDITIONAL_PRODUCT_PROPERTIES))
FINAL_PRODUCT_PROPERTIES := $(call uniq-pairs-by-first-component, \
$(FINAL_PRODUCT_PROPERTIES),=)
@@ -678,6 +686,18 @@ endif
# -----------------------------------------------------------------
# the ramdisk
+BOOT_RAMDISK_COMPRESSOR := $(MINIGZIP)
+RECOVERY_RAMDISK_COMPRESSOR := $(MINIGZIP)
+ifneq ($(LZMA_RAMDISK_TARGETS),)
+ ifneq (,$(findstring boot,$(LZMA_RAMDISK_TARGETS)))
+ BOOT_RAMDISK_COMPRESSOR := lzma -f -c
+ endif
+ ifneq (,$(findstring recovery,$(LZMA_RAMDISK_TARGETS)))
+ RECOVERY_RAMDISK_COMPRESSOR := lzma -f -c
+ TARGET_NOT_USE_GZIP_RECOVERY_RAMDISK := true
+ endif
+endif
+
INTERNAL_RAMDISK_FILES := $(filter $(TARGET_ROOT_OUT)/%, \
$(ALL_GENERATED_SOURCES) \
$(ALL_DEFAULT_INSTALLED_MODULES))
@@ -688,12 +708,12 @@ BUILT_RAMDISK_TARGET := $(PRODUCT_OUT)/ramdisk.img
INSTALLED_RAMDISK_TARGET := $(BUILT_RAMDISK_TARGET)
$(INSTALLED_RAMDISK_TARGET): $(MKBOOTFS) $(INTERNAL_RAMDISK_FILES) | $(MINIGZIP)
$(call pretty,"Target ram disk: $@")
- $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $@
+ $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_ROOT_OUT) | $(BOOT_RAMDISK_COMPRESSOR) > $@
.PHONY: ramdisk-nodeps
ramdisk-nodeps: $(MKBOOTFS) | $(MINIGZIP)
@echo "make $@: ignoring dependencies"
- $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_ROOT_OUT) | $(MINIGZIP) > $(INSTALLED_RAMDISK_TARGET)
+ $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_ROOT_OUT) | $(BOOT_RAMDISK_COMPRESSOR) > $(INSTALLED_RAMDISK_TARGET)
INSTALLED_BOOTIMAGE_TARGET := $(PRODUCT_OUT)/boot.img
@@ -735,6 +755,13 @@ INTERNAL_MKBOOTIMG_VERSION_ARGS := \
--os_version $(PLATFORM_VERSION) \
--os_patch_level $(PLATFORM_SECURITY_PATCH)
+INSTALLED_DTIMAGE_TARGET := $(PRODUCT_OUT)/dt.img
+
+ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
+ INTERNAL_BOOTIMAGE_ARGS += --dt $(INSTALLED_DTIMAGE_TARGET)
+ BOOTIMAGE_EXTRA_DEPS := $(INSTALLED_DTIMAGE_TARGET)
+endif
+
# BOARD_USES_RECOVERY_AS_BOOT = true must have BOARD_BUILD_SYSTEM_ROOT_IMAGE = true.
ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
@@ -747,7 +774,8 @@ ifneq ($(BOARD_USES_RECOVERY_AS_BOOT),true)
ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
$(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore)
-else ifeq (true,$(BOARD_AVB_ENABLE)) # TARGET_BOOTIMAGE_USE_EXT2 != true
+else ifndef BOARD_CUSTOM_BOOTIMG_MK
+ifeq (true,$(BOARD_AVB_ENABLE)) # TARGET_BOOTIMAGE_USE_EXT2 != true
$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(AVBTOOL) $(INTERNAL_BOOTIMAGE_FILES) $(BOARD_AVB_BOOT_KEY_PATH)
$(call pretty,"Target boot image: $@")
@@ -787,7 +815,7 @@ bootimage-nodeps: $(MKBOOTIMG) $(BOOT_SIGNER)
else ifeq (true,$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SUPPORTS_VBOOT)) # PRODUCT_SUPPORTS_BOOT_SIGNER != true
-$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) $(FUTILITY)
+$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(VBOOT_SIGNER) $(FUTILITY) $(BOOTIMAGE_EXTRA_DEPS)
$(call pretty,"Target boot image: $@")
$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@.unsigned
$(VBOOT_SIGNER) $(FUTILITY) $@.unsigned $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $@.keyblock $@
@@ -802,7 +830,7 @@ bootimage-nodeps: $(MKBOOTIMG) $(VBOOT_SIGNER) $(FUTILITY)
else # PRODUCT_SUPPORTS_VBOOT != true
-$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES)
+$(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_FILES) $(BOOTIMAGE_EXTRA_DEPS)
$(call pretty,"Target boot image: $@")
$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $@
$(hide) $(call assert-max-image-size,$@,$(BOARD_BOOTIMAGE_PARTITION_SIZE))
@@ -813,26 +841,22 @@ bootimage-nodeps: $(MKBOOTIMG)
$(hide) $(MKBOOTIMG) $(INTERNAL_BOOTIMAGE_ARGS) $(INTERNAL_MKBOOTIMG_VERSION_ARGS) $(BOARD_MKBOOTIMG_ARGS) --output $(INSTALLED_BOOTIMAGE_TARGET)
$(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
-endif # TARGET_BOOTIMAGE_USE_EXT2
+endif # PRODUCT_SUPPORTS_VBOOT
+endif # TARGET_BOOTIMAGE_USE_EXT2 / BOARD_CUSTOM_BOOTIMG_MK
endif # BOARD_USES_RECOVERY_AS_BOOT
-else # TARGET_NO_KERNEL
+else # TARGET_NO_KERNEL == "true"
ifdef BOARD_PREBUILT_BOOTIMAGE
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
# Remove when b/63676296 is resolved.
$(error Prebuilt bootimage is only supported for AB targets)
endif
$(eval $(call copy-one-file,$(BOARD_PREBUILT_BOOTIMAGE),$(INSTALLED_BOOTIMAGE_TARGET)))
-else
+else # BOARD_PREBUILT_BOOTIMAGE not defined
INTERNAL_KERNEL_CMDLINE := $(strip $(BOARD_KERNEL_CMDLINE))
-# HACK: The top-level targets depend on the bootimage. Not all targets
-# can produce a bootimage, though, and emulator targets need the ramdisk
-# instead. Fake it out by calling the ramdisk the bootimage.
-# TODO: make the emulator use bootimages, and make mkbootimg accept
-# kernel-less inputs.
-INSTALLED_BOOTIMAGE_TARGET := $(INSTALLED_RAMDISK_TARGET)
-endif
-endif
+INSTALLED_BOOTIMAGE_TARGET :=
+endif # BOARD_PREBUILT_BOOTIMAGE
+endif # TARGET_NO_KERNEL
# -----------------------------------------------------------------
# NOTICE files
@@ -1086,53 +1110,80 @@ ifeq ($(INTERNAL_USERIMAGES_USE_EXT),true)
INTERNAL_USERIMAGES_DEPS += $(MKE2FS_CONF)
endif
+ifeq (true,$(USE_LOGICAL_PARTITIONS))
+
+ifeq ($(PRODUCTS.$(INTERNAL_PRODUCT).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 # USE_LOGICAL_PARTITIONS
+
# $(1): the path of the output dictionary file
-# $(2): additional "key=value" pairs to append to the dictionary file.
-define generate-userimage-prop-dictionary
+# $(2): a subset of "system vendor cache userdata product oem"
+# $(3): additional "key=value" pairs to append to the dictionary file.
+define generate-image-prop-dictionary
$(hide) echo "ext_mkuserimg=$(notdir $(MKEXTUSERIMG))" >> $(1)
$(if $(INTERNAL_USERIMAGES_EXT_VARIANT),$(hide) echo "fs_type=$(INTERNAL_USERIMAGES_EXT_VARIANT)" >> $(1))
-$(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
-$(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
-$(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
-$(if $(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_extfs_rsv_pct=$(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
-$(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1))
+$(if $(filter $(2),system),\
+ $(if $(BOARD_SYSTEMIMAGE_PARTITION_SIZE),$(hide) echo "system_size=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE)" >> $(1))
+ $(if $(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "system_fs_type=$(BOARD_SYSTEMIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
+ $(if $(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT),$(hide) echo "system_extfs_inode_count=$(BOARD_SYSTEMIMAGE_EXTFS_INODE_COUNT)" >> $(1))
+ $(if $(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT),$(hide) echo "system_extfs_rsv_pct=$(BOARD_SYSTEMIMAGE_EXTFS_RSV_PCT)" >> $(1))
+ $(if $(BOARD_SYSTEMIMAGE_JOURNAL_SIZE),$(hide) echo "system_journal_size=$(BOARD_SYSTEMIMAGE_JOURNAL_SIZE)" >> $(1))
+ $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
+ $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
+ $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
+ $(if $(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_squashfs_disable_4k_align=$(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
+ $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),$(hide) echo "system_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH)" >> $(1))
+ $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_HEADROOM),$(hide) echo "system_headroom=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_HEADROOM)" >> $(1))
+ $(if $(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "system_reserved_size=$(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
+)
$(if $(BOARD_EXT4_SHARE_DUP_BLOCKS),$(hide) echo "ext4_share_dup_blocks=$(BOARD_EXT4_SHARE_DUP_BLOCKS)" >> $(1))
-$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "system_squashfs_compressor=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
-$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "system_squashfs_compressor_opt=$(BOARD_SYSTEMIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
-$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "system_squashfs_block_size=$(BOARD_SYSTEMIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
-$(if $(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "system_squashfs_disable_4k_align=$(BOARD_SYSTEMIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
-$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH),$(hide) echo "system_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_BASE_FS_PATH)" >> $(1))
-$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_HEADROOM),$(hide) echo "system_headroom=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_SYSTEM_HEADROOM)" >> $(1))
-$(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))
+$(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))
+)
$(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))
-$(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))
-$(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_extfs_rsv_pct=$(BOARD_VENDORIMAGE_EXTFS_RSV_PCT)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_compressor_opt=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
-$(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
-$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
-$(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
-$(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1))
-$(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))
+$(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))
+)
+$(if $(filter $(2),vendor),\
+ $(if $(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "vendor_fs_type=$(BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT),$(hide) echo "vendor_extfs_inode_count=$(BOARD_VENDORIMAGE_EXTFS_INODE_COUNT)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_EXTFS_RSV_PCT),$(hide) echo "vendor_extfs_rsv_pct=$(BOARD_VENDORIMAGE_EXTFS_RSV_PCT)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_PARTITION_SIZE),$(hide) echo "vendor_size=$(BOARD_VENDORIMAGE_PARTITION_SIZE)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_JOURNAL_SIZE),$(hide) echo "vendor_journal_size=$(BOARD_VENDORIMAGE_JOURNAL_SIZE)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "vendor_squashfs_compressor=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "vendor_squashfs_compressor_opt=$(BOARD_VENDORIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "vendor_squashfs_block_size=$(BOARD_VENDORIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "vendor_squashfs_disable_4k_align=$(BOARD_VENDORIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
+ $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH),$(hide) echo "vendor_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_VENDOR_BASE_FS_PATH)" >> $(1))
+ $(if $(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "vendor_reserved_size=$(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE)" >> $(1))
+)
+$(if $(filter $(2),product),\
+ $(if $(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE),$(hide) echo "product_fs_type=$(BOARD_PRODUCTIMAGE_FILE_SYSTEM_TYPE)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT),$(hide) echo "product_extfs_inode_count=$(BOARD_PRODUCTIMAGE_EXTFS_INODE_COUNT)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT),$(hide) echo "product_extfs_rsv_pct=$(BOARD_PRODUCTIMAGE_EXTFS_RSV_PCT)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_PARTITION_SIZE),$(hide) echo "product_size=$(BOARD_PRODUCTIMAGE_PARTITION_SIZE)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_JOURNAL_SIZE),$(hide) echo "product_journal_size=$(BOARD_PRODUCTIMAGE_JOURNAL_SIZE)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR),$(hide) echo "product_squashfs_compressor=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT),$(hide) echo "product_squashfs_compressor_opt=$(BOARD_PRODUCTIMAGE_SQUASHFS_COMPRESSOR_OPT)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE),$(hide) echo "product_squashfs_block_size=$(BOARD_PRODUCTIMAGE_SQUASHFS_BLOCK_SIZE)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN),$(hide) echo "product_squashfs_disable_4k_align=$(BOARD_PRODUCTIMAGE_SQUASHFS_DISABLE_4K_ALIGN)" >> $(1))
+ $(if $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH),$(hide) echo "product_base_fs_file=$(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_BASE_FS_PATH)" >> $(1))
+ $(if $(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE),$(hide) echo "product_reserved_size=$(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE)" >> $(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))
+)
$(if $(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG),$(hide) echo "extfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_EXT_FLAG)" >> $(1))
$(if $(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG),$(hide) echo "squashfs_sparse_flag=$(INTERNAL_USERIMAGES_SPARSE_SQUASHFS_FLAG)" >> $(1))
$(hide) echo "selinux_fc=$(SELINUX_FC)" >> $(1)
@@ -1175,9 +1226,22 @@ $(if $(BOARD_AVB_ENABLE),\
$(if $(filter true,$(BOARD_USES_RECOVERY_AS_BOOT)),\
$(hide) echo "recovery_as_boot=true" >> $(1))
$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)),\
- $(hide) echo "system_root_image=true" >> $(1);\
- echo "ramdisk_dir=$(TARGET_ROOT_OUT)" >> $(1))
-$(if $(2),$(hide) $(foreach kv,$(2),echo "$(kv)" >> $(1);))
+ $(hide) echo "system_root_image=true" >> $(1)
+ $(hide) echo "root_dir=$(TARGET_ROOT_OUT)" >> $(1))
+$(if $(PRODUCT_USE_DYNAMIC_PARTITION_SIZE),$(hide) echo "use_dynamic_partition_size=true" >> $(1))
+$(if $(3),$(hide) $(foreach kv,$(3),echo "$(kv)" >> $(1);))
+endef
+
+# $(1): the path of the output dictionary file
+# $(2): additional "key=value" pairs to append to the dictionary file.
+define generate-userimage-prop-dictionary
+$(call generate-image-prop-dictionary,$(1),system vendor cache userdata product oem,$(2))
+endef
+
+# $(1): the path of the input dictionary file, where each line has the format key=value
+# $(2): the key to look up
+define read-image-prop-dictionary
+$$(grep '$(2)=' $(1) | cut -f2- -d'=')
endef
# $(1): modules list
@@ -1186,15 +1250,15 @@ endef
# $(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
+ rm -rf $(2)/lib/modules
+ mkdir -p $(2)/lib/modules
+ cp $(1) $(2)/lib/modules/
+ rm -rf $(4)
+ mkdir -p $(4)/lib/modules/0.0/$(3)lib/modules
+ cp $(1) $(4)/lib/modules/0.0/$(3)lib/modules
+ $(DEPMOD) -b $(4) 0.0
+ sed -e 's/\(.*modules.*\):/\/\1:/g' -e 's/ \([^ ]*modules[^ ]*\)/ \/\1/g' $(4)/lib/modules/0.0/modules.dep > $(2)/lib/modules/modules.dep
+ cp $(4)/lib/modules/0.0/modules.alias $(2)/lib/modules
endef
# -----------------------------------------------------------------
@@ -1226,6 +1290,7 @@ IGNORE_RECOVERY_SEPOLICY := $(patsubst $(TARGET_RECOVERY_OUT)/%,--exclude=/%,$(r
recovery_kernel := $(INSTALLED_KERNEL_TARGET) # same as a non-recovery system
recovery_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.img
+recovery_uncompressed_ramdisk := $(PRODUCT_OUT)/ramdisk-recovery.cpio
recovery_build_props := $(intermediate_system_build_prop)
ifdef property_overrides_split_enabled
recovery_build_props += $(INSTALLED_VENDOR_BUILD_PROP_TARGET)
@@ -1237,6 +1302,9 @@ recovery_resources_common := $(call include-path-for, recovery)/res
# Set recovery_density to the density bucket of the device.
recovery_density := unknown
+ifneq (,$(TARGET_RECOVERY_DENSITY))
+recovery_density := $(filter %dpi,$(TARGET_RECOVERY_DENSITY))
+else
ifneq (,$(PRODUCT_AAPT_PREF_CONFIG))
# If PRODUCT_AAPT_PREF_CONFIG includes a dpi bucket, then use that value.
recovery_density := $(filter %dpi,$(PRODUCT_AAPT_PREF_CONFIG))
@@ -1244,6 +1312,7 @@ else
# Otherwise, use the default medium density.
recovery_densities := mdpi
endif
+endif
ifneq (,$(wildcard $(recovery_resources_common)-$(recovery_density)))
recovery_resources_common := $(recovery_resources_common)-$(recovery_density)
@@ -1262,6 +1331,16 @@ else
recovery_font := $(call include-path-for, recovery)/fonts/12x22.png
endif
+ifneq ($(TARGET_RECOVERY_DEVICE_DIRS),)
+recovery_root_private := $(strip \
+ $(foreach d,$(TARGET_RECOVERY_DEVICE_DIRS), $(wildcard $(d)/recovery/root)))
+else
+recovery_root_private := $(strip $(wildcard $(TARGET_DEVICE_DIR)/recovery/root))
+endif
+ifneq ($(recovery_root_private),)
+recovery_root_deps := $(shell find $(recovery_root_private) -type f)
+endif
+
ifndef TARGET_PRIVATE_RES_DIRS
TARGET_PRIVATE_RES_DIRS := $(wildcard $(TARGET_DEVICE_DIR)/recovery/res)
endif
@@ -1298,7 +1377,7 @@ endif
# versa though).
ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) \
- $(BOARD_INCLUDE_RECOVERY_DTBO)))
+ $(BOARD_INCLUDE_RECOVERY_DTBO) $(TARGET_NOT_USE_GZIP_RECOVERY_RAMDISK)))
# Named '.dat' so we don't attempt to use imgdiff for patching it.
RECOVERY_RESOURCE_ZIP := $(TARGET_OUT)/etc/recovery-resource.dat
else
@@ -1323,6 +1402,10 @@ endif
ifdef BOARD_INCLUDE_RECOVERY_DTBO
INTERNAL_RECOVERYIMAGE_ARGS += --recovery_dtbo $(BOARD_PREBUILT_DTBOIMAGE)
endif
+ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
+ INTERNAL_RECOVERYIMAGE_ARGS += --dt $(INSTALLED_DTIMAGE_TARGET)
+ RECOVERYIMAGE_EXTRA_DEPS := $(INSTALLED_DTIMAGE_TARGET)
+endif
# Keys authorized to sign OTA packages this build will accept. The
# build always uses dev-keys for this; release packaging tools will
@@ -1344,14 +1427,12 @@ $(RECOVERY_INSTALL_OTA_KEYS): $(OTA_PUBLIC_KEYS) $(DUMPKEY_JAR) $(extra_keys)
RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
-# $(1): output file
-define build-recoveryimage-target
- # Making recovery image
+define build-recoveryramdisk
$(hide) mkdir -p $(TARGET_RECOVERY_OUT)
$(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/etc $(TARGET_RECOVERY_ROOT_OUT)/sdcard $(TARGET_RECOVERY_ROOT_OUT)/tmp
# Copying baseline ramdisk...
# Use rsync because "cp -Rf" fails to overwrite broken symlinks on Mac.
- $(hide) rsync -a --exclude=etc --exclude=sdcard $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
+ $(hide) rsync -a --exclude=etc --exclude=sdcard --exclude=vendor $(IGNORE_RECOVERY_SEPOLICY) $(IGNORE_CACHE_LINK) $(TARGET_ROOT_OUT) $(TARGET_RECOVERY_OUT)
# Copy adbd from system/bin to recovery/root/sbin
$(hide) cp -f $(TARGET_OUT_EXECUTABLES)/adbd $(TARGET_RECOVERY_ROOT_OUT)/sbin/adbd
# Modifying ramdisk contents...
@@ -1361,14 +1442,26 @@ define build-recoveryimage-target
$(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)/
$(hide) cp $(TARGET_ROOT_OUT)/init.recovery.*.rc $(TARGET_RECOVERY_ROOT_OUT)/ || true # Ignore error when the src file doesn't exist.
+ # If charger is not needed in recovery, do the following:
+ # * Remove the charger service from recovery init.rc.
+ # # Remove the charger binary and root symlink.
+ $(if $(BOARD_NEEDS_CHARGER_IN_RECOVERY),,\
+ $(hide) cat $(TARGET_RECOVERY_ROOT_OUT)/init.rc | \
+ awk '/^service/ { elide=0; } /^service charger/ { elide=1; } { if (elide==0) { print; } }' > \
+ $(TARGET_RECOVERY_ROOT_OUT)/.init.rc.tmp && \
+ mv $(TARGET_RECOVERY_ROOT_OUT)/.init.rc.tmp $(TARGET_RECOVERY_ROOT_OUT)/init.rc
+ $(hide) rm -f $(TARGET_RECOVERY_ROOT_OUT)/sbin/charger
+ $(hide) rm -f $(TARGET_RECOVERY_ROOT_OUT)/charger)
$(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/res
$(hide) rm -rf $(TARGET_RECOVERY_ROOT_OUT)/res/*
$(hide) cp -rf $(recovery_resources_common)/* $(TARGET_RECOVERY_ROOT_OUT)/res
$(hide) cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
+ $(hide) $(foreach item,$(recovery_root_private), \
+ cp -rf $(item) $(TARGET_RECOVERY_OUT)/;)
$(hide) $(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
- cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
+ cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline);)
$(hide) $(foreach item,$(recovery_fstab), \
- cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.fstab)
+ cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.fstab;)
$(if $(strip $(recovery_wipe)), \
$(hide) cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/etc/recovery.wipe)
$(hide) cp $(RECOVERY_INSTALL_OTA_KEYS) $(TARGET_RECOVERY_ROOT_OUT)/res/keys
@@ -1379,13 +1472,19 @@ define build-recoveryimage-target
>> $(TARGET_RECOVERY_ROOT_OUT)/prop.default)
$(hide) cat $(recovery_build_props) \
>> $(TARGET_RECOVERY_ROOT_OUT)/prop.default
+ # Never allow persist.sys.usb.config to be set to none in recovery
+ $(hide) sed -i 's/persist.sys.usb.config=none/persist.sys.usb.config=adb/g' $(TARGET_RECOVERY_ROOT_OUT)/prop.default
$(hide) ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
$(BOARD_RECOVERY_IMAGE_PREPARE)
$(if $(filter true,$(BOARD_BUILD_SYSTEM_ROOT_IMAGE)), \
$(hide) mkdir -p $(TARGET_RECOVERY_ROOT_OUT)/system_root; \
rm -rf $(TARGET_RECOVERY_ROOT_OUT)/system; \
ln -sf /system_root/system $(TARGET_RECOVERY_ROOT_OUT)/system) # Mount the system_root_image to /system_root and symlink /system.
- $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(MINIGZIP) > $(recovery_ramdisk)
+endef
+
+RECOVERYIMAGE_ID_FILE := $(PRODUCT_OUT)/recovery.id
+# $(1): output file
+define build-recoveryimage-target
$(if $(filter true,$(PRODUCTS.$(INTERNAL_PRODUCT).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))
@@ -1430,22 +1529,38 @@ $(INSTALLED_BOOTIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) $(ADBD) \
$(BOARD_RECOVERY_KERNEL_MODULES) \
$(DEPMOD)
$(call pretty,"Target boot image from recovery: $@")
+ $(call build-recoveryramdisk)
+ $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(RECOVERY_RAMDISK_COMPRESSOR) > $(recovery_ramdisk)
$(call build-recoveryimage-target, $@)
endif
-$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTFS) $(MKBOOTIMG) $(MINIGZIP) $(ADBD) \
+$(recovery_uncompressed_ramdisk): $(MKBOOTFS) $(ADBD) \
$(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
$(INTERNAL_RECOVERYIMAGE_FILES) \
- $(recovery_initrc) $(recovery_sepolicy) $(recovery_kernel) \
+ $(recovery_initrc) $(recovery_sepolicy) \
$(INSTALLED_2NDBOOTLOADER_TARGET) \
- $(recovery_build_props) $(recovery_resource_deps) \
+ $(recovery_build_props) $(recovery_resource_deps) $(recovery_root_deps) \
$(recovery_fstab) \
$(RECOVERY_INSTALL_OTA_KEYS) \
$(INSTALLED_VENDOR_DEFAULT_PROP_TARGET) \
$(BOARD_RECOVERY_KERNEL_MODULES) \
$(DEPMOD)
+ $(call build-recoveryramdisk)
+ @echo ----- Making uncompressed recovery ramdisk ------
+ $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) > $@
+
+$(recovery_ramdisk): $(MINIGZIP) \
+ $(recovery_uncompressed_ramdisk)
+ @echo ----- Making compressed recovery ramdisk ------
+ $(hide) $(RECOVERY_RAMDISK_COMPRESSOR) < $(recovery_uncompressed_ramdisk) > $@
+
+ifndef BOARD_CUSTOM_BOOTIMG_MK
+$(INSTALLED_RECOVERYIMAGE_TARGET): $(MKBOOTIMG) $(recovery_ramdisk) $(recovery_kernel) \
+ $(RECOVERYIMAGE_EXTRA_DEPS)
+ @echo ----- Making recovery image ------
$(call build-recoveryimage-target, $@)
+endif # BOARD_CUSTOM_BOOTIMG_MK
ifdef RECOVERY_RESOURCE_ZIP
$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
@@ -1457,6 +1572,8 @@ endif
.PHONY: recoveryimage-nodeps
recoveryimage-nodeps:
@echo "make $@: ignoring dependencies"
+ $(call build-recoveryramdisk)
+ $(hide) $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(RECOVERY_RAMDISK_COMPRESSOR) > $(recovery_ramdisk)
$(call build-recoveryimage-target, $(INSTALLED_RECOVERYIMAGE_TARGET))
else # INSTALLED_RECOVERYIMAGE_TARGET not defined
@@ -1474,6 +1591,11 @@ ifneq ($(BOARD_NAND_SPARE_SIZE),)
$(error MTD device is no longer supported and thus BOARD_NAND_SPARE_SIZE is deprecated.)
endif
+ifdef BOARD_CUSTOM_BOOTIMG_MK
+include $(BOARD_CUSTOM_BOOTIMG_MK)
+endif
+
+
# -----------------------------------------------------------------
# system image
#
@@ -1491,6 +1613,10 @@ INTERNAL_SYSTEMIMAGE_FILES := $(filter $(TARGET_OUT)/%, \
FULL_SYSTEMIMAGE_DEPS := $(INTERNAL_SYSTEMIMAGE_FILES) $(INTERNAL_USERIMAGES_DEPS)
+ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
+ FULL_SYSTEMIMAGE_DEPS += $(INSTALLED_KERNEL_TARGET)
+endif
+
# ASAN libraries in the system image - add dependency.
ASAN_IN_SYSTEM_INSTALLED := $(TARGET_OUT)/asan.tar.bz2
ifneq (,$(SANITIZE_TARGET))
@@ -1558,20 +1684,13 @@ define build-systemimage-target
$(call create-system-vendor-symlink)
$(call create-system-product-symlink)
@mkdir -p $(dir $(1)) $(systemimage_intermediates) && rm -rf $(systemimage_intermediates)/system_image_info.txt
- $(call generate-userimage-prop-dictionary, $(systemimage_intermediates)/system_image_info.txt, \
+ $(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) \
- || ( echo "Out of space? the tree size of $(TARGET_OUT) is (MB): " 1>&2 ;\
- du -sm $(TARGET_OUT) 1>&2;\
- if [ "$(INTERNAL_USERIMAGES_EXT_VARIANT)" == "ext4" ]; then \
- maxsize=$(BOARD_SYSTEMIMAGE_PARTITION_SIZE); \
- echo "The max is $$(( maxsize / 1048576 )) MB." 1>&2 ;\
- else \
- echo "The max is $$(( $(BOARD_SYSTEMIMAGE_PARTITION_SIZE) / 1048576 )) MB." 1>&2 ;\
- fi; \
- mkdir -p $(DIST_DIR); cp $(INSTALLED_FILES_FILE) $(DIST_DIR)/installed-files-rescued.txt; \
+ $(systemimage_intermediates)/generated_system_image_info.txt \
+ || ( mkdir -p $(DIST_DIR); cp $(INSTALLED_FILES_FILE) $(DIST_DIR)/installed-files-rescued.txt; \
exit 1 )
endef
@@ -1586,6 +1705,7 @@ SYSTEMIMAGE_SOURCE_DIR := $(TARGET_OUT)
# as the source (since they are very similar). Generate the patch so
# we can see how big it's going to be, and include that in the system
# image size check calculation.
+ifneq ($(INSTALLED_BOOTIMAGE_TARGET),)
ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),)
ifneq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO)))
@@ -1593,6 +1713,9 @@ diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
else
diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff
endif
+ifeq ($(TARGET_NOT_USE_GZIP_RECOVERY_RAMDISK),true)
+diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
+endif
intermediates := $(call intermediates-dir-for,PACKAGING,recovery_patch)
RECOVERY_FROM_BOOT_PATCH := $(intermediates)/recovery_from_boot.p
$(RECOVERY_FROM_BOOT_PATCH): PRIVATE_DIFF_TOOL := $(diff_tool)
@@ -1605,14 +1728,16 @@ $(RECOVERY_FROM_BOOT_PATCH): \
$(PRIVATE_DIFF_TOOL) $(INSTALLED_BOOTIMAGE_TARGET) $(INSTALLED_RECOVERYIMAGE_TARGET) $@
else # $(BOARD_USES_FULL_RECOVERY_IMAGE) == true
RECOVERY_FROM_BOOT_PATCH := $(INSTALLED_RECOVERYIMAGE_TARGET)
-endif
-endif
-
+endif # BOARD_USES_FULL_RECOVERY_IMAGE
+endif # INSTALLED_RECOVERYIMAGE_TARGET
+endif # INSTALLED_BOOTIMAGE_TARGET
$(INSTALLED_SYSTEMIMAGE): $(BUILT_SYSTEMIMAGE) $(RECOVERY_FROM_BOOT_PATCH)
@echo "Install system fs image: $@"
$(copy-file-to-target)
- $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
+ $(hide) $(call assert-max-image-size,$@ $(RECOVERY_FROM_BOOT_PATCH),\
+ $(call read-image-prop-dictionary,\
+ $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
systemimage: $(INSTALLED_SYSTEMIMAGE)
@@ -1621,7 +1746,9 @@ systemimage-nodeps snod: $(filter-out systemimage-nodeps snod,$(MAKECMDGOALS)) \
| $(INTERNAL_USERIMAGES_DEPS)
@echo "make $@: ignoring dependencies"
$(call build-systemimage-target,$(INSTALLED_SYSTEMIMAGE))
- $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),$(BOARD_SYSTEMIMAGE_PARTITION_SIZE))
+ $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMIMAGE),\
+ $(call read-image-prop-dictionary,\
+ $(systemimage_intermediates)/generated_system_image_info.txt,system_size))
ifneq (,$(filter systemimage-nodeps snod, $(MAKECMDGOALS)))
ifeq (true,$(WITH_DEXPREOPT))
@@ -1794,7 +1921,7 @@ define build-userdataimage-target
$(call pretty,"Target userdata fs image: $(INSTALLED_USERDATAIMAGE_TARGET)")
@mkdir -p $(TARGET_OUT_DATA)
@mkdir -p $(userdataimage_intermediates) && rm -rf $(userdataimage_intermediates)/userdata_image_info.txt
- $(call generate-userimage-prop-dictionary, $(userdataimage_intermediates)/userdata_image_info.txt, skip_fsck=true)
+ $(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)
@@ -1901,7 +2028,7 @@ define build-cacheimage-target
$(call pretty,"Target cache fs image: $(INSTALLED_CACHEIMAGE_TARGET)")
@mkdir -p $(TARGET_OUT_CACHE)
@mkdir -p $(cacheimage_intermediates) && rm -rf $(cacheimage_intermediates)/cache_image_info.txt
- $(call generate-userimage-prop-dictionary, $(cacheimage_intermediates)/cache_image_info.txt, skip_fsck=true)
+ $(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)
@@ -1958,11 +2085,14 @@ define build-systemotherimage-target
$(call pretty,"Target system_other fs image: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)")
@mkdir -p $(TARGET_OUT_SYSTEM_OTHER)
@mkdir -p $(systemotherimage_intermediates) && rm -rf $(systemotherimage_intermediates)/system_other_image_info.txt
- $(call generate-userimage-prop-dictionary, $(systemotherimage_intermediates)/system_other_image_info.txt, skip_fsck=true)
+ $(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))
+ $(TARGET_OUT_SYSTEM_OTHER) $(systemotherimage_intermediates)/system_other_image_info.txt $(INSTALLED_SYSTEMOTHERIMAGE_TARGET) $(TARGET_OUT)\
+ $(systemotherimage_intermediates)/generated_system_other_image_info.txt
+ $(hide) $(call assert-max-image-size,$(INSTALLED_SYSTEMOTHERIMAGE_TARGET),\
+ $(call read-image-prop-dictionary,\
+ $(systemotherimage_intermediates)/generated_system_other_image_info.txt,system_size))
endef
# We just build this directly to the install location.
@@ -2007,18 +2137,21 @@ define build-vendorimage-target
$(call pretty,"Target vendor fs image: $(INSTALLED_VENDORIMAGE_TARGET)")
@mkdir -p $(TARGET_OUT_VENDOR)
@mkdir -p $(vendorimage_intermediates) && rm -rf $(vendorimage_intermediates)/vendor_image_info.txt
- $(call generate-userimage-prop-dictionary, $(vendorimage_intermediates)/vendor_image_info.txt, skip_fsck=true)
+ $(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))
+ $(TARGET_OUT_VENDOR) $(vendorimage_intermediates)/vendor_image_info.txt $(INSTALLED_VENDORIMAGE_TARGET) $(TARGET_OUT) \
+ $(vendorimage_intermediates)/generated_vendor_image_info.txt
+ $(hide) $(call assert-max-image-size,$(INSTALLED_VENDORIMAGE_TARGET),\
+ $(call read-image-prop-dictionary,\
+ $(vendorimage_intermediates)/generated_vendor_image_info.txt,vendor_size))
endef
# We just build this directly to the install location.
INSTALLED_VENDORIMAGE_TARGET := $(BUILT_VENDORIMAGE_TARGET)
-$(INSTALLED_VENDORIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_VENDORIMAGE_FILES) $(INSTALLED_FILES_FILE_VENDOR) $(BUILD_IMAGE_SRCS) $(DEPMOD) $(BOARD_VENDOR_KERNEL_MODULES)
+$(INSTALLED_VENDORIMAGE_TARGET): $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_VENDORIMAGE_FILES) $(INSTALLED_FILES_FILE_VENDOR) $(BUILD_IMAGE_SRCS) $(DEPMOD) $(BOARD_VENDOR_KERNEL_MODULES) $(INSTALLED_KERNEL_TARGET)
$(build-vendorimage-target)
.PHONY: vendorimage-nodeps vnod
@@ -2059,11 +2192,14 @@ define build-productimage-target
$(call pretty,"Target product fs image: $(INSTALLED_PRODUCTIMAGE_TARGET)")
@mkdir -p $(TARGET_OUT_PRODUCT)
@mkdir -p $(productimage_intermediates) && rm -rf $(productimage_intermediates)/product_image_info.txt
- $(call generate-userimage-prop-dictionary, $(productimage_intermediates)/product_image_info.txt, skip_fsck=true)
+ $(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))
+ $(TARGET_OUT_PRODUCT) $(productimage_intermediates)/product_image_info.txt $(INSTALLED_PRODUCTIMAGE_TARGET) $(TARGET_OUT) \
+ $(productimage_intermediates)/generated_product_image_info.txt
+ $(hide) $(call assert-max-image-size,$(INSTALLED_PRODUCTIMAGE_TARGET),\
+ $(call read-image-prop-dictionary,\
+ $(productimage_intermediates)/generated_product_image_info.txt,product_size))
endef
# We just build this directly to the install location.
@@ -2102,6 +2238,12 @@ endif
endif
+ifdef TARGET_NEEDS_DTBOIMAGE
+INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
+else ifdef BOARD_KERNEL_SEPARATED_DTBO
+INSTALLED_DTBOIMAGE_TARGET := $(PRODUCT_OUT)/dtbo.img
+endif
+
# -----------------------------------------------------------------
# vbmeta image
ifeq ($(BOARD_AVB_ENABLE),true)
@@ -2155,12 +2297,14 @@ $(eval _footer_args := $(PART)_FOOTER_ARGS)
$(eval $($(_footer_args)) += --rollback_index $($(_rollback_index)))
endef
+ifdef INSTALLED_BOOTIMAGE_TARGET
ifdef BOARD_AVB_BOOT_KEY_PATH
$(eval $(call check-and-set-avb-chain-args,BOOT))
else
INTERNAL_AVB_MAKE_VBMETA_IMAGE_ARGS += \
--include_descriptors_from_image $(INSTALLED_BOOTIMAGE_TARGET)
endif
+endif
ifdef BOARD_AVB_SYSTEM_KEY_PATH
$(eval $(call check-and-set-avb-chain-args,SYSTEM))
@@ -2221,14 +2365,6 @@ ifdef BOARD_AVB_ROLLBACK_INDEX
BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --rollback_index $(BOARD_AVB_ROLLBACK_INDEX)
endif
-ifndef BOARD_BOOTIMAGE_PARTITION_SIZE
- $(error BOARD_BOOTIMAGE_PARTITION_SIZE must be set for BOARD_AVB_ENABLE)
-endif
-
-ifndef BOARD_SYSTEMIMAGE_PARTITION_SIZE
- $(error BOARD_SYSTEMIMAGE_PARTITION_SIZE must be set for BOARD_AVB_ENABLE)
-endif
-
# $(1): the directory to extract public keys to
define extract-avb-chain-public-keys
$(if $(BOARD_AVB_BOOT_KEY_PATH),\
@@ -2279,15 +2415,106 @@ $(INSTALLED_VBMETAIMAGE_TARGET): \
vbmetaimage-nodeps:
$(build-vbmetaimage-target)
-else ifeq (true,$(BOARD_BUILD_DISABLED_VBMETAIMAGE))
-BUILT_DISABLED_VBMETAIMAGE := $(PRODUCT_OUT)/vbmeta.img
+endif # BOARD_AVB_ENABLE
-INSTALLED_VBMETAIMAGE_TARGET := $(BUILT_DISABLED_VBMETAIMAGE)
-$(INSTALLED_VBMETAIMAGE_TARGET): $(AVBTOOL)
- $(hide) $(AVBTOOL) make_vbmeta_image \
- --flag 2 --padding_size 4096 --output $@
+# -----------------------------------------------------------------
+# super partition image
+
+# (1): list of items like "system", "vendor", "product", "product_services"
+# return: map each item to the corresponding image target.
+# system => $(BUILT_SYSTEMIMAGE), vendor => $(INSTALLED_VENDORIMAGE_TARGET), etc.
+define image-for-partitions
+$(foreach item,$(1),$(or $(strip $(foreach mapping,
+ system:$(BUILT_SYSTEMIMAGE)
+ product_services:$(INSTALLED_PRODUCT_SERVICESIMAGE_TARGET),
+ $(if $(filter $(call word-colon,1,$(mapping)),$(item)),
+ $(patsubst $(call word-colon,1,$(mapping)),$(call word-colon,2,$(mapping)),$(item))))),
+ $(INSTALLED_$(call to-upper,$(item)IMAGE_TARGET))))
+endef
-endif # BOARD_AVB_ENABLE
+# (1): list of items like "system", "vendor", "product", "product_services"
+# return: map each item into a command ( wrapped in $$() ) that reads the size
+define read-size-of-partitions
+$(foreach p,$(1),$(call read-image-prop-dictionary,$($(p)image_intermediates)/generated_$(p)_image_info.txt,$(p)_size))
+endef
+
+ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
+
+# BOARD_SUPER_PARTITION_SIZE must be defined to build super image.
+ifdef BOARD_SUPER_PARTITION_SIZE
+
+INSTALLED_SUPERIMAGE_TARGET := $(PRODUCT_OUT)/super.img
+$(INSTALLED_SUPERIMAGE_TARGET): $(call image-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
+
+# For A/B devices, super partition always contains sub-partitions in the _a slot, because this
+# image should only be used for bootstrapping / initializing the device. When flashing the image,
+# bootloader fastboot should always mark _a slot as bootable.
+ifeq ($(AB_OTA_UPDATER),true)
+$(INSTALLED_SUPERIMAGE_TARGET): PRIVATE_PARTITION_SUFFIX=_a
+$(INSTALLED_SUPERIMAGE_TARGET): PRIVATE_METADATA_SLOTS=2
+else
+$(INSTALLED_SUPERIMAGE_TARGET): PRIVATE_METADATA_SLOTS=1
+endif # AB_OTA_UPDATER
+
+
+$(INSTALLED_SUPERIMAGE_TARGET): $(HOST_OUT_EXECUTABLES)/lpmake
+ $< \
+ --sparse \
+ --metadata-size 65536 \
+ --metadata-slots $(PRIVATE_METADATA_SLOTS) \
+ --device-size $(BOARD_SUPER_PARTITION_SIZE) \
+ --output $@ \
+ $(foreach name,$(BOARD_SUPER_PARTITION_PARTITION_LIST), \
+ --partition $(name)$(PRIVATE_PARTITION_SUFFIX):$$($(UUIDGEN) $(name)$(PRIVATE_PARTITION_SUFFIX)):readonly:$(call read-size-of-partitions,$(name)) \
+ --image $(name)$(PRIVATE_PARTITION_SUFFIX)=$(call image-for-partitions,$(name)))
+
+$(call dist-for-goals,dist_files,$(INSTALLED_SUPERIMAGE_TARGET))
+
+endif # BOARD_SUPER_PARTITION_SIZE
+endif # PRODUCT_BUILD_SUPER_PARTITION
+
+# -----------------------------------------------------------------
+# Check image sizes <= size of super partition
+
+ifeq (,$(TARGET_BUILD_APPS))
+# Do not check for apps-only build
+
+ifeq (true,$(PRODUCT_BUILD_SUPER_PARTITION))
+ifdef BOARD_SUPER_PARTITION_SIZE
+ifdef BOARD_SUPER_PARTITION_PARTITION_LIST
+
+droid_targets: check_android_partition_sizes
+
+.PHONY: check_android_partition_sizes
+
+# BOARD_SUPER_PARTITION_PARTITION_LIST: a list of the following tokens
+valid_super_partition_list := system vendor product productservices
+ifneq (,$(filter-out $(valid_super_partition_list),$(BOARD_SUPER_PARTITION_PARTITION_LIST)))
+$(error BOARD_SUPER_PARTITION_PARTITION_LIST contains invalid partition name. \
+ Valid names are $(valid_super_partition_list).)
+endif
+valid_super_partition_list :=
+
+# Add image dependencies so that generated_*_image_info.txt are written before checking.
+check_android_partition_sizes: $(call image-for-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))
+
+check_android_partition_sizes:
+ partition_size_list="$(call read-size-of-partitions,$(BOARD_SUPER_PARTITION_PARTITION_LIST))"; \
+ sum_sizes_expr=$$(sed -e 's/ /+/g' <<< "$${partition_size_list}"); \
+ if [ $$(( $${sum_sizes_expr} )) -gt $(BOARD_SUPER_PARTITION_SIZE) ]; then \
+ echo 'The sum of sizes of all logical partitions is larger than BOARD_SUPER_PARTITION_SIZE.'; \
+ echo $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '>' $(BOARD_SUPER_PARTITION_SIZE); \
+ exit 1; \
+ else \
+ echo 'The sum of sizes of all logical partitions is within BOARD_SUPER_PARTITION_SIZE:' \
+ $${sum_sizes_expr} '==' $$(( $${sum_sizes_expr} )) '<=' $(BOARD_SUPER_PARTITION_SIZE); \
+ fi
+
+endif # BOARD_SUPER_PARTITION_PARTITION_LIST
+endif # BOARD_SUPER_PARTITION_SIZE
+endif # PRODUCT_BUILD_SUPER_PARTITION
+
+endif # TARGET_BUILD_APPS
# -----------------------------------------------------------------
# bring in the installer image generation defines if necessary
@@ -2298,35 +2525,43 @@ endif
# -----------------------------------------------------------------
# host tools needed to build dist and OTA packages
+# set build_ota_package, and allow opt-out below
build_ota_package := true
ifeq ($(TARGET_SKIP_OTA_PACKAGE),true)
-build_ota_package := false
-endif
-ifeq ($(BUILD_OS),darwin)
-build_ota_package := false
+ build_ota_package := false
endif
ifneq ($(strip $(SANITIZE_TARGET)),)
-build_ota_package := false
+ build_ota_package := false
endif
ifeq ($(TARGET_PRODUCT),sdk)
-build_ota_package := false
+ build_ota_package := false
endif
ifneq ($(filter generic%,$(TARGET_DEVICE)),)
-build_ota_package := false
+ build_ota_package := false
endif
ifeq ($(TARGET_NO_KERNEL),true)
-build_ota_package := false
+ build_ota_package := false
endif
ifeq ($(recovery_fstab),)
-build_ota_package := false
+ build_ota_package := false
endif
ifeq ($(TARGET_BUILD_PDK),true)
-build_ota_package := false
+ build_ota_package := false
endif
-ifeq ($(build_ota_package),true)
+# set build_otatools_package, and allow opt-out below
+build_otatools_package := true
+ifeq ($(TARGET_SKIP_OTATOOLS_PACKAGE),true)
+ build_otatools_package := false
+endif
+ifeq ($(TARGET_FORCE_OTA_PACKAGE),true)
+build_ota_package := true
+endif
+
+ifeq ($(build_otatools_package),true)
OTATOOLS := $(HOST_OUT_EXECUTABLES)/minigzip \
$(HOST_OUT_EXECUTABLES)/aapt \
+ $(HOST_OUT_EXECUTABLES)/adb \
$(HOST_OUT_EXECUTABLES)/checkvintf \
$(HOST_OUT_EXECUTABLES)/mkbootfs \
$(HOST_OUT_EXECUTABLES)/mkbootimg \
@@ -2438,7 +2673,7 @@ $(BUILT_OTATOOLS_PACKAGE): $(OTATOOLS) $(OTATOOLS_DEPS) $(OTATOOLS_RELEASETOOLS)
.PHONY: otatools-package
otatools-package: $(BUILT_OTATOOLS_PACKAGE)
-endif # build_ota_package
+endif # build_otatools_package
# -----------------------------------------------------------------
# A zip of the directories that map to the target filesystem.
@@ -2527,6 +2762,7 @@ endef
# Depending on the various images guarantees that the underlying
# directories are up-to-date.
$(BUILT_TARGET_FILES_PACKAGE): \
+ $(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
$(INSTALLED_RADIOIMAGE_TARGET) \
$(INSTALLED_RECOVERYIMAGE_TARGET) \
@@ -2564,6 +2800,9 @@ ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_
$(hide) mkdir -p $(zip_root)/$(PRIVATE_RECOVERY_OUT)
$(hide) $(call package_files-copy-root, \
$(TARGET_RECOVERY_ROOT_OUT),$(zip_root)/$(PRIVATE_RECOVERY_OUT)/RAMDISK)
+ @# OTA install helpers
+ $(hide) $(call package_files-copy-root, \
+ $(PRODUCT_OUT)/install,$(zip_root)/INSTALL)
ifdef INSTALLED_KERNEL_TARGET
$(hide) cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/kernel
endif
@@ -2582,6 +2821,15 @@ endif
ifdef BOARD_KERNEL_PAGESIZE
$(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
endif
+ifdef BOARD_KERNEL_TAGS_ADDR
+ $(hide) echo "$(BOARD_KERNEL_TAGS_ADDR)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/tagsaddr
+endif
+ifdef BOARD_RAMDISK_OFFSET
+ $(hide) echo "$(BOARD_RAMDISK_OFFSET)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/ramdisk_offset
+endif
+ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
+ $(hide) $(ACP) $(INSTALLED_DTIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/dt
+endif
endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
@# Components of the boot image
$(hide) mkdir -p $(zip_root)/BOOT
@@ -2610,6 +2858,16 @@ endif
ifdef BOARD_KERNEL_PAGESIZE
$(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
endif
+ifdef BOARD_KERNEL_TAGS_ADDR
+ $(hide) echo "$(BOARD_KERNEL_TAGS_ADDR)" > $(zip_root)/BOOT/tagsaddr
+endif
+ifdef BOARD_RAMDISK_OFFSET
+ $(hide) echo "$(BOARD_RAMDISK_OFFSET)" > $(zip_root)/BOOT/ramdisk_offset
+endif
+
+ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
+ $(hide) $(ACP) $(INSTALLED_DTIMAGE_TARGET) $(zip_root)/BOOT/dt
+endif
endif # BOARD_USES_RECOVERY_AS_BOOT
$(hide) $(foreach t,$(INSTALLED_RADIOIMAGE_TARGET),\
mkdir -p $(zip_root)/RADIO; \
@@ -2620,6 +2878,12 @@ endif # BOARD_USES_RECOVERY_AS_BOOT
@# Contents of the data image
$(hide) $(call package_files-copy-root, \
$(TARGET_OUT_DATA),$(zip_root)/DATA)
+ifdef BOARD_CUSTOM_BOOTIMG
+ @# Prebuilt boot images
+ $(hide) mkdir -p $(zip_root)/BOOTABLE_IMAGES
+ $(hide) $(ACP) $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/BOOTABLE_IMAGES/
+ $(hide) $(ACP) $(INSTALLED_RECOVERYIMAGE_TARGET) $(zip_root)/BOOTABLE_IMAGES/
+endif
ifdef BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE
@# Contents of the vendor image
$(hide) $(call package_files-copy-root, \
@@ -2683,6 +2947,7 @@ ifdef PRODUCT_EXTRA_RECOVERY_KEYS
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 "use_set_metadata=1" >> $(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
ifneq ($(OEM_THUMBPRINT_PROPERTIES),)
@@ -2708,6 +2973,9 @@ endif
ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
$(hide) echo "full_recovery_image=true" >> $(zip_root)/META/misc_info.txt
endif
+ifeq ($(TARGET_NOT_USE_GZIP_RECOVERY_RAMDISK),true)
+ $(hide) echo "no_gzip_recovery_ramdisk=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
@@ -2772,14 +3040,7 @@ ifeq ($(BREAKPAD_GENERATE_SYMBOLS),true)
@# If breakpad symbols have been generated, add them to the zip.
$(hide) $(ACP) -r $(TARGET_OUT_BREAKPAD) $(zip_root)/BREAKPAD
endif
-# BOARD_BUILD_DISABLED_VBMETAIMAGE is used to build a special vbmeta.img
-# that disables AVB verification. The content is fixed and we can just copy
-# it to $(zip_root)/IMAGES without passing some info into misc_info.txt for
-# regeneration.
-ifeq (true,$(BOARD_BUILD_DISABLED_VBMETAIMAGE))
- $(hide) mkdir -p $(zip_root)/IMAGES
- $(hide) cp $(INSTALLED_VBMETAIMAGE_TARGET) $(zip_root)/IMAGES/
-endif
+ $(hide) echo "ota_override_device=$(OTA_SCRIPT_OVERRIDE_DEVICE)" >> $(zip_root)/META/misc_info.txt
ifdef BOARD_PREBUILT_VENDORIMAGE
$(hide) mkdir -p $(zip_root)/IMAGES
$(hide) cp $(INSTALLED_VENDORIMAGE_TARGET) $(zip_root)/IMAGES/
@@ -2792,7 +3053,7 @@ ifdef BOARD_PREBUILT_BOOTIMAGE
$(hide) mkdir -p $(zip_root)/IMAGES
$(hide) cp $(INSTALLED_BOOTIMAGE_TARGET) $(zip_root)/IMAGES/
endif
-ifdef BOARD_PREBUILT_DTBOIMAGE
+ifdef INSTALLED_DTBOIMAGE_TARGET
$(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
@@ -2806,7 +3067,7 @@ ifdef BOARD_AVB_DTBO_KEY_PATH
>> $(zip_root)/META/misc_info.txt
endif # BOARD_AVB_DTBO_KEY_PATH
endif # BOARD_AVB_ENABLE
-endif # BOARD_PREBUILT_DTBOIMAGE
+endif # INSTALLED_DTBOIMAGE_TARGET
@# 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.
@@ -2891,6 +3152,22 @@ else
$(INTERNAL_OTA_PACKAGE_TARGET): $(BROTLI)
endif
+ifeq ($(TARGET_OTA_ASSERT_DEVICE),)
+ OTA_SCRIPT_OVERRIDE_DEVICE := auto
+else
+ OTA_SCRIPT_OVERRIDE_DEVICE := $(TARGET_OTA_ASSERT_DEVICE)
+endif
+
+ifeq ($(WITH_GMS),true)
+ $(INTERNAL_OTA_PACKAGE_TARGET): backuptool := false
+else
+ifneq ($(LINEAGE_BUILD),)
+ $(INTERNAL_OTA_PACKAGE_TARGET): backuptool := true
+else
+ $(INTERNAL_OTA_PACKAGE_TARGET): backuptool := false
+endif
+endif
+
$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
build/make/tools/releasetools/ota_from_target_files
@echo "Package OTA: $@"
@@ -2900,6 +3177,7 @@ $(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) \
--extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
-p $(HOST_OUT) \
-k $(KEY_CERT_PAIR) \
+ --backup=$(backuptool) \
$(if $(OEM_OTA_CONFIG), -o $(OEM_OTA_CONFIG)) \
$(BUILT_TARGET_FILES_PACKAGE) $@
@@ -2941,6 +3219,7 @@ SYMBOLS_ZIP := $(PRODUCT_OUT)/$(name).zip
# For apps_only build we'll establish the dependency later in build/make/core/main.mk.
ifndef TARGET_BUILD_APPS
$(SYMBOLS_ZIP): $(INSTALLED_SYSTEMIMAGE) \
+ $(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
@@ -2965,6 +3244,7 @@ name := $(name)-coverage-$(FILE_NAME_TAG)
COVERAGE_ZIP := $(PRODUCT_OUT)/$(name).zip
ifndef TARGET_BUILD_APPS
$(COVERAGE_ZIP): $(INSTALLED_SYSTEMIMAGE) \
+ $(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
$(INSTALLED_USERDATAIMAGE_TARGET) \
$(INSTALLED_VENDORIMAGE_TARGET) \
@@ -3053,26 +3333,26 @@ ifeq ($(BUILD_QEMU_IMAGES),true)
INSTALLED_QEMU_SYSTEMIMAGE := $(PRODUCT_OUT)/system-qemu.img
MK_QEMU_IMAGE_SH := device/generic/goldfish/tools/mk_qemu_image.sh
SGDISK_HOST := $(HOST_OUT_EXECUTABLES)/sgdisk
-$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_SYSTEMIMAGE) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
+$(INSTALLED_QEMU_SYSTEMIMAGE): $(INSTALLED_SYSTEMIMAGE) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
@echo Create system-qemu.img
- (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/system.img)
+ (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/system.img)
systemimage: $(INSTALLED_QEMU_SYSTEMIMAGE)
droidcore: $(INSTALLED_QEMU_SYSTEMIMAGE)
ifeq ($(BOARD_USES_VENDORIMAGE),true)
INSTALLED_QEMU_VENDORIMAGE := $(PRODUCT_OUT)/vendor-qemu.img
-$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
+$(INSTALLED_QEMU_VENDORIMAGE): $(INSTALLED_VENDORIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
@echo Create vendor-qemu.img
- (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/vendor.img)
+ (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/vendor.img)
vendorimage: $(INSTALLED_QEMU_VENDORIMAGE)
droidcore: $(INSTALLED_QEMU_VENDORIMAGE)
endif
ifeq ($(BOARD_USES_PRODUCTIMAGE),true)
INSTALLED_QEMU_PRODUCTIMAGE := $(PRODUCT_OUT)/product-qemu.img
-$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST)
+$(INSTALLED_QEMU_PRODUCTIMAGE): $(INSTALLED_PRODUCTIMAGE_TARGET) $(MK_QEMU_IMAGE_SH) $(SGDISK_HOST) $(SIMG2IMG)
@echo Create product-qemu.img
- (export SGDISK=$(SGDISK_HOST); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/product.img)
+ (export SGDISK=$(SGDISK_HOST) SIMG2IMG=$(SIMG2IMG); $(MK_QEMU_IMAGE_SH) ${PRODUCT_OUT}/product.img)
productimage: $(INSTALLED_QEMU_PRODUCTIMAGE)
droidcore: $(INSTALLED_QEMU_PRODUCTIMAGE)
diff --git a/core/base_rules.mk b/core/base_rules.mk
index 22e7aef..af86d56 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -690,7 +690,7 @@ INSTALLABLE_FILES.$(LOCAL_INSTALLED_MODULE).MODULE := $(my_register_name)
##########################################################
# Track module-level dependencies.
# Use $(LOCAL_MODULE) instead of $(my_register_name) to ignore module's bitness.
-ALL_DEPS.MODULES := $(sort $(ALL_DEPS.MODULES) $(LOCAL_MODULE))
+ALL_DEPS.MODULES := $(ALL_DEPS.MODULES) $(LOCAL_MODULE)
ALL_DEPS.$(LOCAL_MODULE).ALL_DEPS := $(sort \
$(ALL_MODULES.$(LOCAL_MODULE).ALL_DEPS) \
$(LOCAL_STATIC_LIBRARIES) \
diff --git a/core/binary.mk b/core/binary.mk
index 61cd5cf..d2c8c1e 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -33,6 +33,30 @@ endif
my_soong_problems :=
+# Automatically replace the old-style kernel header include with a dependency
+# on the generated_kernel_headers header library
+ifneq (,$(findstring $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include,$(LOCAL_C_INCLUDES)))
+ LOCAL_C_INCLUDES := $(patsubst $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include,,$(LOCAL_C_INCLUDES))
+ LOCAL_HEADER_LIBRARIES += generated_kernel_headers
+endif
+ifneq (,$(findstring $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/techpack/audio/include,$(LOCAL_C_INCLUDES)))
+ LOCAL_C_INCLUDES := $(patsubst $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/techpack/audio/include,,$(LOCAL_C_INCLUDES))
+ LOCAL_HEADER_LIBRARIES += generated_kernel_headers
+endif
+
+# Some qcom binaries use this weird -isystem include...
+ifneq (,$(findstring $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include,$(LOCAL_CFLAGS)))
+ LOCAL_CFLAGS := $(patsubst -isystem $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr/include,,$(LOCAL_CFLAGS))
+ LOCAL_HEADER_LIBRARIES += generated_kernel_headers
+endif
+
+# Remove KERNEL_OBJ/usr from any LOCAL_ADDITIONAL_DEPENDENCIES, we will
+# just include generated_kernel_headers which already has the proper
+# dependency
+ifneq (,$(findstring $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr,$(LOCAL_ADDITIONAL_DEPENDENCIES)))
+ LOCAL_ADDITIONAL_DEPENDENCIES := $(patsubst $(TARGET_OUT_INTERMEDIATES)/KERNEL_OBJ/usr,,$(LOCAL_ADDITIONAL_DEPENDENCIES))
+endif
+
# The following LOCAL_ variables will be modified in this file.
# Because the same LOCAL_ variables may be used to define modules for both 1st arch and 2nd arch,
# we can't modify them in place.
@@ -857,13 +881,25 @@ my_proto_c_includes += $(proto_gen_dir)
proto_generated_cpps := $(addprefix $(proto_gen_dir)/, \
$(patsubst %.proto,%.pb$(my_proto_source_suffix),$(proto_sources_fullpath)))
+define copy-proto-files
+$(if $(PRIVATE_PROTOC_OUTPUT), \
+ $(if $(call streq,$(PRIVATE_PROTOC_INPUT),$(PRIVATE_PROTOC_OUTPUT)),, \
+ $(eval proto_generated_path := $(dir $(subst $(PRIVATE_PROTOC_INPUT),$(PRIVATE_PROTOC_OUTPUT),$@)))
+ @mkdir -p $(dir $(proto_generated_path))
+ @echo "Protobuf relocation: $(basename $@).h => $(proto_generated_path)"
+ @cp -f $(basename $@).h $(proto_generated_path) ),)
+endef
+
# Ensure the transform-proto-to-cc rule is only defined once in multilib build.
ifndef $(my_host)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined
$(proto_generated_cpps): PRIVATE_PROTO_INCLUDES := $(TOP)
$(proto_generated_cpps): PRIVATE_PROTOC_FLAGS := $(LOCAL_PROTOC_FLAGS) $(my_protoc_flags)
+$(proto_generated_cpps): PRIVATE_PROTOC_OUTPUT := $(LOCAL_PROTOC_OUTPUT)
+$(proto_generated_cpps): PRIVATE_PROTOC_INPUT := $(LOCAL_PATH)
$(proto_generated_cpps): PRIVATE_RENAME_CPP_EXT := $(my_rename_cpp_ext)
$(proto_generated_cpps): $(proto_gen_dir)/%.pb$(my_proto_source_suffix): %.proto $(my_protoc_deps) $(PROTOC)
$(transform-proto-to-cc)
+ $(copy-proto-files)
$(my_host)$(LOCAL_MODULE_CLASS)_$(LOCAL_MODULE)_proto_defined := true
endif
@@ -1475,6 +1511,11 @@ my_tracked_gen_files :=
$(foreach f,$(my_tracked_src_files),$(eval my_src_file_obj_$(s):=))
my_tracked_src_files :=
+## Allow a device's own headers to take precedence over global ones
+ifneq ($(TARGET_SPECIFIC_HEADER_PATH),)
+my_c_includes := $(TOPDIR)$(TARGET_SPECIFIC_HEADER_PATH) $(my_c_includes)
+endif
+
my_c_includes += $(TOPDIR)$(LOCAL_PATH) $(intermediates) $(generated_sources_dir)
# The platform JNI header is for platform modules only.
diff --git a/core/ccache.mk b/core/ccache.mk
index d67bce6..67ae356 100644
--- a/core/ccache.mk
+++ b/core/ccache.mk
@@ -36,8 +36,14 @@ ifneq ($(filter-out false,$(USE_CCACHE)),)
# See http://petereisentraut.blogspot.com/2011/09/ccache-and-clang-part-2.html
export CCACHE_CPP2 := true
- CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
- ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
+ # Detect if the system already has ccache installed to use instead of the prebuilt
+ ccache := $(shell which ccache)
+
+ ifeq ($(ccache),)
+ CCACHE_HOST_TAG := $(HOST_PREBUILT_TAG)
+ ccache := prebuilts/misc/$(CCACHE_HOST_TAG)/ccache/ccache
+ endif
+
# Check that the executable is here.
ccache := $(strip $(wildcard $(ccache)))
ifdef ccache
diff --git a/core/clear_vars.mk b/core/clear_vars.mk
index bd86cfb..8375d51 100644
--- a/core/clear_vars.mk
+++ b/core/clear_vars.mk
@@ -453,6 +453,7 @@ LOCAL_STATIC_LIBRARIES_32:=
LOCAL_STATIC_LIBRARIES_64:=
LOCAL_WHOLE_STATIC_LIBRARIES_32:=
LOCAL_WHOLE_STATIC_LIBRARIES_64:=
+LOCAL_PROTOC_OUTPUT:=
# Robolectric variables
LOCAL_INSTRUMENT_SOURCE_DIRS :=
@@ -472,6 +473,9 @@ LOCAL_CUSTOM_BUILD_STEP_INPUT:=
LOCAL_CUSTOM_BUILD_STEP_OUTPUT:=
LOCAL_IS_AUX_MODULE :=
+# Include any vendor specific clear_vars.mk file
+-include vendor/*/build/core/clear_vars.mk
+
# Trim MAKEFILE_LIST so that $(call my-dir) doesn't need to
# iterate over thousands of entries every time.
# Leave the current makefile to make sure we don't break anything
diff --git a/core/combo/HOST_EXTRA_wsl-x86_64.mk b/core/combo/HOST_EXTRA_wsl-x86_64.mk
new file mode 100644
index 0000000..b5b90a5
--- /dev/null
+++ b/core/combo/HOST_EXTRA_wsl-x86_64.mk
@@ -0,0 +1,18 @@
+#
+# Copyright (C) 2018 The LineageOS 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.
+#
+
+# Configuration for builds hosted on wsl-x86_64.
+# Included by combo/HOST_linux-x86_64.mk \ No newline at end of file
diff --git a/core/combo/HOST_darwin-x86.mk b/core/combo/HOST_darwin-x86.mk
index 9a55cb5..e009f04 100644
--- a/core/combo/HOST_darwin-x86.mk
+++ b/core/combo/HOST_darwin-x86.mk
@@ -65,5 +65,10 @@ endef
# $(1): The file to check
define get-file-size
-stat -f "%z" $(1)
+GSTAT=$(which gstat) ; \
+if [ ! -z "$GSTAT" ]; then \
+gstat -c "%s" $(1) ; \
+else \
+stat -f "%z" $(1) ; \
+fi
endef
diff --git a/core/combo/HOST_linux-x86_64.mk b/core/combo/HOST_linux-x86_64.mk
index 845733f..60306ba 100644
--- a/core/combo/HOST_linux-x86_64.mk
+++ b/core/combo/HOST_linux-x86_64.mk
@@ -20,3 +20,8 @@
define $(combo_var_prefix)transform-shared-lib-to-toc
$(call _gen_toc_command_for_elf,$(1),$(2))
endef
+
+# Microsoft Windows Subsystem for Linux
+ifeq ($(HOST_OS_IS_WSL),true)
+include $(BUILD_COMBOS)/HOST_EXTRA_wsl-x86_64.mk
+endif \ No newline at end of file
diff --git a/core/config.mk b/core/config.mk
index d218408..e8a130f 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -224,6 +224,15 @@ include $(BUILD_SYSTEM)/envsetup.mk
# See envsetup.mk for a description of SCAN_EXCLUDE_DIRS
FIND_LEAVES_EXCLUDES := $(addprefix --prune=, $(SCAN_EXCLUDE_DIRS) .repo .git)
+# General entries for project pathmap. Any entries listed here should
+# be device and hardware independent.
+$(call project-set-path-variant,ril,TARGET_RIL_VARIANT,hardware/ril)
+
+-include vendor/extra/BoardConfigExtra.mk
+ifneq ($(LINEAGE_BUILD),)
+include vendor/lineage/config/BoardConfigLineage.mk
+endif
+
# The build system exposes several variables for where to find the kernel
# headers:
# TARGET_DEVICE_KERNEL_HEADERS is automatically created for the current
@@ -619,13 +628,13 @@ ZIPTIME := $(prebuilt_build_tools_bin)/ziptime
# ---------------------------------------------------------------
# Generic tools.
-LEX := prebuilts/misc/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/flex/flex-2.5.39
+LEX := $(prebuilt_build_tools_bin)/flex
# The default PKGDATADIR built in the prebuilt bison is a relative path
# prebuilts/build-tools/common/bison.
# To run bison from elsewhere you need to set up enviromental variable
# BISON_PKGDATADIR.
BISON_PKGDATADIR := $(PWD)/prebuilts/build-tools/common/bison
-BISON := prebuilts/build-tools/$(BUILD_OS)-$(HOST_PREBUILT_ARCH)/bin/bison
+BISON := $(prebuilt_build_tools_bin)/bison
YACC := $(BISON) -d
BISON_DATA := $(wildcard $(BISON_PKGDATADIR)/* $(BISON_PKGDATADIR)/*/*)
@@ -681,6 +690,7 @@ 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
+UUIDGEN := build/make/tools/uuidgen.py
PROGUARD := external/proguard/bin/proguard.sh
JAVATAGS := build/make/tools/java-event-log-tags.py
@@ -856,11 +866,6 @@ endif
ifdef PRODUCT_SHIPPING_API_LEVEL
- ifneq ($(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),27),)
- ifneq ($(TARGET_USES_MKE2FS),true)
- $(error When PRODUCT_SHIPPING_API_LEVEL >= 27, TARGET_USES_MKE2FS must be true)
- endif
- endif
ifneq ($(call numbers_less_than,$(PRODUCT_SHIPPING_API_LEVEL),$(BOARD_SYSTEMSDK_VERSIONS)),)
$(error BOARD_SYSTEMSDK_VERSIONS ($(BOARD_SYSTEMSDK_VERSIONS)) must all be greater than or equal to PRODUCT_SHIPPING_API_LEVEL ($(PRODUCT_SHIPPING_API_LEVEL)))
endif
@@ -926,6 +931,59 @@ PLATFORM_SEPOLICY_COMPAT_VERSIONS := \
PLATFORM_SEPOLICY_VERSION \
TOT_SEPOLICY_VERSION \
+# If true, kernel configuration requirements are present in OTA package (and will be enforced
+# during OTA). Otherwise, kernel configuration requirements are enforced in VTS.
+# Devices that checks the running kernel (instead of the kernel in OTA package) should not
+# set this variable to prevent OTA failures.
+ifndef PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
+ PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS :=
+ ifdef PRODUCT_SHIPPING_API_LEVEL
+ ifeq (true,$(call math_gt_or_eq,$(PRODUCT_SHIPPING_API_LEVEL),29))
+ PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS := true
+ endif
+ endif
+endif
+.KATI_READONLY := PRODUCT_OTA_ENFORCE_VINTF_KERNEL_REQUIREMENTS
+
+ifeq ($(USE_LOGICAL_PARTITIONS),true)
+ requirements := \
+ PRODUCT_USE_DYNAMIC_PARTITION_SIZE \
+ PRODUCT_BUILD_SUPER_PARTITION \
+ PRODUCT_USE_FASTBOOTD \
+
+ $(foreach req,$(requirements),$(if $(filter false,$($(req))),\
+ $(error USE_LOGICAL_PARTITIONS requires $(req) to be true)))
+
+ requirements :=
+
+ BOARD_KERNEL_CMDLINE += androidboot.logical_partitions=1
+endif
+
+ifeq ($(PRODUCT_USE_DYNAMIC_PARTITION_SIZE),true)
+
+ifneq ($(BOARD_SYSTEMIMAGE_PARTITION_SIZE),)
+ifneq ($(BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE),)
+$(error Should not define BOARD_SYSTEMIMAGE_PARTITION_SIZE and \
+ BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE together)
+endif
+endif
+
+ifneq ($(BOARD_VENDORIMAGE_PARTITION_SIZE),)
+ifneq ($(BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE),)
+$(error Should not define BOARD_VENDORIMAGE_PARTITION_SIZE and \
+ BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE together)
+endif
+endif
+
+ifneq ($(BOARD_PRODUCTIMAGE_PARTITION_SIZE),)
+ifneq ($(BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE),)
+$(error Should not define BOARD_PRODUCTIMAGE_PARTITION_SIZE and \
+ BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE together)
+endif
+endif
+
+endif # PRODUCT_USE_DYNAMIC_PARTITION_SIZE
+
# ###############################################################
# Set up final options.
# ###############################################################
@@ -1085,4 +1143,13 @@ include $(BUILD_SYSTEM)/ninja_config.mk
include $(BUILD_SYSTEM)/soong_config.mk
endif
+ifneq ($(LINEAGE_BUILD),)
+## We need to be sure the global selinux policies are included
+## last, to avoid accidental resetting by device configs
+$(eval include device/lineage/sepolicy/common/sepolicy.mk)
+endif
+
+# Include any vendor specific config.mk file
+-include vendor/*/build/core/config.mk
+
include $(BUILD_SYSTEM)/dumpvar.mk
diff --git a/core/definitions.mk b/core/definitions.mk
index 599ab49..d83a075 100644
--- a/core/definitions.mk
+++ b/core/definitions.mk
@@ -856,13 +856,13 @@ ESC_RESET := \033[0m
# $(1): path (and optionally line) information
# $(2): message to print
define echo-warning
-echo -e "$(ESC_BOLD)$(1): $(ESC_WARNING)warning:$(ESC_RESET)$(ESC_BOLD)" $(2) "$(ESC_RESET)" >&2
+echo -e "$(ESC_BOLD)$(1): $(ESC_WARNING)warning:$(ESC_RESET)$(ESC_BOLD)" '$(subst ','\'',$(2))' "$(ESC_RESET)" >&2
endef
# $(1): path (and optionally line) information
# $(2): message to print
define echo-error
-echo -e "$(ESC_BOLD)$(1): $(ESC_ERROR)error:$(ESC_RESET)$(ESC_BOLD)" $(2) "$(ESC_RESET)" >&2
+echo -e "$(ESC_BOLD)$(1): $(ESC_ERROR)error:$(ESC_RESET)$(ESC_BOLD)" '$(subst ','\'',$(2))' "$(ESC_RESET)" >&2
endef
# $(1): message to print
@@ -2368,7 +2368,7 @@ $(hide) rm -f $@ $@.tmp
$(hide) $(JAVA) \
$(if $(USE_OPENJDK9),--add-opens java.base/java.lang.invoke=ALL-UNNAMED,) \
-Djdk.internal.lambda.dumpProxyClasses=$(abspath $(dir $@))/desugar_dumped_classes \
- -jar $(DESUGAR) \
+ -jar $(DESUGAR) $(DEX_FLAGS) \
$(addprefix --bootclasspath_entry ,$(PRIVATE_BOOTCLASSPATH)) \
$(addprefix --classpath_entry ,$(PRIVATE_SHARED_JAVA_HEADER_LIBRARIES)) \
--min_sdk_version $(call codename-or-sdk-to-sdk,$(PRIVATE_MIN_SDK_VERSION)) \
@@ -2383,7 +2383,7 @@ define transform-classes.jar-to-dex
@echo "target Dex: $(PRIVATE_MODULE)"
@mkdir -p $(dir $@)
$(hide) rm -f $(dir $@)classes*.dex
-$(hide) $(DX_COMMAND) \
+$(hide) $(DX_COMMAND) $(DEX_FLAGS) \
--dex --output=$(dir $@) \
--min-sdk-version=$(PRIVATE_MIN_SDK_VERSION) \
$(if $(NO_OPTIMIZE_DX), \
@@ -2402,7 +2402,7 @@ define transform-classes-d8.jar-to-dex
@mkdir -p $(dir $@)
$(hide) rm -f $(dir $@)classes*.dex $(dir $@)d8_input.jar
$(hide) $(ZIP2ZIP) -j -i $< -o $(dir $@)d8_input.jar "**/*.class"
-$(hide) $(DX_COMMAND) \
+$(hide) $(DX_COMMAND) $(DEX_FLAGS) \
--output $(dir $@) \
--min-api $(PRIVATE_MIN_SDK_VERSION) \
$(subst --main-dex-list=, --main-dex-list , \
@@ -2827,7 +2827,8 @@ endef
else
define transform-jar-to-proguard
@echo Proguard: $@
-$(hide) $(PROGUARD) -injars $< -outjars $@ $(PRIVATE_PROGUARD_FLAGS) \
+$(hide) $(PROGUARD) $(DEX_FLAGS) \
+ -injars $< -outjars $@ $(PRIVATE_PROGUARD_FLAGS) \
$(addprefix -injars , $(PRIVATE_EXTRA_INPUT_JAR))
endef
endif
@@ -2838,7 +2839,8 @@ endif
###########################################################
define transform-jar-to-dex-r8
@echo R8: $@
-$(hide) $(R8_COMPAT_PROGUARD) -injars '$<' \
+$(hide) $(R8_COMPAT_PROGUARD) $(DEX_FLAGS) \
+ -injars '$<' \
--min-api $(PRIVATE_MIN_SDK_VERSION) \
--force-proguard-compatibility --output $(subst classes.dex,,$@) \
$(PRIVATE_PROGUARD_FLAGS) \
diff --git a/core/dex_preopt.mk b/core/dex_preopt.mk
index 7298bde..17df08d 100644
--- a/core/dex_preopt.mk
+++ b/core/dex_preopt.mk
@@ -35,7 +35,7 @@ endif
# Conditional to building on linux, as dex2oat currently does not work on darwin.
ifeq ($(HOST_OS),linux)
WITH_DEXPREOPT ?= true
- ifeq (eng,$(TARGET_BUILD_VARIANT))
+ ifneq (user,$(TARGET_BUILD_VARIANT))
# Don't strip for quick development turnarounds.
DEX_PREOPT_DEFAULT := nostripping
# For an eng build only pre-opt the boot image and system server. This gives reasonable performance
diff --git a/core/dex_preopt_libart.mk b/core/dex_preopt_libart.mk
index 9c4d55d..45ce37b 100644
--- a/core/dex_preopt_libart.mk
+++ b/core/dex_preopt_libart.mk
@@ -170,6 +170,9 @@ my_2nd_arch_prefix :=
# In the case where LOCAL_ENFORCE_USES_LIBRARIES is true, PRIVATE_DEX2OAT_CLASS_LOADER_CONTEXT
# contains the normalized path list of the libraries. This makes it easier to conditionally prepend
# org.apache.http.legacy.boot based on the SDK level if required.
+ifeq ($(HOST_OS_IS_WSL),true)
+SINGLE_THREAD := "-j1"
+endif
define dex2oat-one-file
$(hide) rm -f $(2)
$(hide) mkdir -p $(dir $(2))
@@ -184,6 +187,7 @@ source build/make/core/verify_uses_libraries.sh "$(1)" && \
source build/make/core/construct_context.sh "$(PRIVATE_CONDITIONAL_USES_LIBRARIES_HOST)" "$(PRIVATE_CONDITIONAL_USES_LIBRARIES_TARGET)" && \
,) \
ANDROID_LOG_TAGS="*:e" $(DEX2OAT) \
+ $(SINGLE_THREAD) \
--runtime-arg -Xms$(DEX2OAT_XMS) --runtime-arg -Xmx$(DEX2OAT_XMX) \
$${class_loader_context_arg} \
$${stored_class_loader_context_arg} \
diff --git a/core/envsetup.mk b/core/envsetup.mk
index 700189e..1d7856b 100644
--- a/core/envsetup.mk
+++ b/core/envsetup.mk
@@ -100,6 +100,12 @@ endif
# HOST_OS
ifneq (,$(findstring Linux,$(UNAME)))
HOST_OS := linux
+ ifneq (,$(findstring Microsoft,$(shell uname -r)))
+ # Microsoft Windows Subsystem for Linux
+ # The HOST_OS is still Linux but with some limitations.
+ # Assumes that there are no other Microsoft Linux kernels
+ HOST_OS_IS_WSL := true
+ endif
endif
ifneq (,$(findstring Darwin,$(UNAME)))
HOST_OS := darwin
@@ -368,8 +374,12 @@ endif
ifeq (,$(strip $(OUT_DIR)))
ifeq (,$(strip $(OUT_DIR_COMMON_BASE)))
+ifneq ($(TOPDIR),)
OUT_DIR := $(TOPDIR)out
else
+OUT_DIR := $(CURDIR)/out
+endif
+else
OUT_DIR := $(OUT_DIR_COMMON_BASE)/$(notdir $(PWD))
endif
endif
diff --git a/core/main.mk b/core/main.mk
index 1946edb..97ec295 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -148,6 +148,15 @@ ADDITIONAL_BUILD_PROPERTIES :=
#
# -----------------------------------------------------------------
+# Validate ADDITIONAL_PRODUCT_PROPERTIES.
+ifneq ($(ADDITIONAL_PRODUCT_PROPERTIES),)
+$(error ADDITIONAL_PRODUCT_PROPERTIES must not be set before here: $(ADDITIONAL_PRODUCT_PROPERTIES))
+endif
+
+ADDITIONAL_PRODUCT_PROPERTIES :=
+
+#
+# -----------------------------------------------------------------
# Add the product-defined properties to the build properties.
ifdef PRODUCT_SHIPPING_API_LEVEL
ADDITIONAL_BUILD_PROPERTIES += \
@@ -206,17 +215,11 @@ include build/make/core/pdk_config.mk
#
# -----------------------------------------------------------------
# Enable dynamic linker and hidden API developer warnings for
-# userdebug, eng and non-REL builds
-ifneq ($(TARGET_BUILD_VARIANT),user)
- ADDITIONAL_BUILD_PROPERTIES += ro.bionic.ld.warning=1 \
- ro.art.hiddenapi.warning=1
-else
-# Enable it for user builds as long as they are not final.
-ifneq ($(PLATFORM_VERSION_CODENAME),REL)
+# eng builds
+ifeq ($(TARGET_BUILD_VARIANT),eng)
ADDITIONAL_BUILD_PROPERTIES += ro.bionic.ld.warning=1 \
ro.art.hiddenapi.warning=1
endif
-endif
ADDITIONAL_BUILD_PROPERTIES += ro.treble.enabled=${PRODUCT_FULL_TREBLE}
@@ -233,6 +236,8 @@ else
ADDITIONAL_DEFAULT_PROPERTIES += ro.actionable_compatible_property.enabled=${PRODUCT_COMPATIBLE_PROPERTY}
endif
+ADDITIONAL_PRODUCT_PROPERTIES += ro.boot.logical_partitions=$(USE_LOGICAL_PARTITIONS)
+
# -----------------------------------------------------------------
###
### In this section we set up the things that are different
@@ -359,6 +364,10 @@ ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android
ADDITIONAL_BUILD_PROPERTIES += dalvik.vm.stack-trace-dir=/data/anr
# ------------------------------------------------------------
+# Include vendor specific additions to build properties
+-include vendor/lineage/build/core/main.mk
+
+# ------------------------------------------------------------
# Define a function that, given a list of module tags, returns
# non-empty if that module should be installed in /system.
@@ -397,6 +406,8 @@ ADDITIONAL_DEFAULT_PROPERTIES := $(strip $(ADDITIONAL_DEFAULT_PROPERTIES))
.KATI_READONLY := ADDITIONAL_DEFAULT_PROPERTIES
ADDITIONAL_BUILD_PROPERTIES := $(strip $(ADDITIONAL_BUILD_PROPERTIES))
.KATI_READONLY := ADDITIONAL_BUILD_PROPERTIES
+ADDITIONAL_PRODUCT_PROPERTIES := $(strip $(ADDITIONAL_PRODUCT_PROPERTIES))
+.KATI_READONLY := ADDITIONAL_PRODUCT_PROPERTIES
ifneq ($(PRODUCT_ENFORCE_RRO_TARGETS),)
ENFORCE_RRO_SOURCES :=
@@ -1095,6 +1106,9 @@ productimage: $(INSTALLED_PRODUCTIMAGE_TARGET)
.PHONY: systemotherimage
systemotherimage: $(INSTALLED_SYSTEMOTHERIMAGE_TARGET)
+.PHONY: superimage
+superimage: $(INSTALLED_SUPERIMAGE_TARGET)
+
.PHONY: bootimage
bootimage: $(INSTALLED_BOOTIMAGE_TARGET)
@@ -1108,6 +1122,7 @@ auxiliary: $(INSTALLED_AUX_TARGETS)
.PHONY: droidcore
droidcore: files \
systemimage \
+ $(INSTALLED_RAMDISK_TARGET) \
$(INSTALLED_BOOTIMAGE_TARGET) \
$(INSTALLED_RECOVERYIMAGE_TARGET) \
$(INSTALLED_VBMETAIMAGE_TARGET) \
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 80d386d..585d9ff 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -493,6 +493,14 @@ framework_res_package_export := \
else # LOCAL_SDK_RES_VERSION
framework_res_package_export := \
$(call intermediates-dir-for,APPS,framework-res,,COMMON)/package-export.apk
+
+# Avoid possible circular dependency with our platform-res
+lineage_plat_res_package_export := \
+ $(call intermediates-dir-for,APPS,org.lineageos.platform-res,,COMMON)/package-export.apk
+
+lineage_plat_res_package_export_deps := \
+ $(dir $(lineage_plat_res_package_export))src/R.stamp
+
endif # LOCAL_SDK_RES_VERSION
endif # LOCAL_NO_STANDARD_LIBRARIES
@@ -505,6 +513,12 @@ all_library_res_package_export_deps := \
$(framework_res_package_export) \
$(foreach lib,$(LOCAL_RES_LIBRARIES),\
$(call intermediates-dir-for,APPS,$(lib),,COMMON)/src/R.stamp)
+
+all_library_res_package_exports += \
+ $(lineage_plat_res_package_export)
+all_library_res_package_export_deps += \
+ $(lineage_plat_res_package_export_deps)
+
$(resource_export_package) $(R_file_stamp) $(LOCAL_BUILT_MODULE): $(all_library_res_package_export_deps)
$(LOCAL_INTERMEDIATE_TARGETS): \
PRIVATE_AAPT_INCLUDES := $(all_library_res_package_exports)
diff --git a/core/pathmap.mk b/core/pathmap.mk
index af33f5d..e622cee 100644
--- a/core/pathmap.mk
+++ b/core/pathmap.mk
@@ -93,3 +93,5 @@ FRAMEWORKS_BASE_SUBDIRS := \
#
FRAMEWORKS_BASE_JAVA_SRC_DIRS := \
$(addprefix frameworks/base/,$(FRAMEWORKS_BASE_SUBDIRS))
+
+-include vendor/lineage/build/core/pathmap.mk
diff --git a/core/product.mk b/core/product.mk
index 899b806..9567a45 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -73,6 +73,7 @@ endef
#
_product_var_list := \
+ PRODUCT_BUILD_PROP_OVERRIDES \
PRODUCT_NAME \
PRODUCT_MODEL \
PRODUCT_LOCALES \
@@ -158,6 +159,10 @@ _product_var_list := \
PRODUCT_CFI_EXCLUDE_PATHS \
PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE \
PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE \
+ PRODUCT_USE_LOGICAL_PARTITIONS \
+ PRODUCT_USE_DYNAMIC_PARTITION_SIZE \
+ PRODUCT_BUILD_SUPER_PARTITION \
+ PRODUCT_USE_FASTBOOTD \
define dump-product
$(info ==== $(1) ====)\
@@ -321,6 +326,14 @@ _product_stash_var_list += \
WITH_DEXPREOPT \
WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY
+# Logical partitions related variables.
+_product_stash_var_list += \
+ BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE \
+ BOARD_VENDORIMAGE_PARTITION_RESERVED_SIZE \
+ BOARD_PRODUCTIMAGE_PARTITION_RESERVED_SIZE \
+ BOARD_SUPER_PARTITION_SIZE \
+ BOARD_SUPER_PARTITION_PARTITION_LIST \
+
#
# Mark the variables in _product_stash_var_list as readonly
#
diff --git a/core/product_config.mk b/core/product_config.mk
index 9406812..2c3f21f 100644
--- a/core/product_config.mk
+++ b/core/product_config.mk
@@ -372,6 +372,13 @@ PRODUCT_PRODUCT_PROPERTIES := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PRODUCT_PROPERTIES))
.KATI_READONLY := PRODUCT_PRODUCT_PROPERTIES
+# A list of property assignments, like "key = value", with zero or more
+# whitespace characters on either side of the '='.
+# used for overriding properties in build.prop
+PRODUCT_BUILD_PROP_OVERRIDES := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_BUILD_PROP_OVERRIDES))
+.KATI_READONLY := PRODUCT_BUILD_PROP_OVERRIDES
+
# Should we use the default resources or add any product specific overlays
PRODUCT_PACKAGE_OVERLAYS := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_PACKAGE_OVERLAYS))
@@ -505,3 +512,26 @@ PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := \
# Whether the whitelist of actionable compatible properties should be disabled or not
PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE := \
$(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_ACTIONABLE_COMPATIBLE_PROPERTY_DISABLE))
+
+# Logical and Resizable Partitions feature flag.
+PRODUCT_USE_LOGICAL_PARTITIONS := \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_USE_LOGICAL_PARTITIONS))
+.KATI_READONLY := PRODUCT_USE_LOGICAL_PARTITIONS
+ifndef USE_LOGICAL_PARTITIONS
+ USE_LOGICAL_PARTITIONS := $(PRODUCT_USE_LOGICAL_PARTITIONS)
+endif
+
+# All requirements of USE_LOGICAL_PARTITIONS falls back to
+# USE_LOGICAL_PARTITIONS if not defined.
+PRODUCT_USE_DYNAMIC_PARTITION_SIZE := $(or \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_USE_DYNAMIC_PARTITION_SIZE)),\
+ $(USE_LOGICAL_PARTITIONS))
+.KATI_READONLY := PRODUCT_USE_DYNAMIC_PARTITION_SIZE
+PRODUCT_BUILD_SUPER_PARTITION := $(or \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_BUILD_SUPER_PARTITION)),\
+ $(USE_LOGICAL_PARTITIONS))
+.KATI_READONLY := PRODUCT_BUILD_SUPER_PARTITION
+PRODUCT_USE_FASTBOOTD := $(or \
+ $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_USE_FASTBOOTD)),\
+ $(USE_LOGICAL_PARTITIONS))
+.KATI_READONLY := PRODUCT_USE_FASTBOOTD
diff --git a/core/soong_app_prebuilt.mk b/core/soong_app_prebuilt.mk
index ae0d196..2513b48 100644
--- a/core/soong_app_prebuilt.mk
+++ b/core/soong_app_prebuilt.mk
@@ -52,7 +52,7 @@ resource_export_stamp := $(intermediates.COMMON)/src/R.stamp
$(resource_export_package): PRIVATE_STAMP := $(resource_export_stamp)
$(resource_export_package): .KATI_IMPLICIT_OUTPUTS := $(resource_export_stamp)
$(resource_export_package): $(LOCAL_SOONG_RESOURCE_EXPORT_PACKAGE)
- @echo "Copy: $$@"
+ @echo "Copy: $@"
$(copy-file-to-target)
touch $(PRIVATE_STAMP)
$(call add-dependency,$(LOCAL_BUILT_MODULE),$(resource_export_package))
diff --git a/core/soong_config.mk b/core/soong_config.mk
index f8cb2fb..53bdcfc 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -151,6 +151,8 @@ $(foreach namespace,$(SOONG_CONFIG_NAMESPACES),\
$(eval _contents := $$(_contents)$(if $(strip $(SOONG_CONFIG_$(namespace))),__SV_END) },$$(newline)))
_contents := $(_contents)$(if $(strip $(SOONG_CONFIG_NAMESPACES)),__SV_END) },$(newline)
+include vendor/lineage/build/soong/soong_config.mk
+
_contents := $(subst $(comma)$(newline)__SV_END,$(newline),$(_contents)__SV_END}$(newline))
$(file >$(SOONG_VARIABLES).tmp,$(_contents))
diff --git a/core/tasks/deps_licenses.mk b/core/tasks/deps_licenses.mk
index bb20fa0..daf986f 100644
--- a/core/tasks/deps_licenses.mk
+++ b/core/tasks/deps_licenses.mk
@@ -40,7 +40,7 @@ $(if $(_gmad_new),$(eval $(1) += $(_gmad_new))\
endef
define print-deps-license
-$(foreach m, $(ALL_DEPS.MODULES),\
+$(foreach m, $(sort $(ALL_DEPS.MODULES)),\
$(eval m_p := $(sort $(ALL_MODULES.$(m).PATH) $(ALL_MODULES.$(m)$(TARGET_2ND_ARCH_MODULE_SUFFIX).PATH)))\
$(if $(filter $(PROJ_PATH),$(m_p)),\
$(eval deps :=)\
diff --git a/core/tasks/oem_image.mk b/core/tasks/oem_image.mk
index 66eec22..e9c506a 100644
--- a/core/tasks/oem_image.mk
+++ b/core/tasks/oem_image.mk
@@ -33,7 +33,7 @@ $(INSTALLED_OEMIMAGE_TARGET) : $(INTERNAL_USERIMAGES_DEPS) $(INTERNAL_OEMIMAGE_F
$(call pretty,"Target oem fs image: $@")
@mkdir -p $(TARGET_OUT_OEM)
@mkdir -p $(oemimage_intermediates) && rm -rf $(oemimage_intermediates)/oem_image_info.txt
- $(call generate-userimage-prop-dictionary, $(oemimage_intermediates)/oem_image_info.txt, skip_fsck=true)
+ $(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)
diff --git a/core/tasks/vendor_module_check.mk b/core/tasks/vendor_module_check.mk
index 6695994..eeade8d 100644
--- a/core/tasks/vendor_module_check.mk
+++ b/core/tasks/vendor_module_check.mk
@@ -48,7 +48,7 @@ _vendor_owner_whitelist := \
widevine
-_restrictions := $(strip $(PRODUCTS.$(INTERNAL_PRODUCT).PRODUCT_RESTRICT_VENDOR_FILES))
+_restrictions := none
ifneq (,$(_restrictions))
ifneq (,$(PRODUCTS.$(INTERNAL_PRODUCT).VENDOR_PRODUCT_RESTRICT_VENDOR_FILES))
diff --git a/envsetup.sh b/envsetup.sh
index cf61950..910c3ce 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -27,6 +27,12 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y
- sgrep: Greps on all local source files.
- godir: Go to the directory containing a file.
+EOF
+
+ __print_lineage_functions_help
+
+cat <<EOF
+
Environment options:
- SANITIZE_HOST: Set to 'true' to use ASAN for all host modules. Note that
ASAN_OPTIONS=detect_leaks=0 will be set by default until the
@@ -37,7 +43,7 @@ EOF
local T=$(gettop)
local A=""
local i
- for i in `cat $T/build/envsetup.sh | sed -n "/^[[:blank:]]*function /s/function \([a-z_]*\).*/\1/p" | sort | uniq`; do
+ for i in `cat $T/build/envsetup.sh $T/vendor/lineage/build/envsetup.sh | sed -n "/^[[:blank:]]*function /s/function \([a-z_]*\).*/\1/p" | sort | uniq`; do
A="$A $i"
done
echo $A
@@ -48,8 +54,8 @@ function build_build_var_cache()
{
local T=$(gettop)
# Grep out the variable names from the script.
- cached_vars=`cat $T/build/envsetup.sh | tr '()' ' ' | awk '{for(i=1;i<=NF;i++) if($i~/get_build_var/) print $(i+1)}' | sort -u | tr '\n' ' '`
- cached_abs_vars=`cat $T/build/envsetup.sh | tr '()' ' ' | awk '{for(i=1;i<=NF;i++) if($i~/get_abs_build_var/) print $(i+1)}' | sort -u | tr '\n' ' '`
+ cached_vars=`cat $T/build/envsetup.sh $T/vendor/lineage/build/envsetup.sh | tr '()' ' ' | awk '{for(i=1;i<=NF;i++) if($i~/get_build_var/) print $(i+1)}' | sort -u | tr '\n' ' '`
+ cached_abs_vars=`cat $T/build/envsetup.sh $T/vendor/lineage/build/envsetup.sh | tr '()' ' ' | awk '{for(i=1;i<=NF;i++) if($i~/get_abs_build_var/) print $(i+1)}' | sort -u | tr '\n' ' '`
# Call the build system to dump the "<val>=<value>" pairs as a shell script.
build_dicts_script=`\builtin cd $T; build/soong/soong_ui.bash --dumpvars-mode \
--vars="$cached_vars" \
@@ -131,6 +137,13 @@ function check_product()
echo "Couldn't locate the top of the tree. Try setting TOP." >&2
return
fi
+ if (echo -n $1 | grep -q -e "^lineage_") ; then
+ LINEAGE_BUILD=$(echo -n $1 | sed -e 's/^lineage_//g')
+ else
+ LINEAGE_BUILD=
+ fi
+ export LINEAGE_BUILD
+
TARGET_PRODUCT=$1 \
TARGET_BUILD_VARIANT= \
TARGET_BUILD_TYPE= \
@@ -305,7 +318,6 @@ function set_stuff_for_environment()
setpaths
set_sequence_number
- export ANDROID_BUILD_TOP=$(gettop)
# With this environment variable new GCC can apply colors to warnings/errors
export GCC_COLORS='error=01;31:warning=01;35:note=01;36:caret=01;32:locus=01:quote=01'
export ASAN_OPTIONS=detect_leaks=0
@@ -494,7 +506,7 @@ function choosevariant()
export TARGET_BUILD_VARIANT=$default_value
elif (echo -n $ANSWER | grep -q -e "^[0-9][0-9]*$") ; then
if [ "$ANSWER" -le "${#VARIANT_CHOICES[@]}" ] ; then
- export TARGET_BUILD_VARIANT=${VARIANT_CHOICES[$(($ANSWER-1))]}
+ export TARGET_BUILD_VARIANT=${VARIANT_CHOICES[$(($ANSWER-$_arrayoffset))]}
fi
else
if check_variant $ANSWER
@@ -592,7 +604,7 @@ function lunch()
then
if [ $answer -le ${#LUNCH_MENU_CHOICES[@]} ]
then
- selection=${LUNCH_MENU_CHOICES[$(($answer-1))]}
+ selection=${LUNCH_MENU_CHOICES[$(($answer-$_arrayoffset))]}
fi
else
selection=$answer
@@ -618,12 +630,37 @@ function lunch()
return 1
fi
+ check_product $product
+ if [ $? -ne 0 ]
+ then
+ # if we can't find a product, try to grab it off the LineageOS GitHub
+ T=$(gettop)
+ cd $T > /dev/null
+ vendor/lineage/build/tools/roomservice.py $product
+ cd - > /dev/null
+ check_product $product
+ else
+ T=$(gettop)
+ cd $T > /dev/null
+ vendor/lineage/build/tools/roomservice.py $product true
+ cd - > /dev/null
+ fi
+
TARGET_PRODUCT=$product \
TARGET_BUILD_VARIANT=$variant \
TARGET_PLATFORM_VERSION=$version \
build_build_var_cache
if [ $? -ne 0 ]
then
+ echo
+ echo "** Don't have a product spec for: '$product'"
+ echo "** Do you have the right repo manifest?"
+ product=
+ fi
+
+ if [ -z "$product" -o -z "$variant" ]
+ then
+ echo
return 1
fi
@@ -638,6 +675,8 @@ function lunch()
echo
+ fixup_common_out_dir
+
set_stuff_for_environment
printconfig
destroy_build_var_cache
@@ -654,7 +693,7 @@ function _lunch()
COMPREPLY=( $(compgen -W "${LUNCH_MENU_CHOICES[*]}" -- ${cur}) )
return 0
}
-complete -F _lunch lunch
+complete -F _lunch lunch 2>/dev/null
# Configures the build to build unbundled apps.
# Run tapas with one or more app names (from LOCAL_PACKAGE_NAME)
@@ -1520,7 +1559,7 @@ function godir () {
echo "Invalid choice"
continue
fi
- pathname=${lines[$(($choice-1))]}
+ pathname=${lines[$(($choice-$_arrayoffset))]}
done
else
pathname=${lines[0]}
@@ -1638,16 +1677,36 @@ function atest()
"$(gettop)"/tools/tradefederation/core/atest/atest.py "$@"
}
-if [ "x$SHELL" != "x/bin/bash" ]; then
+function __detect_shell() {
case `ps -o command -p $$` in
*bash*)
+ echo bash
+ ;;
+ *zsh*)
+ echo zsh
;;
*)
- echo "WARNING: Only bash is supported, use of other shell would lead to erroneous results"
+ echo unknown
+ return 1
;;
esac
+ return
+}
+
+if ! __detect_shell > /dev/null; then
+ echo "WARNING: Only bash and zsh are supported, use of other shell may lead to erroneous results"
fi
+# determine whether arrays are zero-based (bash) or one-based (zsh)
+_xarray=(a b c)
+if [ -z "${_xarray[${#_xarray[@]}]}" ]
+then
+ _arrayoffset=1
+else
+ _arrayoffset=0
+fi
+unset _xarray
+
# Execute the contents of any vendorsetup.sh files we can find.
for f in `test -d device && find -L device -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null | sort` \
`test -d vendor && find -L vendor -maxdepth 4 -name 'vendorsetup.sh' 2> /dev/null | sort` \
@@ -1659,3 +1718,7 @@ done
unset f
addcompletions
+
+export ANDROID_BUILD_TOP=$(gettop)
+
+. $ANDROID_BUILD_TOP/vendor/lineage/build/envsetup.sh
diff --git a/target/board/BoardConfigEmuCommon.mk b/target/board/BoardConfigEmuCommon.mk
new file mode 100644
index 0000000..dc68641
--- /dev/null
+++ b/target/board/BoardConfigEmuCommon.mk
@@ -0,0 +1,41 @@
+# BoardConfigEmuCommon.mk
+#
+# Common compile-time definitions for emulator
+#
+
+# The generic product target doesn't have any hardware-specific pieces.
+TARGET_NO_BOOTLOADER := true
+TARGET_NO_KERNEL := true
+
+HAVE_HTC_AUDIO_DRIVER := true
+BOARD_USES_GENERIC_AUDIO := true
+TARGET_BOOTLOADER_BOARD_NAME := goldfish_$(TARGET_ARCH)
+
+# no hardware camera
+USE_CAMERA_STUB := true
+
+TARGET_USES_HWC2 := true
+NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
+
+# Build OpenGLES emulation guest and host libraries
+BUILD_EMULATOR_OPENGL := true
+BUILD_QEMU_IMAGES := true
+
+# Build and enable the OpenGL ES View renderer. When running on the emulator,
+# the GLES renderer disables itself if host GL acceleration isn't available.
+USE_OPENGL_RENDERER := true
+
+TARGET_COPY_OUT_VENDOR := vendor
+
+# ~100 MB vendor image. Please adjust system image / vendor image sizes
+# when finalizing them. The partition size needs to be a multiple of image
+# block size: 4096.
+BOARD_VENDORIMAGE_PARTITION_SIZE := 100003840
+BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_FLASH_BLOCK_SIZE := 512
+DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
+
+BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/common
+BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
+
+BUILD_BROKEN_DUP_RULES := false
diff --git a/target/board/BoardConfigGsiCommon.mk b/target/board/BoardConfigGsiCommon.mk
new file mode 100644
index 0000000..7319fec
--- /dev/null
+++ b/target/board/BoardConfigGsiCommon.mk
@@ -0,0 +1,57 @@
+# BoardConfigGsiCommon.mk
+#
+# Common compile-time definitions for GSI
+#
+
+# GSIs always use ext4.
+TARGET_USERIMAGES_USE_EXT4 := true
+# GSIs are historically released in sparse format.
+# Some vendors' bootloaders don't work properly with raw format images. So
+# we explicit specify this need below (even though it's the current default).
+TARGET_USERIMAGES_SPARSE_EXT_DISABLED := false
+
+# Enable dyanmic system image size and reserved 64MB in it.
+BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE := 67108864
+
+# Android Verified Boot (AVB):
+# 1) Sets BOARD_AVB_ENABLE to sign the GSI image.
+# 2) Sets AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED (--flag 2) in
+# vbmeta.img to disable AVB verification.
+#
+# To disable AVB for GSI, use the vbmeta.img and the GSI together.
+# To enable AVB for GSI, include the GSI public key into the device-specific
+# vbmeta.img.
+BOARD_AVB_ENABLE := true
+BOARD_AVB_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
+BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flag 2
+
+# Enable chain partition for system.
+BOARD_AVB_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
+BOARD_AVB_SYSTEM_ALGORITHM := SHA256_RSA2048
+BOARD_AVB_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
+BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION := 1
+
+ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
+# GSI is always userdebug and needs a couple of properties taking precedence
+# over those set by the vendor.
+TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop
+endif
+BOARD_VNDK_VERSION := current
+
+# system-as-root is mandatory from Android P
+TARGET_NO_RECOVERY := true
+BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
+
+# 64 bits binder interface is mandatory from Android P
+TARGET_USES_64_BIT_BINDER := true
+
+# Android generic system image always create metadata partition
+BOARD_USES_METADATA_PARTITION := true
+
+# Set this to create /cache mount point for non-A/B devices that mounts /cache.
+# The partition size doesn't matter, just to make build pass.
+BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216
+
+# Audio: must using XML format for Treblized devices
+USE_XML_AUDIO_POLICY_CONF := 1
diff --git a/target/board/generic/BoardConfig.mk b/target/board/generic/BoardConfig.mk
index 6c82846..738c037 100644
--- a/target/board/generic/BoardConfig.mk
+++ b/target/board/generic/BoardConfig.mk
@@ -1,11 +1,19 @@
-# config.mk
+# Copyright (C) 2018 The Android Open Source Project
#
-# Product-specific compile-time definitions.
+# 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 generic product target doesn't have any hardware-specific pieces.
-TARGET_NO_BOOTLOADER := true
-TARGET_NO_KERNEL := true
+# arm emulator specific definitions
TARGET_ARCH := arm
# Note: Before Pi, we built the platform images for ARMv7-A _without_ NEON.
@@ -36,66 +44,11 @@ endif
TARGET_CPU_VARIANT := generic
TARGET_CPU_ABI := armeabi-v7a
TARGET_CPU_ABI2 := armeabi
-HAVE_HTC_AUDIO_DRIVER := true
-BOARD_USES_GENERIC_AUDIO := true
-TARGET_BOOTLOADER_BOARD_NAME := goldfish_$(TARGET_ARCH)
-
-TARGET_USES_64_BIT_BINDER := true
-
-# no hardware camera
-USE_CAMERA_STUB := true
-TARGET_USES_HWC2 := true
-NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
+include build/make/target/board/BoardConfigEmuCommon.mk
+include build/make/target/board/BoardConfigGsiCommon.mk
-# Build OpenGLES emulation guest and host libraries
-BUILD_EMULATOR_OPENGL := true
-BUILD_QEMU_IMAGES := true
-
-# Build and enable the OpenGL ES View renderer. When running on the emulator,
-# the GLES renderer disables itself if host GL acceleration isn't available.
-USE_OPENGL_RENDERER := true
-
-TARGET_USERIMAGES_USE_EXT4 := true
-# Partition size is default 1.5GB (1536MB) for 64 bits projects
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1610612736
BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
-TARGET_COPY_OUT_VENDOR := vendor
-# ~100 MB vendor image. Please adjust system image / vendor image sizes
-# when finalizing them.
-BOARD_VENDORIMAGE_PARTITION_SIZE := 100000000
-BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-BOARD_FLASH_BLOCK_SIZE := 512
-TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
-DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
-
-# Android generic system image always create metadata partition
-BOARD_USES_METADATA_PARTITION := true
-
-# Set this to create /cache mount point for non-A/B devices that mounts /cache.
-# The partition size doesn't matter, just to make build pass.
-BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
-BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216
-
-BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/common
-BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
-
-# Android Verified Boot (AVB):
-# Builds a special vbmeta.img that disables AVB verification.
-# Otherwise, AVB will prevent the device from booting the generic system.img.
-# Also checks that BOARD_AVB_ENABLE is not set, to prevent adding verity
-# metadata into system.img.
-ifeq ($(BOARD_AVB_ENABLE),true)
-$(error BOARD_AVB_ENABLE cannot be set for GSI)
-endif
-BOARD_BUILD_DISABLED_VBMETAIMAGE := true
-
-ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
-# GSI is always userdebug and needs a couple of properties taking precedence
-# over those set by the vendor.
-TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop
-endif
-BOARD_VNDK_VERSION := current
# Wifi.
BOARD_WLAN_DEVICE := emulator
@@ -107,7 +60,3 @@ WPA_SUPPLICANT_VERSION := VER_0_8_X
WIFI_DRIVER_FW_PATH_PARAM := "/dev/null"
WIFI_DRIVER_FW_PATH_STA := "/dev/null"
WIFI_DRIVER_FW_PATH_AP := "/dev/null"
-
-# Enable A/B update
-TARGET_NO_RECOVERY := true
-BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
diff --git a/target/board/generic/device.mk b/target/board/generic/device.mk
index 273ac71..0a32415 100644
--- a/target/board/generic/device.mk
+++ b/target/board/generic/device.mk
@@ -14,14 +14,6 @@
# limitations under the License.
#
-# minimal configuration for audio policy.
-PRODUCT_COPY_FILES += \
- frameworks/av/services/audiopolicy/config/audio_policy_configuration_generic.xml:system/etc/audio_policy_configuration.xml \
- frameworks/av/services/audiopolicy/config/primary_audio_policy_configuration.xml:system/etc/primary_audio_policy_configuration.xml \
- frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:system/etc/r_submix_audio_policy_configuration.xml \
- frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:system/etc/audio_policy_volumes.xml \
- frameworks/av/services/audiopolicy/config/default_volume_tables.xml:system/etc/default_volume_tables.xml \
-
# NFC:
# Provide default libnfc-nci.conf file for devices that does not have one in
# vendor/etc because aosp system image (of aosp_$arch products) is going to
diff --git a/target/board/generic_arm64/BoardConfig.mk b/target/board/generic_arm64/BoardConfig.mk
index 56f15de..13d5bd6 100644
--- a/target/board/generic_arm64/BoardConfig.mk
+++ b/target/board/generic_arm64/BoardConfig.mk
@@ -1,4 +1,4 @@
-# Copyright (C) 2013 The Android Open Source Project
+# Copyright (C) 2018 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.
@@ -13,14 +13,11 @@
# limitations under the License.
#
-# The generic product target doesn't have any hardware-specific pieces.
-TARGET_NO_BOOTLOADER := true
-TARGET_NO_KERNEL := true
+# arm64 emulator specific definitions
TARGET_ARCH := arm64
TARGET_ARCH_VARIANT := armv8-a
TARGET_CPU_VARIANT := generic
TARGET_CPU_ABI := arm64-v8a
-TARGET_BOOTLOADER_BOARD_NAME := goldfish_$(TARGET_ARCH)
TARGET_2ND_ARCH := arm
TARGET_2ND_CPU_ABI := armeabi-v7a
@@ -55,69 +52,18 @@ TARGET_2ND_ARCH_VARIANT := armv8-a
TARGET_2ND_CPU_VARIANT := generic
endif
+include build/make/target/board/BoardConfigEmuCommon.mk
+include build/make/target/board/BoardConfigGsiCommon.mk
-TARGET_USES_64_BIT_BINDER := true
-
-# no hardware camera
-USE_CAMERA_STUB := true
-
-TARGET_USES_HWC2 := true
-NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
-
-# Build OpenGLES emulation host and guest libraries
-BUILD_EMULATOR_OPENGL := true
-BUILD_QEMU_IMAGES := true
-
-# Build and enable the OpenGL ES View renderer. When running on the emulator,
-# the GLES renderer disables itself if host GL acceleration isn't available.
-USE_OPENGL_RENDERER := true
-
-TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2684354560 # 2.5 GB
BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
-TARGET_COPY_OUT_VENDOR := vendor
-# ~100 MB vendor image. Please adjust system image / vendor image sizes
-# when finalizing them.
-BOARD_VENDORIMAGE_PARTITION_SIZE := 100000000
-BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-BOARD_FLASH_BLOCK_SIZE := 512
-TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
-DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
-
-# Android generic system image always create metadata partition
-BOARD_USES_METADATA_PARTITION := true
-
-# Set this to create /cache mount point for non-A/B devices that mounts /cache.
-# The partition size doesn't matter, just to make build pass.
-BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
-BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216
-
-BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
-BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/common
-
-# Android Verified Boot (AVB):
-# Builds a special vbmeta.img that disables AVB verification.
-# Otherwise, AVB will prevent the device from booting the generic system.img.
-# Also checks that BOARD_AVB_ENABLE is not set, to prevent adding verity
-# metadata into system.img.
-ifeq ($(BOARD_AVB_ENABLE),true)
-$(error BOARD_AVB_ENABLE cannot be set for GSI)
-endif
-BOARD_BUILD_DISABLED_VBMETAIMAGE := true
-
-ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
-# GSI is always userdebug and needs a couple of properties taking precedence
-# over those set by the vendor.
-TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop
-endif
-BOARD_VNDK_VERSION := current
# Emulator system image is going to be used as GSI and some vendor still hasn't
# cleaned up all device specific directories under root!
-# TODO(jiyong) These might be SoC specific.
-BOARD_ROOT_EXTRA_FOLDERS += firmware firmware/radio persist
-BOARD_ROOT_EXTRA_SYMLINKS := /vendor/lib/dsp:/dsp
+# TODO(b/111434759, b/111287060) SoC specific hacks
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/lib/dsp:/dsp
+BOARD_ROOT_EXTRA_SYMLINKS += /mnt/vendor/persist:/persist
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt:/firmware
# TODO(b/36764215): remove this setting when the generic system image
# no longer has QCOM-specific directories under /.
@@ -133,7 +79,3 @@ WPA_SUPPLICANT_VERSION := VER_0_8_X
WIFI_DRIVER_FW_PATH_PARAM := "/dev/null"
WIFI_DRIVER_FW_PATH_STA := "/dev/null"
WIFI_DRIVER_FW_PATH_AP := "/dev/null"
-
-# Enable A/B update
-TARGET_NO_RECOVERY := true
-BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
diff --git a/target/board/generic_arm64/device.mk b/target/board/generic_arm64/device.mk
index 8e26700..2004624 100644
--- a/target/board/generic_arm64/device.mk
+++ b/target/board/generic_arm64/device.mk
@@ -14,14 +14,6 @@
# limitations under the License.
#
-# minimal configuration for audio policy.
-PRODUCT_COPY_FILES += \
- frameworks/av/services/audiopolicy/config/audio_policy_configuration_generic.xml:system/etc/audio_policy_configuration.xml \
- frameworks/av/services/audiopolicy/config/primary_audio_policy_configuration.xml:system/etc/primary_audio_policy_configuration.xml \
- frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:system/etc/r_submix_audio_policy_configuration.xml \
- frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:system/etc/audio_policy_volumes.xml \
- frameworks/av/services/audiopolicy/config/default_volume_tables.xml:system/etc/default_volume_tables.xml \
-
# NFC:
# Provide default libnfc-nci.conf file for devices that does not have one in
# vendor/etc because aosp system image (of aosp_$arch products) is going to
diff --git a/target/board/generic_arm64_ab/BoardConfig.mk b/target/board/generic_arm64_ab/BoardConfig.mk
index fc6b582..88b90a8 100644
--- a/target/board/generic_arm64_ab/BoardConfig.mk
+++ b/target/board/generic_arm64_ab/BoardConfig.mk
@@ -34,7 +34,9 @@ BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
# TODO(jiyong) These might be SoC specific.
BOARD_ROOT_EXTRA_FOLDERS += firmware firmware/radio persist
-BOARD_ROOT_EXTRA_SYMLINKS := /vendor/lib/dsp:/dsp
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/lib/dsp:/dsp
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/image:/firmware/image
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/verinfo:/firmware/verinfo
# Set this to create /cache mount point for non-A/B devices that mounts /cache.
# The partition size doesn't matter, just to make build pass.
diff --git a/target/board/generic_arm_64b_a/BoardConfig.mk b/target/board/generic_arm_64b_a/BoardConfig.mk
new file mode 100644
index 0000000..fa9cfe7
--- /dev/null
+++ b/target/board/generic_arm_64b_a/BoardConfig.mk
@@ -0,0 +1,31 @@
+#
+# Copyright (C) 2018 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.
+#
+
+include build/make/target/board/treble_common_32.mk
+
+# For devices using 64-bit binder interface
+TARGET_USES_64_BIT_BINDER := true
+
+TARGET_ARCH := arm
+TARGET_ARCH_VARIANT := armv7-a-neon
+TARGET_CPU_ABI := armeabi-v7a
+TARGET_CPU_ABI2 := armeabi
+TARGET_CPU_VARIANT := generic
+
+# Set this to create /cache mount point for non-A/B devices that mounts /cache.
+# The partition size doesn't matter, just to make build pass.
+BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216
diff --git a/target/board/generic_arm_64b_ab/BoardConfig.mk b/target/board/generic_arm_64b_ab/BoardConfig.mk
new file mode 100644
index 0000000..6ec0a33
--- /dev/null
+++ b/target/board/generic_arm_64b_ab/BoardConfig.mk
@@ -0,0 +1,35 @@
+#
+# Copyright (C) 2018 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.
+#
+
+include build/make/target/board/treble_common_32.mk
+
+# For devices using 64-bit binder interface
+TARGET_USES_64_BIT_BINDER := true
+
+TARGET_ARCH := arm
+TARGET_ARCH_VARIANT := armv7-a-neon
+TARGET_CPU_ABI := armeabi-v7a
+TARGET_CPU_ABI2 := armeabi
+TARGET_CPU_VARIANT := generic
+
+# Enable system-as-root
+TARGET_NO_RECOVERY := true
+BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
+
+# Set this to create /cache mount point for non-A/B devices that mounts /cache.
+# The partition size doesn't matter, just to make build pass.
+BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
+BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216
diff --git a/target/board/generic_arm_a/BoardConfig.mk b/target/board/generic_arm_a/BoardConfig.mk
index f0e1a39..57a5196 100644
--- a/target/board/generic_arm_a/BoardConfig.mk
+++ b/target/board/generic_arm_a/BoardConfig.mk
@@ -16,9 +16,6 @@
include build/make/target/board/treble_common_32.mk
-# Overwrite the setting in treble_common_32.mk for non-A/B arm GSI
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 943718400 # 900MB
-
TARGET_ARCH := arm
TARGET_ARCH_VARIANT := armv7-a-neon
TARGET_CPU_ABI := armeabi-v7a
diff --git a/target/board/generic_arm_ab/BoardConfig.mk b/target/board/generic_arm_ab/BoardConfig.mk
index 7c04cd5..3d14842 100644
--- a/target/board/generic_arm_ab/BoardConfig.mk
+++ b/target/board/generic_arm_ab/BoardConfig.mk
@@ -16,9 +16,6 @@
include build/make/target/board/treble_common_32.mk
-# Overwrite the setting in treble_common_32.mk for non-A/B arm GSI
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 943718400 # 900MB
-
TARGET_ARCH := arm
TARGET_ARCH_VARIANT := armv7-a-neon
TARGET_CPU_ABI := armeabi-v7a
@@ -31,7 +28,9 @@ BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
# TODO(jiyong) These might be SoC specific.
BOARD_ROOT_EXTRA_FOLDERS += firmware firmware/radio persist
-BOARD_ROOT_EXTRA_SYMLINKS := /vendor/lib/dsp:/dsp
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/lib/dsp:/dsp
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/image:/firmware/image
+BOARD_ROOT_EXTRA_SYMLINKS += /vendor/firmware_mnt/verinfo:/firmware/verinfo
# Set this to create /cache mount point for non-A/B devices that mounts /cache.
# The partition size doesn't matter, just to make build pass.
diff --git a/target/board/generic_x86/BoardConfig.mk b/target/board/generic_x86/BoardConfig.mk
index 684dfc7..650073e 100644
--- a/target/board/generic_x86/BoardConfig.mk
+++ b/target/board/generic_x86/BoardConfig.mk
@@ -1,95 +1,32 @@
-# config.mk
+# Copyright (C) 2018 The Android Open Source Project
#
-# Product-specific compile-time definitions.
+# 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 generic product target doesn't have any hardware-specific pieces.
-TARGET_NO_BOOTLOADER := true
-TARGET_NO_KERNEL := true
+# x86 emulator specific definitions
TARGET_CPU_ABI := x86
TARGET_ARCH := x86
TARGET_ARCH_VARIANT := x86
-TARGET_PRELINK_MODULE := false
-TARGET_BOOTLOADER_BOARD_NAME := goldfish_$(TARGET_ARCH)
-
-#emulator now uses 64bit kernel to run 32bit x86 image
-#
-TARGET_USES_64_BIT_BINDER := true
-
-# The IA emulator (qemu) uses the Goldfish devices
-HAVE_HTC_AUDIO_DRIVER := true
-BOARD_USES_GENERIC_AUDIO := true
-
-# no hardware camera
-USE_CAMERA_STUB := true
-
-# Enable dex-preoptimization to speed up the first boot sequence
-# of an SDK AVD. Note that this operation only works on Linux for now
-ifeq ($(HOST_OS),linux)
-WITH_DEXPREOPT ?= true
-WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= false
-endif
-TARGET_USES_HWC2 := true
-NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
-
-# Build OpenGLES emulation host and guest libraries
-BUILD_EMULATOR_OPENGL := true
-
-# Build partitioned system.img and vendor.img (if applicable)
-# for qemu, otherwise, init cannot find PART_NAME
-BUILD_QEMU_IMAGES := true
+TARGET_PRELINK_MODULE := false
-# Build and enable the OpenGL ES View renderer. When running on the emulator,
-# the GLES renderer disables itself if host GL acceleration isn't available.
-USE_OPENGL_RENDERER := true
+include build/make/target/board/BoardConfigEmuCommon.mk
+include build/make/target/board/BoardConfigGsiCommon.mk
-TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2684354560
# Resize to 4G to accomodate ASAN and CTS
BOARD_USERDATAIMAGE_PARTITION_SIZE := 4294967296
-TARGET_COPY_OUT_VENDOR := vendor
-BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
-# ~100 MB vendor image. Please adjust system image / vendor image sizes
-# when finalizing them.
-BOARD_VENDORIMAGE_PARTITION_SIZE := 100000000
-BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-BOARD_FLASH_BLOCK_SIZE := 512
-TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
-DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
-
-# Android generic system image always create metadata partition
-BOARD_USES_METADATA_PARTITION := true
-
-# Set this to create /cache mount point for non-A/B devices that mounts /cache.
-# The partition size doesn't matter, just to make build pass.
-BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
-BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216
-
-BOARD_SEPOLICY_DIRS += \
- device/generic/goldfish/sepolicy/common \
- device/generic/goldfish/sepolicy/x86
-
-# Android Verified Boot (AVB):
-# Builds a special vbmeta.img that disables AVB verification.
-# Otherwise, AVB will prevent the device from booting the generic system.img.
-# Also checks that BOARD_AVB_ENABLE is not set, to prevent adding verity
-# metadata into system.img.
-ifeq ($(BOARD_AVB_ENABLE),true)
-$(error BOARD_AVB_ENABLE cannot be set for GSI)
-endif
-BOARD_BUILD_DISABLED_VBMETAIMAGE := true
-
-ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
-# GSI is always userdebug and needs a couple of properties taking precedence
-# over those set by the vendor.
-TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop
-endif
-BOARD_VNDK_VERSION := current
-# Enable A/B update
-TARGET_NO_RECOVERY := true
-BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
+BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/x86
# Wifi.
BOARD_WLAN_DEVICE := emulator
diff --git a/target/board/generic_x86/device.mk b/target/board/generic_x86/device.mk
index 273ac71..0a32415 100644
--- a/target/board/generic_x86/device.mk
+++ b/target/board/generic_x86/device.mk
@@ -14,14 +14,6 @@
# limitations under the License.
#
-# minimal configuration for audio policy.
-PRODUCT_COPY_FILES += \
- frameworks/av/services/audiopolicy/config/audio_policy_configuration_generic.xml:system/etc/audio_policy_configuration.xml \
- frameworks/av/services/audiopolicy/config/primary_audio_policy_configuration.xml:system/etc/primary_audio_policy_configuration.xml \
- frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:system/etc/r_submix_audio_policy_configuration.xml \
- frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:system/etc/audio_policy_volumes.xml \
- frameworks/av/services/audiopolicy/config/default_volume_tables.xml:system/etc/default_volume_tables.xml \
-
# NFC:
# Provide default libnfc-nci.conf file for devices that does not have one in
# vendor/etc because aosp system image (of aosp_$arch products) is going to
diff --git a/target/board/generic_x86_64/BoardConfig.mk b/target/board/generic_x86_64/BoardConfig.mk
index 5bcb9ad..1426630 100755
--- a/target/board/generic_x86_64/BoardConfig.mk
+++ b/target/board/generic_x86_64/BoardConfig.mk
@@ -1,89 +1,35 @@
-# config.mk
+# Copyright (C) 2018 The Android Open Source Project
#
-# Product-specific compile-time definitions.
+# 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 generic product target doesn't have any hardware-specific pieces.
-TARGET_NO_BOOTLOADER := true
-TARGET_NO_KERNEL := true
+# x86_64 emulator specific definitions
TARGET_CPU_ABI := x86_64
TARGET_ARCH := x86_64
TARGET_ARCH_VARIANT := x86_64
-TARGET_PRELINK_MODULE := false
-TARGET_BOOTLOADER_BOARD_NAME := goldfish_$(TARGET_ARCH)
TARGET_2ND_CPU_ABI := x86
TARGET_2ND_ARCH := x86
TARGET_2ND_ARCH_VARIANT := x86_64
-TARGET_USES_64_BIT_BINDER := true
-
-# The IA emulator (qemu) uses the Goldfish devices
-HAVE_HTC_AUDIO_DRIVER := true
-BOARD_USES_GENERIC_AUDIO := true
-
-# no hardware camera
-USE_CAMERA_STUB := true
-
-# Enable dex-preoptimization to speed up the first boot sequence
-# of an SDK AVD. Note that this operation only works on Linux for now
-ifeq ($(HOST_OS),linux)
-WITH_DEXPREOPT ?= true
-WITH_DEXPREOPT_BOOT_IMG_AND_SYSTEM_SERVER_ONLY ?= false
-endif
-
-TARGET_USES_HWC2 := true
-NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
-
-# Build OpenGLES emulation host and guest libraries
-BUILD_EMULATOR_OPENGL := true
-BUILD_QEMU_IMAGES := true
+TARGET_PRELINK_MODULE := false
-# Build and enable the OpenGL ES View renderer. When running on the emulator,
-# the GLES renderer disables itself if host GL acceleration isn't available.
-USE_OPENGL_RENDERER := true
+include build/make/target/board/BoardConfigEmuCommon.mk
+include build/make/target/board/BoardConfigGsiCommon.mk
-TARGET_USERIMAGES_USE_EXT4 := true
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 2684354560 # 2.5 GB
BOARD_USERDATAIMAGE_PARTITION_SIZE := 576716800
-TARGET_COPY_OUT_VENDOR := vendor
-# ~100 MB vendor image. Please adjust system image / vendor image sizes
-# when finalizing them.
-BOARD_VENDORIMAGE_PARTITION_SIZE := 100000000
-BOARD_VENDORIMAGE_FILE_SYSTEM_TYPE := ext4
-BOARD_FLASH_BLOCK_SIZE := 512
-TARGET_USERIMAGES_SPARSE_EXT_DISABLED := true
-BOARD_PROPERTY_OVERRIDES_SPLIT_ENABLED := true
-DEVICE_MATRIX_FILE := device/generic/goldfish/compatibility_matrix.xml
-
-# Android generic system image always create metadata partition
-BOARD_USES_METADATA_PARTITION := true
-
-# Set this to create /cache mount point for non-A/B devices that mounts /cache.
-# The partition size doesn't matter, just to make build pass.
-BOARD_CACHEIMAGE_FILE_SYSTEM_TYPE := ext4
-BOARD_CACHEIMAGE_PARTITION_SIZE := 16777216
-BOARD_SEPOLICY_DIRS += \
- device/generic/goldfish/sepolicy/common \
- device/generic/goldfish/sepolicy/x86
-
-# Android Verified Boot (AVB):
-# Builds a special vbmeta.img that disables AVB verification.
-# Otherwise, AVB will prevent the device from booting the generic system.img.
-# Also checks that BOARD_AVB_ENABLE is not set, to prevent adding verity
-# metadata into system.img.
-ifeq ($(BOARD_AVB_ENABLE),true)
-$(error BOARD_AVB_ENABLE cannot be set for GSI)
-endif
-BOARD_BUILD_DISABLED_VBMETAIMAGE := true
-
-ifneq (,$(filter userdebug eng,$(TARGET_BUILD_VARIANT)))
-# GSI is always userdebug and needs a couple of properties taking precedence
-# over those set by the vendor.
-TARGET_SYSTEM_PROP := build/make/target/board/gsi_system.prop
-endif
-BOARD_VNDK_VERSION := current
+BOARD_SEPOLICY_DIRS += device/generic/goldfish/sepolicy/x86
# Wifi.
BOARD_WLAN_DEVICE := emulator
@@ -95,7 +41,3 @@ WPA_SUPPLICANT_VERSION := VER_0_8_X
WIFI_DRIVER_FW_PATH_PARAM := "/dev/null"
WIFI_DRIVER_FW_PATH_STA := "/dev/null"
WIFI_DRIVER_FW_PATH_AP := "/dev/null"
-
-# Enable A/B update
-TARGET_NO_RECOVERY := true
-BOARD_BUILD_SYSTEM_ROOT_IMAGE := true
diff --git a/target/board/generic_x86_64/device.mk b/target/board/generic_x86_64/device.mk
index 273ac71..0a32415 100755
--- a/target/board/generic_x86_64/device.mk
+++ b/target/board/generic_x86_64/device.mk
@@ -14,14 +14,6 @@
# limitations under the License.
#
-# minimal configuration for audio policy.
-PRODUCT_COPY_FILES += \
- frameworks/av/services/audiopolicy/config/audio_policy_configuration_generic.xml:system/etc/audio_policy_configuration.xml \
- frameworks/av/services/audiopolicy/config/primary_audio_policy_configuration.xml:system/etc/primary_audio_policy_configuration.xml \
- frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:system/etc/r_submix_audio_policy_configuration.xml \
- frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:system/etc/audio_policy_volumes.xml \
- frameworks/av/services/audiopolicy/config/default_volume_tables.xml:system/etc/default_volume_tables.xml \
-
# NFC:
# Provide default libnfc-nci.conf file for devices that does not have one in
# vendor/etc because aosp system image (of aosp_$arch products) is going to
diff --git a/target/board/treble_common.mk b/target/board/treble_common.mk
index c4e68fe..ccb69f2 100644
--- a/target/board/treble_common.mk
+++ b/target/board/treble_common.mk
@@ -34,7 +34,9 @@ TARGET_NO_KERNEL := true
TARGET_USERIMAGES_USE_EXT4 := true
TARGET_USERIMAGES_USE_F2FS := true
TARGET_USERIMAGES_SPARSE_EXT_DISABLED := false
-TARGET_USES_MKE2FS := true
+
+# Enable dyanmic system image size and reserved 64MB in it.
+BOARD_SYSTEMIMAGE_PARTITION_RESERVED_SIZE := 67108864
# Generic AOSP image always requires separate vendor.img
TARGET_COPY_OUT_VENDOR := vendor
@@ -51,11 +53,19 @@ NUM_FRAMEBUFFER_SURFACE_BUFFERS := 3
USE_XML_AUDIO_POLICY_CONF := 1
# Android Verified Boot (AVB):
-# Builds a special vbmeta.img that disables AVB verification.
-# Otherwise, AVB will prevent the device from booting the generic system.img.
-# Also checks that BOARD_AVB_ENABLE is not set, to prevent adding verity
-# metadata into system.img.
-ifeq ($(BOARD_AVB_ENABLE),true)
-$(error BOARD_AVB_ENABLE cannot be set for Treble GSI)
-endif
-BOARD_BUILD_DISABLED_VBMETAIMAGE := true
+# 1) Sets BOARD_AVB_ENABLE to sign the GSI image.
+# 2) Sets AVB_VBMETA_IMAGE_FLAGS_VERIFICATION_DISABLED (--flag 2) in
+# vbmeta.img to disable AVB verification.
+#
+# To disable AVB for GSI, use the vbmeta.img and the GSI together.
+# To enable AVB for GSI, include the GSI public key into the device-specific
+# vbmeta.img.
+BOARD_AVB_ENABLE := true
+BOARD_AVB_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
+BOARD_AVB_MAKE_VBMETA_IMAGE_ARGS += --flag 2
+
+# Enable chain partition for system.
+BOARD_AVB_SYSTEM_KEY_PATH := external/avb/test/data/testkey_rsa2048.pem
+BOARD_AVB_SYSTEM_ALGORITHM := SHA256_RSA2048
+BOARD_AVB_SYSTEM_ROLLBACK_INDEX := $(PLATFORM_SECURITY_PATCH_TIMESTAMP)
+BOARD_AVB_SYSTEM_ROLLBACK_INDEX_LOCATION := 1
diff --git a/target/board/treble_common_32.mk b/target/board/treble_common_32.mk
index dbe0899..b66c41e 100644
--- a/target/board/treble_common_32.mk
+++ b/target/board/treble_common_32.mk
@@ -15,7 +15,3 @@
#
include build/make/target/board/treble_common.mk
-
-# Partition size defaults to 1 GB (1024 MB) for 32-bit products. It can
-# be overwritten in specific BoardConfig.mk, if so desired.
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1073741824
diff --git a/target/board/treble_common_64.mk b/target/board/treble_common_64.mk
index 0a6eb17..8980dfd 100644
--- a/target/board/treble_common_64.mk
+++ b/target/board/treble_common_64.mk
@@ -18,6 +18,3 @@ include build/make/target/board/treble_common.mk
# Enable 64-bits binder
TARGET_USES_64_BIT_BINDER := true
-
-# Partition size is default 1.5GB (1536MB) for 64 bits projects
-BOARD_SYSTEMIMAGE_PARTITION_SIZE := 1610612736
diff --git a/target/product/AndroidProducts.mk b/target/product/AndroidProducts.mk
index 85330b3..7237ea6 100644
--- a/target/product/AndroidProducts.mk
+++ b/target/product/AndroidProducts.mk
@@ -52,6 +52,8 @@ PRODUCT_MAKEFILES := \
$(LOCAL_DIR)/aosp_arm.mk \
$(LOCAL_DIR)/aosp_arm_a.mk \
$(LOCAL_DIR)/aosp_arm_ab.mk \
+ $(LOCAL_DIR)/aosp_arm_64b_a.mk \
+ $(LOCAL_DIR)/aosp_arm_64b_ab.mk \
$(LOCAL_DIR)/full.mk \
$(LOCAL_DIR)/aosp_x86.mk \
$(LOCAL_DIR)/aosp_x86_a.mk \
diff --git a/target/product/aosp_arm.mk b/target/product/aosp_arm.mk
index b872f48..f0752a8 100644
--- a/target/product/aosp_arm.mk
+++ b/target/product/aosp_arm.mk
@@ -14,14 +14,27 @@
# limitations under the License.
#
--include device/generic/goldfish/arm32-vendor.mk
+# The system image of aosp_arm-userdebug is a GSI for the devices with:
+# - ARM 32 bits user space
+# - 64 bits binder interface
+# - system-as-root
+# - VNDK enforcement
+# - compatible property override enabled
-# TODO(b/78308559): includes vr_hwc into GSI before vr_hwc move to vendor
-PRODUCT_PACKAGES += \
- vr_hwc
+-include device/generic/goldfish/arm32-vendor.mk
include $(SRC_TARGET_DIR)/product/full.mk
+# Enable dynamic partition size
+PRODUCT_USE_DYNAMIC_PARTITION_SIZE := true
+
+# Enable A/B update
+AB_OTA_UPDATER := true
+AB_OTA_PARTITIONS := system
+PRODUCT_PACKAGES += \
+ update_engine \
+ update_verifier
+
# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
diff --git a/target/product/aosp_arm64.mk b/target/product/aosp_arm64.mk
index 33defe1..ab23111 100644
--- a/target/product/aosp_arm64.mk
+++ b/target/product/aosp_arm64.mk
@@ -14,6 +14,13 @@
# limitations under the License.
#
+# The system image of aosp_arm64-userdebug is a GSI for the devices with:
+# - ARM 64 bits user space
+# - 64 bits binder interface
+# - system-as-root
+# - VNDK enforcement
+# - compatible property override enabled
+
# This is a build configuration for a full-featured build of the
# Open-Source part of the tree. It's geared toward a US-centric
# build quite specifically for the emulator, and might not be
@@ -29,15 +36,21 @@
PRODUCT_COPY_FILES += \
system/core/rootdir/init.zygote32_64.rc:root/init.zygote32_64.rc
-# TODO(b/78308559): includes vr_hwc into GSI before vr_hwc move to vendor
-PRODUCT_PACKAGES += \
- vr_hwc
-
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_arm64/device.mk)
+# Enable dynamic partition size
+PRODUCT_USE_DYNAMIC_PARTITION_SIZE := true
+
+# Enable A/B update
+AB_OTA_UPDATER := true
+AB_OTA_PARTITIONS := system
+PRODUCT_PACKAGES += \
+ update_engine \
+ update_verifier
+
# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
diff --git a/target/product/aosp_arm64_ab.mk b/target/product/aosp_arm64_ab.mk
index 6ff1157..d389c74 100644
--- a/target/product/aosp_arm64_ab.mk
+++ b/target/product/aosp_arm64_ab.mk
@@ -19,8 +19,20 @@
# on the generic system image, place them in build/make/target/board/
# treble_system.prop.
+# aosp_arm64_ab-userdebug is a Legacy GSI for the devices with:
+# - ARM 64 bits user space
+# - 64 bits binder interface
+# - system-as-root
+
include build/make/target/product/treble_common_64.mk
+# Enable A/B update
+AB_OTA_UPDATER := true
+AB_OTA_PARTITIONS := system
+PRODUCT_PACKAGES += \
+ update_engine \
+ update_verifier
+
PRODUCT_NAME := aosp_arm64_ab
PRODUCT_DEVICE := generic_arm64_ab
PRODUCT_BRAND := Android
diff --git a/target/product/aosp_arm_64b_a.mk b/target/product/aosp_arm_64b_a.mk
new file mode 100644
index 0000000..18e02b8
--- /dev/null
+++ b/target/product/aosp_arm_64b_a.mk
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2018 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.
+#
+
+# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
+# /vendor/[build|default].prop when build split is on. In order to have sysprops
+# on the generic system image, place them in build/make/target/board/
+# treble_system.prop.
+
+include build/make/target/product/treble_common_32.mk
+
+PRODUCT_NAME := aosp_arm_64b_a
+PRODUCT_DEVICE := generic_arm_64b_a
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on ARM32
diff --git a/target/product/aosp_arm_64b_ab.mk b/target/product/aosp_arm_64b_ab.mk
new file mode 100644
index 0000000..99530d2
--- /dev/null
+++ b/target/product/aosp_arm_64b_ab.mk
@@ -0,0 +1,27 @@
+#
+# Copyright (C) 2018 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.
+#
+
+# PRODUCT_PROPERTY_OVERRIDES cannot be used here because sysprops will be at
+# /vendor/[build|default].prop when build split is on. In order to have sysprops
+# on the generic system image, place them in build/make/target/board/
+# treble_system.prop.
+
+include build/make/target/product/treble_common_32.mk
+
+PRODUCT_NAME := aosp_arm_64b_ab
+PRODUCT_DEVICE := generic_arm_64b_ab
+PRODUCT_BRAND := Android
+PRODUCT_MODEL := AOSP on ARM32
diff --git a/target/product/aosp_arm_ab.mk b/target/product/aosp_arm_ab.mk
index 9a4688e..5845d3b 100644
--- a/target/product/aosp_arm_ab.mk
+++ b/target/product/aosp_arm_ab.mk
@@ -19,8 +19,20 @@
# on the generic system image, place them in build/make/target/board/
# treble_system.prop.
+# aosp_arm_ab-userdebug is a Legacy GSI for the devices with:
+# - ARM 32 bits user space
+# - 32 bits binder interface
+# - system-as-root
+
include build/make/target/product/treble_common_32.mk
+# Enable A/B update
+AB_OTA_UPDATER := true
+AB_OTA_PARTITIONS := system
+PRODUCT_PACKAGES += \
+ update_engine \
+ update_verifier
+
PRODUCT_NAME := aosp_arm_ab
PRODUCT_DEVICE := generic_arm_ab
PRODUCT_BRAND := Android
diff --git a/target/product/aosp_x86.mk b/target/product/aosp_x86.mk
index 9ba9523..9d1b14b 100644
--- a/target/product/aosp_x86.mk
+++ b/target/product/aosp_x86.mk
@@ -14,14 +14,27 @@
# limitations under the License.
#
--include device/generic/goldfish/x86-vendor.mk
+# The system image of aosp_x86-userdebug is a GSI for the devices with:
+# - x86 32 bits user space
+# - 64 bits binder interface
+# - system-as-root
+# - VNDK enforcement
+# - compatible property override enabled
-# TODO(b/78308559): includes vr_hwc into GSI before vr_hwc move to vendor
-PRODUCT_PACKAGES += \
- vr_hwc
+-include device/generic/goldfish/x86-vendor.mk
include $(SRC_TARGET_DIR)/product/full_x86.mk
+# Enable dynamic partition size
+PRODUCT_USE_DYNAMIC_PARTITION_SIZE := true
+
+# Enable A/B update
+AB_OTA_UPDATER := true
+AB_OTA_PARTITIONS := system
+PRODUCT_PACKAGES += \
+ update_engine \
+ update_verifier
+
# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
diff --git a/target/product/aosp_x86_64.mk b/target/product/aosp_x86_64.mk
index 7afc782..b38c417 100644
--- a/target/product/aosp_x86_64.mk
+++ b/target/product/aosp_x86_64.mk
@@ -14,6 +14,13 @@
# limitations under the License.
#
+# The system image of aosp_x86_64-userdebug is a GSI for the devices with:
+# - x86 64 bits user space
+# - 64 bits binder interface
+# - system-as-root
+# - VNDK enforcement
+# - compatible property override enabled
+
# This is a build configuration for a full-featured build of the
# Open-Source part of the tree. It's geared toward a US-centric
# build quite specifically for the emulator, and might not be
@@ -29,15 +36,21 @@
PRODUCT_COPY_FILES += \
system/core/rootdir/init.zygote32_64.rc:root/init.zygote32_64.rc
-# TODO(b/78308559): includes vr_hwc into GSI before vr_hwc move to vendor
-PRODUCT_PACKAGES += \
- vr_hwc
-
$(call inherit-product, $(SRC_TARGET_DIR)/product/emulator.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/core_64_bit.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base_telephony.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/board/generic_x86_64/device.mk)
+# Enable dynamic partition size
+PRODUCT_USE_DYNAMIC_PARTITION_SIZE := true
+
+# Enable A/B update
+AB_OTA_UPDATER := true
+AB_OTA_PARTITIONS := system
+PRODUCT_PACKAGES += \
+ update_engine \
+ update_verifier
+
# Needed by Pi newly launched device to pass VtsTrebleSysProp on GSI
PRODUCT_COMPATIBLE_PROPERTY_OVERRIDE := true
diff --git a/target/product/aosp_x86_64_ab.mk b/target/product/aosp_x86_64_ab.mk
index 3524dbc..d9163d7 100644
--- a/target/product/aosp_x86_64_ab.mk
+++ b/target/product/aosp_x86_64_ab.mk
@@ -19,8 +19,20 @@
# on the generic system image, place them in build/make/target/board/
# treble_system.prop.
+# aosp_x86_64_ab-userdebug is a Legacy GSI for the devices with:
+# - x86 64 bits user space
+# - 64 bits binder interface
+# - system-as-root
+
include build/make/target/product/treble_common_64.mk
+# Enable A/B update
+AB_OTA_UPDATER := true
+AB_OTA_PARTITIONS := system
+PRODUCT_PACKAGES += \
+ update_engine \
+ update_verifier
+
PRODUCT_NAME := aosp_x86_64_ab
PRODUCT_DEVICE := generic_x86_64_ab
PRODUCT_BRAND := Android
diff --git a/target/product/aosp_x86_ab.mk b/target/product/aosp_x86_ab.mk
index e72b38d..4fff3d1 100644
--- a/target/product/aosp_x86_ab.mk
+++ b/target/product/aosp_x86_ab.mk
@@ -19,8 +19,20 @@
# on the generic system image, place them in build/make/target/board/
# treble_system.prop.
+# aosp_x86_ab-userdebug is a Legacy GSI for the devices with:
+# - x86 32 bits user space
+# - 32 bits binder interface
+# - system-as-root
+
include build/make/target/product/treble_common_32.mk
+# Enable A/B update
+AB_OTA_UPDATER := true
+AB_OTA_PARTITIONS := system
+PRODUCT_PACKAGES += \
+ update_engine \
+ update_verifier
+
PRODUCT_NAME := aosp_x86_ab
PRODUCT_DEVICE := generic_x86_ab
PRODUCT_BRAND := Android
diff --git a/target/product/core.mk b/target/product/core.mk
index c72bb2f..dfce360 100644
--- a/target/product/core.mk
+++ b/target/product/core.mk
@@ -41,7 +41,6 @@ PRODUCT_PACKAGES += \
InputDevices \
KeyChain \
Keyguard \
- LatinIME \
Launcher3QuickStep \
ManagedProvisioning \
MtpDocumentsProvider \
diff --git a/target/product/core_base.mk b/target/product/core_base.mk
index 7dc0010..5b37b8d 100644
--- a/target/product/core_base.mk
+++ b/target/product/core_base.mk
@@ -16,10 +16,6 @@
# Note that components added here will be also shared in PDK. Components
# that should not be in PDK should be added in lower level like core.mk.
-PRODUCT_PROPERTY_OVERRIDES := \
- ro.config.notification_sound=OnTheHunt.ogg \
- ro.config.alarm_alert=Alarm_Classic.ogg
-
PRODUCT_PACKAGES += \
ContactsProvider \
DefaultContainerService \
@@ -33,7 +29,6 @@ PRODUCT_PACKAGES += \
libfilterpack_imageproc \
libgabi++ \
libmdnssd \
- libnfc_ndef \
libpowermanager \
libspeexresampler \
libstagefright_soft_aacdec \
diff --git a/target/product/core_minimal.mk b/target/product/core_minimal.mk
index 85646c1..b8e04e0 100644
--- a/target/product/core_minimal.mk
+++ b/target/product/core_minimal.mk
@@ -133,6 +133,8 @@ endif
# The order of PRODUCT_SYSTEM_SERVER_JARS matters.
PRODUCT_SYSTEM_SERVER_JARS := \
+ org.lineageos.platform \
+ org.lineageos.hardware \
services \
ethernet-service \
wifi-service \
diff --git a/target/product/full_base.mk b/target/product/full_base.mk
index c390ffd..cfc51a9 100644
--- a/target/product/full_base.mk
+++ b/target/product/full_base.mk
@@ -23,16 +23,6 @@ PRODUCT_PACKAGES := \
libfwdlockengine \
WAPPushManager
-PRODUCT_PACKAGES += \
- Galaxy4 \
- HoloSpiralWallpaper \
- LiveWallpapers \
- LiveWallpapersPicker \
- MagicSmokeWallpapers \
- NoiseField \
- PhaseBeam \
- PhotoTable
-
# Bluetooth:
# audio.a2dp.default is a system module. Generic system image includes
# audio.a2dp.default to support A2DP if board has the capability.
@@ -47,16 +37,11 @@ PRODUCT_PACKAGES += \
PRODUCT_PACKAGES += \
netutils-wrapper-1.0
-# Additional settings used in all AOSP builds
-PRODUCT_PROPERTY_OVERRIDES := \
- ro.config.ringtone=Ring_Synth_04.ogg \
- ro.config.notification_sound=pixiedust.ogg
-
# Put en_US first in the list, so make it default.
PRODUCT_LOCALES := en_US
# Get some sounds
-$(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.mk)
+$(call inherit-product-if-exists, frameworks/base/data/sounds/AudioPackage14.mk)
# Get a list of languages.
$(call inherit-product, $(SRC_TARGET_DIR)/product/languages_full.mk)
diff --git a/target/product/full_base_telephony.mk b/target/product/full_base_telephony.mk
index af4097d..7988e9b 100644
--- a/target/product/full_base_telephony.mk
+++ b/target/product/full_base_telephony.mk
@@ -20,12 +20,7 @@
# entirely appropriate to inherit from for on-device configurations.
PRODUCT_PROPERTY_OVERRIDES := \
- keyguard.no_require_sim=true \
- ro.com.android.dataroaming=true
-
-PRODUCT_COPY_FILES := \
- device/sample/etc/apns-full-conf.xml:system/etc/apns-conf.xml \
- frameworks/native/data/etc/handheld_core_hardware.xml:$(TARGET_COPY_OUT_VENDOR)/etc/permissions/handheld_core_hardware.xml
+ keyguard.no_require_sim=true
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony.mk)
diff --git a/target/product/generic_no_telephony.mk b/target/product/generic_no_telephony.mk
index 6a84c35..e266cc3 100644
--- a/target/product/generic_no_telephony.mk
+++ b/target/product/generic_no_telephony.mk
@@ -24,7 +24,6 @@ PRODUCT_PACKAGES := \
Gallery2 \
Music \
MusicFX \
- NfcNci \
OneTimeInitializer \
Provision \
SystemUI \
diff --git a/target/product/languages_full.mk b/target/product/languages_full.mk
index 5f3795f..1f7726f 100644
--- a/target/product/languages_full.mk
+++ b/target/product/languages_full.mk
@@ -105,3 +105,9 @@ PRODUCT_LOCALES := \
zh_HK \
zh_TW \
zu_ZA
+
+# LineageOS specific languages
+PRODUCT_LOCALES += \
+ ast_ES \
+ gd_GB \
+ cy_GB
diff --git a/target/product/treble_common.mk b/target/product/treble_common.mk
index 6cf66af..6b0ef2f 100644
--- a/target/product/treble_common.mk
+++ b/target/product/treble_common.mk
@@ -23,6 +23,9 @@
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony.mk)
+# Enable dynamic partition size
+PRODUCT_USE_DYNAMIC_PARTITION_SIZE := true
+
# Split selinux policy
PRODUCT_FULL_TREBLE_OVERRIDE := true
@@ -31,15 +34,6 @@ PRODUCT_FULL_TREBLE_OVERRIDE := true
PRODUCT_PACKAGES += \
messaging
-# The following policy XML files are used as fallback for
-# vendors/devices not using XML to configure audio policy.
-PRODUCT_COPY_FILES += \
- frameworks/av/services/audiopolicy/config/audio_policy_configuration_generic.xml:system/etc/audio_policy_configuration.xml \
- frameworks/av/services/audiopolicy/config/primary_audio_policy_configuration.xml:system/etc/primary_audio_policy_configuration.xml \
- frameworks/av/services/audiopolicy/config/r_submix_audio_policy_configuration.xml:system/etc/r_submix_audio_policy_configuration.xml \
- frameworks/av/services/audiopolicy/config/audio_policy_volumes.xml:system/etc/audio_policy_volumes.xml \
- frameworks/av/services/audiopolicy/config/default_volume_tables.xml:system/etc/default_volume_tables.xml \
-
# Telephony:
# Provide a default APN configuration
PRODUCT_COPY_FILES += \
@@ -62,7 +56,3 @@ PRODUCT_PACKAGES += \
# Support addtional O-MR1 vendor interface
PRODUCT_EXTRA_VNDK_VERSIONS := 27
-
-# TODO(b/78308559): includes vr_hwc into GSI before vr_hwc move to vendor
-PRODUCT_PACKAGES += \
- vr_hwc
diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh
index 5a54462..9a03fad 100755
--- a/tools/buildinfo.sh
+++ b/tools/buildinfo.sh
@@ -61,4 +61,6 @@ if [ -n "$BUILD_THUMBPRINT" ] ; then
fi
echo "ro.build.characteristics=$TARGET_AAPT_CHARACTERISTICS"
+echo "ro.lineage.device=$LINEAGE_DEVICE"
+
echo "# end build properties"
diff --git a/tools/fs_config/Android.mk b/tools/fs_config/Android.mk
index a01e702..f6c8132 100644
--- a/tools/fs_config/Android.mk
+++ b/tools/fs_config/Android.mk
@@ -63,6 +63,12 @@ else
my_fs_config_h := $(LOCAL_PATH)/default/$(ANDROID_FS_CONFIG_H)
endif
+ifneq ($(TARGET_FS_CONFIG_GEN),)
+ifeq ($(TARGET_ALLOW_LEGACY_AIDS),true)
+allow_legacy_aids := --allow-legacy-aids
+endif
+endif
+
##################################
include $(CLEAR_VARS)
LOCAL_SRC_FILES := fs_config_generate.c
@@ -79,7 +85,7 @@ oem := $(local-generated-sources-dir)/generated_oem_aid.h
$(oem): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
$(oem): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
$(oem): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config)
-$(oem): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/fs_config_generator.py oemaid --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
+$(oem): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/fs_config_generator.py oemaid --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(allow_legacy_aids) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
$(oem): $(TARGET_FS_CONFIG_GEN) $(LOCAL_PATH)/fs_config_generator.py
$(transform-generated-source)
@@ -88,7 +94,7 @@ gen := $(local-generated-sources-dir)/$(ANDROID_FS_CONFIG_H)
$(gen): PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
$(gen): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
$(gen): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config)
-$(gen): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/fs_config_generator.py fsconfig --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
+$(gen): PRIVATE_CUSTOM_TOOL = $(PRIVATE_LOCAL_PATH)/fs_config_generator.py fsconfig --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(allow_legacy_aids) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
$(gen): $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config) $(LOCAL_PATH)/fs_config_generator.py
$(transform-generated-source)
@@ -270,7 +276,7 @@ $(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config)
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config)
@mkdir -p $(dir $@)
- $(hide) $< passwd --required-prefix=vendor_ --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
+ $(hide) $< passwd --required-prefix=vendor_ --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(allow_legacy_aids) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
##################################
# Generate the vendor/etc/group text file for the target
@@ -289,7 +295,7 @@ $(LOCAL_BUILT_MODULE): PRIVATE_TARGET_FS_CONFIG_GEN := $(TARGET_FS_CONFIG_GEN)
$(LOCAL_BUILT_MODULE): PRIVATE_ANDROID_FS_HDR := $(system_android_filesystem_config)
$(LOCAL_BUILT_MODULE): $(LOCAL_PATH)/fs_config_generator.py $(TARGET_FS_CONFIG_GEN) $(system_android_filesystem_config)
@mkdir -p $(dir $@)
- $(hide) $< group --required-prefix=vendor_ --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
+ $(hide) $< group --required-prefix=vendor_ --aid-header=$(PRIVATE_ANDROID_FS_HDR) $(allow_legacy_aids) $(PRIVATE_TARGET_FS_CONFIG_GEN) > $@
system_android_filesystem_config :=
endif
diff --git a/tools/fs_config/fs_config_generator.py b/tools/fs_config/fs_config_generator.py
index 4839578..1f6de80 100755
--- a/tools/fs_config/fs_config_generator.py
+++ b/tools/fs_config/fs_config_generator.py
@@ -533,7 +533,7 @@ class FSConfigFileParser(object):
_SECTIONS = [('_handle_aid', ('value',)),
('_handle_path', ('mode', 'user', 'group', 'caps'))]
- def __init__(self, config_files, oem_ranges):
+ def __init__(self, config_files, oem_ranges, warn_only=False):
"""
Args:
config_files ([str]): The list of config.fs files to parse.
@@ -541,6 +541,7 @@ class FSConfigFileParser(object):
oem_ranges ([(),()]): range tuples indicating reserved OEM ranges.
"""
+ self._warn_only = warn_only
self._files = []
self._dirs = []
self._aids = []
@@ -655,7 +656,10 @@ class FSConfigFileParser(object):
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))
+ if self._warn_only:
+ sys.stderr.write(error_message(emsg))
+ else:
+ sys.exit(error_message(emsg))
# use the normalized int value in the dict and detect
# duplicate definitions of the same value
@@ -952,11 +956,19 @@ class FSConfigGen(BaseGenerator):
help='An android_filesystem_config.h file'
' to parse AIDs and OEM Ranges from')
+ opt_group.add_argument(
+ '--allow-legacy-aids',
+ action="store_true",
+ required=False,
+ default=False,
+ help='Allow legacy AIDs that fall outside allowed OEM ranges')
+
def __call__(self, args):
self._base_parser = AIDHeaderParser(args['aid_header'])
self._oem_parser = FSConfigFileParser(args['fsconfig'],
- self._base_parser.oem_ranges)
+ self._base_parser.oem_ranges,
+ args['allow_legacy_aids'])
base_aids = self._base_parser.aids
oem_aids = self._oem_parser.aids
@@ -1180,11 +1192,20 @@ class OEMAidGen(BaseGenerator):
help='An android_filesystem_config.h file'
'to parse AIDs and OEM Ranges from')
+ opt_group.add_argument(
+ '--allow-legacy-aids',
+ action="store_true",
+ required=False,
+ default=False,
+ help='Allow legacy AIDs that fall outside allowed OEM ranges')
+
def __call__(self, args):
hdr_parser = AIDHeaderParser(args['aid_header'])
- parser = FSConfigFileParser(args['fsconfig'], hdr_parser.oem_ranges)
+ parser = FSConfigFileParser(args['fsconfig'],
+ hdr_parser.oem_ranges,
+ args['allow_legacy_aids'])
print OEMAidGen._GENERATED
@@ -1236,11 +1257,20 @@ class PasswdGen(BaseGenerator):
required=False,
help='A prefix that the names are required to contain.')
+ opt_group.add_argument(
+ '--allow-legacy-aids',
+ action="store_true",
+ required=False,
+ default=False,
+ help='Allow legacy AIDs that fall outside allowed OEM ranges')
+
def __call__(self, args):
hdr_parser = AIDHeaderParser(args['aid_header'])
- parser = FSConfigFileParser(args['fsconfig'], hdr_parser.oem_ranges)
+ parser = FSConfigFileParser(args['fsconfig'],
+ hdr_parser.oem_ranges,
+ args['allow_legacy_aids'])
required_prefix = args['required_prefix']
diff --git a/tools/post_process_props.py b/tools/post_process_props.py
index 9ddd5d7..45a46ca 100755
--- a/tools/post_process_props.py
+++ b/tools/post_process_props.py
@@ -38,9 +38,9 @@ def mangle_default_prop_override(prop):
# Put the modifications that you need to make into the /system/etc/prop.default into this
# function. The prop object has get(name) and put(name,value) methods.
def mangle_default_prop(prop):
- # If ro.debuggable is 1, then enable adb on USB by default
- # (this is for userdebug builds)
- if prop.get("ro.debuggable") == "1":
+ # If ro.adb.secure is not 1, then enable adb on USB by default
+ # (this is for eng builds)
+ if prop.get("ro.adb.secure") != "1":
val = prop.get("persist.sys.usb.config")
if "adb" not in val:
if val == "":
diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py
index f68976e..461a8f0 100755
--- a/tools/releasetools/add_img_to_target_files.py
+++ b/tools/releasetools/add_img_to_target_files.py
@@ -110,12 +110,12 @@ def GetCareMap(which, imgname):
simg = sparse_img.SparseImage(imgname)
care_map_ranges = simg.care_map
- key = which + "_adjusted_partition_size"
- adjusted_blocks = OPTIONS.info_dict.get(key)
- if adjusted_blocks:
- assert adjusted_blocks > 0, "blocks should be positive for " + which
- care_map_ranges = care_map_ranges.intersect(rangelib.RangeSet(
- "0-%d" % (adjusted_blocks,)))
+ key = which + "_image_blocks"
+ image_blocks = OPTIONS.info_dict.get(key)
+ if image_blocks:
+ assert image_blocks > 0, "blocks for {} must be positive".format(which)
+ care_map_ranges = care_map_ranges.intersect(
+ rangelib.RangeSet("0-{}".format(image_blocks)))
return [which, care_map_ranges.to_string_raw()]
@@ -284,18 +284,18 @@ def CreateImage(input_dir, info_dict, what, output_file, block_list=None):
if block_list:
block_list.Write()
- # Set the 'adjusted_partition_size' that excludes the verity blocks of the
- # given image. When avb is enabled, this size is the max image size returned
- # by the avb tool.
+ # Set the '_image_blocks' that excludes the verity metadata blocks of the
+ # given image. When AVB is enabled, this size is the max image size returned
+ # by the AVB tool.
is_verity_partition = "verity_block_device" in image_props
verity_supported = (image_props.get("verity") == "true" or
image_props.get("avb_enable") == "true")
is_avb_enable = image_props.get("avb_hashtree_enable") == "true"
if verity_supported and (is_verity_partition or is_avb_enable):
- adjusted_blocks_value = image_props.get("partition_size")
- if adjusted_blocks_value:
- adjusted_blocks_key = what + "_adjusted_partition_size"
- info_dict[adjusted_blocks_key] = int(adjusted_blocks_value)/4096 - 1
+ image_size = image_props.get("image_size")
+ if image_size:
+ image_blocks_key = what + "_image_blocks"
+ info_dict[image_blocks_key] = int(image_size) / 4096 - 1
def AddUserdata(output_zip):
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index ca96d01..ec500b1 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -18,8 +18,10 @@
Builds output_image from the given input_directory, properties_file,
and writes the image to target_output_directory.
+If argument generated_prop_file exists, write additional properties to the file.
+
Usage: build_image.py input_directory properties_file output_image \\
- target_output_directory
+ target_output_directory [generated_prop_file]
"""
from __future__ import print_function
@@ -40,22 +42,29 @@ OPTIONS = common.OPTIONS
FIXED_SALT = "aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7"
BLOCK_SIZE = 4096
+BYTES_IN_MB = 1024 * 1024
-def RunCommand(cmd, verbose=None):
+def RunCommand(cmd, verbose=None, env=None):
"""Echo and run the given command.
Args:
cmd: the command represented as a list of strings.
verbose: show commands being executed.
+ env: a dictionary of additional environment variables.
Returns:
A tuple of the output and the exit code.
"""
+ env_copy = None
+ if env is not None:
+ env_copy = os.environ.copy()
+ env_copy.update(env)
if verbose is None:
verbose = OPTIONS.verbose
if verbose:
print("Running: " + " ".join(cmd))
- p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
+ p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT,
+ env=env_copy)
output, _ = p.communicate()
if verbose:
@@ -104,6 +113,24 @@ def GetVeritySize(partition_size, fec_supported):
return verity_size
+def GetDiskUsage(path):
+ """Return number of bytes that "path" occupies on host.
+
+ Args:
+ path: The directory or file to calculate size on
+ Returns:
+ True and the number of bytes if successful,
+ False and 0 otherwise.
+ """
+ env = {"POSIXLY_CORRECT": "1"}
+ cmd = ["du", "-s", path]
+ output, exit_code = RunCommand(cmd, verbose=False, env=env)
+ if exit_code != 0:
+ return False, 0
+ # POSIX du returns number of blocks with block size 512
+ return True, int(output.split()[0]) * 512
+
+
def GetSimgSize(image_file):
simg = sparse_img.SparseImage(image_file, build_map=False)
return simg.blocksize * simg.total_blocks
@@ -123,13 +150,14 @@ def AVBCalcMaxImageSize(avbtool, footer_type, partition_size, additional_args):
avbtool: String with path to avbtool.
footer_type: 'hash' or 'hashtree' for generating footer.
partition_size: The size of the partition in question.
- additional_args: Additional arguments to pass to 'avbtool
- add_hashtree_image'.
+ additional_args: Additional arguments to pass to "avbtool add_hash_footer"
+ or "avbtool add_hashtree_footer".
+
Returns:
The maximum image size or 0 if an error occurred.
"""
cmd = [avbtool, "add_%s_footer" % footer_type,
- "--partition_size", partition_size, "--calc_max_image_size"]
+ "--partition_size", str(partition_size), "--calc_max_image_size"]
cmd.extend(shlex.split(additional_args))
(output, exit_code) = RunCommand(cmd)
@@ -139,6 +167,63 @@ def AVBCalcMaxImageSize(avbtool, footer_type, partition_size, additional_args):
return int(output)
+def AVBCalcMinPartitionSize(image_size, size_calculator):
+ """Calculates min partition size for a given image size.
+
+ Args:
+ image_size: The size of the image in question.
+ size_calculator: The function to calculate max image size
+ for a given partition size.
+
+ Returns:
+ The minimum partition size required to accommodate the image size.
+ """
+ # Use image size as partition size to approximate final partition size.
+ image_ratio = size_calculator(image_size) / float(image_size)
+
+ # Prepare a binary search for the optimal partition size.
+ lo = int(image_size / image_ratio) // BLOCK_SIZE * BLOCK_SIZE - BLOCK_SIZE
+
+ # Ensure lo is small enough: max_image_size should <= image_size.
+ delta = BLOCK_SIZE
+ max_image_size = size_calculator(lo)
+ while max_image_size > image_size:
+ image_ratio = max_image_size / float(lo)
+ lo = int(image_size / image_ratio) // BLOCK_SIZE * BLOCK_SIZE - delta
+ delta *= 2
+ max_image_size = size_calculator(lo)
+
+ hi = lo + BLOCK_SIZE
+
+ # Ensure hi is large enough: max_image_size should >= image_size.
+ delta = BLOCK_SIZE
+ max_image_size = size_calculator(hi)
+ while max_image_size < image_size:
+ image_ratio = max_image_size / float(hi)
+ hi = int(image_size / image_ratio) // BLOCK_SIZE * BLOCK_SIZE + delta
+ delta *= 2
+ max_image_size = size_calculator(hi)
+
+ partition_size = hi
+
+ # Start to binary search.
+ while lo < hi:
+ mid = ((lo + hi) // (2 * BLOCK_SIZE)) * BLOCK_SIZE
+ max_image_size = size_calculator(mid)
+ if max_image_size >= image_size: # if mid can accommodate image_size
+ if mid < partition_size: # if a smaller partition size is found
+ partition_size = mid
+ hi = mid
+ else:
+ lo = mid + BLOCK_SIZE
+
+ if OPTIONS.verbose:
+ print("AVBCalcMinPartitionSize({}): partition_size: {}.".format(
+ image_size, partition_size))
+
+ return partition_size
+
+
def AVBAddFooter(image_path, avbtool, footer_type, partition_size,
partition_name, key_path, algorithm, salt,
additional_args):
@@ -153,8 +238,8 @@ def AVBAddFooter(image_path, avbtool, footer_type, partition_size,
key_path: Path to key to use or None.
algorithm: Name of algorithm to use or None.
salt: The salt to use (a hexadecimal string) or None.
- additional_args: Additional arguments to pass to 'avbtool
- add_hashtree_image'.
+ additional_args: Additional arguments to pass to "avbtool add_hash_footer"
+ or "avbtool add_hashtree_footer".
Returns:
True if the operation succeeded.
@@ -171,8 +256,11 @@ def AVBAddFooter(image_path, avbtool, footer_type, partition_size,
cmd.extend(shlex.split(additional_args))
- (_, exit_code) = RunCommand(cmd)
- return exit_code == 0
+ output, exit_code = RunCommand(cmd)
+ if exit_code != 0:
+ print("Failed to add AVB footer! Error: %s" % output)
+ return False
+ return True
def AdjustPartitionSizeForVerity(partition_size, fec_supported):
@@ -345,7 +433,7 @@ def MakeVerityEnabledImage(out_file, fec_supported, prop_dict):
True on success, False otherwise.
"""
# get properties
- image_size = int(prop_dict["partition_size"])
+ image_size = int(prop_dict["image_size"])
block_dev = prop_dict["verity_block_device"]
signer_key = prop_dict["verity_key"] + ".pk8"
if OPTIONS.verity_signer_path is not None:
@@ -376,10 +464,10 @@ def MakeVerityEnabledImage(out_file, fec_supported, prop_dict):
return False
# build the full verified image
- target_size = int(prop_dict["original_partition_size"])
+ partition_size = int(prop_dict["partition_size"])
verity_size = int(prop_dict["verity_size"])
- padding_size = target_size - image_size - verity_size
+ padding_size = partition_size - image_size - verity_size
assert padding_size >= 0
if not BuildVerifiedImage(out_file,
@@ -400,6 +488,52 @@ def ConvertBlockMapToBaseFs(block_map_file):
return base_fs_file if exit_code == 0 else None
+def SetUpInDirAndFsConfig(origin_in, prop_dict):
+ """Returns the in_dir and fs_config that should be used for image building.
+
+ If the target uses system_root_image and it's building system.img, it creates
+ and returns a staged dir that combines the contents of /system (i.e. in the
+ given in_dir) and root.
+
+ Args:
+ origin_in: Path to the input directory.
+ prop_dict: A property dict that contains info like partition size. Values
+ may be updated.
+
+ Returns:
+ A tuple of in_dir and fs_config that should be used to build the image.
+ """
+ fs_config = prop_dict.get("fs_config")
+ if (prop_dict.get("system_root_image") != "true" or
+ prop_dict["mount_point"] != "system"):
+ return origin_in, fs_config
+
+ # Construct a staging directory of the root file system.
+ in_dir = common.MakeTempDir()
+ root_dir = prop_dict.get("root_dir")
+ if root_dir:
+ shutil.rmtree(in_dir)
+ shutil.copytree(root_dir, in_dir, symlinks=True)
+ in_dir_system = os.path.join(in_dir, "system")
+ shutil.rmtree(in_dir_system, ignore_errors=True)
+ shutil.copytree(origin_in, in_dir_system, symlinks=True)
+
+ # Change the mount point to "/".
+ prop_dict["mount_point"] = "/"
+ if fs_config:
+ # We need to merge the fs_config files of system and root.
+ merged_fs_config = common.MakeTempFile(
+ prefix="merged_fs_config", suffix=".txt")
+ with open(merged_fs_config, "w") as fw:
+ if "root_fs_config" in prop_dict:
+ with open(prop_dict["root_fs_config"]) as fr:
+ fw.writelines(fr.readlines())
+ with open(fs_config) as fr:
+ fw.writelines(fr.readlines())
+ fs_config = merged_fs_config
+ return in_dir, fs_config
+
+
def CheckHeadroom(ext4fs_output, prop_dict):
"""Checks if there's enough headroom space available.
@@ -443,38 +577,25 @@ def CheckHeadroom(ext4fs_output, prop_dict):
def BuildImage(in_dir, prop_dict, out_file, target_out=None):
- """Build an image to out_file from in_dir with property prop_dict.
+ """Builds an image for the files under in_dir and writes it to out_file.
+
+ When using system_root_image, it will additionally look for the files under
+ root (specified by 'root_dir') and builds an image that contains both sources.
Args:
- in_dir: path of input directory.
- prop_dict: property dictionary.
- out_file: path of the output image file.
- target_out: path of the product out directory to read device specific FS
- config files.
+ in_dir: Path to input directory.
+ prop_dict: A property dict that contains info like partition size. Values
+ will be updated with computed values.
+ out_file: The output image file.
+ target_out: Path to the TARGET_OUT directory as in Makefile. It actually
+ points to the /system directory under PRODUCT_OUT. fs_config (the one
+ under system/core/libcutils) reads device specific FS config files from
+ there.
Returns:
True iff the image is built successfully.
"""
- # system_root_image=true: build a system.img that combines the contents of
- # /system and the ramdisk, and can be mounted at the root of the file system.
- origin_in = in_dir
- fs_config = prop_dict.get("fs_config")
- if (prop_dict.get("system_root_image") == "true" and
- prop_dict["mount_point"] == "system"):
- in_dir = common.MakeTempDir()
- # Change the mount point to "/".
- prop_dict["mount_point"] = "/"
- if fs_config:
- # We need to merge the fs_config files of system and ramdisk.
- merged_fs_config = common.MakeTempFile(prefix="root_fs_config",
- suffix=".txt")
- with open(merged_fs_config, "w") as fw:
- if "ramdisk_fs_config" in prop_dict:
- with open(prop_dict["ramdisk_fs_config"]) as fr:
- fw.writelines(fr.readlines())
- with open(fs_config) as fr:
- fw.writelines(fr.readlines())
- fs_config = merged_fs_config
+ in_dir, fs_config = SetUpInDirAndFsConfig(in_dir, prop_dict)
build_command = []
fs_type = prop_dict.get("fs_type", "")
@@ -488,36 +609,61 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
verity_supported = prop_dict.get("verity") == "true"
verity_fec_supported = prop_dict.get("verity_fec") == "true"
- # Adjust the partition size to make room for the hashes if this is to be
- # verified.
+ avb_footer_type = None
+ if prop_dict.get("avb_hash_enable") == "true":
+ avb_footer_type = "hash"
+ elif prop_dict.get("avb_hashtree_enable") == "true":
+ avb_footer_type = "hashtree"
+
+ if avb_footer_type:
+ avbtool = prop_dict.get("avb_avbtool")
+ avb_signing_args = prop_dict.get(
+ "avb_add_" + avb_footer_type + "_footer_args")
+
+ if (prop_dict.get("use_dynamic_partition_size") == "true" and
+ "partition_size" not in prop_dict):
+ # if partition_size is not defined, use output of `du' + reserved_size
+ success, size = GetDiskUsage(in_dir)
+ if not success:
+ return False
+ if OPTIONS.verbose:
+ print("The tree size of %s is %d MB." % (in_dir, size // BYTES_IN_MB))
+ size += int(prop_dict.get("partition_reserved_size", 0))
+ # Round this up to a multiple of 4K so that avbtool works
+ size = common.RoundUpTo4K(size)
+ # Adjust partition_size to add more space for AVB footer, to prevent
+ # it from consuming partition_reserved_size.
+ if avb_footer_type:
+ size = AVBCalcMinPartitionSize(
+ size,
+ lambda x: AVBCalcMaxImageSize(
+ avbtool, avb_footer_type, x, avb_signing_args))
+ prop_dict["partition_size"] = str(size)
+ if OPTIONS.verbose:
+ print("Allocating %d MB for %s." % (size // BYTES_IN_MB, out_file))
+
+ prop_dict["image_size"] = prop_dict["partition_size"]
+
+ # Adjust the image size to make room for the hashes if this is to be verified.
if verity_supported and is_verity_partition:
partition_size = int(prop_dict.get("partition_size"))
- (adjusted_size, verity_size) = AdjustPartitionSizeForVerity(
+ image_size, verity_size = AdjustPartitionSizeForVerity(
partition_size, verity_fec_supported)
- if not adjusted_size:
+ if not image_size:
return False
- prop_dict["partition_size"] = str(adjusted_size)
- prop_dict["original_partition_size"] = str(partition_size)
+ prop_dict["image_size"] = str(image_size)
prop_dict["verity_size"] = str(verity_size)
- # Adjust partition size for AVB hash footer or AVB hashtree footer.
- avb_footer_type = ''
- if prop_dict.get("avb_hash_enable") == "true":
- avb_footer_type = 'hash'
- elif prop_dict.get("avb_hashtree_enable") == "true":
- avb_footer_type = 'hashtree'
-
+ # Adjust the image size for AVB hash footer or AVB hashtree footer.
if avb_footer_type:
- avbtool = prop_dict["avb_avbtool"]
partition_size = prop_dict["partition_size"]
# avb_add_hash_footer_args or avb_add_hashtree_footer_args.
- additional_args = prop_dict["avb_add_" + avb_footer_type + "_footer_args"]
max_image_size = AVBCalcMaxImageSize(avbtool, avb_footer_type,
- partition_size, additional_args)
- if max_image_size == 0:
+ partition_size, avb_signing_args)
+ if max_image_size <= 0:
+ print("AVBCalcMaxImageSize is <= 0: %d" % max_image_size)
return False
- prop_dict["partition_size"] = str(max_image_size)
- prop_dict["original_partition_size"] = partition_size
+ prop_dict["image_size"] = str(max_image_size)
if fs_type.startswith("ext"):
build_command = [prop_dict["ext_mkuserimg"]]
@@ -526,7 +672,7 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
run_e2fsck = True
build_command.extend([in_dir, out_file, fs_type,
prop_dict["mount_point"]])
- build_command.append(prop_dict["partition_size"])
+ build_command.append(prop_dict["image_size"])
if "journal_size" in prop_dict:
build_command.extend(["-j", prop_dict["journal_size"]])
if "timestamp" in prop_dict:
@@ -585,7 +731,7 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
build_command.extend(["-a"])
elif fs_type.startswith("f2fs"):
build_command = ["mkf2fsuserimg.sh"]
- build_command.extend([out_file, prop_dict["partition_size"]])
+ build_command.extend([out_file, prop_dict["image_size"]])
if fs_config:
build_command.extend(["-C", fs_config])
build_command.extend(["-f", in_dir])
@@ -601,20 +747,26 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
print("Error: unknown filesystem type '%s'" % (fs_type))
return False
- if in_dir != origin_in:
- # Construct a staging directory of the root file system.
- ramdisk_dir = prop_dict.get("ramdisk_dir")
- if ramdisk_dir:
- shutil.rmtree(in_dir)
- shutil.copytree(ramdisk_dir, in_dir, symlinks=True)
- staging_system = os.path.join(in_dir, "system")
- shutil.rmtree(staging_system, ignore_errors=True)
- shutil.copytree(origin_in, staging_system, symlinks=True)
-
(mkfs_output, exit_code) = RunCommand(build_command)
if exit_code != 0:
print("Error: '%s' failed with exit code %d:\n%s" % (
build_command, exit_code, mkfs_output))
+ success, du = GetDiskUsage(in_dir)
+ du_str = ("%d bytes (%d MB)" % (du, du // BYTES_IN_MB)
+ ) if success else "unknown"
+ print(
+ "Out of space? The tree size of {} is {}, with reserved space of {} "
+ "bytes ({} MB).".format(
+ in_dir, du_str,
+ int(prop_dict.get("partition_reserved_size", 0)),
+ int(prop_dict.get("partition_reserved_size", 0)) // BYTES_IN_MB))
+ print(
+ "The max image size for filsystem files is {} bytes ({} MB), out of a "
+ "total partition size of {} bytes ({} MB).".format(
+ int(prop_dict["image_size"]),
+ int(prop_dict["image_size"]) // BYTES_IN_MB,
+ int(prop_dict["partition_size"]),
+ int(prop_dict["partition_size"]) // BYTES_IN_MB))
return False
# Check if there's enough headroom space available for ext4 image.
@@ -624,14 +776,14 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
if not fs_spans_partition:
mount_point = prop_dict.get("mount_point")
- partition_size = int(prop_dict.get("partition_size"))
- image_size = GetSimgSize(out_file)
- if image_size > partition_size:
+ image_size = int(prop_dict["image_size"])
+ sparse_image_size = GetSimgSize(out_file)
+ if sparse_image_size > image_size:
print("Error: %s image size of %d is larger than partition size of "
- "%d" % (mount_point, image_size, partition_size))
+ "%d" % (mount_point, sparse_image_size, image_size))
return False
if verity_supported and is_verity_partition:
- ZeroPadSimg(out_file, partition_size - image_size)
+ ZeroPadSimg(out_file, image_size - sparse_image_size)
# Create the verified image if this is to be verified.
if verity_supported and is_verity_partition:
@@ -640,18 +792,15 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
# Add AVB HASH or HASHTREE footer (metadata).
if avb_footer_type:
- avbtool = prop_dict["avb_avbtool"]
- original_partition_size = prop_dict["original_partition_size"]
+ partition_size = prop_dict["partition_size"]
partition_name = prop_dict["partition_name"]
# 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")
salt = prop_dict.get("avb_salt")
- # avb_add_hash_footer_args or avb_add_hashtree_footer_args
- additional_args = prop_dict["avb_add_" + avb_footer_type + "_footer_args"]
if not AVBAddFooter(out_file, avbtool, avb_footer_type,
- original_partition_size, partition_name, key_path,
- algorithm, salt, additional_args):
+ partition_size, partition_name, key_path,
+ algorithm, salt, avb_signing_args):
return False
if run_e2fsck and prop_dict.get("skip_fsck") != "true":
@@ -715,6 +864,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
"avb_enable",
"avb_avbtool",
"avb_salt",
+ "use_dynamic_partition_size",
)
for p in common_props:
copy_prop(p, p)
@@ -736,8 +886,8 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
d["journal_size"] = "0"
copy_prop("system_verity_block_device", "verity_block_device")
copy_prop("system_root_image", "system_root_image")
- copy_prop("ramdisk_dir", "ramdisk_dir")
- copy_prop("ramdisk_fs_config", "ramdisk_fs_config")
+ copy_prop("root_dir", "root_dir")
+ copy_prop("root_fs_config", "root_fs_config")
copy_prop("ext4_share_dup_blocks", "ext4_share_dup_blocks")
copy_prop("system_squashfs_compressor", "squashfs_compressor")
copy_prop("system_squashfs_compressor_opt", "squashfs_compressor_opt")
@@ -747,6 +897,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
copy_prop("system_extfs_inode_count", "extfs_inode_count")
if not copy_prop("system_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
+ copy_prop("system_reserved_size", "partition_reserved_size")
elif mount_point == "system_other":
# We inherit the selinux policies of /system since we contain some of its
# files.
@@ -769,6 +920,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
copy_prop("system_extfs_inode_count", "extfs_inode_count")
if not copy_prop("system_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
+ copy_prop("system_reserved_size", "partition_reserved_size")
elif mount_point == "data":
# Copy the generic fs type first, override with specific one if available.
copy_prop("fs_type", "fs_type")
@@ -799,6 +951,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
copy_prop("vendor_extfs_inode_count", "extfs_inode_count")
if not copy_prop("vendor_extfs_rsv_pct", "extfs_rsv_pct"):
d["extfs_rsv_pct"] = "0"
+ copy_prop("vendor_reserved_size", "partition_reserved_size")
elif mount_point == "product":
copy_prop("avb_product_hashtree_enable", "avb_hashtree_enable")
copy_prop("avb_product_add_hashtree_footer_args",
@@ -818,6 +971,7 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
copy_prop("product_extfs_inode_count", "extfs_inode_count")
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 == "oem":
copy_prop("fs_type", "fs_type")
copy_prop("oem_size", "partition_size")
@@ -844,8 +998,32 @@ def LoadGlobalDict(filename):
return d
+def GlobalDictFromImageProp(image_prop, mount_point):
+ d = {}
+ def copy_prop(src_p, dest_p):
+ if src_p in image_prop:
+ d[dest_p] = image_prop[src_p]
+ return True
+ return False
+
+ if mount_point == "system":
+ copy_prop("partition_size", "system_size")
+ elif mount_point == "system_other":
+ copy_prop("partition_size", "system_size")
+ elif mount_point == "vendor":
+ copy_prop("partition_size", "vendor_size")
+ elif mount_point == "product":
+ copy_prop("partition_size", "product_size")
+ return d
+
+
+def SaveGlobalDict(filename, glob_dict):
+ with open(filename, "w") as f:
+ f.writelines(["%s=%s" % (key, value) for (key, value) in glob_dict.items()])
+
+
def main(argv):
- if len(argv) != 4:
+ if len(argv) < 4 or len(argv) > 5:
print(__doc__)
sys.exit(1)
@@ -853,6 +1031,7 @@ def main(argv):
glob_dict_file = argv[1]
out_file = argv[2]
target_out = argv[3]
+ prop_file_out = argv[4] if len(argv) >= 5 else None
glob_dict = LoadGlobalDict(glob_dict_file)
if "mount_point" in glob_dict:
@@ -887,6 +1066,9 @@ def main(argv):
file=sys.stderr)
sys.exit(1)
+ if prop_file_out:
+ glob_dict_out = GlobalDictFromImageProp(image_properties, mount_point)
+ SaveGlobalDict(prop_file_out, glob_dict_out)
if __name__ == '__main__':
try:
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index 6defb2b..df077b1 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -194,10 +194,10 @@ def LoadInfoDict(input_file, input_dir=None):
if fc_config:
d["selinux_fc"] = fc_config
- # Similarly we need to redirect "ramdisk_dir" and "ramdisk_fs_config".
+ # Similarly we need to redirect "root_dir" and "root_fs_config".
if d.get("system_root_image") == "true":
- d["ramdisk_dir"] = os.path.join(input_dir, "ROOT")
- d["ramdisk_fs_config"] = os.path.join(
+ d["root_dir"] = os.path.join(input_dir, "ROOT")
+ d["root_fs_config"] = os.path.join(
input_dir, "META", "root_filesystem_config.txt")
# Redirect {system,vendor}_base_fs_file.
@@ -339,8 +339,9 @@ def LoadRecoveryFSTab(read_helper, fstab_version, recovery_fstab_path,
context = i
mount_point = pieces[1]
- d[mount_point] = Partition(mount_point=mount_point, fs_type=pieces[2],
- device=pieces[0], length=length, context=context)
+ if not d.get(mount_point):
+ d[mount_point] = Partition(mount_point=mount_point, fs_type=pieces[2],
+ device=pieces[0], length=length, context=context)
# / is used for the system mount point when the root directory is included in
# system. Other areas assume system is always at "/system" so point /system
@@ -439,6 +440,21 @@ def _BuildBootableImage(sourcedir, fs_config_file, info_dict=None,
cmd.append("--pagesize")
cmd.append(open(fn).read().rstrip("\n"))
+ fn = os.path.join(sourcedir, "tagsaddr")
+ if os.access(fn, os.F_OK):
+ cmd.append("--tags-addr")
+ cmd.append(open(fn).read().rstrip("\n"))
+
+ fn = os.path.join(sourcedir, "ramdisk_offset")
+ if os.access(fn, os.F_OK):
+ cmd.append("--ramdisk_offset")
+ cmd.append(open(fn).read().rstrip("\n"))
+
+ fn = os.path.join(sourcedir, "dt")
+ if os.access(fn, os.F_OK):
+ cmd.append("--dt")
+ cmd.append(fn)
+
args = info_dict.get("mkbootimg_args", None)
if args and args.strip():
cmd.extend(shlex.split(args))
@@ -1066,6 +1082,7 @@ class PasswordManager(object):
def __init__(self):
self.editor = os.getenv("EDITOR", None)
self.pwfile = os.getenv("ANDROID_PW_FILE", None)
+ self.secure_storage_cmd = os.getenv("ANDROID_SECURE_STORAGE_CMD", None)
def GetPasswords(self, items):
"""Get passwords corresponding to each string in 'items',
@@ -1085,9 +1102,23 @@ class PasswordManager(object):
missing = []
for i in items:
if i not in current or not current[i]:
- missing.append(i)
+ # Attempt to load using ANDROID_SECURE_STORAGE_CMD
+ if self.secure_storage_cmd:
+ try:
+ os.environ["TMP__KEY_FILE_NAME"] = str(i)
+ ps = subprocess.Popen(self.secure_storage_cmd, shell=True, stdout=subprocess.PIPE)
+ output = ps.communicate()[0]
+ if ps.returncode == 0:
+ current[i] = output
+ except Exception as e:
+ print(e)
+ pass
+ if i not in current or not current[i]:
+ missing.append(i)
# Are all the passwords already in the file?
if not missing:
+ if "ANDROID_SECURE_STORAGE_CMD" in os.environ:
+ del os.environ["ANDROID_SECURE_STORAGE_CMD"]
return current
for i in missing:
@@ -1333,6 +1364,11 @@ class DeviceSpecificParams(object):
used to install the image for the device's baseband processor."""
return self._DoCall("FullOTA_InstallEnd")
+ def FullOTA_PostValidate(self):
+ """Called after installing and validating /system; typically this is
+ used to resize the system partition after a block based installation."""
+ return self._DoCall("FullOTA_PostValidate")
+
def IncrementalOTA_Assertions(self):
"""Called after emitting the block of assertions at the top of an
incremental OTA package. Implementations can add whatever
@@ -1774,7 +1810,10 @@ PARTITION_TYPES = {
"ext4": "EMMC",
"emmc": "EMMC",
"f2fs": "EMMC",
- "squashfs": "EMMC"
+ "squashfs": "EMMC",
+ "ext2": "EMMC",
+ "ext3": "EMMC",
+ "vfat": "EMMC"
}
def GetTypeAndDevice(mount_point, info):
@@ -1852,6 +1891,7 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img,
info_dict = OPTIONS.info_dict
full_recovery_image = info_dict.get("full_recovery_image") == "true"
+ use_bsdiff = info_dict.get("no_gzip_recovery_ramdisk") == "true"
if full_recovery_image:
output_sink("etc/recovery.img", recovery_img.data)
@@ -1862,7 +1902,7 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img,
# With system-root-image, boot and recovery images will have mismatching
# entries (only recovery has the ramdisk entry) (Bug: 72731506). Use bsdiff
# to handle such a case.
- if system_root_image:
+ if system_root_image or use_bsdiff:
diff_program = ["bsdiff"]
bonus_args = ""
assert not os.path.exists(path)
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index 7a81928..30ff3e5 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -145,20 +145,29 @@ class EdifyGenerator(object):
def AssertDevice(self, device):
"""Assert that the device identifier is the given string."""
- cmd = ('getprop("ro.product.device") == "%s" || '
- 'abort("E%d: This package is for \\"%s\\" devices; '
- 'this is a \\"" + getprop("ro.product.device") + "\\".");') % (
- device, common.ErrorCode.DEVICE_MISMATCH, device)
- self.script.append(cmd)
+ cmd = ('assert(' +
+ ' || \0'.join(['getprop("ro.product.device") == "%s" || getprop("ro.build.product") == "%s"'
+ % (i, i) for i in device.split(",")]) +
+ ' || abort("E%d: This package is for device: %s; ' +
+ 'this device is " + getprop("ro.product.device") + ".");' +
+ ');') % (common.ErrorCode.DEVICE_MISMATCH, device)
+ self.script.append(self.WordWrap(cmd))
def AssertSomeBootloader(self, *bootloaders):
- """Asert that the bootloader version is one of *bootloaders."""
+ """Assert that the bootloader version is one of *bootloaders."""
cmd = ("assert(" +
" ||\0".join(['getprop("ro.bootloader") == "%s"' % (b,)
for b in bootloaders]) +
+ ' || abort("This package supports bootloader(s): ' +
+ ", ".join(["%s" % (b,) for b in bootloaders]) +
+ '; this device has bootloader " + getprop("ro.bootloader") + ".");' +
");")
self.script.append(self.WordWrap(cmd))
+ def RunBackup(self, command, system_path):
+ self.script.append(('run_program("/tmp/install/bin/backuptool.sh", "%s", "%s");' % (
+ command, system_path)))
+
def ShowProgress(self, frac, dur):
"""Update the progress bar, advancing it over 'frac' over the next
'dur' seconds. 'dur' may be zero to advance it via SetProgress
@@ -230,6 +239,17 @@ class EdifyGenerator(object):
p.mount_point, mount_flags))
self.mounts.add(p.mount_point)
+ def Unmount(self, mount_point):
+ """Unmount the partition with the given mount_point."""
+ if mount_point in self.mounts:
+ self.mounts.remove(mount_point)
+ self.script.append('unmount("%s");' % (mount_point,))
+
+ def UnpackPackageDir(self, src, dst):
+ """Unpack a given directory from the OTA package into the given
+ destination directory."""
+ self.script.append('package_extract_dir("%s", "%s");' % (src, dst))
+
def Comment(self, comment):
"""Write a comment into the update script."""
self.script.append("")
@@ -287,6 +307,25 @@ class EdifyGenerator(object):
cmd = "".join(cmd)
self.script.append(self.WordWrap(cmd))
+ def SetPermissionsRecursive(self, fn, uid, gid, dmode, fmode, selabel,
+ capabilities):
+ """Recursively set path ownership and permissions."""
+ if not self.info.get("use_set_metadata", False):
+ self.script.append('set_perm_recursive(%d, %d, 0%o, 0%o, "%s");'
+ % (uid, gid, dmode, fmode, fn))
+ else:
+ if capabilities is None:
+ capabilities = "0x0"
+ cmd = 'set_metadata_recursive("%s", "uid", %d, "gid", %d, ' \
+ '"dmode", 0%o, "fmode", 0%o' \
+ % (fn, uid, gid, dmode, fmode)
+ if not fn.startswith("/tmp"):
+ cmd += ', "capabilities", "%s"' % capabilities
+ if selabel is not None:
+ cmd += ', "selabel", "%s"' % selabel
+ cmd += ');'
+ self.script.append(cmd)
+
def WriteRawImage(self, mount_point, fn, mapfn=None):
"""Write the given package file into the partition for the given
mount point."""
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 10a19b3..a5f2d50 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -156,6 +156,13 @@ Usage: ota_from_target_files [flags] input_target_files output_ota_package
ones. Should only be used if caller knows it's safe to do so (e.g. all the
postinstall work is to dexopt apps and a data wipe will happen immediately
after). Only meaningful when generating A/B OTAs.
+
+ --override_device <device>
+ Override device-specific asserts. Can be a comma-separated list.
+
+ --backup <boolean>
+ Enable or disable the execution of backuptool.sh.
+ Disabled by default.
"""
from __future__ import print_function
@@ -207,11 +214,13 @@ OPTIONS.payload_signer_args = []
OPTIONS.extracted_input = None
OPTIONS.key_passwords = []
OPTIONS.skip_postinstall = False
+OPTIONS.override_device = 'auto'
+OPTIONS.backuptool = False
METADATA_NAME = 'META-INF/com/android/metadata'
POSTINSTALL_CONFIG = 'META/postinstall_config.txt'
-UNZIP_PATTERN = ['IMAGES/*', 'META/*']
+UNZIP_PATTERN = ['IMAGES/*', 'META/*', 'INSTALL/*', 'SYSTEM/build.prop']
class BuildInfo(object):
@@ -263,7 +272,10 @@ class BuildInfo(object):
assert oem_dicts, "OEM source required for this build"
# These two should be computed only after setting self._oem_props.
- self._device = self.GetOemProperty("ro.product.device")
+ if OPTIONS.override_device == "auto":
+ self._device = self.GetOemProperty("ro.product.device")
+ else:
+ self._device = OPTIONS.override_device
self._fingerprint = self.CalculateFingerprint()
@property
@@ -709,6 +721,15 @@ def AddCompatibilityArchiveIfTrebleEnabled(target_zip, output_zip, target_info,
AddCompatibilityArchive(system_updated, vendor_updated)
+def CopyInstallTools(output_zip):
+ install_path = os.path.join(OPTIONS.input_tmp, "INSTALL")
+ for root, subdirs, files in os.walk(install_path):
+ for f in files:
+ install_source = os.path.join(root, f)
+ install_target = os.path.join("install", os.path.relpath(root, install_path), f)
+ output_zip.write(install_source, install_target)
+
+
def WriteFullOTAPackage(input_zip, output_file):
target_info = BuildInfo(OPTIONS.info_dict, OPTIONS.oem_dicts)
@@ -743,9 +764,9 @@ def WriteFullOTAPackage(input_zip, output_file):
assert HasRecoveryPatch(input_zip)
# Assertions (e.g. downgrade check, device properties check).
- ts = target_info.GetBuildProp("ro.build.date.utc")
- ts_text = target_info.GetBuildProp("ro.build.date")
- script.AssertOlderBuild(ts, ts_text)
+ #ts = target_info.GetBuildProp("ro.build.date.utc")
+ #ts_text = target_info.GetBuildProp("ro.build.date")
+ #script.AssertOlderBuild(ts, ts_text)
target_info.WriteDeviceAssertions(script, OPTIONS.oem_no_mount)
device_specific.FullOTA_Assertions()
@@ -799,8 +820,24 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
# Dump fingerprints
script.Print("Target: {}".format(target_info.fingerprint))
+ script.AppendExtra("ifelse(is_mounted(\"/system\"), unmount(\"/system\"));")
device_specific.FullOTA_InstallBegin()
+ CopyInstallTools(output_zip)
+ script.UnpackPackageDir("install", "/tmp/install")
+ script.SetPermissionsRecursive("/tmp/install", 0, 0, 0755, 0644, None, None)
+ script.SetPermissionsRecursive("/tmp/install/bin", 0, 0, 0755, 0755, None, None)
+
+ if OPTIONS.backuptool:
+ is_system_as_root = script.fstab["/system"].mount_point == "/"
+ if is_system_as_root:
+ script.fstab["/system"].mount_point = "/system"
+ script.Mount("/system")
+ script.RunBackup("backup", "/system/system" if is_system_as_root else "/system")
+ script.Unmount("/system")
+ if is_system_as_root:
+ script.fstab["/system"].mount_point = "/"
+
system_progress = 0.75
if OPTIONS.wipe_user_data:
@@ -840,6 +877,19 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
common.CheckSize(boot_img.data, "boot.img", target_info)
common.ZipWriteStr(output_zip, "boot.img", boot_img.data)
+ device_specific.FullOTA_PostValidate()
+
+ if OPTIONS.backuptool:
+ script.ShowProgress(0.02, 10)
+ is_system_as_root = script.fstab["/system"].mount_point == "/"
+ if is_system_as_root:
+ script.fstab["/system"].mount_point = "/system"
+ script.Mount("/system")
+ script.RunBackup("restore", "/system/system" if is_system_as_root else "/system")
+ script.Unmount("/system")
+ if is_system_as_root:
+ script.fstab["/system"].mount_point = "/"
+
script.ShowProgress(0.05, 5)
script.WriteRawImage("/boot", "boot.img")
@@ -876,6 +926,9 @@ endif;
script.AddToZip(input_zip, output_zip, input_path=OPTIONS.updater_binary)
metadata["ota-required-cache"] = str(script.required_cache)
+ common.ZipWriteStr(output_zip, "system/build.prop",
+ ""+input_zip.read("SYSTEM/build.prop"))
+
# We haven't written the metadata entry, which will be done in
# FinalizeMetadata.
common.ZipClose(output_zip)
@@ -1596,6 +1649,9 @@ endif;
script.AddToZip(target_zip, output_zip, input_path=OPTIONS.updater_binary)
metadata["ota-required-cache"] = str(script.required_cache)
+ common.ZipWriteStr(output_zip, "system/build.prop",
+ ""+target_zip.read("SYSTEM/build.prop"))
+
# We haven't written the metadata entry yet, which will be handled in
# FinalizeMetadata().
common.ZipClose(output_zip)
@@ -1830,6 +1886,10 @@ def main(argv):
OPTIONS.extracted_input = a
elif o == "--skip_postinstall":
OPTIONS.skip_postinstall = True
+ elif o in ("--override_device"):
+ OPTIONS.override_device = a
+ elif o in ("--backup"):
+ OPTIONS.backuptool = bool(a.lower() == 'true')
else:
return False
return True
@@ -1860,6 +1920,8 @@ def main(argv):
"payload_signer_args=",
"extracted_input_target_files=",
"skip_postinstall",
+ "override_device=",
+ "backup=",
], extra_option_handler=option_handler)
if len(args) != 2:
@@ -1903,6 +1965,9 @@ def main(argv):
# Load OEM dicts if provided.
OPTIONS.oem_dicts = _LoadOemDicts(OPTIONS.oem_source)
+ if "ota_override_device" in OPTIONS.info_dict:
+ OPTIONS.override_device = OPTIONS.info_dict.get("ota_override_device")
+
ab_update = OPTIONS.info_dict.get("ab_update") == "true"
# Use the default key to sign the package if not specified with package_key.
diff --git a/tools/releasetools/sign_zip.py b/tools/releasetools/sign_zip.py
new file mode 100755
index 0000000..c40b1b4
--- /dev/null
+++ b/tools/releasetools/sign_zip.py
@@ -0,0 +1,69 @@
+#!/usr/bin/env python
+#
+# Copyright (C) 2017 The LineageOS 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.
+
+"""
+Signs the given zip with the given key producing a new zip.
+
+Usage: sign_release_zip [flags] input_zip output_zip
+
+ -k (--package_key) <key> Key to use to sign the package (default is
+ "build/target/product/security/testkey").
+"""
+import sys
+
+import common
+
+OPTIONS = common.OPTIONS
+
+OPTIONS.package_key = "build/target/product/security/testkey"
+
+def SignOutput(input_zip_name, output_zip_name):
+ key_passwords = common.GetKeyPasswords([OPTIONS.package_key])
+ pw = key_passwords[OPTIONS.package_key]
+
+ common.SignFile(input_zip_name, output_zip_name, OPTIONS.package_key, pw,
+ whole_file=True)
+
+
+def main(argv):
+
+ def option_handler(o, a):
+ if o in ("-k", "--package_key"):
+ OPTIONS.package_key = a
+ else:
+ return False
+ return True
+
+ args = common.ParseOptions(argv, __doc__,
+ extra_opts="k:",
+ extra_long_opts=[
+ "package_key=",
+ ], extra_option_handler=option_handler)
+ if len(args) != 2:
+ common.Usage(__doc__)
+ sys.exit(1)
+
+ SignOutput(args[0], args[1])
+
+
+if __name__ == '__main__':
+ try:
+ main(sys.argv[1:])
+ except common.ExternalError as e:
+ print()
+ print(" ERROR: %s" % e)
+ print()
+ sys.exit(1)
diff --git a/tools/releasetools/test_add_img_to_target_files.py b/tools/releasetools/test_add_img_to_target_files.py
index 9a0f78e..08c547d 100644
--- a/tools/releasetools/test_add_img_to_target_files.py
+++ b/tools/releasetools/test_add_img_to_target_files.py
@@ -319,7 +319,7 @@ class AddImagesToTargetFilesTest(unittest.TestCase):
(0xCAC3, 4),
(0xCAC1, 6)])
OPTIONS.info_dict = {
- 'system_adjusted_partition_size' : 12,
+ 'system_image_blocks' : 12,
}
name, care_map = GetCareMap('system', sparse_image)
self.assertEqual('system', name)
@@ -334,6 +334,6 @@ class AddImagesToTargetFilesTest(unittest.TestCase):
(0xCAC3, 4),
(0xCAC1, 6)])
OPTIONS.info_dict = {
- 'system_adjusted_partition_size' : -12,
+ 'system_image_blocks' : -12,
}
self.assertRaises(AssertionError, GetCareMap, 'system', sparse_image)
diff --git a/tools/releasetools/test_build_image.py b/tools/releasetools/test_build_image.py
index 161faff..daadf7c 100644
--- a/tools/releasetools/test_build_image.py
+++ b/tools/releasetools/test_build_image.py
@@ -14,10 +14,16 @@
# limitations under the License.
#
+import filecmp
+import math
+import os.path
+import random
import unittest
import common
-from build_image import CheckHeadroom, RunCommand
+from build_image import (
+ AVBCalcMinPartitionSize, BLOCK_SIZE,
+ CheckHeadroom, RunCommand, SetUpInDirAndFsConfig)
class BuildImageTest(unittest.TestCase):
@@ -26,6 +32,16 @@ class BuildImageTest(unittest.TestCase):
EXT4FS_OUTPUT = (
"Created filesystem with 2777/129024 inodes and 515099/516099 blocks")
+ def setUp(self):
+ # To test AVBCalcMinPartitionSize(), by using 200MB to 2GB image size.
+ # - 51200 = 200MB * 1024 * 1024 / 4096
+ # - 524288 = 2GB * 1024 * 1024 * 1024 / 4096
+ self._image_sizes = [BLOCK_SIZE * random.randint(51200, 524288) + offset
+ for offset in range(BLOCK_SIZE)]
+
+ def tearDown(self):
+ common.Cleanup()
+
def test_CheckHeadroom_SizeUnderLimit(self):
# Required headroom: 1000 blocks.
prop_dict = {
@@ -91,4 +107,143 @@ class BuildImageTest(unittest.TestCase):
}
self.assertFalse(CheckHeadroom(ext4fs_output, prop_dict))
- common.Cleanup()
+ def test_SetUpInDirAndFsConfig_SystemRootImageFalse(self):
+ prop_dict = {
+ 'fs_config': 'fs-config',
+ 'mount_point': 'system',
+ }
+ in_dir, fs_config = SetUpInDirAndFsConfig('/path/to/in_dir', prop_dict)
+ self.assertEqual('/path/to/in_dir', in_dir)
+ self.assertEqual('fs-config', fs_config)
+ self.assertEqual('system', prop_dict['mount_point'])
+
+ def test_SetUpInDirAndFsConfig_SystemRootImageTrue_NonSystem(self):
+ prop_dict = {
+ 'fs_config': 'fs-config',
+ 'mount_point': 'vendor',
+ 'system_root_image': 'true',
+ }
+ in_dir, fs_config = SetUpInDirAndFsConfig('/path/to/in_dir', prop_dict)
+ self.assertEqual('/path/to/in_dir', in_dir)
+ self.assertEqual('fs-config', fs_config)
+ self.assertEqual('vendor', prop_dict['mount_point'])
+
+ @staticmethod
+ def _gen_fs_config(partition):
+ fs_config = common.MakeTempFile(suffix='.txt')
+ with open(fs_config, 'w') as fs_config_fp:
+ fs_config_fp.write('fs-config-{}\n'.format(partition))
+ return fs_config
+
+ def test_SetUpInDirAndFsConfig_SystemRootImageTrue(self):
+ root_dir = common.MakeTempDir()
+ with open(os.path.join(root_dir, 'init'), 'w') as init_fp:
+ init_fp.write('init')
+
+ origin_in = common.MakeTempDir()
+ with open(os.path.join(origin_in, 'file'), 'w') as in_fp:
+ in_fp.write('system-file')
+ os.symlink('../etc', os.path.join(origin_in, 'symlink'))
+
+ fs_config_system = self._gen_fs_config('system')
+
+ prop_dict = {
+ 'fs_config': fs_config_system,
+ 'mount_point': 'system',
+ 'root_dir': root_dir,
+ 'system_root_image': 'true',
+ }
+ in_dir, fs_config = SetUpInDirAndFsConfig(origin_in, prop_dict)
+
+ self.assertTrue(filecmp.cmp(
+ os.path.join(in_dir, 'init'), os.path.join(root_dir, 'init')))
+ self.assertTrue(filecmp.cmp(
+ os.path.join(in_dir, 'system', 'file'),
+ os.path.join(origin_in, 'file')))
+ self.assertTrue(os.path.islink(os.path.join(in_dir, 'system', 'symlink')))
+
+ self.assertTrue(filecmp.cmp(fs_config_system, fs_config))
+ self.assertEqual('/', prop_dict['mount_point'])
+
+ def test_SetUpInDirAndFsConfig_SystemRootImageTrue_WithRootFsConfig(self):
+ root_dir = common.MakeTempDir()
+ with open(os.path.join(root_dir, 'init'), 'w') as init_fp:
+ init_fp.write('init')
+
+ origin_in = common.MakeTempDir()
+ with open(os.path.join(origin_in, 'file'), 'w') as in_fp:
+ in_fp.write('system-file')
+ os.symlink('../etc', os.path.join(origin_in, 'symlink'))
+
+ fs_config_system = self._gen_fs_config('system')
+ fs_config_root = self._gen_fs_config('root')
+
+ prop_dict = {
+ 'fs_config': fs_config_system,
+ 'mount_point': 'system',
+ 'root_dir': root_dir,
+ 'root_fs_config': fs_config_root,
+ 'system_root_image': 'true',
+ }
+ in_dir, fs_config = SetUpInDirAndFsConfig(origin_in, prop_dict)
+
+ self.assertTrue(filecmp.cmp(
+ os.path.join(in_dir, 'init'), os.path.join(root_dir, 'init')))
+ self.assertTrue(filecmp.cmp(
+ os.path.join(in_dir, 'system', 'file'),
+ os.path.join(origin_in, 'file')))
+ self.assertTrue(os.path.islink(os.path.join(in_dir, 'system', 'symlink')))
+
+ with open(fs_config) as fs_config_fp:
+ fs_config_data = fs_config_fp.readlines()
+ self.assertIn('fs-config-system\n', fs_config_data)
+ self.assertIn('fs-config-root\n', fs_config_data)
+ self.assertEqual('/', prop_dict['mount_point'])
+
+ def test_AVBCalcMinPartitionSize_LinearFooterSize(self):
+ """Tests with footer size which is linear to partition size."""
+ for image_size in self._image_sizes:
+ for ratio in 0.95, 0.56, 0.22:
+ expected_size = common.RoundUpTo4K(int(math.ceil(image_size / ratio)))
+ self.assertEqual(
+ expected_size,
+ AVBCalcMinPartitionSize(image_size, lambda x: int(x * ratio)))
+
+ def test_AVBCalcMinPartitionSize_SlowerGrowthFooterSize(self):
+ """Tests with footer size which grows slower than partition size."""
+
+ def _SizeCalculator(partition_size):
+ """Footer size is the power of 0.95 of partition size."""
+ # Minus footer size to return max image size.
+ return partition_size - int(math.pow(partition_size, 0.95))
+
+ for image_size in self._image_sizes:
+ min_partition_size = AVBCalcMinPartitionSize(image_size, _SizeCalculator)
+ # Checks min_partition_size can accommodate image_size.
+ self.assertGreaterEqual(
+ _SizeCalculator(min_partition_size),
+ image_size)
+ # Checks min_partition_size (round to BLOCK_SIZE) is the minimum.
+ self.assertLess(
+ _SizeCalculator(min_partition_size - BLOCK_SIZE),
+ image_size)
+
+ def test_AVBCalcMinPartitionSize_FasterGrowthFooterSize(self):
+ """Tests with footer size which grows faster than partition size."""
+
+ def _SizeCalculator(partition_size):
+ """Max image size is the power of 0.95 of partition size."""
+ # Max image size grows less than partition size, which means
+ # footer size grows faster than partition size.
+ return int(math.pow(partition_size, 0.95))
+
+ for image_size in self._image_sizes:
+ min_partition_size = AVBCalcMinPartitionSize(image_size, _SizeCalculator)
+ # Checks min_partition_size can accommodate image_size.
+ self.assertGreaterEqual(
+ _SizeCalculator(min_partition_size),
+ image_size)
+ # Checks min_partition_size (round to BLOCK_SIZE) is the minimum.
+ self.assertLess(
+ _SizeCalculator(min_partition_size - BLOCK_SIZE),
+ image_size)
diff --git a/tools/uuidgen.py b/tools/uuidgen.py
new file mode 100755
index 0000000..d3091a7
--- /dev/null
+++ b/tools/uuidgen.py
@@ -0,0 +1,29 @@
+#!/usr/bin/env python
+#
+# Copyright 2018 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.
+
+from __future__ import print_function
+import sys
+import uuid
+
+def uuidgen(name):
+ return uuid.uuid5(uuid.uuid5(uuid.NAMESPACE_URL, "android.com"), name)
+
+if __name__ == "__main__":
+ if len(sys.argv) < 2:
+ print("Usage: uuidgen.py <name>")
+ sys.exit(1)
+ name = sys.argv[1]
+ print(uuidgen(name))
diff --git a/tools/vendor_buildinfo.sh b/tools/vendor_buildinfo.sh
index c12f7cb..6590049 100755
--- a/tools/vendor_buildinfo.sh
+++ b/tools/vendor_buildinfo.sh
@@ -3,6 +3,13 @@
echo "# begin build properties"
echo "# autogenerated by vendor_buildinfo.sh"
+echo "ro.vendor.build.id=$BUILD_ID"
+echo "ro.vendor.build.version.incremental=$BUILD_NUMBER"
+echo "ro.vendor.build.version.sdk=$PLATFORM_SDK_VERSION"
+echo "ro.vendor.build.version.release=$PLATFORM_VERSION"
+echo "ro.vendor.build.type=$TARGET_BUILD_TYPE"
+echo "ro.vendor.build.tags=$BUILD_VERSION_TAGS"
+
echo "ro.product.board=$TARGET_BOOTLOADER_BOARD_NAME"
echo "ro.board.platform=$TARGET_BOARD_PLATFORM"