BaseTools: Fix the bug for RAW file alignment value support

Fix the bug for RAW file to support Align=32 and Align=64. Current FDF
spec FfsAlignmentValues support this two values, while it is not the
valid value for GenFfs. So this patch add the logic to handle it.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=248
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
Reviewed-by: Liming Gao <liming.gao@intel.com>
This commit is contained in:
Yonghong Zhu 2016-12-27 17:52:12 +08:00
parent 63022be1e5
commit d2192f12b2
1 changed files with 7 additions and 0 deletions

View File

@ -429,11 +429,18 @@ class GenFdsGlobalVariable:
def GenerateFfs(Output, Input, Type, Guid, Fixed=False, CheckSum=False, Align=None,
SectionAlign=None):
Cmd = ["GenFfs", "-t", Type, "-g", Guid]
mFfsValidAlign = ["0", "8", "16", "128", "512", "1K", "4K", "32K", "64K"]
if Fixed == True:
Cmd += ["-x"]
if CheckSum:
Cmd += ["-s"]
if Align not in [None, '']:
if Align not in mFfsValidAlign:
Align = GenFdsGlobalVariable.GetAlignment (Align)
for index in range(0, len(mFfsValidAlign) - 1):
if ((Align > GenFdsGlobalVariable.GetAlignment(mFfsValidAlign[index])) and (Align <= GenFdsGlobalVariable.GetAlignment(mFfsValidAlign[index + 1]))):
break
Align = mFfsValidAlign[index + 1]
Cmd += ["-a", Align]
Cmd += ["-o", Output]