- # FV alignment position.\r
- FvAlignmentValue = 1 << (FvHeaderBuffer[0x2E] & 0x1F)\r
- if FvAlignmentValue >= 0x400:\r
- if FvAlignmentValue >= 0x100000:\r
- if FvAlignmentValue >= 0x1000000:\r
- #The max alignment supported by FFS is 16M.\r
- self.FvAlignment = "16M"\r
+ Signature = FvHeaderBuffer[0x28:0x32]\r
+ if Signature and Signature.startswith(b'_FVH'):\r
+ GenFdsGlobalVariable.VerboseLogger("\nGenerate %s FV Successfully" % self.UiFvName)\r
+ GenFdsGlobalVariable.SharpCounter = 0\r
+\r
+ FvFileObj.seek(0)\r
+ Buffer.write(FvFileObj.read())\r
+ # FV alignment position.\r
+ FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E:0x2F]) & 0x1F)\r
+ if FvAlignmentValue >= 0x400:\r
+ if FvAlignmentValue >= 0x100000:\r
+ if FvAlignmentValue >= 0x1000000:\r
+ #The max alignment supported by FFS is 16M.\r
+ self.FvAlignment = "16M"\r
+ else:\r
+ self.FvAlignment = str(FvAlignmentValue // 0x100000) + "M"\r