summaryrefslogtreecommitdiff
path: root/BaseTools/Source
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2015-12-18 06:46:23 +0000
committervanjeff <vanjeff@Edk2>2015-12-18 06:46:23 +0000
commit9ada9cb84cb0693d545a0286f940afaa79765e04 (patch)
tree7051d5273675a0a9f7a12d174f9e1e465740f272 /BaseTools/Source
parent5fbc2feda298235bd54b38a1e2838db01501aca3 (diff)
downloadedk2-platforms-9ada9cb84cb0693d545a0286f940afaa79765e04.tar.xz
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. (Sync patch r19137 from main trunk.) Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> Reviewed-by: Liming Gao <liming.gao@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/branches/UDK2015@19373 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source')
-rw-r--r--BaseTools/Source/C/Include/Common/BuildVersion.h2
-rw-r--r--BaseTools/Source/Python/GenFds/Fv.py43
2 files changed, 24 insertions, 21 deletions
diff --git a/BaseTools/Source/C/Include/Common/BuildVersion.h b/BaseTools/Source/C/Include/Common/BuildVersion.h
index d5bc56cb87..8bfa741140 100644
--- a/BaseTools/Source/C/Include/Common/BuildVersion.h
+++ b/BaseTools/Source/C/Include/Common/BuildVersion.h
@@ -12,4 +12,4 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
**/
-#define __BUILD_VERSION ""
+#define __BUILD_VERSION "Build 99862"
diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py
index 163ccd37f1..df97ccbab6 100644
--- a/BaseTools/Source/Python/GenFds/Fv.py
+++ b/BaseTools/Source/Python/GenFds/Fv.py
@@ -181,30 +181,33 @@ class FV (FvClassObject):
#
# 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()