diff options
Diffstat (limited to 'BaseTools/Source/C/GenFv')
-rw-r--r-- | BaseTools/Source/C/GenFv/GenFv.c | 35 | ||||
-rw-r--r-- | BaseTools/Source/C/GenFv/GenFvInternalLib.c | 14 | ||||
-rw-r--r-- | BaseTools/Source/C/GenFv/GenFvInternalLib.h | 1 |
3 files changed, 46 insertions, 4 deletions
diff --git a/BaseTools/Source/C/GenFv/GenFv.c b/BaseTools/Source/C/GenFv/GenFv.c index 8f452c7374..fa86d009da 100644 --- a/BaseTools/Source/C/GenFv/GenFv.c +++ b/BaseTools/Source/C/GenFv/GenFv.c @@ -124,6 +124,11 @@ Returns: Address is the rebase start address for drivers that\n\
run in Flash. It supports DEC or HEX digital format.\n\
If it is set to zero, no rebase action will be taken\n");
+ fprintf (stdout, " -F ForceRebase, --force-rebase ForceRebase\n\
+ If value is TRUE, will always take rebase action\n\
+ If value is FALSE, will always not take reabse action\n\
+ If not specified, will take rebase action if rebase address greater than zero, \n\
+ will not take rebase action if rebase address is zero.\n");
fprintf (stdout, " -a AddressFile, --addrfile AddressFile\n\
AddressFile is one file used to record the child\n\
FV base address when current FV base address is set.\n");
@@ -231,6 +236,7 @@ Returns: // Set the default FvGuid
//
memcpy (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid, sizeof (EFI_GUID));
+ mFvDataInfo.ForceRebase = -1;
//
// Parse command line
@@ -330,7 +336,7 @@ Returns: continue;
}
- if ((stricmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--ffsfile") == 0)) {
+ if ((strcmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--ffsfile") == 0)) {
if (argv[1] == NULL) {
Error (NULL, 0, 1003, "Invalid option value", "Input Ffsfile can't be null");
return STATUS_ERROR;
@@ -372,6 +378,26 @@ Returns: argv ++;
continue;
}
+
+ if ((strcmp (argv[0], "-F") == 0) || (stricmp (argv[0], "--force-rebase") == 0)) {
+ if (argv[1] == NULL) {
+ Error (NULL, 0, 1003, "Invalid option value", "Froce rebase flag can't be null");
+ return STATUS_ERROR;
+ }
+
+ if (stricmp (argv[1], "TRUE") == 0) {
+ mFvDataInfo.ForceRebase = 1;
+ } else if (stricmp (argv[1], "FALSE") == 0) {
+ mFvDataInfo.ForceRebase = 0;
+ } else {
+ Error (NULL, 0, 1003, "Invalid option value", "froce rebase flag value must be \"TRUE\" or \"FALSE\"");
+ return STATUS_ERROR;
+ }
+
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
if (stricmp (argv[0], "--capheadsize") == 0) {
//
@@ -597,7 +623,12 @@ Returns: );
} else {
VerboseMsg ("Create Fv image and its map file");
- if (mFvDataInfo.BaseAddress != 0) {
+ //
+ // Will take rebase action at below situation:
+ // 1. ForceRebase Flag specified to TRUE;
+ // 2. ForceRebase Flag not specified, BaseAddress greater than zero.
+ //
+ if (((mFvDataInfo.BaseAddress > 0) && (mFvDataInfo.ForceRebase == -1)) || (mFvDataInfo.ForceRebase == 1)) {
VerboseMsg ("FvImage Rebase Address is 0x%llX", (unsigned long long) mFvDataInfo.BaseAddress);
}
//
diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.c b/BaseTools/Source/C/GenFv/GenFvInternalLib.c index d86909b4df..9fdcb47d6b 100644 --- a/BaseTools/Source/C/GenFv/GenFvInternalLib.c +++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.c @@ -209,6 +209,7 @@ Returns: DebugMsg (NULL, 0, 9, "rebase address", "%s = %s", EFI_FV_BASE_ADDRESS_STRING, Value);
FvInfo->BaseAddress = Value64;
+ FvInfo->BaseAddressSet = TRUE;
}
}
@@ -2826,11 +2827,20 @@ Returns: PeFileBuffer = NULL;
//
- // Don't need to relocate image when BaseAddress is not set.
+ // Don't need to relocate image when BaseAddress is zero and no ForceRebase Flag specified.
//
- if (FvInfo->BaseAddress == 0) {
+ if ((FvInfo->BaseAddress == 0) && (FvInfo->ForceRebase == -1)) {
return EFI_SUCCESS;
}
+
+ //
+ // If ForceRebase Flag specified to FALSE, will always not take rebase action.
+ //
+ if (FvInfo->ForceRebase == 0) {
+ return EFI_SUCCESS;
+ }
+
+
XipBase = FvInfo->BaseAddress + XipOffset;
//
diff --git a/BaseTools/Source/C/GenFv/GenFvInternalLib.h b/BaseTools/Source/C/GenFv/GenFvInternalLib.h index bc25ea8358..2629b9aee8 100644 --- a/BaseTools/Source/C/GenFv/GenFvInternalLib.h +++ b/BaseTools/Source/C/GenFv/GenFvInternalLib.h @@ -232,6 +232,7 @@ typedef struct { CHAR8 FvFiles[MAX_NUMBER_OF_FILES_IN_FV][_MAX_PATH];
UINT32 SizeofFvFiles[MAX_NUMBER_OF_FILES_IN_FV];
BOOLEAN IsPiFvImage;
+ INT8 ForceRebase;
} FV_INFO;
typedef struct {
|