summaryrefslogtreecommitdiff
path: root/BaseTools/Source/Python/GenFds
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2015-12-07 09:01:44 +0000
committeryzhu52 <yzhu52@Edk2>2015-12-07 09:01:44 +0000
commitca9d6d7962a7ed07ebde22fdde7543d4d0f6cd66 (patch)
treeaf2a6065eea8e379673ddcfb53591d4d0c42b424 /BaseTools/Source/Python/GenFds
parenteadb60d96f3aec44ad58b31cb3c30b3e68e288c1 (diff)
downloadedk2-platforms-ca9d6d7962a7ed07ebde22fdde7543d4d0f6cd66.tar.xz
Revert the change in r19137.
Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com> git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19138 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'BaseTools/Source/Python/GenFds')
-rw-r--r--BaseTools/Source/Python/GenFds/Fv.py43
1 files changed, 20 insertions, 23 deletions
diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py
index df97ccbab6..163ccd37f1 100644
--- a/BaseTools/Source/Python/GenFds/Fv.py
+++ b/BaseTools/Source/Python/GenFds/Fv.py
@@ -181,33 +181,30 @@ class FV (FvClassObject):
#
# Write the Fv contents to Buffer
#
- if os.path.isfile(FvOutputFile):
- FvFileObj = open ( FvOutputFile,'r+b')
+ 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"
- else:
- self.FvAlignment = str (FvAlignmentValue / 0x400) + "K"
+ 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:
- # FvAlignmentValue is less than 1K
- self.FvAlignment = str (FvAlignmentValue)
- FvFileObj.close()
- GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
- GenFdsGlobalVariable.LargeFileInFvFlags.pop()
+ self.FvAlignment = str (FvAlignmentValue / 0x400) + "K"
else:
- GenFdsGlobalVariable.ErrorLogger("Failed to generate %s FV file." %self.UiFvName)
+ # FvAlignmentValue is less than 1K
+ self.FvAlignment = str (FvAlignmentValue)
+ FvFileObj.close()
+ GenFds.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile
+ GenFdsGlobalVariable.LargeFileInFvFlags.pop()
return FvOutputFile
## _GetBlockSize()