add a command line option("-leaveversion") to GenFw to retain the version 
information in application .EFI files.



Cc: M: Yonghong Zhu <[email protected]>

       M: Liming Gao <[email protected]>

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Thompson, James J <[email protected]>

---
diff --git a/BaseTools/Source/C/GenFw/GenFw.c b/BaseTools/Source/C/GenFw/GenFw.c
index 4756c52..eea131f 100644
--- a/BaseTools/Source/C/GenFw/GenFw.c
+++ b/BaseTools/Source/C/GenFw/GenFw.c
@@ -1078,6 +1078,7 @@ Returns:
   UNWIND_INFO                      *UnwindInfo;
   STATUS                           Status;
   BOOLEAN                          ReplaceFlag;
+  BOOLEAN                          LeaveVersionFlag;
   BOOLEAN                          KeepExceptionTableFlag;
   BOOLEAN                          KeepZeroPendingFlag;
   UINT64                           LogLevel;
@@ -1140,6 +1141,7 @@ Returns:
   InputFileLength   = 0;
   Optional32        = NULL;
   Optional64        = NULL;
+  LeaveVersionFlag  = FALSE;
   KeepExceptionTableFlag = FALSE;
   KeepZeroPendingFlag    = FALSE;
   NumberOfFormPacakge    = 0;
@@ -1262,7 +1264,14 @@ Returns:
       continue;
     }
-    if (stricmp (argv[0], "--keepexceptiontable") == 0) {
+             if (stricmp(argv[0], "--leaveversion") == 0) {
+                             LeaveVersionFlag = TRUE;
+                             argc--;
+                             argv++;
+                             continue;
+             }
+
+             if (stricmp(argv[0], "--keepexceptiontable") == 0) {
       KeepExceptionTableFlag = TRUE;
       argc --;
       argv ++;
@@ -2397,8 +2406,10 @@ Returns:
     Optional64 = (EFI_IMAGE_OPTIONAL_HEADER64 *)&PeHdr->Pe32.OptionalHeader;
     Optional64->MajorOperatingSystemVersion = 0;
     Optional64->MinorOperatingSystemVersion = 0;
-    Optional64->MajorImageVersion           = 0;
-    Optional64->MinorImageVersion           = 0;
+             if (!LeaveVersionFlag) {
+                             Optional64->MajorImageVersion = 0;
+                             Optional64->MinorImageVersion = 0;
+             }
     Optional64->MajorSubsystemVersion       = 0;
     Optional64->MinorSubsystemVersion       = 0;
     Optional64->Win32VersionValue           = 0;
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to