Merge changes from topic "nonab_on_vab_r" into rvc-dev am: 4d8e9cc847
Change-Id: I18ae2cc04e6edad5498fdc0c2de6f5a163d10c82
This commit is contained in:
@@ -2673,11 +2673,12 @@ class BlockDifference(object):
|
||||
self.device = 'map_partition("%s")' % partition
|
||||
else:
|
||||
if OPTIONS.source_info_dict is None:
|
||||
_, device_path = GetTypeAndDevice("/" + partition, OPTIONS.info_dict)
|
||||
_, device_expr = GetTypeAndDeviceExpr("/" + partition,
|
||||
OPTIONS.info_dict)
|
||||
else:
|
||||
_, device_path = GetTypeAndDevice("/" + partition,
|
||||
OPTIONS.source_info_dict)
|
||||
self.device = '"%s"' % device_path
|
||||
_, device_expr = GetTypeAndDeviceExpr("/" + partition,
|
||||
OPTIONS.source_info_dict)
|
||||
self.device = device_expr
|
||||
|
||||
@property
|
||||
def required_cache(self):
|
||||
@@ -2909,16 +2910,51 @@ PARTITION_TYPES = {
|
||||
"squashfs": "EMMC"
|
||||
}
|
||||
|
||||
|
||||
def GetTypeAndDevice(mount_point, info):
|
||||
def GetTypeAndDevice(mount_point, info, check_no_slot=True):
|
||||
"""
|
||||
Use GetTypeAndDeviceExpr whenever possible. This function is kept for
|
||||
backwards compatibility. It aborts if the fstab entry has slotselect option
|
||||
(unless check_no_slot is explicitly set to False).
|
||||
"""
|
||||
fstab = info["fstab"]
|
||||
if fstab:
|
||||
if check_no_slot:
|
||||
assert not fstab[mount_point].slotselect, \
|
||||
"Use GetTypeAndDeviceExpr instead"
|
||||
return (PARTITION_TYPES[fstab[mount_point].fs_type],
|
||||
fstab[mount_point].device)
|
||||
else:
|
||||
raise KeyError
|
||||
|
||||
|
||||
def GetTypeAndDeviceExpr(mount_point, info):
|
||||
"""
|
||||
Return the filesystem of the partition, and an edify expression that evaluates
|
||||
to the device at runtime.
|
||||
"""
|
||||
fstab = info["fstab"]
|
||||
if fstab:
|
||||
p = fstab[mount_point]
|
||||
device_expr = '"%s"' % fstab[mount_point].device
|
||||
if p.slotselect:
|
||||
device_expr = 'add_slot_suffix(%s)' % device_expr
|
||||
return (PARTITION_TYPES[fstab[mount_point].fs_type], device_expr)
|
||||
else:
|
||||
raise KeyError
|
||||
|
||||
|
||||
def GetEntryForDevice(fstab, device):
|
||||
"""
|
||||
Returns:
|
||||
The first entry in fstab whose device is the given value.
|
||||
"""
|
||||
if not fstab:
|
||||
return None
|
||||
for mount_point in fstab:
|
||||
if fstab[mount_point].device == device:
|
||||
return fstab[mount_point]
|
||||
return None
|
||||
|
||||
def ParseCertificate(data):
|
||||
"""Parses and converts a PEM-encoded certificate into DER-encoded.
|
||||
|
||||
@@ -3043,8 +3079,10 @@ def MakeRecoveryPatch(input_dir, output_sink, recovery_img, boot_img,
|
||||
try:
|
||||
# The following GetTypeAndDevice()s need to use the path in the target
|
||||
# info_dict instead of source_info_dict.
|
||||
boot_type, boot_device = GetTypeAndDevice("/boot", info_dict)
|
||||
recovery_type, recovery_device = GetTypeAndDevice("/recovery", info_dict)
|
||||
boot_type, boot_device = GetTypeAndDevice("/boot", info_dict,
|
||||
check_no_slot=False)
|
||||
recovery_type, recovery_device = GetTypeAndDevice("/recovery", info_dict,
|
||||
check_no_slot=False)
|
||||
except KeyError:
|
||||
return
|
||||
|
||||
@@ -3086,8 +3124,8 @@ fi
|
||||
'recovery_size': recovery_img.size,
|
||||
'recovery_sha1': recovery_img.sha1,
|
||||
'boot_type': boot_type,
|
||||
'boot_device': boot_device,
|
||||
'recovery_type': recovery_type,
|
||||
'boot_device': boot_device + '$(getprop ro.boot.slot_suffix)',
|
||||
'recovery_type': recovery_type + '$(getprop ro.boot.slot_suffix)',
|
||||
'recovery_device': recovery_device,
|
||||
'bonus_args': bonus_args}
|
||||
|
||||
|
Reference in New Issue
Block a user