From 10fc949873b098e12ae0a1dd1684dca07f79c8d3 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Tue, 14 Aug 2018 12:17:48 -0700 Subject: [PATCH] Reland "Generate the list of installed files in recovery image." This reverts commit 60a47827cbee10c67e963d78bb9218e7c1576576 to reland the change that generates installed-files-recovery.{txt,json}. This CL addresses the previous issue by explicitly depending on INSTALLED_BOOTIMAGE_TARGET or INSTALLED_RECOVERYIMAGE_TARGET. This avoids the race condition between INSTALLED_{BOOT,RECOVERY}IMAGE_TARGET and INSTALLED_FILES_FILE_RECOVERY. As a result, it will also give a complete list of files that are installed to recovery ramdisk image. Bug: 30414428 Test: `m dist` with aosp_taimen-userdebug. Check the generated files of $OUT/installed-files-recovery.{txt,json}. Change-Id: I8bde0dafda7d8ed9c4113dc82553c4edc7f79548 --- core/Makefile | 21 +++++++++++++++++++++ core/main.mk | 4 ++++ 2 files changed, 25 insertions(+) diff --git a/core/Makefile b/core/Makefile index 8a9ec024d4..be2d148579 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1339,6 +1339,27 @@ ifneq (,$(INSTALLED_RECOVERYIMAGE_TARGET)$(filter true,$(BOARD_USES_RECOVERY_AS_ INTERNAL_RECOVERYIMAGE_FILES := $(filter $(TARGET_RECOVERY_OUT)/%, \ $(ALL_DEFAULT_INSTALLED_MODULES)) +INSTALLED_FILES_FILE_RECOVERY := $(PRODUCT_OUT)/installed-files-recovery.txt +INSTALLED_FILES_JSON_RECOVERY := $(INSTALLED_FILES_FILE_RECOVERY:.txt=.json) + +# TODO(b/30414428): Can't depend on INTERNAL_RECOVERYIMAGE_FILES alone like other +# INSTALLED_FILES_FILE_* rules. Because currently there're cp/rsync/rm commands in +# build-recoveryimage-target, which would touch the files under TARGET_RECOVERY_OUT and race with +# the call to FILELIST. +ifeq ($(BOARD_USES_RECOVERY_AS_BOOT),true) +$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_BOOTIMAGE_TARGET) +else +$(INSTALLED_FILES_FILE_RECOVERY): $(INSTALLED_RECOVERYIMAGE_TARGET) +endif + +$(INSTALLED_FILES_FILE_RECOVERY): .KATI_IMPLICIT_OUTPUTS := $(INSTALLED_FILES_JSON_RECOVERY) +$(INSTALLED_FILES_FILE_RECOVERY): $(INTERNAL_RECOVERYIMAGE_FILES) $(FILESLIST) + @echo Installed file list: $@ + @mkdir -p $(dir $@) + @rm -f $@ + $(hide) $(FILESLIST) $(TARGET_RECOVERY_ROOT_OUT) > $(@:.txt=.json) + $(hide) build/make/tools/fileslist_util.py -c $(@:.txt=.json) > $@ + recovery_initrc := $(call include-path-for, recovery)/etc/init.rc recovery_sepolicy := \ $(TARGET_RECOVERY_ROOT_OUT)/sepolicy \ diff --git a/core/main.mk b/core/main.mk index 678bc981af..07042d2b39 100644 --- a/core/main.mk +++ b/core/main.mk @@ -1240,6 +1240,8 @@ droidcore: files \ $(INSTALLED_FILES_JSON_PRODUCT_SERVICES) \ $(INSTALLED_FILES_FILE_SYSTEMOTHER) \ $(INSTALLED_FILES_JSON_SYSTEMOTHER) \ + $(INSTALLED_FILES_FILE_RECOVERY) \ + $(INSTALLED_FILES_JSON_RECOVERY) \ soong_docs # dist_files only for putting your library into the dist directory with a full build. @@ -1313,6 +1315,8 @@ else # TARGET_BUILD_APPS $(INSTALLED_FILES_JSON_PRODUCT_SERVICES) \ $(INSTALLED_FILES_FILE_SYSTEMOTHER) \ $(INSTALLED_FILES_JSON_SYSTEMOTHER) \ + $(INSTALLED_FILES_FILE_RECOVERY) \ + $(INSTALLED_FILES_JSON_RECOVERY) \ $(INSTALLED_BUILD_PROP_TARGET) \ $(BUILT_TARGET_FILES_PACKAGE) \ $(INSTALLED_ANDROID_INFO_TXT_TARGET) \