]> git.proxmox.com Git - mirror_edk2.git/blobdiff - BaseTools/Source/C/GenFv/GenFv.c
Sync BaseTool trunk (version r2610) into EDKII BaseTools.
[mirror_edk2.git] / BaseTools / Source / C / GenFv / GenFv.c
index 8f452c7374f6765a58daabc10316312937d3b2ea..8f837d2695f593ebaebd0dcc7184ee6e81704a74 100644 (file)
@@ -1,6 +1,6 @@
 /** @file\r
 \r
-Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.<BR>\r
+Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.<BR>\r
 This program and the accompanying materials                          \r
 are licensed and made available under the terms and conditions of the BSD License         \r
 which accompanies this distribution.  The full text of the license may be found at        \r
@@ -42,6 +42,7 @@ Abstract:
 #define UTILITY_MINOR_VERSION 1\r
 \r
 EFI_GUID  mEfiFirmwareFileSystem2Guid = EFI_FIRMWARE_FILE_SYSTEM2_GUID;\r
+EFI_GUID  mEfiFirmwareFileSystem3Guid = EFI_FIRMWARE_FILE_SYSTEM3_GUID;\r
 \r
 STATIC\r
 VOID \r
@@ -96,7 +97,7 @@ Returns:
   //\r
   // Copyright declaration\r
   // \r
-  fprintf (stdout, "Copyright (c) 2007 - 2010, Intel Corporation. All rights reserved.\n\n");\r
+  fprintf (stdout, "Copyright (c) 2007 - 2013, Intel Corporation. All rights reserved.\n\n");\r
 \r
   //\r
   // Details Option\r
@@ -124,6 +125,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
@@ -138,6 +144,8 @@ Returns:
                         Its format is xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx\n");\r
   fprintf (stdout, "  --capflag CapFlag     Capsule Reset Flag can be PersistAcrossReset,\n\\r
                         or PopulateSystemTable or InitiateReset or not set\n");\r
+  fprintf (stdout, "  --capoemflag CapOEMFlag\n\\r
+                        Capsule OEM Flag is an integer between 0x0000 and 0xffff\n");\r
   fprintf (stdout, "  --capheadsize HeadSize\n\\r
                         HeadSize is one HEX or DEC format value\n\\r
                         HeadSize is required by Capsule Image.\n");                        \r
@@ -231,6 +239,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 +339,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 +381,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
@@ -413,6 +442,22 @@ Returns:
       continue; \r
     }\r
 \r
+    if (stricmp (argv[0], "--capoemflag") == 0) {\r
+      if (argv[1] == NULL) {\r
+        Error (NULL, 0, 1003, "Invalid option value", "Capsule OEM flag can't be null");\r
+      }\r
+      Status = AsciiStringToUint64(argv[1], FALSE, &TempNumber);\r
+      if (EFI_ERROR (Status) || TempNumber > 0xffff) {\r
+        Error (NULL, 0, 1003, "Invalid option value", "Capsule OEM flag value must be integer value between 0x0000 and 0xffff");\r
+        return STATUS_ERROR;\r
+      }\r
+      mCapDataInfo.Flags |= TempNumber;\r
+      DebugMsg( NULL, 0, 9, "Capsule OEM Flags", argv[1]);\r
+      argc -= 2;\r
+      argv += 2;\r
+      continue;\r
+    }\r
+\r
     if (stricmp (argv[0], "--capguid") == 0) {\r
       //\r
       // Get the Capsule Guid\r
@@ -597,7 +642,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