diff --git a/core/Makefile b/core/Makefile index 6b1c721b04e22cdd6b36a3303dc8cf04760ea3d8..fa0e7521b10158751abed3da3bbc9aa67c66e397 100644 --- a/core/Makefile +++ b/core/Makefile @@ -2145,6 +2145,11 @@ endif $(hide) (cd $(zip_root) && \ zip -qryX ../$(notdir $@) ./META && \ zip -qryXu ../$(notdir $@) .) + @# The radio images in BOARD_PACK_RADIOIMAGES will be additionally copied from RADIO/ into + @# IMAGES/, which then will be added into -img.zip. Such images must be listed in + @# INSTALLED_RADIOIMAGE_TARGET. + $(hide) $(foreach part,$(BOARD_PACK_RADIOIMAGES), \ + echo $(part) >> $(zip_root)/META/pack_radioimages.txt;) @# Run fs_config on all the system, vendor, boot ramdisk, @# and recovery ramdisk files in the zip, and save the output $(hide) zipinfo -1 $@ | awk 'BEGIN { FS="SYSTEM/" } /^SYSTEM\// {print "system/" $$2}' | $(HOST_OUT_EXECUTABLES)/fs_config -C -D $(TARGET_OUT) -S $(SELINUX_FC) > $(zip_root)/META/filesystem_config.txt diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py index 9595c7e2fc28f4c4133704fdadeda21e3228385d..4519751c14128e1b2eb849a7da50a3d8fb9656b7 100755 --- a/tools/releasetools/add_img_to_target_files.py +++ b/tools/releasetools/add_img_to_target_files.py @@ -510,6 +510,34 @@ def AddImagesToTargetFiles(filename): if care_map_list: file_path = "META/care_map.txt" common.ZipWriteStr(output_zip, file_path, '\n'.join(care_map_list)) + # Radio images that need to be packed into IMAGES/, and product-img.zip. + pack_radioimages = os.path.join( + OPTIONS.input_tmp, "META", "pack_radioimages.txt") + if os.path.exists(pack_radioimages): + banner("radio") + with open(pack_radioimages, 'r') as f: + lines = f.readlines() + for line in lines: + img_name = line.strip() + _, ext = os.path.splitext(img_name) + if not ext: + img_name += ".img" + prebuilt_path = os.path.join(OPTIONS.input_tmp, "IMAGES", img_name) + if os.path.exists(prebuilt_path): + print("%s already exists, no need to overwrite..." % (img_name,)) + continue + + img_radio_path = os.path.join(OPTIONS.input_tmp, "RADIO", img_name) + assert os.path.exists(img_radio_path), \ + "Failed to find %s at %s" % (img_name, img_radio_path) + if output_zip: + common.ZipWrite(output_zip, img_radio_path, + os.path.join("IMAGES", img_name)) + else: + shutil.copy(img_radio_path, prebuilt_path) + + if output_zip: + common.ZipClose(output_zip) common.ZipClose(output_zip)