From 26259ef4d7dad3d55475fddefb0bd37327183544 Mon Sep 17 00:00:00 2001 From: Tao Bao Date: Mon, 16 Nov 2015 16:32:27 -0800 Subject: [PATCH] releasetools: Pack updatable images into IMAGES/ for A/B update. Vendor-specific images (radio, bootloader and etc) used to stay in RADIO/ in target_files zip. A/B updater expects them to be available under IMAGES/. Make a copy for such images when calling add_img_to_target_files.py. We cannot move them directly from RADIO/ to IMAGES/, because we will delete everything under IMAGES/ when signing for release. Bug: 25674625 Change-Id: I1c260c1d9fc069c258b2c19cf3831f833d2fa1cf (cherry picked from commit a0421cd1bd2398589f2292dfd92ba802110e98e1) --- tools/releasetools/add_img_to_target_files.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/tools/releasetools/add_img_to_target_files.py b/tools/releasetools/add_img_to_target_files.py index a99d77891..ec9f75b7e 100755 --- a/tools/releasetools/add_img_to_target_files.py +++ b/tools/releasetools/add_img_to_target_files.py @@ -319,6 +319,23 @@ def AddImagesToTargetFiles(filename): banner("cache") AddCache(output_zip) + # For devices using A/B update, copy over images from RADIO/ to IMAGES/ and + # make sure we have all the needed images ready under IMAGES/. + ab_partitions = os.path.join(OPTIONS.input_tmp, "META", "ab_partitions.txt") + if os.path.exists(ab_partitions): + with open(ab_partitions, 'r') as f: + lines = f.readlines() + for line in lines: + img_name = line.strip() + ".img" + img_radio_path = os.path.join(OPTIONS.input_tmp, "RADIO", img_name) + if os.path.exists(img_radio_path): + common.ZipWrite(output_zip, img_radio_path, + os.path.join("IMAGES", img_name)) + + # Zip spec says: All slashes MUST be forward slashes. + img_path = 'IMAGES/' + img_name + assert img_path in output_zip.namelist(), "cannot find " + img_name + common.ZipClose(output_zip) def main(argv): -- 2.11.0