summaryrefslogtreecommitdiff
path: root/BaseTools/Source/C/GenFv/GenFv.c
diff options
context:
space:
mode:
Diffstat (limited to 'BaseTools/Source/C/GenFv/GenFv.c')
-rw-r--r--BaseTools/Source/C/GenFv/GenFv.c35
1 files changed, 33 insertions, 2 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);
}
//