From 6c62884000b572e8d55c7cb9b98039f3882aa271 Mon Sep 17 00:00:00 2001 From: Bowgo Tsai Date: Fri, 17 May 2019 23:21:48 +0800 Subject: [PATCH] Moving /odm/build.prop to /odm/etc/buid.prop In device root directory, we have the following symlinks: - /odm/app -> /vendor/odm/app - /odm/bin -> /vendor/odm/bin - /odm/etc -> /vendor/odm/etc ... This allows the Generic System Image (GSI) to be used on both devices: 1) Has a physical odm partition, where those symlink will be hidden when /odm is used as the mount point 2) Has no physical odm partition and fallback to /vendor/odm/. We can't just have the symlink /odm -> /vendor/odm, because the former devices won't have /vendor/odm directory, which leads to mount failure when the mount point /odm is resolved to /vendor/odm. The existing /vendor/odm/build.prop won't be loaded in the latter devices, because there is no symlink: - /odm/build.prop -> /vendor/odm/build.prop. Note that init blocks reading through direct symlinks (O_NOFOLLOW) so the above symlink won't work either. This CL moves the odm build.prop to /odm/etc/build.prop for init to load it (symlinks in earlier components of the path will still be followed by O_NOFOLLOW). Bug: 132128501 Test: boot a device and checks /odm/etc/build.prop is loaded Test: make dist with an odm.img, checks $OUT/odm/etc/build.prop is loaded Change-Id: I6f88763db755c9ec6068bfdd9cee81c19d72e9d7 --- CleanSpec.mk | 4 ++++ core/Makefile | 2 +- tools/releasetools/common.py | 8 +++++++- tools/releasetools/sign_target_files_apks.py | 6 ++++-- 4 files changed, 16 insertions(+), 4 deletions(-) diff --git a/CleanSpec.mk b/CleanSpec.mk index fca07fd18d..f43fa0ec40 100644 --- a/CleanSpec.mk +++ b/CleanSpec.mk @@ -642,6 +642,10 @@ $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib*/libc_malloc*) # Clean up old location of soft OMX plugins $(call add-clean-step, rm -rf $(PRODUCT_OUT)/system/lib*/libstagefright_soft*) +# Move odm build.prop to /odm/etc/. +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/odm/build.prop) +$(call add-clean-step, rm -rf $(PRODUCT_OUT)/vendor/odm/build.prop) + # ************************************************ # NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST # ************************************************ diff --git a/core/Makefile b/core/Makefile index 019e7c3688..9c73930606 100644 --- a/core/Makefile +++ b/core/Makefile @@ -568,7 +568,7 @@ endif # BOARD_USES_PRODUCTIMAGE # ---------------------------------------------------------------- # odm build.prop -INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/build.prop +INSTALLED_ODM_BUILD_PROP_TARGET := $(TARGET_OUT_ODM)/etc/build.prop ALL_DEFAULT_INSTALLED_MODULES += $(INSTALLED_ODM_BUILD_PROP_TARGET) FINAL_ODM_BUILD_PROPERTIES += \ diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index e6422978d2..1b2505aaac 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -415,8 +415,14 @@ def LoadInfoDict(input_file, repacking=False): # Tries to load the build props for all partitions with care_map, including # system and vendor. for partition in PARTITIONS_WITH_CARE_MAP: - d["{}.build.prop".format(partition)] = LoadBuildProp( + partition_prop = "{}.build.prop".format(partition) + d[partition_prop] = LoadBuildProp( read_helper, "{}/build.prop".format(partition.upper())) + # Some partition might use //etc/build.prop as the new path. + # TODO: try new path first when majority of them switch to the new path. + if not d[partition_prop]: + d[partition_prop] = LoadBuildProp( + read_helper, "{}/etc/build.prop".format(partition.upper())) d["build.prop"] = d["system.build.prop"] # Set up the salt (based on fingerprint or thumbprint) that will be used when diff --git a/tools/releasetools/sign_target_files_apks.py b/tools/releasetools/sign_target_files_apks.py index 7de097832d..c174d2fedf 100755 --- a/tools/releasetools/sign_target_files_apks.py +++ b/tools/releasetools/sign_target_files_apks.py @@ -491,8 +491,10 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info, elif filename in ("SYSTEM/build.prop", "VENDOR/build.prop", "SYSTEM/vendor/build.prop", - "ODM/build.prop", - "VENDOR/odm/build.prop", + "ODM/build.prop", # legacy + "ODM/etc/build.prop", + "VENDOR/odm/build.prop", # legacy + "VENDOR/odm/etc/build.prop", "PRODUCT/build.prop", "SYSTEM/product/build.prop", "PRODUCT_SERVICES/build.prop",