QcommodulePkg: BootLib: do no decrement retry count on dev images
Dev images with custom userspace/ramdisk do not have slot successful
set, do not decrement retry count for such custom images.
Change-Id: Ia37e853b40b41bb62c766838d6a7efc4b37f4427
diff --git a/QcomModulePkg/Include/Library/BootLinux.h b/QcomModulePkg/Include/Library/BootLinux.h
index 9dda01d..0ae998b 100644
--- a/QcomModulePkg/Include/Library/BootLinux.h
+++ b/QcomModulePkg/Include/Library/BootLinux.h
@@ -110,4 +110,5 @@
BOOLEAN TargetBuildVariantUser();
EFI_STATUS GetImage(CONST BootInfo *Info, VOID**ImageBuffer, UINTN *ImageSize, CHAR8 *ImageName);
BOOLEAN LoadAndValidateDtboImg(BootInfo *Info, VOID** DtboImgBuffer);
+BOOLEAN IsBootDevImage();
#endif
diff --git a/QcomModulePkg/Library/BootLib/BootLinux.c b/QcomModulePkg/Library/BootLib/BootLinux.c
index e37107a..a041ca8 100644
--- a/QcomModulePkg/Library/BootLib/BootLinux.c
+++ b/QcomModulePkg/Library/BootLib/BootLinux.c
@@ -47,6 +47,7 @@
STATIC QCOM_SCM_MODE_SWITCH_PROTOCOL *pQcomScmModeSwitchProtocol = NULL;
+STATIC BOOLEAN BootDevImage;
STATIC EFI_STATUS SwitchTo32bitModeBooting(UINT64 KernelLoadAddr, UINT64 DeviceTreeLoadAddr) {
EFI_STATUS Status;
@@ -277,6 +278,9 @@
*Called before ShutdownUefiBootServices as it uses some boot service functions*/
CmdLine[BOOT_ARGS_SIZE-1] = '\0';
+ if (AsciiStrStr(CmdLine, "root="))
+ BootDevImage = TRUE;
+
Status = UpdateCmdLine(CmdLine, FfbmStr, Recovery, AlarmBoot, Info->VBCmdLine, &FinalCmdLine);
if (EFI_ERROR(Status))
{
@@ -657,3 +661,8 @@
return FALSE;
}
#endif
+
+BOOLEAN IsBootDevImage()
+{
+ return BootDevImage;
+}
diff --git a/QcomModulePkg/Library/BootLib/PartitionTableUpdate.c b/QcomModulePkg/Library/BootLib/PartitionTableUpdate.c
index 452170e..268a42f 100644
--- a/QcomModulePkg/Library/BootLib/PartitionTableUpdate.c
+++ b/QcomModulePkg/Library/BootLib/PartitionTableUpdate.c
@@ -1332,14 +1332,16 @@
DEBUG((EFI_D_VERBOSE, "Active Slot %s is bootable\n",
BootableSlot->Suffix));
} else if (Unbootable == 0 && BootSuccess == 0 && RetryCount > 0) {
- RetryCount--;
- BootEntry->PartEntry.Attributes &= ~PART_ATT_MAX_RETRY_COUNT_VAL;
- BootEntry->PartEntry.Attributes |=
- RetryCount << PART_ATT_MAX_RETRY_CNT_BIT;
- UpdatePartitionAttributes();
- DEBUG((EFI_D_INFO,
- "Active Slot %s is bootable, retry count %ld\n",
- BootableSlot->Suffix, RetryCount));
+ if (!IsBootDevImage()) {
+ RetryCount--;
+ BootEntry->PartEntry.Attributes &= ~PART_ATT_MAX_RETRY_COUNT_VAL;
+ BootEntry->PartEntry.Attributes |=
+ RetryCount << PART_ATT_MAX_RETRY_CNT_BIT;
+ UpdatePartitionAttributes();
+ DEBUG((EFI_D_INFO,
+ "Active Slot %s is bootable, retry count %ld\n",
+ BootableSlot->Suffix, RetryCount));
+ }
} else {
DEBUG((EFI_D_INFO,
"Slot %s is unbootable, trying alternate slot\n",
diff --git a/QcomModulePkg/Library/BootLib/UpdateCmdLine.c b/QcomModulePkg/Library/BootLib/UpdateCmdLine.c
index 66c6683..105300a 100644
--- a/QcomModulePkg/Library/BootLib/UpdateCmdLine.c
+++ b/QcomModulePkg/Library/BootLib/UpdateCmdLine.c
@@ -476,7 +476,7 @@
}
if (HaveCmdLine) {
- if (MultiSlotBoot && !AsciiStrStr(CmdLine, "root=")) {
+ if (MultiSlotBoot && !IsBootDevImage()) {
/* Slot suffix */
Src = AndroidSlotSuffix;
--Dst;