Carl:
  Could you let me how you uses the version information in application .EFI 
file?

Thanks
Liming
From: Miller, Carl H [mailto:carl.mil...@pnnl.gov]
Sent: Wednesday, October 28, 2015 10:32 PM
To: edk2-devel@lists.01.org
Cc: Zhu, Yonghong; Gao, Liming
Subject: [PATCH] BaseTools/GenFw: add option to retain image version info


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



Cc: M: Yonghong Zhu <yonghong....@intel.com<mailto:yonghong....@intel.com>>

       M: Liming Gao <liming....@intel.com<mailto:liming....@intel.com>>

Contributed-under: TianoCore Contribution Agreement 1.0

Signed-off-by: Thompson, James J 
<james.thomp...@pnnl.gov<mailto:james.thomp...@pnnl.gov>>

---
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
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel

Reply via email to