## @file\r
# process FV image section generation\r
#\r
-# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>\r
#\r
# This program and the accompanying materials\r
# are licensed and made available under the terms and conditions of the BSD License\r
else:\r
if self.FvFileName != None:\r
FvFileName = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FvFileName)\r
+ if os.path.isfile(FvFileName):\r
+ FvFileObj = open (FvFileName,'r+b')\r
+ FvFileObj.seek(0)\r
+ # PI FvHeader is 0x48 byte\r
+ FvHeaderBuffer = FvFileObj.read(0x48)\r
+ # FV alignment position.\r
+ FvAlignmentValue = 1 << (ord (FvHeaderBuffer[0x2E]) & 0x1F)\r
+ # FvAlignmentValue is larger than or equal to 1K\r
+ if FvAlignmentValue >= 0x400:\r
+ if FvAlignmentValue >= 0x10000:\r
+ #The max alignment supported by FFS is 64K.\r
+ self.Alignment = "64K"\r
+ else:\r
+ self.Alignment = str (FvAlignmentValue / 0x400) + "K"\r
+ else:\r
+ # FvAlignmentValue is less than 1K\r
+ self.Alignment = str (FvAlignmentValue)\r
+ FvFileObj.close()\r
else:\r
EdkLogger.error("GenFds", GENFDS_ERROR, "FvImageSection Failed! %s NOT found in FDF" % self.FvName)\r
\r