diff --git a/core/Makefile b/core/Makefile index e2e9ba3aea01a7fbd5febe7e6ba246fcb982cd49..3fee8da58054bc1402973b7b8a8bc1dce88e9a69 100644 --- a/core/Makefile +++ b/core/Makefile @@ -3980,6 +3980,7 @@ endif $(hide) cp $(SELINUX_FC) $(zip_root)/META/file_contexts.bin $(hide) echo "recovery_api_version=$(PRIVATE_RECOVERY_API_VERSION)" > $(zip_root)/META/misc_info.txt $(hide) echo "fstab_version=$(PRIVATE_RECOVERY_FSTAB_VERSION)" >> $(zip_root)/META/misc_info.txt + ifdef BOARD_FLASH_BLOCK_SIZE $(hide) echo "blocksize=$(BOARD_FLASH_BLOCK_SIZE)" >> $(zip_root)/META/misc_info.txt endif @@ -3989,6 +3990,12 @@ endif ifeq ($(INSTALLED_RECOVERYIMAGE_TARGET),) $(hide) echo "no_recovery=true" >> $(zip_root)/META/misc_info.txt endif +ifeq ($(TARGET_NO_BOOTIMAGE),true) + $(hide) echo "no_boot=true" >> $(zip_root)/META/misc_info.txt +else + $(hide) echo "no_boot=false" >> $(zip_root)/META/misc_info.txt +endif + ifdef BOARD_INCLUDE_RECOVERY_DTBO $(hide) echo "include_recovery_dtbo=true" >> $(zip_root)/META/misc_info.txt endif diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py index 96b7f0b04d448ed082fb81bea0d9c571d1c87a1e..5e1cbba39d5c0d93051165400e4448cb10a620d2 100755 --- a/tools/releasetools/add_img_to_target_files.py +++ b/tools/releasetools/add_img_to_target_files.py @@ -733,6 +733,8 @@ def AddImagesToTargetFiles(filename): has_recovery = OPTIONS.info_dict.get("no_recovery") != "true" + has_boot = OPTIONS.info_dict.get("no_boot") != "true" + # {vendor,odm,product,product_services}.img are unlike system.img or # system_other.img. Because it could be built from source, or dropped into # target_files.zip as a prebuilt blob. We consider either of them as @@ -781,15 +783,17 @@ def AddImagesToTargetFiles(filename): banner("boot") # common.GetBootableImage() returns the image directly if present. - boot_image = common.GetBootableImage( - "IMAGES/boot.img", "boot.img", OPTIONS.input_tmp, "BOOT") - # boot.img may be unavailable in some targets (e.g. aosp_arm64). - if boot_image: - partitions['boot'] = os.path.join(OPTIONS.input_tmp, "IMAGES", "boot.img") - if not os.path.exists(partitions['boot']): - boot_image.WriteToDir(OPTIONS.input_tmp) - if output_zip: - boot_image.AddToZip(output_zip) + boot_image = None + if(has_boot): + boot_image = common.GetBootableImage( + "IMAGES/boot.img", "boot.img", OPTIONS.input_tmp, "BOOT") + # boot.img may be unavailable in some targets (e.g. aosp_arm64). + if boot_image: + partitions['boot'] = os.path.join(OPTIONS.input_tmp, "IMAGES", "boot.img") + if not os.path.exists(partitions['boot']): + boot_image.WriteToDir(OPTIONS.input_tmp) + if output_zip: + boot_image.AddToZip(output_zip) recovery_image = None if has_recovery: diff --git a/tools/releasetools/common.py b/tools/releasetools/common.py index b2afaf15353fc8d0890408bb8e19fae45dc3357e..7a72a8df48683c66e319a881ab1906591350fbeb 100644 --- a/tools/releasetools/common.py +++ b/tools/releasetools/common.py @@ -779,7 +779,8 @@ def GetBootableImage(name, prebuilt_name, unpack_dir, tree_subdir, if info_dict is None: info_dict = OPTIONS.info_dict - + if info_dict["no_boot"] == "true" and prebuilt_name == "boot.img": + return None # With system_root_image == "true", we don't pack ramdisk into the boot image. # Unless "recovery_as_boot" is specified, in which case we carry the ramdisk # for recovery. diff --git a/tools/releasetools/ota_from_target_files.py b/tools/releasetools/ota_from_target_files.py index 0cff60f1a1608f66036a956509fbcc02cef8a240..b9176cba2ffe0501df8feddc988531b0459a953f 100755 --- a/tools/releasetools/ota_from_target_files.py +++ b/tools/releasetools/ota_from_target_files.py @@ -992,8 +992,8 @@ def WriteFullOTAPackage(input_zip, output_file): input_tmp=OPTIONS.input_tmp, metadata=metadata, info_dict=OPTIONS.info_dict) - - assert HasRecoveryPatch(input_zip) + if target_info["no_boot"] != "true": + assert HasRecoveryPatch(input_zip) # Assertions (e.g. downgrade check, device properties check). #ts = target_info.GetBuildProp("ro.build.date.utc") @@ -1100,16 +1100,17 @@ else if get_stage("%(bcb_dev)s") == "3/3" then boot_img = common.GetBootableImage( "boot.img", "boot.img", OPTIONS.input_tmp, "BOOT") - common.CheckSize(boot_img.data, "boot.img", target_info) - common.ZipWriteStr(output_zip, "boot.img", boot_img.data) + if boot_img != None: + 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") + if boot_img != None: + script.WriteRawImage("/boot", "boot.img") script.ShowProgress(0.1, 10) device_specific.FullOTA_InstallEnd()