From 33fd5d4277d7e49c100a92ea68ff44c912708afa Mon Sep 17 00:00:00 2001 From: Yifan Hong Date: Thu, 24 Sep 2020 18:18:26 -0700 Subject: [PATCH] Add /system/etc/ramdisk/build.prop. Add a build.prop file for ramdisk. Properties uses the name ro.[product.]bootimage*. These ro.[product.]bootimage.* properties are also included in recovery properties. The file is installed to system/etc/ramdisk/build.prop under ramdisk. On devices with dedicated recovery partition, the file is installed to ramdisk/, which is installed to the ramdisk in the boot image. The file is NOT installed to recovery/root to prevent collision. On devices with recovery_as_boot, in addition to ramdisk/, it is also installed to recovery/root, which is installed to the ramdisk in the boot image. Test: m bootimage and inspect output Bug: 169169031 Bug: 162623577 Bug: 170411692 Bug: 170364317 Change-Id: Ica6515b2a4e0f4a7fe4440434a3d7085fde64387 --- core/Makefile | 10 ++++++++++ core/main.mk | 1 + core/sysprop.mk | 10 ++++++++++ 3 files changed, 21 insertions(+) diff --git a/core/Makefile b/core/Makefile index 1f9bd14d67..dd4190aec5 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1829,6 +1829,15 @@ $(INSTALLED_RECOVERY_BUILD_PROP_TARGET): \ $(hide) cat $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET) >> $@ $(call append-recovery-ui-properties,$(PRIVATE_RECOVERY_UI_PROPERTIES),$@) +# Only install boot/etc/build.prop to recovery image on recovery_as_boot. +# On device with dedicated recovery partition, the file should come from the boot +# ramdisk. +ifeq (true,$(BOARD_USES_RECOVERY_AS_BOOT)) +INSTALLED_RECOVERY_RAMDISK_BUILD_PROP_TARGET := $(TARGET_RECOVERY_ROOT_OUT)/$(RAMDISK_BUILD_PROP_REL_PATH) +$(INSTALLED_RECOVERY_RAMDISK_BUILD_PROP_TARGET): $(INSTALLED_RAMDISK_BUILD_PROP_TARGET) + $(copy-file-to-target) +endif + ifeq (truetrue,$(strip $(BUILDING_VENDOR_BOOT_IMAGE))$(strip $(AB_OTA_UPDATER))) INTERNAL_RECOVERYIMAGE_ARGS := --ramdisk $(recovery_ramdisk) ifdef GENERIC_KERNEL_CMDLINE @@ -1873,6 +1882,7 @@ $(recovery_ramdisk): $(MKBOOTFS) $(COMPRESSION_COMMAND_DEPS) \ $(recovery_sepolicy) \ $(INSTALLED_2NDBOOTLOADER_TARGET) \ $(INSTALLED_RECOVERY_BUILD_PROP_TARGET) \ + $(INSTALLED_RECOVERY_RAMDISK_BUILD_PROP_TARGET) \ $(recovery_resource_deps) \ $(recovery_fstab) # Making recovery image diff --git a/core/main.mk b/core/main.mk index 36071b8d2b..0e419a2d73 100644 --- a/core/main.mk +++ b/core/main.mk @@ -1739,6 +1739,7 @@ else ifeq (,$(TARGET_BUILD_UNBUNDLED)) $(INSTALLED_PRODUCT_BUILD_PROP_TARGET):build.prop-product \ $(INSTALLED_ODM_BUILD_PROP_TARGET):build.prop-odm \ $(INSTALLED_SYSTEM_EXT_BUILD_PROP_TARGET):build.prop-system_ext \ + $(INSTALLED_RAMDISK_BUILD_PROP_TARGET):build.prop-ramdisk \ $(BUILT_TARGET_FILES_PACKAGE) \ $(INSTALLED_ANDROID_INFO_TXT_TARGET) \ $(INSTALLED_MISC_INFO_TARGET) \ diff --git a/core/sysprop.mk b/core/sysprop.mk index 73dbec792a..a74ff9fedc 100644 --- a/core/sysprop.mk +++ b/core/sysprop.mk @@ -429,3 +429,13 @@ $(eval $(call build-properties,\ $(_prop_files_),\ $(_prop_vars_),\ $(empty))) + +# ---------------------------------------------------------------- +# ramdisk/boot/etc/build.prop +# + +RAMDISK_BUILD_PROP_REL_PATH := system/etc/ramdisk/build.prop +INSTALLED_RAMDISK_BUILD_PROP_TARGET := $(TARGET_RAMDISK_OUT)/$(RAMDISK_BUILD_PROP_REL_PATH) +$(eval $(call build-properties,\ + bootimage,\ + $(INSTALLED_RAMDISK_BUILD_PROP_TARGET)))