diff options
author | Tao Bao <tbao@google.com> | 2015-10-29 16:13:52 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2015-10-29 16:13:52 +0000 |
commit | c448e91c3d3d095f8f200c9925f7db2ad525132f (patch) | |
tree | c68117852ef20dd818551aaac1834c5dc9321acb | |
parent | fe4e86c7fd1b9c8903fda194b8515451c477ced9 (diff) | |
parent | db45efa64764c1de5c007384ab172ad817e1d295 (diff) | |
download | build-c448e91c3d3d095f8f200c9925f7db2ad525132f.tar.gz |
Merge "Honor TARGET_NO_RECOVERY flag."
-rw-r--r-- | core/Makefile | 7 | ||||
-rwxr-xr-x | tools/releasetools/add_img_to_target_files.py | 24 | ||||
-rwxr-xr-x | tools/releasetools/img_from_target_files.py | 9 | ||||
-rwxr-xr-x | tools/releasetools/ota_from_target_files.py | 4 |
4 files changed, 30 insertions, 14 deletions
diff --git a/core/Makefile b/core/Makefile index db568d069d..d94318de71 100644 --- a/core/Makefile +++ b/core/Makefile @@ -1485,6 +1485,7 @@ $(BUILT_TARGET_FILES_PACKAGE): \ @echo "Package target files: $@" $(hide) rm -rf $@ $(zip_root) $(hide) mkdir -p $(dir $@) $(zip_root) +ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) @# Components of the recovery image $(hide) mkdir -p $(zip_root)/RECOVERY $(hide) $(call package_files-copy-root, \ @@ -1505,6 +1506,7 @@ endif ifdef BOARD_KERNEL_PAGESIZE $(hide) echo "$(BOARD_KERNEL_PAGESIZE)" > $(zip_root)/RECOVERY/pagesize endif +endif @# Components of the boot image $(hide) mkdir -p $(zip_root)/BOOT ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) @@ -1567,6 +1569,9 @@ endif ifdef BOARD_BOOTIMAGE_PARTITION_SIZE $(hide) echo "boot_size=$(BOARD_BOOTIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt endif +ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),) + $(hide) echo "no_recovery=true" >> $(zip_root)/META/misc_info.txt +endif ifdef BOARD_RECOVERYIMAGE_PARTITION_SIZE $(hide) echo "recovery_size=$(BOARD_RECOVERYIMAGE_PARTITION_SIZE)" >> $(zip_root)/META/misc_info.txt endif @@ -1631,7 +1636,9 @@ ifeq ($(BOARD_BUILD_SYSTEM_ROOT_IMAGE),true) else $(hide) zipinfo -1 $@ | awk 'BEGIN { FS="BOOT/RAMDISK/" } /^BOOT\/RAMDISK\// {print $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC) > $(zip_root)/META/boot_filesystem_config.txt endif +ifneq ($(INSTALLED_RECOVERYIMAGE_TARGET),) $(hide) zipinfo -1 $@ | awk 'BEGIN { FS="RECOVERY/RAMDISK/" } /^RECOVERY\/RAMDISK\// {print $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC) > $(zip_root)/META/recovery_filesystem_config.txt +endif $(hide) (cd $(zip_root) && zip -q ../$(notdir $@) META/*filesystem_config.txt) $(hide) PATH=$(foreach p,$(INTERNAL_USERIMAGES_BINARY_PATHS),$(p):)$$PATH MKBOOTIMG=$(MKBOOTIMG) \ ./build/tools/releasetools/add_img_to_target_files -v -p $(HOST_OUT) $@ diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py index 6bdb9d1c66..54c7189fd2 100755 --- a/tools/releasetools/add_img_to_target_files.py +++ b/tools/releasetools/add_img_to_target_files.py @@ -271,6 +271,8 @@ def AddImagesToTargetFiles(filename): output_zip = zipfile.ZipFile(filename, "a", compression=zipfile.ZIP_DEFLATED) + has_recovery = (OPTIONS.info_dict.get("no_recovery") != "true") + def banner(s): print "\n\n++++ " + s + " ++++\n\n" @@ -288,19 +290,21 @@ def AddImagesToTargetFiles(filename): if boot_image: boot_image.AddToZip(output_zip) - banner("recovery") recovery_image = None - prebuilt_path = os.path.join(OPTIONS.input_tmp, "IMAGES", "recovery.img") - if os.path.exists(prebuilt_path): - print "recovery.img already exists in IMAGES/, no need to rebuild..." - if OPTIONS.rebuild_recovery: + if has_recovery: + banner("recovery") + prebuilt_path = os.path.join(OPTIONS.input_tmp, "IMAGES", "recovery.img") + if os.path.exists(prebuilt_path): + print "recovery.img already exists in IMAGES/, no need to rebuild..." + if OPTIONS.rebuild_recovery: + recovery_image = common.GetBootableImage( + "IMAGES/recovery.img", "recovery.img", OPTIONS.input_tmp, + "RECOVERY") + else: recovery_image = common.GetBootableImage( "IMAGES/recovery.img", "recovery.img", OPTIONS.input_tmp, "RECOVERY") - else: - recovery_image = common.GetBootableImage( - "IMAGES/recovery.img", "recovery.img", OPTIONS.input_tmp, "RECOVERY") - if recovery_image: - recovery_image.AddToZip(output_zip) + if recovery_image: + recovery_image.AddToZip(output_zip) banner("system") AddSystem(output_zip, recovery_img=recovery_image, boot_img=boot_image) diff --git a/tools/releasetools/img_from_target_files.py b/tools/releasetools/img_from_target_files.py index ce5808f040..aa21d7eab9 100755 --- a/tools/releasetools/img_from_target_files.py +++ b/tools/releasetools/img_from_target_files.py @@ -102,10 +102,11 @@ def main(argv): if boot_image: boot_image.AddToZip(output_zip) - recovery_image = common.GetBootableImage( - "recovery.img", "recovery.img", OPTIONS.input_tmp, "RECOVERY") - if recovery_image: - recovery_image.AddToZip(output_zip) + if OPTIONS.info_dict.get("no_recovery") != "true": + recovery_image = common.GetBootableImage( + "recovery.img", "recovery.img", OPTIONS.input_tmp, "RECOVERY") + if recovery_image: + recovery_image.AddToZip(output_zip) def banner(s): print "\n\n++++ " + s + " ++++\n\n" diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py index 354b9ad437..4e860659b3 100755 --- a/tools/releasetools/ota_from_target_files.py +++ b/tools/releasetools/ota_from_target_files.py @@ -1612,6 +1612,10 @@ def main(argv): if OPTIONS.device_specific is not None: OPTIONS.device_specific = os.path.abspath(OPTIONS.device_specific) + if OPTIONS.info_dict.get("no_recovery") == "true": + raise common.ExternalError( + "--- target build has specified no recovery ---") + while True: if OPTIONS.no_signing: |