Skip to content

Commit

Permalink
follow fastboot standard
Browse files Browse the repository at this point in the history
  • Loading branch information
bongbui321 committed Mar 21, 2024
1 parent d52d83b commit 7228c96
Showing 1 changed file with 7 additions and 4 deletions.
11 changes: 7 additions & 4 deletions edlclient/Library/firehose.py
Original file line number Diff line number Diff line change
Expand Up @@ -1326,18 +1326,21 @@ def cmd_patch_multiple(lun, start_sector, byte_offset, patch_data):
offset += size_each_patch
return True

# flags: 0x3a for inactive and 0x6f for inactive boot partition
def set_flags(flags, active, is_boot):
new_flags = flags
if active:
if is_boot:
new_flags |= (PART_ATT_PRIORITY_VAL | PART_ATT_ACTIVE_VAL | PART_ATT_MAX_RETRY_COUNT_VAL)
new_flags &= (~PART_ATT_SUCCESSFUL_VAL & ~PART_ATT_UNBOOTABLE_VAL)
#new_flags |= (PART_ATT_PRIORITY_VAL | PART_ATT_ACTIVE_VAL | PART_ATT_MAX_RETRY_COUNT_VAL)
#new_flags &= (~PART_ATT_SUCCESSFUL_VAL & ~PART_ATT_UNBOOTABLE_VAL)
new_flags = 0x6f << (AB_FLAG_OFFSET*8)
else:
new_flags |= AB_PARTITION_ATTR_SLOT_ACTIVE << (AB_FLAG_OFFSET*8)
else:
if is_boot:
new_flags &= (~PART_ATT_PRIORITY_VAL & ~PART_ATT_ACTIVE_VAL)
new_flags |= ((MAX_PRIORITY-1) << PART_ATT_PRIORITY_BIT)
#new_flags &= (~PART_ATT_PRIORITY_VAL & ~PART_ATT_ACTIVE_VAL)
#new_flags |= ((MAX_PRIORITY-1) << PART_ATT_PRIORITY_BIT)
new_flags = 0x3a << (AB_FLAG_OFFSET*8)
else:
new_flags &= ~(AB_PARTITION_ATTR_SLOT_ACTIVE << (AB_FLAG_OFFSET*8))
return new_flags
Expand Down

0 comments on commit 7228c96

Please sign in to comment.