mirror of
https://github.com/bkerler/edl.git
synced 2024-11-24 08:27:58 -05:00
fix setactiveslot
This commit is contained in:
parent
bd36481568
commit
69d9a7e772
2 changed files with 18 additions and 13 deletions
|
@ -1303,19 +1303,24 @@ class firehose(metaclass=LogBase):
|
|||
return None
|
||||
|
||||
def cmd_setactiveslot(self, slot: str):
|
||||
def cmd_patch_multiple(lun, start_sector_patch, byte_offset_patch, headeroffset, pdata, header):
|
||||
offset = 0
|
||||
def cmd_patch_multiple(lun, start_sector_patch, byte_offset_patch, headeroffset, pdata, header):
|
||||
offset = 0
|
||||
header_size = len(header)
|
||||
pdata_size = len(pdata)
|
||||
write_size = pdata_size # with assumption pdata_size > header_size
|
||||
patch_subset_size = 4
|
||||
for i in range(0, write_size, patch_subset_size):
|
||||
pdata_subset = int(unpack("<I", pdata[offset:offset+patch_subset_size])[0])
|
||||
self.cmd_patch(lun, start_sector_patch, byte_offset_patch, pdata_subset, patch_subset_size, True)
|
||||
size_each_patch = 4
|
||||
write_size = len(pdata)
|
||||
for i in range(0, write_size, size_each_patch):
|
||||
pdata_subset = int(unpack("<I", pdata[offset:offset+size_each_patch])[0])
|
||||
self.cmd_patch( lun, start_sector_patch, \
|
||||
byte_offset_patch + offset, \
|
||||
pdata_subset, \
|
||||
size_each_patch, True)
|
||||
if i < header_size:
|
||||
header_subset = int(unpack("<I", header[offset:offset+patch_subset_size])[0])
|
||||
self.cmd_patch(lun, headeroffset, 0, header_subset, patch_subset_size, True)
|
||||
offset += patch_subset_size
|
||||
header_subset = int(unpack("<I", header[offset:offset+size_each_patch])[0])
|
||||
self.cmd_patch(lun, headeroffset, \
|
||||
offset, \
|
||||
header_subset, \
|
||||
size_each_patch, True)
|
||||
offset += size_each_patch
|
||||
return True
|
||||
|
||||
if slot.lower() not in ["a", "b"]:
|
||||
|
|
|
@ -224,7 +224,7 @@ class gpt(metaclass=LogBase):
|
|||
self.name = sh.string(72)
|
||||
|
||||
def create(self):
|
||||
val = pack("16s16sQQQ72s", self.type, self.unique, self.first_lba, self.last_lba, self.flags, self.name)
|
||||
val = pack("<16s16sQQQ72s", self.type, self.unique, self.first_lba, self.last_lba, self.flags, self.name)
|
||||
return val
|
||||
|
||||
class efi_type(Enum):
|
||||
|
@ -498,7 +498,7 @@ class gpt(metaclass=LogBase):
|
|||
if active:
|
||||
flags |= AB_PARTITION_ATTR_SLOT_ACTIVE << (AB_FLAG_OFFSET*8)
|
||||
else:
|
||||
flags |= AB_PARTITION_ATTR_UNBOOTABLE << (AB_FLAG_OFFSET*8)
|
||||
flags &= AB_PARTITION_ATTR_UNBOOTABLE << (AB_FLAG_OFFSET*8)
|
||||
partentry.flags = flags
|
||||
pdata = partentry.create()
|
||||
return pdata, partition.entryoffset
|
||||
|
|
Loading…
Reference in a new issue