Enable device to boot to secondary partition
Enable device to boot to secondary partition when
the primary partition is disabled in unlocked state.
Change-Id: I54ce4de55f86d48702e3a30c451a88dbbf99d03f
Acked-by: Jing Chen <chenjing@qti.qualcomm.com>
diff --git a/QcomModulePkg/Library/BootLib/PartitionTableUpdate.c b/QcomModulePkg/Library/BootLib/PartitionTableUpdate.c
index 624e8a9..12e75db 100644
--- a/QcomModulePkg/Library/BootLib/PartitionTableUpdate.c
+++ b/QcomModulePkg/Library/BootLib/PartitionTableUpdate.c
@@ -1241,6 +1241,27 @@
return EFI_LOAD_ERROR;
}
+EFI_STATUS ClearUnbootable()
+{
+ EFI_STATUS Status = EFI_SUCCESS;
+ Slot ActiveSlot = {{0}};
+ struct PartitionEntry *BootEntry = NULL;
+
+ Status = GetActiveSlot(&ActiveSlot);
+ if(Status != EFI_SUCCESS) {
+ DEBUG((EFI_D_ERROR, "ClearUnbootable: GetActiveSlot failed.\n"));
+ return Status;
+ }
+ BootEntry = GetBootPartitionEntry(&ActiveSlot);
+ if (BootEntry == NULL) {
+ DEBUG((EFI_D_ERROR, "ClearUnbootable: No boot partition entry for slot %s\n", ActiveSlot.Suffix));
+ return EFI_NOT_FOUND;
+ }
+ BootEntry->PartEntry.Attributes &= ~PART_ATT_UNBOOTABLE_VAL;
+ UpdatePartitionAttributes();
+ return EFI_SUCCESS;
+}
+
STATIC EFI_STATUS ValidateSlotGuids(Slot *BootableSlot)
{
EFI_STATUS Status = EFI_SUCCESS;