Revision: 19137
          http://sourceforge.net/p/edk2/code/19137
Author:   yzhu52
Date:     2015-12-07 08:29:10 +0000 (Mon, 07 Dec 2015)
Log Message:
-----------
BaseTools: Enhance GenFv Tool to report error message

When two vtf files in one FV image, no FV file can be generated, but it
report the stack trace info. so we enhance the tool to report error
message directly but not the stack trace info.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong....@intel.com>
Reviewed-by: Liming Gao <liming....@intel.com>

Modified Paths:
--------------
    trunk/edk2/BaseTools/Source/C/Include/Common/BuildVersion.h
    trunk/edk2/BaseTools/Source/Python/GenFds/Fv.py

Modified: trunk/edk2/BaseTools/Source/C/Include/Common/BuildVersion.h
===================================================================
--- trunk/edk2/BaseTools/Source/C/Include/Common/BuildVersion.h 2015-12-07 
08:27:53 UTC (rev 19136)
+++ trunk/edk2/BaseTools/Source/C/Include/Common/BuildVersion.h 2015-12-07 
08:29:10 UTC (rev 19137)
@@ -12,4 +12,4 @@
 
 **/
 
-#define __BUILD_VERSION ""
+#define __BUILD_VERSION "Build 99862"

Modified: trunk/edk2/BaseTools/Source/Python/GenFds/Fv.py
===================================================================
--- trunk/edk2/BaseTools/Source/Python/GenFds/Fv.py     2015-12-07 08:27:53 UTC 
(rev 19136)
+++ trunk/edk2/BaseTools/Source/Python/GenFds/Fv.py     2015-12-07 08:29:10 UTC 
(rev 19137)
@@ -181,30 +181,33 @@
         #
         # Write the Fv contents to Buffer
         #
-        FvFileObj = open ( FvOutputFile,'r+b')
+        if os.path.isfile(FvOutputFile):
+            FvFileObj = open ( FvOutputFile,'r+b')
 
-        GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s FV Successfully" 
%self.UiFvName)
-        GenFdsGlobalVariable.SharpCounter = 0
+            GenFdsGlobalVariable.VerboseLogger( "\nGenerate %s FV 
Successfully" %self.UiFvName)
+            GenFdsGlobalVariable.SharpCounter = 0
 
-        Buffer.write(FvFileObj.read())
-        FvFileObj.seek(0)
-        # PI FvHeader is 0x48 byte
-        FvHeaderBuffer = FvFileObj.read(0x48)
-        # FV alignment position.
-        FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F)
-        # FvAlignmentValue is larger than or equal to 1K
-        if FvAlignmentValue >= 0x400:
-            if FvAlignmentValue >= 0x10000:
-                #The max alignment supported by FFS is 64K.
-                self.FvAlignment = "64K"
+            Buffer.write(FvFileObj.read())
+            FvFileObj.seek(0)
+            # PI FvHeader is 0x48 byte
+            FvHeaderBuffer = FvFileObj.read(0x48)
+            # FV alignment position.
+            FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F)
+            # FvAlignmentValue is larger than or equal to 1K
+            if FvAlignmentValue >= 0x400:
+                if FvAlignmentValue >= 0x10000:
+                    #The max alignment supported by FFS is 64K.
+                    self.FvAlignment = "64K"
+                else:
+                    self.FvAlignment = str (FvAlignmentValue / 0x400) + "K"
             else:
-                self.FvAlignment = str (FvAlignmentValue / 0x400) + "K"
+                # FvAlignmentValue is less than 1K
+                self.FvAlignment = str (FvAlignmentValue)
+            FvFileObj.close()
+            GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
+            GenFdsGlobalVariable.LargeFileInFvFlags.pop()
         else:
-            # FvAlignmentValue is less than 1K
-            self.FvAlignment = str (FvAlignmentValue)
-        FvFileObj.close()
-        GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
-        GenFdsGlobalVariable.LargeFileInFvFlags.pop()
+            GenFdsGlobalVariable.ErrorLogger("Failed to generate %s FV file." 
%self.UiFvName)
         return FvOutputFile
 
     ## _GetBlockSize()


------------------------------------------------------------------------------
Go from Idea to Many App Stores Faster with Intel(R) XDK
Give your users amazing mobile app experiences with Intel(R) XDK.
Use one codebase in this all-in-one HTML5 development environment.
Design, debug & build mobile apps & 2D/3D high-impact games for multiple OSs.
http://pubads.g.doubleclick.net/gampad/clk?id=254741911&iu=/4140
_______________________________________________
edk2-commits mailing list
edk2-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/edk2-commits

Reply via email to