From d2192f12b2d0b93416ff63ac73a3276a07d26c9e Mon Sep 17 00:00:00 2001 From: Yonghong Zhu Date: Tue, 27 Dec 2016 17:52:12 +0800 Subject: 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 Contributed-under: TianoCore Contribution Agreement 1.0 Signed-off-by: Yonghong Zhu Reviewed-by: Liming Gao --- BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'BaseTools/Source/Python') diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py index c3f36243f0..d02befec11 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -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] -- cgit v1.2.3