summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorqctecmdr <qctecmdr@localhost>2021-09-15 22:33:58 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2021-09-15 22:33:58 -0700
commit6cc2c7c32777707e4fa82baf0ea75677a57a76f4 (patch)
tree0183710223c34af4b5046d6ffd0214f1f47ad042
parent220a7d84a99b5db076748e9d12ee7d1a55444d7d (diff)
parent54557a53c94e4e437b90be5b7b1fcf946ca9def3 (diff)
Merge "dm-verity: Change global variable to compiler flag"
-rw-r--r--QcomModulePkg/Library/BootLib/LECmdLine.c43
-rw-r--r--QcomModulePkg/Library/BootLib/LECmdLine.h9
-rw-r--r--QcomModulePkg/Library/BootLib/UpdateCmdLine.c2
-rwxr-xr-xQcomModulePkg/QcomModulePkg.dsc3
-rw-r--r--makefile1
5 files changed, 23 insertions, 35 deletions
diff --git a/QcomModulePkg/Library/BootLib/LECmdLine.c b/QcomModulePkg/Library/BootLib/LECmdLine.c
index 221c6f4ea6..63e9ad7ab5 100644
--- a/QcomModulePkg/Library/BootLib/LECmdLine.c
+++ b/QcomModulePkg/Library/BootLib/LECmdLine.c
@@ -55,26 +55,26 @@ STATIC CONST CHAR8 *FecRoot = "fec_roots";
STATIC CONST CHAR8 *FecBlock = "fec_blocks";
STATIC CONST CHAR8 *FecStart = "fec_start";
-STATIC BOOLEAN LEVerityNandIgnore;
-
#define FEATUREARGS 10
#if VERITY_LE
BOOLEAN IsLEVerity (VOID)
{
return TRUE;
}
-
-BOOLEAN IsLEVerityNandIgnore (VOID)
-{
- return LEVerityNandIgnore;
-}
#else
BOOLEAN IsLEVerity (VOID)
{
return FALSE;
}
+#endif
-BOOLEAN IsLEVerityNandIgnore (VOID)
+#if VERITY_LE_USE_EXT4_GLUEBI
+BOOLEAN IsLEVerityUseExt4Gluebi (VOID)
+{
+ return TRUE;
+}
+#else
+BOOLEAN IsLEVerityUseExt4Gluebi (VOID)
{
return FALSE;
}
@@ -159,14 +159,11 @@ GetLEVerityCmdLine (CONST CHAR8 *SourceCmdLine,
INT32 HashSize = 0;
CHAR8 *Hash = NULL;
CHAR8 *FecOff = NULL;
- CHAR8 *NandIgnore = NULL;
CHAR8 *DMDataStr = NULL;
BOOLEAN MultiSlotBoot = FALSE;
CHAR16 PartitionName[MAX_GPT_NAME_SIZE];
INT32 Index = 0;
- LEVerityNandIgnore = FALSE;
-
/* Get verity command line from SourceCmdLine */
DMDataStr = AsciiStrStr (SourceCmdLine, "verity=");
@@ -232,21 +229,6 @@ GetLEVerityCmdLine (CONST CHAR8 *SourceCmdLine,
DEBUG ((EFI_D_ERROR, "GetLEVerityCmdLine: Fec Offset error \n"));
goto ErrLEVerityout;
}
- DMDataStr += Length;
-
- NandIgnore = AllocateZeroPool (sizeof (CHAR8) * MAX_VERITY_NAND_IGNORE_LEN);
- if (!NandIgnore) {
- DEBUG ((EFI_D_ERROR, "Failed to allocate memory for NandIgnore\n"));
- Status = EFI_OUT_OF_RESOURCES;
- goto ErrLEVerityout;
- }
-
- Status = LEVerityWordnCpy ((CHAR8 *) &NandIgnore[0],
- MAX_VERITY_NAND_IGNORE_LEN, DMDataStr, &Length);
- if (Status != EFI_SUCCESS) {
- DEBUG ((EFI_D_ERROR, "GetLEVerityCmdLine: Nand Ignore error \n"));
- goto ErrLEVerityout;
- }
/* Get HashSize which is always greater by 8 bytes to DataSize */
HashSize = AsciiStrDecimalToUintn ((CHAR8 *) &DataSize[0]) + 8;
@@ -283,12 +265,11 @@ GetLEVerityCmdLine (CONST CHAR8 *SourceCmdLine,
GetRootDeviceType (RootDevStr, BOOT_DEV_NAME_SIZE_MAX);
if (!AsciiStrCmp ("NAND", RootDevStr)) {
/*
- * If Nand Ignore flag set, do not append verity cmdline parameters.
+ * Only append verity command line parameters if using gluebi
* This is to support a use case where same boot image may be used
* by emmc and nand but nand does not support read-only limitations
*/
- if (!AsciiStrCmp ("1", NandIgnore)) {
- LEVerityNandIgnore = TRUE;
+ if (!IsLEVerityUseExt4Gluebi ()) {
*LEVerityCmdLine = AllocateZeroPool (1);
if (!*LEVerityCmdLine) {
DEBUG ((EFI_D_ERROR, "LEVerityCmdLine buffer: Out of resources\n"));
@@ -377,10 +358,6 @@ ErrLEVerityout:
FreePool (FecOff);
FecOff = NULL;
}
- if (NandIgnore != NULL) {
- FreePool (NandIgnore);
- NandIgnore = NULL;
- }
if (DMTemp != NULL) {
FreePool (DMTemp);
DMTemp = NULL;
diff --git a/QcomModulePkg/Library/BootLib/LECmdLine.h b/QcomModulePkg/Library/BootLib/LECmdLine.h
index 14f77893de..8a192c8cd7 100644
--- a/QcomModulePkg/Library/BootLib/LECmdLine.h
+++ b/QcomModulePkg/Library/BootLib/LECmdLine.h
@@ -56,6 +56,13 @@ GetLEVerityCmdLine (CONST CHAR8 *SourceCmdLine,
**/
BOOLEAN IsLEVerity (VOID);
-BOOLEAN IsLEVerityNandIgnore (VOID);
+/**
+ This function checks if VERITY_LE_USE_EXT4_GLUEBI is defined or not.
+ @param[in] VOID VOID
+ @retval TRUE If VERITY_LE_USE_EXT4_GLUEBI is defined.
+ @retval FALSE If VERITY_LE_USE_EXT4_GLUEBI is not defined.
+ **/
+
+BOOLEAN IsLEVerityUseExt4Gluebi (VOID);
#endif
diff --git a/QcomModulePkg/Library/BootLib/UpdateCmdLine.c b/QcomModulePkg/Library/BootLib/UpdateCmdLine.c
index 2829861a48..746ff6e8ea 100644
--- a/QcomModulePkg/Library/BootLib/UpdateCmdLine.c
+++ b/QcomModulePkg/Library/BootLib/UpdateCmdLine.c
@@ -379,7 +379,7 @@ GetSystemPath (CHAR8 **SysPath, BootInfo *Info)
} else {
if (IsLEVerity () &&
!Info->BootIntoRecovery &&
- !IsLEVerityNandIgnore ()) {
+ IsLEVerityUseExt4Gluebi ()) {
AsciiSPrint (*SysPath, MAX_PATH_SIZE,
" rootfstype=ext4 ubi.mtd=%d ubi.block=0,0 root=/dev/dm-0",
(Index - 1));
diff --git a/QcomModulePkg/QcomModulePkg.dsc b/QcomModulePkg/QcomModulePkg.dsc
index e566fd61cb..31b38708bb 100755
--- a/QcomModulePkg/QcomModulePkg.dsc
+++ b/QcomModulePkg/QcomModulePkg.dsc
@@ -111,6 +111,9 @@
!if $(VERITY_LE)
GCC:*_*_*_CC_FLAGS = -DVERITY_LE
!endif
+ !if $(VERITY_LE_USE_EXT4_GLUEBI)
+ GCC:*_*_*_CC_FLAGS = -DVERITY_LE_USE_EXT4_GLUEBI
+ !endif
!if $(USER_BUILD_VARIANT) == 0
GCC:*_*_*_CC_FLAGS = -DENABLE_UPDATE_PARTITIONS_CMDS -DENABLE_BOOT_CMD -DENABLE_DEVICE_CRITICAL_LOCK_UNLOCK_CMDS
!else
diff --git a/makefile b/makefile
index 880aa60219..006a97eb34 100644
--- a/makefile
+++ b/makefile
@@ -140,6 +140,7 @@ ABL_FV_IMG: EDK_TOOLS_BIN
-D AB_RETRYCOUNT_DISABLE=$(AB_RETRYCOUNT_DISABLE) \
-D TARGET_BOARD_TYPE_AUTO=$(TARGET_BOARD_TYPE_AUTO) \
-D VERITY_LE=$(VERITY_LE) \
+ -D VERITY_LE_USE_EXT4_GLUEBI=$(VERITY_LE_USE_EXT4_GLUEBI) \
-D USER_BUILD_VARIANT=$(USER_BUILD_VARIANT) \
-D DISABLE_PARALLEL_DOWNLOAD_FLASH=$(DISABLE_PARALLEL_DOWNLOAD_FLASH) \
-D ENABLE_LE_VARIANT=$(ENABLE_LE_VARIANT) \