Loading core/Makefile +0 −15 Original line number Diff line number Diff line Loading @@ -2493,10 +2493,6 @@ $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY endif ifeq ($(AB_OTA_UPDATER),true) ifdef BRILLO_VENDOR_PARTITIONS $(BUILT_TARGET_FILES_PACKAGE): $(foreach p,$(BRILLO_VENDOR_PARTITIONS),\ $(call word-colon,1,$(p))/$(call word-colon,2,$(p))) endif ifdef OSRELEASED_DIRECTORY $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version Loading Loading @@ -2739,17 +2735,6 @@ ifeq ($(AB_OTA_UPDATER),true) @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds. $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $(zip_root)/META/misc_info.txt $(hide) echo "ab_update=true" >> $(zip_root)/META/misc_info.txt ifdef BRILLO_VENDOR_PARTITIONS $(hide) mkdir -p $(zip_root)/VENDOR_IMAGES $(hide) for f in $(BRILLO_VENDOR_PARTITIONS); do \ pair1="$$(echo $$f | awk -F':' '{print $$1}')"; \ pair2="$$(echo $$f | awk -F':' '{print $$2}')"; \ src=$${pair1}/$${pair2}; \ dest=$(zip_root)/VENDOR_IMAGES/$${pair2}; \ mkdir -p $$(dirname "$${dest}"); \ cp $${src} $${dest}; \ done; endif ifdef OSRELEASED_DIRECTORY $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt Loading tools/releasetools/add_img_to_target_files.py +6 −18 Original line number Diff line number Diff line Loading @@ -405,7 +405,7 @@ def AddVBMeta(output_zip, partitions): if os.path.exists(image_path): continue found = False for dir_name in ['IMAGES', 'RADIO', 'VENDOR_IMAGES', 'PREBUILT_IMAGES']: for dir_name in ['IMAGES', 'RADIO', 'PREBUILT_IMAGES']: alt_path = os.path.join( OPTIONS.input_tmp, dir_name, os.path.basename(image_path)) if os.path.exists(alt_path): Loading Loading @@ -488,9 +488,8 @@ def AddCache(output_zip): def AddRadioImagesForAbOta(output_zip, ab_partitions): """Adds the radio images needed for A/B OTA to the output file. It parses the list of A/B partitions, looks for the missing ones from RADIO/ or VENDOR_IMAGES/ dirs, and copies them to IMAGES/ of the output file (or dir). It parses the list of A/B partitions, looks for the missing ones from RADIO/, and copies them to IMAGES/ of the output file (or dir). It also ensures that on returning from the function all the listed A/B partitions must have their images available under IMAGES/. Loading Loading @@ -518,17 +517,6 @@ def AddRadioImagesForAbOta(output_zip, ab_partitions): shutil.copy(img_radio_path, prebuilt_path) continue # Walk through VENDOR_IMAGES/ since files could be under subdirs. img_vendor_dir = os.path.join(OPTIONS.input_tmp, "VENDOR_IMAGES") for root, _, files in os.walk(img_vendor_dir): if img_name in files: if output_zip: common.ZipWrite(output_zip, os.path.join(root, img_name), "IMAGES/" + img_name) else: shutil.copy(os.path.join(root, img_name), prebuilt_path) break # Assert that the image is present under IMAGES/ now. if output_zip: # Zip spec says: All slashes MUST be forward slashes. Loading Loading @@ -763,9 +751,9 @@ def AddImagesToTargetFiles(filename): with open(ab_partitions_txt, 'r') as f: ab_partitions = f.readlines() # For devices using A/B update, copy over images from RADIO/ and/or # VENDOR_IMAGES/ to IMAGES/ and make sure we have all the needed # images ready under IMAGES/. All images should have '.img' as extension. # 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/. All images # should have '.img' as extension. AddRadioImagesForAbOta(output_zip, ab_partitions) # Generate care_map.txt for system and vendor partitions (if present), then Loading tools/releasetools/test_add_img_to_target_files.py +0 −24 Original line number Diff line number Diff line Loading @@ -85,30 +85,6 @@ class AddImagesToTargetFilesTest(unittest.TestCase): for image in images: self.assertIn('IMAGES/' + image + '.img', verify_zip.namelist()) def test_AddRadioImagesForAbOta_copyFromVendorImages(self): """Tests the case that copies images from VENDOR_IMAGES/.""" vendor_images_path = os.path.join(OPTIONS.input_tmp, 'VENDOR_IMAGES') os.mkdir(vendor_images_path) partitions = ['aboot', 'xbl'] for index, partition in enumerate(partitions): subdir = os.path.join(vendor_images_path, 'subdir-{}'.format(index)) os.mkdir(subdir) partition_image_path = os.path.join(subdir, partition + '.img') with open(partition_image_path, 'wb') as partition_fp: partition_fp.write(partition.encode()) # Set up the output dir. images_path = os.path.join(OPTIONS.input_tmp, 'IMAGES') os.mkdir(images_path) AddRadioImagesForAbOta(None, partitions) for partition in partitions: self.assertTrue( os.path.exists(os.path.join(images_path, partition + '.img'))) def test_AddRadioImagesForAbOta_missingImages(self): images, _ = self._create_images(['aboot', 'xbl'], 'RADIO') self.assertRaises(AssertionError, AddRadioImagesForAbOta, None, Loading Loading
core/Makefile +0 −15 Original line number Diff line number Diff line Loading @@ -2493,10 +2493,6 @@ $(BUILT_TARGET_FILES_PACKAGE): PRIVATE_RECOVERY_OUT := RECOVERY endif ifeq ($(AB_OTA_UPDATER),true) ifdef BRILLO_VENDOR_PARTITIONS $(BUILT_TARGET_FILES_PACKAGE): $(foreach p,$(BRILLO_VENDOR_PARTITIONS),\ $(call word-colon,1,$(p))/$(call word-colon,2,$(p))) endif ifdef OSRELEASED_DIRECTORY $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(BUILT_TARGET_FILES_PACKAGE): $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version Loading Loading @@ -2739,17 +2735,6 @@ ifeq ($(AB_OTA_UPDATER),true) @# Include the build type in META/misc_info.txt so the server can easily differentiate production builds. $(hide) echo "build_type=$(TARGET_BUILD_VARIANT)" >> $(zip_root)/META/misc_info.txt $(hide) echo "ab_update=true" >> $(zip_root)/META/misc_info.txt ifdef BRILLO_VENDOR_PARTITIONS $(hide) mkdir -p $(zip_root)/VENDOR_IMAGES $(hide) for f in $(BRILLO_VENDOR_PARTITIONS); do \ pair1="$$(echo $$f | awk -F':' '{print $$1}')"; \ pair2="$$(echo $$f | awk -F':' '{print $$2}')"; \ src=$${pair1}/$${pair2}; \ dest=$(zip_root)/VENDOR_IMAGES/$${pair2}; \ mkdir -p $$(dirname "$${dest}"); \ cp $${src} $${dest}; \ done; endif ifdef OSRELEASED_DIRECTORY $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_id $(zip_root)/META/product_id.txt $(hide) cp $(TARGET_OUT_OEM)/$(OSRELEASED_DIRECTORY)/product_version $(zip_root)/META/product_version.txt Loading
tools/releasetools/add_img_to_target_files.py +6 −18 Original line number Diff line number Diff line Loading @@ -405,7 +405,7 @@ def AddVBMeta(output_zip, partitions): if os.path.exists(image_path): continue found = False for dir_name in ['IMAGES', 'RADIO', 'VENDOR_IMAGES', 'PREBUILT_IMAGES']: for dir_name in ['IMAGES', 'RADIO', 'PREBUILT_IMAGES']: alt_path = os.path.join( OPTIONS.input_tmp, dir_name, os.path.basename(image_path)) if os.path.exists(alt_path): Loading Loading @@ -488,9 +488,8 @@ def AddCache(output_zip): def AddRadioImagesForAbOta(output_zip, ab_partitions): """Adds the radio images needed for A/B OTA to the output file. It parses the list of A/B partitions, looks for the missing ones from RADIO/ or VENDOR_IMAGES/ dirs, and copies them to IMAGES/ of the output file (or dir). It parses the list of A/B partitions, looks for the missing ones from RADIO/, and copies them to IMAGES/ of the output file (or dir). It also ensures that on returning from the function all the listed A/B partitions must have their images available under IMAGES/. Loading Loading @@ -518,17 +517,6 @@ def AddRadioImagesForAbOta(output_zip, ab_partitions): shutil.copy(img_radio_path, prebuilt_path) continue # Walk through VENDOR_IMAGES/ since files could be under subdirs. img_vendor_dir = os.path.join(OPTIONS.input_tmp, "VENDOR_IMAGES") for root, _, files in os.walk(img_vendor_dir): if img_name in files: if output_zip: common.ZipWrite(output_zip, os.path.join(root, img_name), "IMAGES/" + img_name) else: shutil.copy(os.path.join(root, img_name), prebuilt_path) break # Assert that the image is present under IMAGES/ now. if output_zip: # Zip spec says: All slashes MUST be forward slashes. Loading Loading @@ -763,9 +751,9 @@ def AddImagesToTargetFiles(filename): with open(ab_partitions_txt, 'r') as f: ab_partitions = f.readlines() # For devices using A/B update, copy over images from RADIO/ and/or # VENDOR_IMAGES/ to IMAGES/ and make sure we have all the needed # images ready under IMAGES/. All images should have '.img' as extension. # 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/. All images # should have '.img' as extension. AddRadioImagesForAbOta(output_zip, ab_partitions) # Generate care_map.txt for system and vendor partitions (if present), then Loading
tools/releasetools/test_add_img_to_target_files.py +0 −24 Original line number Diff line number Diff line Loading @@ -85,30 +85,6 @@ class AddImagesToTargetFilesTest(unittest.TestCase): for image in images: self.assertIn('IMAGES/' + image + '.img', verify_zip.namelist()) def test_AddRadioImagesForAbOta_copyFromVendorImages(self): """Tests the case that copies images from VENDOR_IMAGES/.""" vendor_images_path = os.path.join(OPTIONS.input_tmp, 'VENDOR_IMAGES') os.mkdir(vendor_images_path) partitions = ['aboot', 'xbl'] for index, partition in enumerate(partitions): subdir = os.path.join(vendor_images_path, 'subdir-{}'.format(index)) os.mkdir(subdir) partition_image_path = os.path.join(subdir, partition + '.img') with open(partition_image_path, 'wb') as partition_fp: partition_fp.write(partition.encode()) # Set up the output dir. images_path = os.path.join(OPTIONS.input_tmp, 'IMAGES') os.mkdir(images_path) AddRadioImagesForAbOta(None, partitions) for partition in partitions: self.assertTrue( os.path.exists(os.path.join(images_path, partition + '.img'))) def test_AddRadioImagesForAbOta_missingImages(self): images, _ = self._create_images(['aboot', 'xbl'], 'RADIO') self.assertRaises(AssertionError, AddRadioImagesForAbOta, None, Loading