summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/Makefile149
-rw-r--r--core/base_rules.mk33
-rw-r--r--core/binary.mk25
-rw-r--r--core/config.mk19
-rw-r--r--core/main.mk18
-rw-r--r--core/package_internal.mk14
-rw-r--r--core/pathmap.mk2
-rw-r--r--core/product.mk5
-rw-r--r--core/soong_config.mk4
-rw-r--r--core/tasks/boot_jars_package_check.mk3
-rwxr-xr-xcore/tasks/check_boot_jars/check_boot_jars.py53
-rw-r--r--core/tasks/check_boot_jars/package_allowed_list.txt21
-rw-r--r--envsetup.sh52
-rw-r--r--target/board/BoardConfigEmuCommon.mk2
-rw-r--r--target/board/BoardConfigMainlineCommon.mk2
-rw-r--r--target/product/aosp_product.mk7
-rw-r--r--target/product/base_system.mk6
-rw-r--r--target/product/full_base.mk6
-rw-r--r--target/product/full_base_telephony.mk10
-rw-r--r--target/product/handheld_product.mk6
-rw-r--r--target/product/handheld_system.mk5
-rw-r--r--target/product/languages_default.mk6
-rw-r--r--target/product/mainline.mk7
-rw-r--r--target/product/mainline_system.mk6
-rw-r--r--target/product/media_system.mk1
-rwxr-xr-xtools/buildinfo.sh2
-rwxr-xr-xtools/post_process_props.py6
-rw-r--r--tools/releasetools/Android.bp12
-rwxr-xr-xtools/releasetools/build_image.py29
-rw-r--r--tools/releasetools/common.py69
-rw-r--r--tools/releasetools/edify_generator.py61
-rw-r--r--tools/releasetools/make_recovery_patch.py12
-rwxr-xr-xtools/releasetools/ota_from_target_files.py56
-rwxr-xr-xtools/releasetools/sign_target_files_apks.py2
-rwxr-xr-xtools/releasetools/sign_zip.py69
35 files changed, 662 insertions, 118 deletions
diff --git a/core/Makefile b/core/Makefile
index 3e748eb2dc..4a7c84cf12 100644
--- a/core/Makefile
+++ b/core/Makefile
@@ -229,6 +229,7 @@ define generate-common-build-props
PRODUCT_MANUFACTURER="$(PRODUCT_MANUFACTURER)" \
PRODUCT_MODEL="$(PRODUCT_MODEL)" \
PRODUCT_NAME="$(TARGET_PRODUCT)" \
+ $(PRODUCT_BUILD_PROP_OVERRIDES) \
$(call generate-common-build-props-with-product-vars-set,$(1),$(2))
endef
@@ -425,10 +426,12 @@ $(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTE
PRODUCT_MODEL="$(PRODUCT_SYSTEM_MODEL)" \
PRODUCT_NAME="$(PRODUCT_SYSTEM_NAME)" \
PRODUCT_DEVICE="$(PRODUCT_SYSTEM_DEVICE)" \
+ $(PRODUCT_BUILD_PROP_OVERRIDES) \
$(call generate-common-build-props-with-product-vars-set,system,$@)
$(hide) TARGET_BUILD_TYPE="$(TARGET_BUILD_VARIANT)" \
TARGET_BUILD_FLAVOR="$(TARGET_BUILD_FLAVOR)" \
TARGET_DEVICE="$(TARGET_DEVICE)" \
+ LINEAGE_DEVICE="$(TARGET_DEVICE)" \
PRODUCT_DEFAULT_LOCALE="$(call get-default-product-locale,$(PRODUCT_LOCALES))" \
PRODUCT_DEFAULT_WIFI_CHANNELS="$(PRODUCT_DEFAULT_WIFI_CHANNELS)" \
PRIVATE_BUILD_DESC="$(PRIVATE_BUILD_DESC)" \
@@ -456,6 +459,7 @@ $(intermediate_system_build_prop): $(BUILDINFO_SH) $(BUILDINFO_COMMON_SH) $(INTE
TARGET_CPU_ABI_LIST_64_BIT="$(TARGET_CPU_ABI_LIST_64_BIT)" \
TARGET_CPU_ABI="$(TARGET_CPU_ABI)" \
TARGET_CPU_ABI2="$(TARGET_CPU_ABI2)" \
+ $(PRODUCT_BUILD_PROP_OVERRIDES) \
bash $(BUILDINFO_SH) >> $@
$(hide) $(foreach file,$(system_prop_file), \
if [ -f "$(file)" ]; then \
@@ -1154,6 +1158,10 @@ ifeq ($(BOARD_RAMDISK_USE_LZ4),true)
COMPRESSION_COMMAND_DEPS := $(LZ4)
COMPRESSION_COMMAND := $(LZ4) -l -12 --favor-decSpeed
RAMDISK_EXT := .lz4
+else ifeq ($(BOARD_RAMDISK_USE_XZ),true)
+COMPRESSION_COMMAND_DEPS := $(XZ)
+COMPRESSION_COMMAND := $(XZ) -f -c --check=crc32 --lzma2=dict=32MiB
+RAMDISK_EXT := .xz
else
COMPRESSION_COMMAND_DEPS := $(MINIGZIP)
COMPRESSION_COMMAND := $(MINIGZIP)
@@ -1241,10 +1249,19 @@ INTERNAL_MKBOOTIMG_VERSION_ARGS := \
--os_version $(PLATFORM_VERSION_LAST_STABLE) \
--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
+
# Define these only if we are building boot
ifdef BUILDING_BOOT_IMAGE
INSTALLED_BOOTIMAGE_TARGET := $(BUILT_BOOTIMAGE_TARGET)
+ifndef BOARD_CUSTOM_BOOTIMG_MK
+
ifeq ($(TARGET_BOOTIMAGE_USE_EXT2),true)
$(error TARGET_BOOTIMAGE_USE_EXT2 is not supported anymore)
@@ -1288,7 +1305,7 @@ bootimage-nodeps: $(MKBOOTIMG) $(BOOT_SIGNER)
else ifeq (true,$(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 $(PRODUCT_VBOOT_SIGNING_KEY).vbpubk $(PRODUCT_VBOOT_SIGNING_KEY).vbprivk $(PRODUCT_VBOOT_SIGNING_SUBKEY).vbprivk $@.keyblock $@
@@ -1303,7 +1320,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))
@@ -1315,6 +1332,7 @@ bootimage-nodeps: $(MKBOOTIMG)
$(hide) $(call assert-max-image-size,$(INSTALLED_BOOTIMAGE_TARGET),$(BOARD_BOOTIMAGE_PARTITION_SIZE))
endif # TARGET_BOOTIMAGE_USE_EXT2
+endif # BOARD_CUSTOM_BOOTIMG_MK not defined
endif # BUILDING_BOOT_IMAGE
else # TARGET_NO_KERNEL == "true"
@@ -1882,6 +1900,8 @@ ifdef BUILDING_RECOVERY_IMAGE
INTERNAL_RECOVERYIMAGE_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \
$(ALL_DEFAULT_INSTALLED_MODULES))
+INTERNAL_RECOVERYIMAGE_FILES += $(filter $(PRODUCT_OUT)/install/%, \
+ $(ALL_DEFAULT_INSTALLED_MODULES))
INSTALLED_FILES_FILE_RECOVERY := $(PRODUCT_OUT)/installed-files-recovery.txt
INSTALLED_FILES_JSON_RECOVERY := $(INSTALLED_FILES_FILE_RECOVERY:.txt=.json)
@@ -1924,8 +1944,12 @@ 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_resources_common := $(call include-path-for, recovery)/res
+ifneq (,$(TARGET_RECOVERY_DENSITY))
+recovery_density := $(filter %dpi,$(TARGET_RECOVERY_DENSITY))
+else
# Set recovery_density to a density bucket based on TARGET_SCREEN_DENSITY, PRODUCT_AAPT_PREF_CONFIG,
# or mdpi, in order of preference. We support both specific buckets (e.g. xdpi) and numbers,
# which get remapped to a bucket.
@@ -1941,6 +1965,7 @@ recovery_density := $(strip \
$(if $(filter $(shell echo $$(($(recovery_density_value) >= 280))),1),xhdpi),\
$(if $(filter $(shell echo $$(($(recovery_density_value) >= 200))),1),hdpi,mdpi)))
endif
+endif
ifneq (,$(wildcard $(recovery_resources_common)-$(recovery_density)))
recovery_resources_common := $(recovery_resources_common)-$(recovery_density)
@@ -1984,23 +2009,12 @@ RECOVERY_ERASING_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/erasing_te
RECOVERY_ERROR_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/error_text.png
RECOVERY_NO_COMMAND_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/no_command_text.png
-RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/cancel_wipe_data_text.png
-RECOVERY_FACTORY_DATA_RESET_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/factory_data_reset_text.png
-RECOVERY_TRY_AGAIN_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/try_again_text.png
-RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_confirmation_text.png
-RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE := $(dir $(RECOVERY_INSTALLING_TEXT_FILE))/wipe_data_menu_header_text.png
-
generated_recovery_text_files := \
$(RECOVERY_INSTALLING_TEXT_FILE) \
$(RECOVERY_INSTALLING_SECURITY_TEXT_FILE) \
$(RECOVERY_ERASING_TEXT_FILE) \
$(RECOVERY_ERROR_TEXT_FILE) \
$(RECOVERY_NO_COMMAND_TEXT_FILE) \
- $(RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE) \
- $(RECOVERY_FACTORY_DATA_RESET_TEXT_FILE) \
- $(RECOVERY_TRY_AGAIN_TEXT_FILE) \
- $(RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE) \
- $(RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE)
resource_dir := $(call include-path-for, recovery)/tools/recovery_l10n/res/
image_generator_jar := $(HOST_OUT_JAVA_LIBRARIES)/RecoveryImageGenerator.jar
@@ -2017,12 +2031,6 @@ $(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST := \
recovery_erasing \
recovery_error \
recovery_no_command
-$(RECOVERY_INSTALLING_TEXT_FILE): PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST := \
- recovery_cancel_wipe_data \
- recovery_factory_data_reset \
- recovery_try_again \
- recovery_wipe_data_menu_header \
- recovery_wipe_data_confirmation
$(RECOVERY_INSTALLING_TEXT_FILE): .KATI_IMPLICIT_OUTPUTS := $(filter-out $(RECOVERY_INSTALLING_TEXT_FILE),$(generated_recovery_text_files))
$(RECOVERY_INSTALLING_TEXT_FILE): $(image_generator_jar) $(resource_dir) $(recovery_noto-fonts_dep) $(recovery_roboto-fonts_dep) $(zopflipng)
# Prepares the font directory.
@@ -2031,7 +2039,7 @@ $(RECOVERY_INSTALLING_TEXT_FILE): $(image_generator_jar) $(resource_dir) $(recov
$(foreach filename,$(PRIVATE_SOURCE_FONTS), cp $(filename) $(PRIVATE_RECOVERY_FONT_FILES_DIR) &&) true
@rm -rf $(dir $@)
@mkdir -p $(dir $@)
- $(foreach text_name,$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST) $(PRIVATE_RECOVERY_WIPE_DATA_TEXT_LIST), \
+ $(foreach text_name,$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST), \
$(eval output_file := $(dir $@)/$(patsubst recovery_%,%_text.png,$(text_name))) \
$(eval center_alignment := $(if $(filter $(text_name),$(PRIVATE_RECOVERY_BACKGROUND_TEXT_LIST)), --center_alignment)) \
java -jar $(PRIVATE_IMAGE_GENERATOR_JAR) \
@@ -2047,13 +2055,18 @@ RECOVERY_INSTALLING_SECURITY_TEXT_FILE :=
RECOVERY_ERASING_TEXT_FILE :=
RECOVERY_ERROR_TEXT_FILE :=
RECOVERY_NO_COMMAND_TEXT_FILE :=
-RECOVERY_CANCEL_WIPE_DATA_TEXT_FILE :=
-RECOVERY_FACTORY_DATA_RESET_TEXT_FILE :=
-RECOVERY_TRY_AGAIN_TEXT_FILE :=
-RECOVERY_WIPE_DATA_CONFIRMATION_TEXT_FILE :=
-RECOVERY_WIPE_DATA_MENU_HEADER_TEXT_FILE :=
endif # TARGET_RECOVERY_UI_SCREEN_WIDTH
+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
@@ -2093,7 +2106,8 @@ endif
# (BOARD_INCLUDE_RECOVERY_ACPIO = true).
ifeq (,$(filter true, $(BOARD_USES_FULL_RECOVERY_IMAGE) $(BOARD_USES_RECOVERY_AS_BOOT) \
- $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
+ $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO) \
+ $(BOARD_RAMDISK_USE_LZ4) $(BOARD_RAMDISK_USE_XZ)))
# Named '.dat' so we don't attempt to use imgdiff for patching it.
RECOVERY_RESOURCE_ZIP := $(TARGET_OUT_VENDOR)/etc/recovery-resource.dat
ALL_DEFAULT_INSTALLED_MODULES += $(RECOVERY_RESOURCE_ZIP)
@@ -2105,6 +2119,7 @@ INSTALLED_RECOVERY_BUILD_PROP_TARGET := $(TARGET_RECOVERY_ROOT_OUT)/prop.default
$(INSTALLED_RECOVERY_BUILD_PROP_TARGET): PRIVATE_RECOVERY_UI_PROPERTIES := \
TARGET_RECOVERY_UI_ANIMATION_FPS:animation_fps \
+ TARGET_RECOVERY_UI_BLANK_UNBLANK_ON_INIT:blank_unblank_on_init \
TARGET_RECOVERY_UI_MARGIN_HEIGHT:margin_height \
TARGET_RECOVERY_UI_MARGIN_WIDTH:margin_width \
TARGET_RECOVERY_UI_MENU_UNUSABLE_ROWS:menu_unusable_rows \
@@ -2187,14 +2202,19 @@ ifndef BOARD_RECOVERY_MKBOOTIMG_ARGS
BOARD_RECOVERY_MKBOOTIMG_ARGS := $(BOARD_MKBOOTIMG_ARGS)
endif
-$(recovery_ramdisk): $(MKBOOTFS) $(COMPRESSION_COMMAND_DEPS) \
+ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
+ INTERNAL_RECOVERYIMAGE_ARGS += --dt $(INSTALLED_DTIMAGE_TARGET)
+ RECOVERYIMAGE_EXTRA_DEPS := $(INSTALLED_DTIMAGE_TARGET)
+endif
+
+$(recovery_uncompressed_ramdisk): $(MKBOOTFS) \
$(INTERNAL_ROOT_FILES) \
$(INSTALLED_RAMDISK_TARGET) \
$(INTERNAL_RECOVERYIMAGE_FILES) \
$(recovery_sepolicy) \
$(INSTALLED_2NDBOOTLOADER_TARGET) \
$(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \
- $(recovery_resource_deps) \
+ $(recovery_resource_deps) $(recovery_root_deps) \
$(recovery_fstab)
# Making recovery image
mkdir -p $(TARGET_RECOVERY_OUT)
@@ -2214,15 +2234,23 @@ $(recovery_ramdisk): $(MKBOOTFS) $(COMPRESSION_COMMAND_DEPS) \
$(foreach recovery_text_file,$(generated_recovery_text_files), \
cp -rf $(recovery_text_file) $(TARGET_RECOVERY_ROOT_OUT)/res/images/ &&) true
cp -f $(recovery_font) $(TARGET_RECOVERY_ROOT_OUT)/res/images/font.png
+ $(foreach item,$(recovery_root_private), \
+ cp -rf $(item) $(TARGET_RECOVERY_OUT)/;)
$(foreach item,$(TARGET_PRIVATE_RES_DIRS), \
- cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline))
+ cp -rf $(item) $(TARGET_RECOVERY_ROOT_OUT)/$(newline);)
$(foreach item,$(recovery_fstab), \
- cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.fstab)
+ cp -f $(item) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.fstab;)
$(if $(strip $(recovery_wipe)), \
cp -f $(recovery_wipe) $(TARGET_RECOVERY_ROOT_OUT)/system/etc/recovery.wipe)
ln -sf prop.default $(TARGET_RECOVERY_ROOT_OUT)/default.prop
$(BOARD_RECOVERY_IMAGE_PREPARE)
- $(MKBOOTFS) -d $(TARGET_OUT) $(TARGET_RECOVERY_ROOT_OUT) | $(COMPRESSION_COMMAND) > $(recovery_ramdisk)
+ @echo ----- Making uncompressed recovery ramdisk ------
+ $(MKBOOTFS) $(TARGET_RECOVERY_ROOT_OUT) > $@
+
+$(recovery_ramdisk): $(recovery_uncompressed_ramdisk) $(COMPRESSION_COMMAND_DEPS)
+ @echo ----- Making compressed recovery ramdisk ------
+ $(COMPRESSION_COMMAND) < $(recovery_uncompressed_ramdisk) > $@
+
# $(1): output file
# $(2): kernel file
@@ -2281,8 +2309,12 @@ $(INSTALLED_BOOTIMAGE_TARGET): $(recoveryimage-deps)
$(call build-recoveryimage-target, $@, $(PRODUCT_OUT)/$(subst .img,,$(subst boot,kernel,$(notdir $@))))
endif # BOARD_USES_RECOVERY_AS_BOOT
-$(INSTALLED_RECOVERYIMAGE_TARGET): $(recoveryimage-deps)
+ifndef BOARD_CUSTOM_BOOTIMG_MK
+$(INSTALLED_RECOVERYIMAGE_TARGET): $(recoveryimage-deps) $(RECOVERYIMAGE_EXTRA_DEPS)
$(call build-recoveryimage-target, $@, $(recovery_kernel))
+else
+INTERNAL_RECOVERYIMAGE_ARGS += --kernel $(recovery_kernel)
+endif # BOARD_CUSTOM_BOOTIMG_MK
ifdef RECOVERY_RESOURCE_ZIP
$(RECOVERY_RESOURCE_ZIP): $(INSTALLED_RECOVERYIMAGE_TARGET) | $(ZIPTIME)
@@ -2311,6 +2343,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
+
+
ifneq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true)
# -----------------------------------------------------------------
# the debug ramdisk, which is the original ramdisk plus additional
@@ -2747,7 +2784,8 @@ INSTALLED_SYSTEMIMAGE := $(INSTALLED_SYSTEMIMAGE_TARGET)
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) $(BOARD_INCLUDE_RECOVERY_ACPIO)))
+ifneq (,$(filter true, $(BOARD_BUILD_SYSTEM_ROOT_IMAGE) $(BOARD_INCLUDE_RECOVERY_DTBO) $(BOARD_INCLUDE_RECOVERY_ACPIO) \
+ $(BOARD_RAMDISK_USE_LZ4) $(BOARD_RAMDISK_USE_XZ)))
diff_tool := $(HOST_OUT_EXECUTABLES)/bsdiff
else
diff_tool := $(HOST_OUT_EXECUTABLES)/imgdiff
@@ -4049,10 +4087,6 @@ endif
# -----------------------------------------------------------------
# host tools needed to build dist and OTA packages
-ifeq ($(BUILD_OS),darwin)
- build_ota_package := false
- build_otatools_package := false
-else
# Set build_ota_package, and allow opt-out below.
build_ota_package := true
ifeq ($(TARGET_SKIP_OTA_PACKAGE),true)
@@ -4084,7 +4118,6 @@ else
ifeq ($(TARGET_SKIP_OTATOOLS_PACKAGE),true)
build_otatools_package := false
endif
-endif
ifeq ($(build_otatools_package),true)
@@ -4261,6 +4294,9 @@ endif
ifeq ($(BOARD_RAMDISK_USE_LZ4),true)
echo "lz4_ramdisks=true" >> $@
endif
+ifeq ($(BOARD_RAMDISK_USE_XZ),true)
+ echo "xz_ramdisks=true" >> $@
+endif
ifneq ($(INSTALLED_VENDOR_BOOTIMAGE_TARGET),)
echo "vendor_boot=true" >> $@
echo "vendor_boot_size=$(BOARD_VENDOR_BOOTIMAGE_PARTITION_SIZE)" >> $@
@@ -4291,6 +4327,7 @@ endif
$(hide) echo 'mkbootimg_args=$(BOARD_MKBOOTIMG_ARGS)' >> $@
$(hide) echo 'recovery_mkbootimg_args=$(BOARD_RECOVERY_MKBOOTIMG_ARGS)' >> $@
$(hide) echo 'mkbootimg_version_args=$(INTERNAL_MKBOOTIMG_VERSION_ARGS)' >> $@
+ $(hide) echo "use_set_metadata=1" >> $@
$(hide) echo "multistage_support=1" >> $@
$(hide) echo "blockimgdiff_versions=3,4" >> $@
ifeq ($(PRODUCT_BUILD_GENERIC_OTA_PACKAGE),true)
@@ -4307,6 +4344,9 @@ endif
ifeq ($(BOARD_USES_FULL_RECOVERY_IMAGE),true)
$(hide) echo "full_recovery_image=true" >> $@
endif
+ifdef BUILDING_VENDOR_IMAGE
+ $(hide) echo "board_builds_vendorimage=true" >> $@
+endif
ifdef BOARD_USES_VENDORIMAGE
$(hide) echo "board_uses_vendorimage=true" >> $@
endif
@@ -4404,6 +4444,9 @@ endif
ifdef DEVICE_MANIFEST_FILE
$(hide) echo "vintf_include_empty_vendor_sku=true" >> $@
endif
+ifneq ($(TARGET_OTA_ASSERT_DEVICE),)
+ $(hide) echo "ota_override_device=$(TARGET_OTA_ASSERT_DEVICE)" >> $@
+endif
.PHONY: misc_info
misc_info: $(INSTALLED_MISC_INFO_TARGET)
@@ -4521,13 +4564,13 @@ define dump-dynamic-partitions-info
$(foreach device,$(BOARD_SUPER_PARTITION_BLOCK_DEVICES), \
echo "super_$(device)_device_size=$(BOARD_SUPER_PARTITION_$(call to-upper,$(device))_DEVICE_SIZE)" >> $(1);)
$(if $(BOARD_SUPER_PARTITION_PARTITION_LIST), \
- echo "dynamic_partition_list=$(call filter-out-missing-vendor, $(BOARD_SUPER_PARTITION_PARTITION_LIST))" >> $(1))
+ echo "dynamic_partition_list=$(call filter-out-missing-vendor,$(BOARD_SUPER_PARTITION_PARTITION_LIST))" >> $(1))
$(if $(BOARD_SUPER_PARTITION_GROUPS),
echo "super_partition_groups=$(BOARD_SUPER_PARTITION_GROUPS)" >> $(1))
$(foreach group,$(BOARD_SUPER_PARTITION_GROUPS), \
echo "super_$(group)_group_size=$(BOARD_$(call to-upper,$(group))_SIZE)" >> $(1); \
$(if $(BOARD_$(call to-upper,$(group))_PARTITION_LIST), \
- echo "super_$(group)_partition_list=$(call filter-out-missing-vendor, $(BOARD_$(call to-upper,$(group))_PARTITION_LIST))" >> $(1);))
+ echo "super_$(group)_partition_list=$(call filter-out-missing-vendor,$(BOARD_$(call to-upper,$(group))_PARTITION_LIST))" >> $(1);))
$(if $(filter true,$(TARGET_USERIMAGES_SPARSE_EXT_DISABLED)), \
echo "build_non_sparse_super_partition=true" >> $(1))
$(if $(filter true,$(TARGET_USERIMAGES_SPARSE_F2FS_DISABLED)), \
@@ -4614,6 +4657,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
cp $(INSTALLED_KERNEL_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/
endif
@@ -4645,6 +4691,9 @@ endif
ifdef BOARD_KERNEL_PAGESIZE
echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/$(PRIVATE_RECOVERY_OUT)/pagesize
endif
+ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
+ $(hide) $(ACP) $(INSTALLED_DTIMAGE_TARGET) $(zip_root)/$(PRIVATE_RECOVERY_OUT)/dt
+endif
endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET not defined
endif # INSTALLED_RECOVERYIMAGE_TARGET defined or BOARD_USES_RECOVERY_AS_BOOT is true
@# Components of the boot image
@@ -4675,6 +4724,9 @@ endif
ifdef BOARD_KERNEL_PAGESIZE
echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/BOOT/pagesize
endif
+ifeq ($(strip $(BOARD_KERNEL_SEPARATED_DT)),true)
+ $(hide) $(ACP) $(INSTALLED_DTIMAGE_TARGET) $(zip_root)/BOOT/dt
+endif
else # INSTALLED_VENDOR_BOOTIMAGE_TARGET defined
echo "$(GENERIC_KERNEL_CMDLINE)" > $(zip_root)/BOOT/cmdline
endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET defined
@@ -4697,6 +4749,12 @@ ifdef BOARD_KERNEL_PAGESIZE
endif
echo "$(INTERNAL_KERNEL_CMDLINE)" > $(zip_root)/VENDOR_BOOT/vendor_cmdline
endif # INSTALLED_VENDOR_BOOTIMAGE_TARGET
+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 BUILDING_SYSTEM_IMAGE
@# Contents of the system image
$(hide) $(call package_files-copy-root, \
@@ -4918,6 +4976,7 @@ PATH=$(INTERNAL_USERIMAGES_BINARY_PATHS):$$PATH \
--verbose \
--extracted_input_target_files $(patsubst %.zip,%,$(BUILT_TARGET_FILES_PACKAGE)) \
--path $(HOST_OUT) \
+ --backup=$(backuptool) \
$(if $(OEM_OTA_CONFIG), --oem_settings $(OEM_OTA_CONFIG)) \
$(2) \
$(BUILT_TARGET_FILES_PACKAGE) $(1)
@@ -4932,6 +4991,16 @@ name := $(name)-ota-$(FILE_NAME_TAG)
INTERNAL_OTA_PACKAGE_TARGET := $(PRODUCT_OUT)/$(name).zip
INTERNAL_OTA_METADATA := $(PRODUCT_OUT)/ota_metadata
+ifeq ($(TARGET_BUILD_VARIANT),user)
+ $(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): KEY_CERT_PAIR := $(DEFAULT_KEY_CERT_PAIR)
$(INTERNAL_OTA_PACKAGE_TARGET): .KATI_IMPLICIT_OUTPUTS := $(INTERNAL_OTA_METADATA)
$(INTERNAL_OTA_PACKAGE_TARGET): $(BUILT_TARGET_FILES_PACKAGE) $(OTA_FROM_TARGET_FILES)
diff --git a/core/base_rules.mk b/core/base_rules.mk
index e608ee7e14..7a5ccb405f 100644
--- a/core/base_rules.mk
+++ b/core/base_rules.mk
@@ -464,12 +464,33 @@ endif
# Set up phony targets that covers all modules under the given paths.
# This allows us to build everything in given paths by running mmma/mma.
-my_path_components := $(subst /,$(space),$(LOCAL_PATH))
-my_path_prefix := MODULES-IN
-$(foreach c, $(my_path_components),\
- $(eval my_path_prefix := $(my_path_prefix)-$(c))\
- $(eval .PHONY : $(my_path_prefix))\
- $(eval $(my_path_prefix) : $(my_all_targets)))
+define my_path_comp
+parent := $(patsubst %/,%,$(dir $(1)))
+parent_target := MODULES-IN-$$(subst /,-,$$(parent))
+.PHONY: $$(parent_target)
+$$(parent_target): $(2)
+ifndef $$(parent_target)
+ $$(parent_target) := true
+ ifneq (,$$(findstring /,$$(parent)))
+ $$(eval $$(call my_path_comp,$$(parent),$$(parent_target)))
+ endif
+endif
+endef
+
+_local_path := $(patsubst %/,%,$(LOCAL_PATH))
+_local_path_target := MODULES-IN-$(subst /,-,$(_local_path))
+
+.PHONY: $(_local_path_target)
+$(_local_path_target): $(my_register_name)
+
+ifndef $(_local_path_target)
+ $(_local_path_target) := true
+ $(eval $(call my_path_comp,$(_local_path),$(_local_path_target)))
+endif
+
+_local_path :=
+_local_path_target :=
+my_path_comp :=
###########################################################
## Module installation rule
diff --git a/core/binary.mk b/core/binary.mk
index db476c0851..99250c0f1b 100644
--- a/core/binary.mk
+++ b/core/binary.mk
@@ -34,6 +34,26 @@ 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
+
+# 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.
@@ -1355,6 +1375,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/config.mk b/core/config.mk
index 90eea5ba99..c9efa116fc 100644
--- a/core/config.mk
+++ b/core/config.mk
@@ -294,6 +294,11 @@ 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)
+-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
@@ -969,8 +974,7 @@ $(error BOARD_SUPER_PARTITION_PARTITION_LIST should not be defined, but computed
BOARD_SUPER_PARTITION_GROUPS and BOARD_*_PARTITION_LIST)
endif
BOARD_SUPER_PARTITION_PARTITION_LIST := \
- $(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)), \
- $(BOARD_$(group)_PARTITION_LIST))
+ $(foreach group,$(call to-upper,$(BOARD_SUPER_PARTITION_GROUPS)),$(BOARD_$(group)_PARTITION_LIST))
.KATI_READONLY := BOARD_SUPER_PARTITION_PARTITION_LIST
ifneq ($(BOARD_SUPER_PARTITION_SIZE),)
@@ -1229,6 +1233,14 @@ dont_bother_goals := out \
vbmetaimage-nodeps \
product-graph dump-products
+ifneq ($(LINEAGE_BUILD),)
+ifneq ($(wildcard device/lineage/sepolicy/common/sepolicy.mk),)
+## 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
+endif
+
ifeq ($(CALLED_FROM_SETUP),true)
include $(BUILD_SYSTEM)/ninja_config.mk
include $(BUILD_SYSTEM)/soong_config.mk
@@ -1239,4 +1251,7 @@ endif
DEFAULT_DATA_OUT_MODULES := ltp $(ltp_packages) $(kselftest_modules)
.KATI_READONLY := DEFAULT_DATA_OUT_MODULES
+# Include any vendor specific config.mk file
+-include vendor/*/build/core/config.mk
+
include $(BUILD_SYSTEM)/dumpvar.mk
diff --git a/core/main.mk b/core/main.mk
index 357c70da33..5b39e8da41 100644
--- a/core/main.mk
+++ b/core/main.mk
@@ -362,6 +362,10 @@ BUILD_WITHOUT_PV := true
ADDITIONAL_BUILD_PROPERTIES += net.bt.name=Android
# ------------------------------------------------------------
+# 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.
@@ -1108,13 +1112,23 @@ endef
# $(2): heading to print on failure
define maybe-print-list-and-error
$(if $(strip $(1)), \
+ $(call maybe-print-list-and-warn,$(1),$(2)) \
+ $(error Build failed) \
+)
+endef
+
+# Warns if the given list is non-empty, and prints it entries (stripping PRODUCT_OUT).
+# $(1): list of files to print
+# $(2): heading to print
+define maybe-print-list-and-warn
+$(if $(strip $(1)), \
$(warning $(2)) \
$(info Offending entries:) \
$(foreach e,$(sort $(1)),$(info $(patsubst $(PRODUCT_OUT)/%,%,$(e)))) \
- $(error Build failed) \
)
endef
+
ifdef FULL_BUILD
ifneq (true,$(ALLOW_MISSING_DEPENDENCIES))
# Check to ensure that all modules in PRODUCT_PACKAGES exist (opt in per product)
@@ -1213,7 +1227,7 @@ $(call dist-for-goals,droidcore,$(CERTIFICATE_VIOLATION_MODULES_FILENAME))
$(makefile) produces files outside its artifact path requirement. \
Allowed paths are $(subst $(space),$(comma)$(space),$(addsuffix *,$(requirements)))) \
$(eval unused_allowed := $(filter-out $(files),$(allowed_patterns))) \
- $(call maybe-print-list-and-error,$(unused_allowed),$(makefile) includes redundant allowed entries in its artifact path requirement.) \
+ $(call maybe-print-list-and-warn,$(unused_allowed),$(makefile) includes redundant allowed entries in its artifact path requirement.) \
$(eval ### Optionally verify that nothing else produces files inside this artifact path requirement.) \
$(eval extra_files := $(filter-out $(files) $(HOST_OUT)/%,$(product_target_FILES))) \
$(eval files_in_requirement := $(filter $(path_patterns),$(extra_files))) \
diff --git a/core/package_internal.mk b/core/package_internal.mk
index 692ff49fcc..876f28a081 100644
--- a/core/package_internal.mk
+++ b/core/package_internal.mk
@@ -406,6 +406,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
@@ -418,6 +426,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 af33f5de35..e622cee02c 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 f8ba5936f8..13a182a023 100644
--- a/core/product.mk
+++ b/core/product.mk
@@ -114,6 +114,9 @@ _product_single_value_vars :=
# Variables that are lists of values.
_product_list_vars :=
+# Add support to override build.prop values
+_product_list_vars += PRODUCT_BUILD_PROP_OVERRIDES
+
_product_single_value_vars += PRODUCT_NAME
_product_single_value_vars += PRODUCT_MODEL
@@ -553,9 +556,11 @@ _readonly_late_variables := \
# Modified internally in the build system
_readonly_late_variables += \
+ PRODUCT_CFI_INCLUDE_PATHS \
PRODUCT_COPY_FILES \
PRODUCT_DEX_PREOPT_NEVER_ALLOW_STRIPPING \
PRODUCT_DEX_PREOPT_BOOT_FLAGS \
+ PRODUCT_SOONG_NAMESPACES
_readonly_early_variables := $(filter-out $(_readonly_late_variables),$(_product_var_list))
diff --git a/core/soong_config.mk b/core/soong_config.mk
index 51b7e384a4..7c6410a999 100644
--- a/core/soong_config.mk
+++ b/core/soong_config.mk
@@ -128,6 +128,7 @@ $(call add_json_bool, ArtUseReadBarrier, $(call invert_bool,$(fi
$(call add_json_bool, Binder32bit, $(BINDER32BIT))
$(call add_json_str, BtConfigIncludeDir, $(BOARD_BLUETOOTH_BDROID_BUILDCFG_INCLUDE_DIR))
$(call add_json_list, DeviceKernelHeaders, $(TARGET_PROJECT_SYSTEM_INCLUDES))
+$(call add_json_str, TargetSpecificHeaderPath, $(TARGET_SPECIFIC_HEADER_PATH))
$(call add_json_bool, DevicePrefer32BitApps, $(filter true,$(TARGET_PREFER_32_BIT_APPS)))
$(call add_json_bool, DevicePrefer32BitExecutables, $(filter true,$(TARGET_PREFER_32_BIT_EXECUTABLES)))
$(call add_json_str, DeviceVndkVersion, $(BOARD_VNDK_VERSION))
@@ -138,6 +139,9 @@ $(call add_json_bool, BoardVndkRuntimeDisable, $(BOARD_VNDK_RUNTIME_DI
$(call add_json_list, DeviceSystemSdkVersions, $(BOARD_SYSTEMSDK_VERSIONS))
$(call add_json_list, Platform_systemsdk_versions, $(PLATFORM_SYSTEMSDK_VERSIONS))
$(call add_json_bool, Malloc_not_svelte, $(call invert_bool,$(filter true,$(MALLOC_SVELTE))))
+$(call add_json_bool, Malloc_not_svelte_libc32, $(if $(MALLOC_SVELTE_FOR_LIBC32),\
+ $(call invert_bool,$(filter true,$(MALLOC_SVELTE_FOR_LIBC32))),\
+ $(call invert_bool,$(filter true,$(MALLOC_SVELTE)))))
$(call add_json_str, Override_rs_driver, $(OVERRIDE_RS_DRIVER))
$(call add_json_bool, UncompressPrivAppDex, $(call invert_bool,$(filter true,$(DONT_UNCOMPRESS_PRIV_APPS_DEXS))))
diff --git a/core/tasks/boot_jars_package_check.mk b/core/tasks/boot_jars_package_check.mk
index 825bbc37d7..79dc14a775 100644
--- a/core/tasks/boot_jars_package_check.mk
+++ b/core/tasks/boot_jars_package_check.mk
@@ -41,10 +41,11 @@ allowed_file := build/make/core/tasks/check_boot_jars/package_allowed_list.txt
$(stamp): PRIVATE_BOOT_JARS := $(built_boot_jars)
$(stamp): PRIVATE_SCRIPT := $(script)
+$(stamp): PRIVATE_DEXDUMP := $(DEXDUMP)
$(stamp): PRIVATE_ALLOWED := $(allowed_file)
$(stamp) : $(built_boot_jars) $(script) $(allowed_file)
@echo "Check package name for $(PRIVATE_BOOT_JARS)"
- $(hide) $(PRIVATE_SCRIPT) $(PRIVATE_ALLOWED) $(PRIVATE_BOOT_JARS)
+ $(hide) $(PRIVATE_SCRIPT) $(PRIVATE_DEXDUMP) $(PRIVATE_ALLOWED) $(PRIVATE_BOOT_JARS)
$(hide) mkdir -p $(dir $@) && touch $@
.PHONY: check-boot-jars
diff --git a/core/tasks/check_boot_jars/check_boot_jars.py b/core/tasks/check_boot_jars/check_boot_jars.py
index cf4ef27825..b8a92c64eb 100755
--- a/core/tasks/check_boot_jars/check_boot_jars.py
+++ b/core/tasks/check_boot_jars/check_boot_jars.py
@@ -3,13 +3,14 @@
"""
Check boot jars.
-Usage: check_boot_jars.py <package_allow_list_file> <jar1> <jar2> ...
+Usage: check_boot_jars.py <dexdump_path> <package_allow_list_file> <jar1> <jar2> ...
"""
import logging
import os.path
import re
import subprocess
import sys
+import xml.etree.ElementTree
# The compiled allow list RE.
@@ -38,8 +39,45 @@ def LoadAllowList(filename):
return False
return True
+def CheckDexJar(dexdump_path, allow_list_path, jar):
+ """Check a dex jar file.
+ """
+ # Use dexdump to generate the XML representation of the dex jar file.
+ p = subprocess.Popen(args='%s -l xml %s' % (dexdump_path, jar),
+ stdout=subprocess.PIPE, shell=True)
+ stdout, _ = p.communicate()
+ if p.returncode != 0:
+ return False
+
+ packages = 0
+ try:
+ # TODO(b/172063475) - improve performance
+ root = xml.etree.ElementTree.fromstring(stdout)
+ except xml.etree.ElementTree.ParseError as e:
+ print >> sys.stderr, 'Error processing jar %s - %s' % (jar, e)
+ print >> sys.stderr, stdout
+ return False
+ for package_elt in root.iterfind('package'):
+ packages += 1
+ package_name = package_elt.get('name')
+ if not package_name or not allow_list_re.match(package_name):
+ # Report the name of a class in the package as it is easier to navigate to
+ # the source of a concrete class than to a package which is often required
+ # to investigate this failure.
+ class_name = package_elt[0].get('name')
+ if package_name != "":
+ class_name = package_name + "." + class_name
+ print >> sys.stderr, ('Error: %s contains class file %s, whose package name "%s" is empty or'
+ ' not in the allow list %s of packages allowed on the bootclasspath.'
+ % (jar, class_name, package_name, allow_list_path))
+ return False
+ if packages == 0:
+ print >> sys.stderr, ('Error: %s does not contain any packages.' % jar)
+ return False
+ return True
+
-def CheckJar(allow_list_path, jar):
+def CheckJar(dexdump_path, allow_list_path, jar):
"""Check a jar file.
"""
# Get the list of files inside the jar file.
@@ -49,6 +87,8 @@ def CheckJar(allow_list_path, jar):
if p.returncode != 0:
return False
items = stdout.split()
+ if 'classes.dex' in items:
+ return CheckDexJar(dexdump_path, allow_list_path, jar)
classes = 0
for f in items:
if f.endswith('.class'):
@@ -67,17 +107,18 @@ def CheckJar(allow_list_path, jar):
def main(argv):
- if len(argv) < 2:
+ if len(argv) < 3:
print __doc__
return 1
- allow_list_path = argv[0]
+ dexdump_path = argv[0]
+ allow_list_path = argv[1]
if not LoadAllowList(allow_list_path):
return 1
passed = True
- for jar in argv[1:]:
- if not CheckJar(allow_list_path, jar):
+ for jar in argv[2:]:
+ if not CheckJar(dexdump_path, allow_list_path, jar):
passed = False
if not passed:
return 1
diff --git a/core/tasks/check_boot_jars/package_allowed_list.txt b/core/tasks/check_boot_jars/package_allowed_list.txt
index 18ab427b51..a571790b11 100644
--- a/core/tasks/check_boot_jars/package_allowed_list.txt
+++ b/core/tasks/check_boot_jars/package_allowed_list.txt
@@ -246,3 +246,24 @@ com\.google\.i18n\.phonenumbers
# Packages used for Android in Chrome OS
org\.chromium\.arc
org\.chromium\.arc\..*
+
+###################################################
+# LineageOS
+lineageos\.platform
+org\.lineageos\.platform\.internal
+
+###################################################
+# QCOM WFD
+com\.qualcomm\.wfd
+com\.qualcomm\.wfd\..*
+
+###################################################
+# CodeAurora IMS functionality needed by frameworks/opt/telephony
+# as part of "ims-ext-common"
+org\.codeaurora\.ims.*
+# telephony-ext:
+org\.codeaurora\.internal.*
+
+###################################################
+# IFAA Manager used for Alipay and/or WeChat payment
+org\.ifaa\.android\.manager.*
diff --git a/envsetup.sh b/envsetup.sh
index 793f4b6cfa..47ae6f1464 100644
--- a/envsetup.sh
+++ b/envsetup.sh
@@ -35,6 +35,12 @@ Invoke ". build/envsetup.sh" from your shell to add the following functions to y
- pathmod: Get the directory containing a module.
- refreshmod: Refresh list of modules for allmod/gomod.
+EOF
+
+ __print_lineage_functions_help
+
+cat <<EOF
+
Environment options:
- SANITIZE_HOST: Set to 'address' to use ASAN for all host modules.
- ANDROID_QUIET_BUILD: set to 'true' to display only the essential messages.
@@ -44,7 +50,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
@@ -55,8 +61,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[*]}" \
@@ -138,6 +144,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= \
@@ -334,7 +347,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'
}
@@ -649,12 +661,36 @@ function lunch()
return 1
fi
+ if ! check_product $product
+ 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
@@ -669,6 +705,8 @@ function lunch()
echo
+ fixup_common_out_dir
+
set_stuff_for_environment
printconfig
destroy_build_var_cache
@@ -1328,7 +1366,7 @@ function refreshmod() {
mkdir -p $ANDROID_PRODUCT_OUT || return 1
# Note, can't use absolute path because of the way make works.
- m out/target/product/$(get_build_var TARGET_DEVICE)/module-info.json \
+ m $(get_build_var PRODUCT_OUT)/module-info.json \
> $ANDROID_PRODUCT_OUT/module-info.json.build.log 2>&1
}
@@ -1602,3 +1640,7 @@ function source_vendorsetup() {
validate_current_shell
source_vendorsetup
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
index e9fb096647..a2e5518d37 100644
--- a/target/board/BoardConfigEmuCommon.mk
+++ b/target/board/BoardConfigEmuCommon.mk
@@ -33,6 +33,8 @@ ifeq ($(PRODUCT_USE_DYNAMIC_PARTITIONS),true)
# emulator needs super.img
BOARD_BUILD_SUPER_IMAGE_BY_DEFAULT := true
+ BOARD_EXT4_SHARE_DUP_BLOCKS := true
+
# 3G + header
BOARD_SUPER_PARTITION_SIZE := 3229614080
BOARD_SUPER_PARTITION_GROUPS := emulator_dynamic_partitions
diff --git a/target/board/BoardConfigMainlineCommon.mk b/target/board/BoardConfigMainlineCommon.mk
index bf015e5024..c57968eed3 100644
--- a/target/board/BoardConfigMainlineCommon.mk
+++ b/target/board/BoardConfigMainlineCommon.mk
@@ -6,8 +6,6 @@
TARGET_NO_BOOTLOADER := true
TARGET_NO_RECOVERY := true
-BOARD_EXT4_SHARE_DUP_BLOCKS := true
-
TARGET_USERIMAGES_USE_EXT4 := true
# Mainline devices must have /system_ext, /vendor and /product partitions.
diff --git a/target/product/aosp_product.mk b/target/product/aosp_product.mk
index e3819e6115..3e03e62133 100644
--- a/target/product/aosp_product.mk
+++ b/target/product/aosp_product.mk
@@ -19,6 +19,7 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/handheld_product.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_product.mk)
# Default AOSP sounds
+ifeq ($(LINEAGE_BUILD),)
$(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.mk)
# Additional settings used in all AOSP builds
@@ -27,6 +28,10 @@ PRODUCT_PRODUCT_PROPERTIES += \
ro.config.notification_sound=pixiedust.ogg \
ro.com.android.dataroaming=true \
+else
+$(call inherit-product-if-exists, frameworks/base/data/sounds/AudioPackage14.mk)
+endif
+
# More AOSP packages
PRODUCT_PACKAGES += \
messaging \
@@ -34,6 +39,7 @@ PRODUCT_PACKAGES += \
preinstalled-packages-platform-aosp-product.xml \
WallpaperPicker \
+ifeq ($(LINEAGE_BUILD),)
# Telephony:
# Provide a APN configuration to GSI product
PRODUCT_COPY_FILES += \
@@ -43,3 +49,4 @@ PRODUCT_COPY_FILES += \
# Provide a libnfc-nci.conf to GSI product
PRODUCT_COPY_FILES += \
device/generic/common/nfc/libnfc-nci.conf:$(TARGET_COPY_OUT_PRODUCT)/etc/libnfc-nci.conf
+endif
diff --git a/target/product/base_system.mk b/target/product/base_system.mk
index 4569bceff9..5b118eee7f 100644
--- a/target/product/base_system.mk
+++ b/target/product/base_system.mk
@@ -378,7 +378,6 @@ PRODUCT_PACKAGES_DEBUG := \
ss \
start_with_lockagent \
strace \
- su \
sanitizer-status \
tracepath \
tracepath6 \
@@ -387,6 +386,11 @@ PRODUCT_PACKAGES_DEBUG := \
unwind_reg_info \
unwind_symbols \
+ifeq ($(LINEAGE_BUILD),)
+PRODUCT_PACKAGES_DEBUG += \
+ su
+endif
+
# The set of packages whose code can be loaded by the system server.
PRODUCT_SYSTEM_SERVER_APPS += \
SettingsProvider \
diff --git a/target/product/full_base.mk b/target/product/full_base.mk
index ffd3cde11a..267859a626 100644
--- a/target/product/full_base.mk
+++ b/target/product/full_base.mk
@@ -42,16 +42,22 @@ PRODUCT_PACKAGES += \
PRODUCT_PACKAGES += \
netutils-wrapper-1.0
+ifeq ($(LINEAGE_BUILD),)
# Additional settings used in all AOSP builds
PRODUCT_PROPERTY_OVERRIDES := \
ro.config.ringtone=Ring_Synth_04.ogg \
ro.config.notification_sound=pixiedust.ogg
+endif
# Put en_US first in the list, so make it default.
PRODUCT_LOCALES := en_US
# Get some sounds
+ifeq ($(LINEAGE_BUILD),)
$(call inherit-product-if-exists, frameworks/base/data/sounds/AllAudio.mk)
+else
+$(call inherit-product-if-exists, frameworks/base/data/sounds/AudioPackage14.mk)
+endif
# 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 af4097d87a..314de3e921 100644
--- a/target/product/full_base_telephony.mk
+++ b/target/product/full_base_telephony.mk
@@ -21,11 +21,19 @@
PRODUCT_PROPERTY_OVERRIDES := \
keyguard.no_require_sim=true \
+
+ifeq ($(LINEAGE_BUILD),)
+PRODUCT_PROPERTY_OVERRIDES += \
ro.com.android.dataroaming=true
+endif
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
+ifeq ($(LINEAGE_BUILD),)
+PRODUCT_COPY_FILES += \
+ device/sample/etc/apns-full-conf.xml:system/etc/apns-conf.xml
+endif
+
$(call inherit-product, $(SRC_TARGET_DIR)/product/aosp_base.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony.mk)
diff --git a/target/product/handheld_product.mk b/target/product/handheld_product.mk
index 2199c570a0..968d150683 100644
--- a/target/product/handheld_product.mk
+++ b/target/product/handheld_product.mk
@@ -28,7 +28,6 @@ PRODUCT_PACKAGES += \
Contacts \
DeskClock \
Gallery2 \
- LatinIME \
Music \
OneTimeInitializer \
preinstalled-packages-platform-handheld-product.xml \
@@ -36,5 +35,10 @@ PRODUCT_PACKAGES += \
SettingsIntelligence \
frameworks-base-overlays
+ifeq ($(LINEAGE_BUILD),)
+PRODUCT_PACKAGES += \
+ LatinIME
+endif
+
PRODUCT_PACKAGES_DEBUG += \
frameworks-base-overlays-debug
diff --git a/target/product/handheld_system.mk b/target/product/handheld_system.mk
index 77c103d7ee..f6c92b5e80 100644
--- a/target/product/handheld_system.mk
+++ b/target/product/handheld_system.mk
@@ -56,7 +56,6 @@ PRODUCT_PACKAGES += \
MmsService \
MtpService \
MusicFX \
- NfcNci \
PacProcessor \
PrintRecommendationService \
PrintSpooler \
@@ -85,5 +84,9 @@ PRODUCT_COPY_FILES += \
PRODUCT_PROPERTY_OVERRIDES += \
ro.carrier=unknown \
+
+ifeq ($(LINEAGE_BUILD),)
+PRODUCT_PROPERTY_OVERRIDES += \
ro.config.notification_sound=OnTheHunt.ogg \
ro.config.alarm_alert=Alarm_Classic.ogg
+endif
diff --git a/target/product/languages_default.mk b/target/product/languages_default.mk
index a13a23c569..70fbefa236 100644
--- a/target/product/languages_default.mk
+++ b/target/product/languages_default.mk
@@ -103,3 +103,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/mainline.mk b/target/product/mainline.mk
index 22436e66b3..418b1eedd8 100644
--- a/target/product/mainline.mk
+++ b/target/product/mainline.mk
@@ -26,14 +26,21 @@ $(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_system_ext.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_vendor.mk)
$(call inherit-product, $(SRC_TARGET_DIR)/product/telephony_product.mk)
+ifeq ($(LINEAGE_BUILD),)
$(call inherit-product, frameworks/base/data/sounds/AllAudio.mk)
PRODUCT_PROPERTY_OVERRIDES += \
ro.config.ringtone=Ring_Synth_04.ogg \
ro.com.android.dataroaming=true \
+else
+$(call inherit-product, frameworks/base/data/sounds/AudioPackage14.mk)
+endif
+
PRODUCT_PACKAGES += \
PhotoTable \
WallpaperPicker \
+ifeq ($(LINEAGE_BUILD),)
PRODUCT_COPY_FILES += device/sample/etc/apns-full-conf.xml:$(TARGET_COPY_OUT_PRODUCT)/etc/apns-conf.xml
+endif
diff --git a/target/product/mainline_system.mk b/target/product/mainline_system.mk
index a787707a04..e9f9dde138 100644
--- a/target/product/mainline_system.mk
+++ b/target/product/mainline_system.mk
@@ -135,6 +135,12 @@ _base_mk_allowed_list :=
_my_allowed_list := $(_base_mk_allowed_list)
+# vendor.lineage.power@1.0 currently violates the artifact path requirements
+# Exclude it from the check for now
+_my_allowed_list += \
+ $(TARGET_COPY_OUT_SYSTEM_EXT)/lib/vendor.lineage.power@1.0.so \
+ $(TARGET_COPY_OUT_SYSTEM_EXT)/lib64/vendor.lineage.power@1.0.so \
+
# For mainline, system.img should be mounted at /, so we include ROOT here.
_my_paths := \
$(TARGET_COPY_OUT_ROOT)/ \
diff --git a/target/product/media_system.mk b/target/product/media_system.mk
index 4d507b5fb0..f42491eede 100644
--- a/target/product/media_system.mk
+++ b/target/product/media_system.mk
@@ -50,6 +50,7 @@ endif
# The order here is the same order they end up on the classpath, so it matters.
PRODUCT_SYSTEM_SERVER_JARS := \
+ org.lineageos.platform \
com.android.location.provider \
services \
ethernet-service
diff --git a/tools/buildinfo.sh b/tools/buildinfo.sh
index 9bee115484..954a01fb28 100755
--- a/tools/buildinfo.sh
+++ b/tools/buildinfo.sh
@@ -53,4 +53,6 @@ if [ -n "$BUILD_THUMBPRINT" ] ; then
echo "ro.build.thumbprint=$BUILD_THUMBPRINT"
fi
+echo "ro.lineage.device=$LINEAGE_DEVICE"
+
echo "# end build properties"
diff --git a/tools/post_process_props.py b/tools/post_process_props.py
index 9ddd5d7677..45a46caf3c 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/Android.bp b/tools/releasetools/Android.bp
index 5785688473..4bacddc358 100644
--- a/tools/releasetools/Android.bp
+++ b/tools/releasetools/Android.bp
@@ -239,6 +239,18 @@ python_defaults {
embedded_launcher: false,
},
},
+ // TODO (b/140144201) Build imgdiff from releasetools_common
+ required: [
+ "aapt2",
+ "boot_signer",
+ "brotli",
+ "bsdiff",
+ "imgdiff",
+ "minigzip",
+ "lz4",
+ "mkbootfs",
+ "signapk",
+ ],
}
python_binary_host {
diff --git a/tools/releasetools/build_image.py b/tools/releasetools/build_image.py
index 8cf074147e..ae0dfa0ab0 100755
--- a/tools/releasetools/build_image.py
+++ b/tools/releasetools/build_image.py
@@ -57,7 +57,7 @@ def GetDiskUsage(path):
Returns:
The number of bytes based on a 1K block_size.
"""
- cmd = ["du", "-k", "-s", path]
+ cmd = ["du", "-b", "-k", "-s", path]
output = common.RunAndCheckOutput(cmd, verbose=False)
return int(output.split()[0]) * 1024
@@ -273,7 +273,7 @@ def BuildImageMkfs(in_dir, prop_dict, out_file, target_out, fs_config):
base_fs_file = ConvertBlockMapToBaseFs(prop_dict["base_fs_file"])
build_command.extend(["-d", base_fs_file])
build_command.extend(["-L", prop_dict["mount_point"]])
- if "extfs_inode_count" in prop_dict:
+ if "extfs_inode_count" in prop_dict and int(prop_dict["extfs_inode_count"]) >= 0:
build_command.extend(["-i", prop_dict["extfs_inode_count"]])
if "extfs_rsv_pct" in prop_dict:
build_command.extend(["-M", prop_dict["extfs_rsv_pct"]])
@@ -459,19 +459,20 @@ def BuildImage(in_dir, prop_dict, out_file, target_out=None):
size = common.RoundUpTo4K(size)
else:
size = ((size + block_size - 1) // block_size) * block_size
- extfs_inode_count = prop_dict["extfs_inode_count"]
- inodes = int(fs_dict.get("Inode count", extfs_inode_count))
- inodes -= int(fs_dict.get("Free inodes", "0"))
- # add .2% margin or 1 inode, whichever is greater
- spare_inodes = inodes * 2 // 1000
- min_spare_inodes = 1
- if spare_inodes < min_spare_inodes:
- spare_inodes = min_spare_inodes
- inodes += spare_inodes
- prop_dict["extfs_inode_count"] = str(inodes)
+ if int(prop_dict["extfs_inode_count"]) >= 0:
+ extfs_inode_count = prop_dict["extfs_inode_count"]
+ inodes = int(fs_dict.get("Inode count", extfs_inode_count))
+ inodes -= int(fs_dict.get("Free inodes", "0"))
+ # add .2% margin or 1 inode, whichever is greater
+ spare_inodes = inodes * 2 // 1000
+ min_spare_inodes = 1
+ if spare_inodes < min_spare_inodes:
+ spare_inodes = min_spare_inodes
+ inodes += spare_inodes
+ prop_dict["extfs_inode_count"] = str(inodes)
+ logger.info(
+ "Allocating %d Inodes for %s.", inodes, out_file)
prop_dict["partition_size"] = str(size)
- logger.info(
- "Allocating %d Inodes for %s.", inodes, out_file)
if verity_image_builder:
size = verity_image_builder.CalculateDynamicPartitionSize(size)
prop_dict["partition_size"] = str(size)
diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py
index ae7da2fb64..76c2c97cb9 100644
--- a/tools/releasetools/common.py
+++ b/tools/releasetools/common.py
@@ -390,7 +390,7 @@ class BuildInfo(object):
"system_other"] = self._partition_fingerprints["system"]
# These two should be computed only after setting self._oem_props.
- self._device = self.GetOemProperty("ro.product.device")
+ self._device = info_dict.get("ota_override_device", self.GetOemProperty("ro.product.device"))
self._fingerprint = self.CalculateFingerprint()
check_fingerprint(self._fingerprint)
@@ -900,9 +900,10 @@ 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,
- slotselect=slotselect)
+ 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,
+ slotselect=slotselect)
# / 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
@@ -1152,7 +1153,7 @@ def BuildVBMeta(image_path, partitions, name, needed_partitions):
assert OPTIONS.aftl_signer_helper is not None, 'No AFTL signer helper provided.'
# AFTL inclusion proof generation code will go here.
-def _MakeRamdisk(sourcedir, fs_config_file=None, lz4_ramdisks=False):
+def _MakeRamdisk(sourcedir, fs_config_file=None, lz4_ramdisks=False, xz_ramdisks=False):
ramdisk_img = tempfile.NamedTemporaryFile()
if fs_config_file is not None and os.access(fs_config_file, os.F_OK):
@@ -1164,6 +1165,9 @@ def _MakeRamdisk(sourcedir, fs_config_file=None, lz4_ramdisks=False):
if lz4_ramdisks:
p2 = Run(["lz4", "-l", "-12" , "--favor-decSpeed"], stdin=p1.stdout,
stdout=ramdisk_img.file.fileno())
+ elif xz_ramdisks:
+ p2 = Run(["xz", "-f", "-c", "--check=crc32", "--lzma2=dict=32MiB"], stdin=p1.stdout,
+ stdout=ramdisk_img.file.fileno())
else:
p2 = Run(["minigzip"], stdin=p1.stdout, stdout=ramdisk_img.file.fileno())
@@ -1209,7 +1213,8 @@ def _BuildBootableImage(image_name, sourcedir, fs_config_file, info_dict=None,
if has_ramdisk:
use_lz4 = info_dict.get("lz4_ramdisks") == 'true'
- ramdisk_img = _MakeRamdisk(sourcedir, fs_config_file, lz4_ramdisks=use_lz4)
+ use_xz = info_dict.get("xz_ramdisks") == 'true'
+ ramdisk_img = _MakeRamdisk(sourcedir, fs_config_file, lz4_ramdisks=use_lz4, xz_ramdisks=use_xz)
# use MKBOOTIMG from environ, or "mkbootimg" if empty or not set
mkbootimg = os.getenv('MKBOOTIMG') or "mkbootimg"
@@ -1241,6 +1246,11 @@ def _BuildBootableImage(image_name, sourcedir, fs_config_file, info_dict=None,
cmd.append("--pagesize")
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)
+
if partition_name == "recovery":
args = info_dict.get("recovery_mkbootimg_args")
if not args:
@@ -1394,7 +1404,8 @@ def _BuildVendorBootImage(sourcedir, info_dict=None):
img = tempfile.NamedTemporaryFile()
use_lz4 = info_dict.get("lz4_ramdisks") == 'true'
- ramdisk_img = _MakeRamdisk(sourcedir, lz4_ramdisks=use_lz4)
+ use_xz = info_dict.get("xz_ramdisks") == 'true'
+ ramdisk_img = _MakeRamdisk(sourcedir, lz4_ramdisks=use_lz4, xz_ramdisks=use_xz)
# use MKBOOTIMG from environ, or "mkbootimg" if empty or not set
mkbootimg = os.getenv('MKBOOTIMG') or "mkbootimg"
@@ -2123,6 +2134,7 @@ class PasswordManager(object):
def __init__(self):
self.editor = os.getenv("EDITOR")
self.pwfile = os.getenv("ANDROID_PW_FILE")
+ self.secure_storage_cmd = os.getenv("ANDROID_SECURE_STORAGE_CMD", None)
def GetPasswords(self, items):
"""Get passwords corresponding to each string in 'items',
@@ -2142,9 +2154,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:
@@ -2408,6 +2434,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
@@ -3026,12 +3057,10 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img,
# In this case, the output sink is rooted at VENDOR
recovery_img_path = "etc/recovery.img"
recovery_resource_dat_path = "VENDOR/etc/recovery-resource.dat"
- sh_dir = "bin"
else:
# In this case the output sink is rooted at SYSTEM
recovery_img_path = "vendor/etc/recovery.img"
recovery_resource_dat_path = "SYSTEM/vendor/etc/recovery-resource.dat"
- sh_dir = "vendor/bin"
if full_recovery_image:
output_sink(recovery_img_path, recovery_img.data)
@@ -3114,11 +3143,7 @@ fi
# The install script location moved from /system/etc to /system/bin in the L
# release. In the R release it is in VENDOR/bin or SYSTEM/vendor/bin.
- sh_location = os.path.join(sh_dir, "install-recovery.sh")
-
- logger.info("putting script in %s", sh_location)
-
- output_sink(sh_location, sh.encode())
+ output_sink("bin/install-recovery.sh", sh.encode())
class DynamicPartitionUpdate(object):
@@ -3157,10 +3182,11 @@ class DynamicGroupUpdate(object):
class DynamicPartitionsDifference(object):
def __init__(self, info_dict, block_diffs, progress_dict=None,
- source_info_dict=None):
+ source_info_dict=None, build_without_vendor=False):
if progress_dict is None:
progress_dict = {}
+ self._build_without_vendor = build_without_vendor
self._remove_all_before_apply = False
if source_info_dict is None:
self._remove_all_before_apply = True
@@ -3285,6 +3311,17 @@ class DynamicPartitionsDifference(object):
def comment(line):
self._op_list.append("# %s" % line)
+ if self._build_without_vendor:
+ comment('System-only build, keep original vendor partition')
+ # When building without vendor, we do not want to override
+ # any partition already existing. In this case, we can only
+ # resize, but not remove / create / re-create any other
+ # partition.
+ for p, u in self._partition_updates.items():
+ comment('Resize partition %s to %s' % (p, u.tgt_size))
+ append('resize %s %s' % (p, u.tgt_size))
+ return
+
if self._remove_all_before_apply:
comment('Remove all existing dynamic partitions and groups before '
'applying full OTA')
diff --git a/tools/releasetools/edify_generator.py b/tools/releasetools/edify_generator.py
index b9c9b197b3..0a0ff5f126 100644
--- a/tools/releasetools/edify_generator.py
+++ b/tools/releasetools/edify_generator.py
@@ -137,20 +137,39 @@ 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, mount_point, dynamic=False):
+ systemEntry = self.fstab[mount_point]
+ if dynamic:
+ for p in ["vendor", "product", "system_ext"]:
+ fstabEntry = self.fstab.get("/"+p, None)
+ if fstabEntry:
+ self.script.append('map_partition("%s");' % (fstabEntry.device,))
+
+ self.script.append(('run_program("/tmp/install/bin/backuptool.sh", "%s", map_partition("%s"), "%s");' % (
+ command, systemEntry.device, systemEntry.fs_type)))
+ else:
+ self.script.append(('run_program("/tmp/install/bin/backuptool.sh", "%s", "%s", "%s");' % (
+ command, systemEntry.device, systemEntry.fs_type)))
+
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
@@ -243,6 +262,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("")
@@ -381,6 +411,25 @@ class EdifyGenerator(object):
assert not entry.slotselect, \
"Use %s because %s is slot suffixed" % (fn, lst[1])
+ 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/make_recovery_patch.py b/tools/releasetools/make_recovery_patch.py
index 1497d69ed7..b52289b8a2 100644
--- a/tools/releasetools/make_recovery_patch.py
+++ b/tools/releasetools/make_recovery_patch.py
@@ -49,13 +49,19 @@ def main(argv):
board_uses_vendorimage = OPTIONS.info_dict.get(
"board_uses_vendorimage") == "true"
+ board_builds_vendorimage = OPTIONS.info_dict.get(
+ "board_builds_vendorimage") == "true"
+ target_files_dir = None
- if board_uses_vendorimage:
+ if board_builds_vendorimage:
target_files_dir = "VENDOR"
- else:
- target_files_dir = "SYSTEM"
+ elif not board_uses_vendorimage:
+ target_files_dir = "SYSTEM/vendor"
def output_sink(fn, data):
+ if target_files_dir is None:
+ return
+
with open(os.path.join(output_dir, target_files_dir,
*fn.split("/")), "wb") as f:
f.write(data)
diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py
index 3b68439d8f..2ec6d4176c 100755
--- a/tools/releasetools/ota_from_target_files.py
+++ b/tools/releasetools/ota_from_target_files.py
@@ -202,6 +202,10 @@ A/B OTA specific options
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.
+
+ --backup <boolean>
+ Enable or disable the execution of backuptool.sh.
+ Disabled by default.
"""
from __future__ import print_function
@@ -266,13 +270,14 @@ OPTIONS.output_metadata_path = None
OPTIONS.disable_fec_computation = False
OPTIONS.force_non_ab = False
OPTIONS.boot_variable_file = None
+OPTIONS.backuptool = False
METADATA_NAME = 'META-INF/com/android/metadata'
POSTINSTALL_CONFIG = 'META/postinstall_config.txt'
DYNAMIC_PARTITION_INFO = 'META/dynamic_partitions_info.txt'
AB_PARTITIONS = 'META/ab_partitions.txt'
-UNZIP_PATTERN = ['IMAGES/*', 'META/*', 'OTA/*', 'RADIO/*']
+UNZIP_PATTERN = ['IMAGES/*', 'INSTALL/*', 'META/*', 'OTA/*', 'RADIO/*']
# Files to be unzipped for target diffing purpose.
TARGET_DIFFING_UNZIP_PATTERN = ['BOOT', 'RECOVERY', 'SYSTEM/*', 'VENDOR/*',
'PRODUCT/*', 'SYSTEM_EXT/*', 'ODM/*']
@@ -538,12 +543,17 @@ def _WriteRecoveryImageToBoot(script, output_zip):
def HasRecoveryPatch(target_files_zip, info_dict):
board_uses_vendorimage = info_dict.get("board_uses_vendorimage") == "true"
+ board_builds_vendorimage = info_dict.get("board_builds_vendorimage") == "true"
+ target_files_dir = None
- if board_uses_vendorimage:
+ if board_builds_vendorimage:
target_files_dir = "VENDOR"
- else:
+ elif not board_uses_vendorimage:
target_files_dir = "SYSTEM/vendor"
+ if target_files_dir is None:
+ return True
+
patch = "%s/recovery-from-boot.p" % target_files_dir
img = "%s/etc/recovery.img" %target_files_dir
@@ -708,6 +718,15 @@ def GetBlockDifferences(target_zip, source_zip, target_info, source_info,
return block_diff_dict
+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 = common.BuildInfo(OPTIONS.info_dict, OPTIONS.oem_dicts)
@@ -742,9 +761,9 @@ def WriteFullOTAPackage(input_zip, output_file):
assert HasRecoveryPatch(input_zip, info_dict=OPTIONS.info_dict)
# 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()
@@ -805,6 +824,19 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
device_specific.FullOTA_InstallBegin()
+ CopyInstallTools(output_zip)
+ script.UnpackPackageDir("install", "/tmp/install")
+ script.SetPermissionsRecursive("/tmp/install", 0, 0, 0o755, 0o644, None, None)
+ script.SetPermissionsRecursive("/tmp/install/bin", 0, 0, 0o755, 0o755, None, None)
+
+ if target_info.get("system_root_image") == "true":
+ sysmount = "/"
+ else:
+ sysmount = "/system"
+
+ if OPTIONS.backuptool:
+ script.RunBackup("backup", sysmount, target_info.get('use_dynamic_partitions') == "true")
+
# All other partitions as well as the data wipe use 10% of the progress, and
# the update of the system partition takes the remaining progress.
system_progress = 0.9 - (len(block_diff_dict) - 1) * 0.1
@@ -819,7 +851,8 @@ else if get_stage("%(bcb_dev)s") == "3/3" then
dynamic_partitions_diff = common.DynamicPartitionsDifference(
info_dict=OPTIONS.info_dict,
block_diffs=block_diff_dict.values(),
- progress_dict=progress_dict)
+ progress_dict=progress_dict,
+ build_without_vendor=(not HasPartition(input_zip, "vendor")))
dynamic_partitions_diff.WriteScript(script, output_zip,
write_verify_script=OPTIONS.verify)
else:
@@ -835,6 +868,12 @@ 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)
+ script.RunBackup("restore", sysmount, target_info.get('use_dynamic_partitions') == "true")
+
script.WriteRawImage("/boot", "boot.img")
script.ShowProgress(0.1, 10)
@@ -2107,6 +2146,8 @@ def main(argv):
OPTIONS.force_non_ab = True
elif o == "--boot_variable_file":
OPTIONS.boot_variable_file = a
+ elif o in ("--backup"):
+ OPTIONS.backuptool = bool(a.lower() == 'true')
else:
return False
return True
@@ -2145,6 +2186,7 @@ def main(argv):
"disable_fec_computation",
"force_non_ab",
"boot_variable_file=",
+ "backup=",
], extra_option_handler=option_handler)
if len(args) != 2:
diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py
index 47360c9464..4eb73dc9d1 100755
--- a/tools/releasetools/sign_target_files_apks.py
+++ b/tools/releasetools/sign_target_files_apks.py
@@ -785,7 +785,7 @@ def RewriteProps(data):
value = "/".join(pieces)
elif key == "ro.build.description":
pieces = value.split(" ")
- assert len(pieces) == 5
+ assert pieces[-1].endswith("-keys")
pieces[-1] = EditTags(pieces[-1])
value = " ".join(pieces)
elif key.startswith("ro.") and key.endswith(".build.tags"):
diff --git a/tools/releasetools/sign_zip.py b/tools/releasetools/sign_zip.py
new file mode 100755
index 0000000000..c40b1b42c3
--- /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)