Merge "releasetools: Remove deprecated BOARD_BUILD_SYSTEM_ROOT_IMAGE" into main
This commit is contained in:
commit
7a519aebde
7 changed files with 19 additions and 77 deletions
|
@ -821,7 +821,6 @@ def ImagePropFromGlobalDict(glob_dict, mount_point):
|
|||
d["mount_point"] = mount_point
|
||||
if mount_point == "system":
|
||||
copy_prop("system_headroom", "partition_headroom")
|
||||
copy_prop("system_root_image", "system_root_image")
|
||||
copy_prop("root_dir", "root_dir")
|
||||
copy_prop("root_fs_config", "root_fs_config")
|
||||
elif mount_point == "data":
|
||||
|
|
|
@ -1156,8 +1156,7 @@ class PartitionBuildProps(object):
|
|||
return self.build_props.get(prop)
|
||||
|
||||
|
||||
def LoadRecoveryFSTab(read_helper, fstab_version, recovery_fstab_path,
|
||||
system_root_image=False):
|
||||
def LoadRecoveryFSTab(read_helper, fstab_version, recovery_fstab_path):
|
||||
class Partition(object):
|
||||
def __init__(self, mount_point, fs_type, device, length, context, slotselect):
|
||||
self.mount_point = mount_point
|
||||
|
@ -1216,12 +1215,6 @@ def LoadRecoveryFSTab(read_helper, fstab_version, recovery_fstab_path,
|
|||
device=pieces[0], length=length, context=context,
|
||||
slotselect=slotselect)
|
||||
|
||||
# / is used for the system mount point when the root directory is included in
|
||||
# system. Other areas assume system is always at "/system" so point /system
|
||||
# at /.
|
||||
if system_root_image:
|
||||
assert '/system' not in d and '/' in d
|
||||
d["/system"] = d["/"]
|
||||
return d
|
||||
|
||||
|
||||
|
@ -1237,22 +1230,19 @@ def _FindAndLoadRecoveryFstab(info_dict, input_file, read_helper):
|
|||
# ../RAMDISK/system/etc/recovery.fstab. This function has to handle both
|
||||
# cases, since it may load the info_dict from an old build (e.g. when
|
||||
# generating incremental OTAs from that build).
|
||||
system_root_image = info_dict.get('system_root_image') == 'true'
|
||||
if info_dict.get('no_recovery') != 'true':
|
||||
recovery_fstab_path = 'RECOVERY/RAMDISK/system/etc/recovery.fstab'
|
||||
if not DoesInputFileContain(input_file, recovery_fstab_path):
|
||||
recovery_fstab_path = 'RECOVERY/RAMDISK/etc/recovery.fstab'
|
||||
return LoadRecoveryFSTab(
|
||||
read_helper, info_dict['fstab_version'], recovery_fstab_path,
|
||||
system_root_image)
|
||||
read_helper, info_dict['fstab_version'], recovery_fstab_path)
|
||||
|
||||
if info_dict.get('recovery_as_boot') == 'true':
|
||||
recovery_fstab_path = 'BOOT/RAMDISK/system/etc/recovery.fstab'
|
||||
if not DoesInputFileContain(input_file, recovery_fstab_path):
|
||||
recovery_fstab_path = 'BOOT/RAMDISK/etc/recovery.fstab'
|
||||
return LoadRecoveryFSTab(
|
||||
read_helper, info_dict['fstab_version'], recovery_fstab_path,
|
||||
system_root_image)
|
||||
read_helper, info_dict['fstab_version'], recovery_fstab_path)
|
||||
|
||||
return None
|
||||
|
||||
|
@ -1980,11 +1970,6 @@ def HasRamdisk(partition_name, info_dict=None):
|
|||
if info_dict.get("gki_boot_image_without_ramdisk") == "true":
|
||||
return False # A GKI boot.img has no ramdisk since Android-13.
|
||||
|
||||
if info_dict.get("system_root_image") == "true":
|
||||
# The ramdisk content is merged into the system.img, so there is NO
|
||||
# ramdisk in the boot.img or boot-<kernel version>.img.
|
||||
return False
|
||||
|
||||
if info_dict.get("init_boot") == "true":
|
||||
# The ramdisk is moved to the init_boot.img, so there is NO
|
||||
# ramdisk in the boot.img or boot-<kernel version>.img.
|
||||
|
@ -3853,14 +3838,11 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img,
|
|||
output_sink(recovery_img_path, recovery_img.data)
|
||||
|
||||
else:
|
||||
system_root_image = info_dict.get("system_root_image") == "true"
|
||||
include_recovery_dtbo = info_dict.get("include_recovery_dtbo") == "true"
|
||||
include_recovery_acpio = info_dict.get("include_recovery_acpio") == "true"
|
||||
path = os.path.join(input_dir, recovery_resource_dat_path)
|
||||
# With system-root-image, boot and recovery images will have mismatching
|
||||
# entries (only recovery has the ramdisk entry) (Bug: 72731506). Use bsdiff
|
||||
# to handle such a case.
|
||||
if system_root_image or include_recovery_dtbo or include_recovery_acpio:
|
||||
# Use bsdiff to handle mismatching entries (Bug: 72731506)
|
||||
if include_recovery_dtbo or include_recovery_acpio:
|
||||
diff_program = ["bsdiff"]
|
||||
bonus_args = ""
|
||||
assert not os.path.exists(path)
|
||||
|
|
|
@ -83,9 +83,8 @@ Usage: sign_target_files_apks [flags] input_target_files output_target_files
|
|||
|
||||
--replace_verity_public_key <key>
|
||||
Replace the certificate (public key) used for verity verification. The
|
||||
key file replaces the one at BOOT/RAMDISK/verity_key (or ROOT/verity_key
|
||||
for devices using system_root_image). It expects the key filename WITH
|
||||
the extension (e.g. verity_key.pub).
|
||||
key file replaces the one at BOOT/RAMDISK/verity_key. It expects the key
|
||||
filename WITH the extension (e.g. verity_key.pub).
|
||||
|
||||
--replace_verity_keyid <path_to_X509_PEM_cert_file>
|
||||
Replace the veritykeyid in BOOT/cmdline of input_target_file_zip
|
||||
|
@ -555,8 +554,6 @@ def ProcessTargetFiles(input_tf_zip, output_tf_zip, misc_info,
|
|||
# Sets this to zero for targets without APK files, e.g., gki_arm64.
|
||||
maxsize = 0
|
||||
|
||||
system_root_image = misc_info.get("system_root_image") == "true"
|
||||
|
||||
for info in input_tf_zip.infolist():
|
||||
filename = info.filename
|
||||
if filename.startswith("IMAGES/"):
|
||||
|
|
|
@ -99,11 +99,10 @@ class BuildImageTest(test_utils.ReleaseToolsTestCase):
|
|||
}
|
||||
self.assertRaises(BuildImageError, CheckHeadroom, ext4fs_output, prop_dict)
|
||||
|
||||
def test_SetUpInDirAndFsConfig_SystemRootImageTrue_NonSystem(self):
|
||||
def test_SetUpInDirAndFsConfig_NonSystem(self):
|
||||
prop_dict = {
|
||||
'fs_config': 'fs-config',
|
||||
'mount_point': 'vendor',
|
||||
'system_root_image': 'true',
|
||||
}
|
||||
in_dir, fs_config = SetUpInDirAndFsConfig('/path/to/in_dir', prop_dict)
|
||||
self.assertEqual('/path/to/in_dir', in_dir)
|
||||
|
|
|
@ -1348,7 +1348,6 @@ class CommonUtilsTest(test_utils.ReleaseToolsTestCase):
|
|||
INFO_DICT_DEFAULT = {
|
||||
'recovery_api_version': 3,
|
||||
'fstab_version': 2,
|
||||
'system_root_image': 'true',
|
||||
'no_recovery': 'true',
|
||||
'recovery_as_boot': 'true',
|
||||
}
|
||||
|
@ -1377,14 +1376,8 @@ class CommonUtilsTest(test_utils.ReleaseToolsTestCase):
|
|||
info_values = ''.join(
|
||||
['{}={}\n'.format(k, v) for k, v in sorted(info_dict.items())])
|
||||
common.ZipWriteStr(target_files_zip, 'META/misc_info.txt', info_values)
|
||||
|
||||
FSTAB_TEMPLATE = "/dev/block/system {} ext4 ro,barrier=1 defaults"
|
||||
if info_dict.get('system_root_image') == 'true':
|
||||
fstab_values = FSTAB_TEMPLATE.format('/')
|
||||
else:
|
||||
fstab_values = FSTAB_TEMPLATE.format('/system')
|
||||
common.ZipWriteStr(target_files_zip, fstab_path, fstab_values)
|
||||
|
||||
common.ZipWriteStr(target_files_zip, fstab_path,
|
||||
"/dev/block/system /system ext4 ro,barrier=1 defaults")
|
||||
common.ZipWriteStr(
|
||||
target_files_zip, 'META/file_contexts', 'file-contexts')
|
||||
return target_files
|
||||
|
@ -1397,7 +1390,6 @@ class CommonUtilsTest(test_utils.ReleaseToolsTestCase):
|
|||
loaded_dict = common.LoadInfoDict(target_files_zip)
|
||||
self.assertEqual(3, loaded_dict['recovery_api_version'])
|
||||
self.assertEqual(2, loaded_dict['fstab_version'])
|
||||
self.assertIn('/', loaded_dict['fstab'])
|
||||
self.assertIn('/system', loaded_dict['fstab'])
|
||||
|
||||
def test_LoadInfoDict_legacyRecoveryFstabPath(self):
|
||||
|
@ -1408,7 +1400,6 @@ class CommonUtilsTest(test_utils.ReleaseToolsTestCase):
|
|||
loaded_dict = common.LoadInfoDict(target_files_zip)
|
||||
self.assertEqual(3, loaded_dict['recovery_api_version'])
|
||||
self.assertEqual(2, loaded_dict['fstab_version'])
|
||||
self.assertIn('/', loaded_dict['fstab'])
|
||||
self.assertIn('/system', loaded_dict['fstab'])
|
||||
|
||||
@test_utils.SkipIfExternalToolsUnavailable()
|
||||
|
@ -1420,7 +1411,6 @@ class CommonUtilsTest(test_utils.ReleaseToolsTestCase):
|
|||
loaded_dict = common.LoadInfoDict(unzipped)
|
||||
self.assertEqual(3, loaded_dict['recovery_api_version'])
|
||||
self.assertEqual(2, loaded_dict['fstab_version'])
|
||||
self.assertIn('/', loaded_dict['fstab'])
|
||||
self.assertIn('/system', loaded_dict['fstab'])
|
||||
|
||||
@test_utils.SkipIfExternalToolsUnavailable()
|
||||
|
@ -1432,15 +1422,11 @@ class CommonUtilsTest(test_utils.ReleaseToolsTestCase):
|
|||
loaded_dict = common.LoadInfoDict(unzipped)
|
||||
self.assertEqual(3, loaded_dict['recovery_api_version'])
|
||||
self.assertEqual(2, loaded_dict['fstab_version'])
|
||||
self.assertIn('/', loaded_dict['fstab'])
|
||||
self.assertIn('/system', loaded_dict['fstab'])
|
||||
|
||||
def test_LoadInfoDict_systemRootImageFalse(self):
|
||||
# Devices not using system-as-root nor recovery-as-boot. Non-A/B devices
|
||||
# launched prior to P will likely have this config.
|
||||
def test_LoadInfoDict_recoveryAsBootFalse(self):
|
||||
info_dict = copy.copy(self.INFO_DICT_DEFAULT)
|
||||
del info_dict['no_recovery']
|
||||
del info_dict['system_root_image']
|
||||
del info_dict['recovery_as_boot']
|
||||
target_files = self._test_LoadInfoDict_createTargetFiles(
|
||||
info_dict,
|
||||
|
@ -1452,22 +1438,6 @@ class CommonUtilsTest(test_utils.ReleaseToolsTestCase):
|
|||
self.assertNotIn('/', loaded_dict['fstab'])
|
||||
self.assertIn('/system', loaded_dict['fstab'])
|
||||
|
||||
def test_LoadInfoDict_recoveryAsBootFalse(self):
|
||||
# Devices using system-as-root, but with standalone recovery image. Non-A/B
|
||||
# devices launched since P will likely have this config.
|
||||
info_dict = copy.copy(self.INFO_DICT_DEFAULT)
|
||||
del info_dict['no_recovery']
|
||||
del info_dict['recovery_as_boot']
|
||||
target_files = self._test_LoadInfoDict_createTargetFiles(
|
||||
info_dict,
|
||||
'RECOVERY/RAMDISK/system/etc/recovery.fstab')
|
||||
with zipfile.ZipFile(target_files, 'r', allowZip64=True) as target_files_zip:
|
||||
loaded_dict = common.LoadInfoDict(target_files_zip)
|
||||
self.assertEqual(3, loaded_dict['recovery_api_version'])
|
||||
self.assertEqual(2, loaded_dict['fstab_version'])
|
||||
self.assertIn('/', loaded_dict['fstab'])
|
||||
self.assertIn('/system', loaded_dict['fstab'])
|
||||
|
||||
def test_LoadInfoDict_noRecoveryTrue(self):
|
||||
# Device doesn't have a recovery partition at all.
|
||||
info_dict = copy.copy(self.INFO_DICT_DEFAULT)
|
||||
|
@ -1499,7 +1469,6 @@ class CommonUtilsTest(test_utils.ReleaseToolsTestCase):
|
|||
loaded_dict = common.LoadInfoDict(unzipped, True)
|
||||
self.assertEqual(3, loaded_dict['recovery_api_version'])
|
||||
self.assertEqual(2, loaded_dict['fstab_version'])
|
||||
self.assertIn('/', loaded_dict['fstab'])
|
||||
self.assertIn('/system', loaded_dict['fstab'])
|
||||
self.assertEqual(
|
||||
os.path.join(unzipped, 'ROOT'), loaded_dict['root_dir'])
|
||||
|
|
|
@ -156,7 +156,6 @@ class ValidateTargetFilesTest(test_utils.ReleaseToolsTestCase):
|
|||
verity_key_mincrypt)
|
||||
|
||||
info_dict = {
|
||||
'system_root_image' : 'true',
|
||||
'verity' : 'true',
|
||||
}
|
||||
options = {
|
||||
|
|
|
@ -361,18 +361,15 @@ def ValidateVerifiedBootImages(input_tmp, info_dict, options):
|
|||
"Mismatching mincrypt verity key files"
|
||||
logging.info('Verified the content of /verity_key')
|
||||
|
||||
# For devices with a separate ramdisk (i.e. non-system-as-root), there must
|
||||
# be a copy in ramdisk.
|
||||
if info_dict.get("system_root_image") != "true":
|
||||
verity_key_ramdisk = os.path.join(
|
||||
input_tmp, 'BOOT', 'RAMDISK', 'verity_key')
|
||||
assert os.path.exists(
|
||||
verity_key_ramdisk), 'Missing verity_key in ramdisk'
|
||||
verity_key_ramdisk = os.path.join(
|
||||
input_tmp, 'BOOT', 'RAMDISK', 'verity_key')
|
||||
assert os.path.exists(
|
||||
verity_key_ramdisk), 'Missing verity_key in ramdisk'
|
||||
|
||||
assert filecmp.cmp(
|
||||
verity_key_mincrypt, verity_key_ramdisk, shallow=False), \
|
||||
'Mismatching verity_key files in root and ramdisk'
|
||||
logging.info('Verified the content of /verity_key in ramdisk')
|
||||
assert filecmp.cmp(
|
||||
verity_key_mincrypt, verity_key_ramdisk, shallow=False), \
|
||||
'Mismatching verity_key files in root and ramdisk'
|
||||
logging.info('Verified the content of /verity_key in ramdisk')
|
||||
|
||||
# Then verify the verity signed system/vendor/product images, against the
|
||||
# verity pubkey in mincrypt format.
|
||||
|
|
Loading…
Reference in a new issue