]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/GenFv/GenFv.c
Sync BaseTools Branch (version r2362) to EDKII main trunk.
[mirror_edk2.git] / BaseTools / Source / C / GenFv / GenFv.c
index 8f452c7374f6765a58daabc10316312937d3b2ea..fa86d009da28a831eb52d1b6a1ad8d8973aae617 100644 (file)
@@ -124,6 +124,11 @@ Returns:
                         Address is the rebase start address for drivers that\n\\r
                         run in Flash. It supports DEC or HEX digital format.\n\\r
                         If it is set to zero, no rebase action will be taken\n");\r
+  fprintf (stdout, "  -F ForceRebase, --force-rebase ForceRebase\n\\r
+                        If value is TRUE, will always take rebase action\n\\r
+                        If value is FALSE, will always not take reabse action\n\\r
+                        If not specified, will take rebase action if rebase address greater than zero, \n\\r
+                        will not take rebase action if rebase address is zero.\n");\r
   fprintf (stdout, "  -a AddressFile, --addrfile AddressFile\n\\r
                         AddressFile is one file used to record the child\n\\r
                         FV base address when current FV base address is set.\n");\r
@@ -231,6 +236,7 @@ Returns:
   // Set the default FvGuid\r
   //\r
   memcpy (&mFvDataInfo.FvFileSystemGuid, &mEfiFirmwareFileSystem2Guid, sizeof (EFI_GUID));\r
+  mFvDataInfo.ForceRebase = -1;\r
    \r
   //\r
   // Parse command line\r
@@ -330,7 +336,7 @@ Returns:
       continue; \r
     }\r
 \r
-    if ((stricmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--ffsfile") == 0)) {\r
+    if ((strcmp (argv[0], "-f") == 0) || (stricmp (argv[0], "--ffsfile") == 0)) {\r
       if (argv[1] == NULL) {\r
         Error (NULL, 0, 1003, "Invalid option value", "Input Ffsfile can't be null");\r
         return STATUS_ERROR;\r
@@ -372,6 +378,26 @@ Returns:
       argv ++;\r
       continue; \r
     }\r
+  \r
+    if ((strcmp (argv[0], "-F") == 0) || (stricmp (argv[0], "--force-rebase") == 0)) {\r
+      if (argv[1] == NULL) {\r
+        Error (NULL, 0, 1003, "Invalid option value", "Froce rebase flag can't be null");\r
+        return STATUS_ERROR;\r
+      }\r
+\r
+      if (stricmp (argv[1], "TRUE") == 0) {\r
+        mFvDataInfo.ForceRebase = 1;\r
+      } else if (stricmp (argv[1], "FALSE") == 0) {\r
+        mFvDataInfo.ForceRebase = 0;\r
+      } else {\r
+        Error (NULL, 0, 1003, "Invalid option value", "froce rebase flag value must be \"TRUE\" or \"FALSE\"");\r
+        return STATUS_ERROR;\r
+      }\r
+\r
+      argc -= 2;\r
+      argv += 2;\r
+      continue; \r
+    } \r
 \r
     if (stricmp (argv[0], "--capheadsize") == 0) {\r
       //\r
@@ -597,7 +623,12 @@ Returns:
               );\r
   } else {\r
     VerboseMsg ("Create Fv image and its map file");\r
-    if (mFvDataInfo.BaseAddress != 0) {\r
+    //\r
+    // Will take rebase action at below situation:\r
+    // 1. ForceRebase Flag specified to TRUE;\r
+    // 2. ForceRebase Flag not specified, BaseAddress greater than zero.\r
+    //\r
+    if (((mFvDataInfo.BaseAddress > 0) && (mFvDataInfo.ForceRebase == -1)) || (mFvDataInfo.ForceRebase == 1)) {\r
       VerboseMsg ("FvImage Rebase Address is 0x%llX", (unsigned long long) mFvDataInfo.BaseAddress);\r
     }\r
     //\r