summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorYonghong Zhu <yonghong.zhu@intel.com>2016-12-27 17:52:12 +0800
committerYonghong Zhu <yonghong.zhu@intel.com>2016-12-29 16:58:17 +0800
commitd2192f12b2d0b93416ff63ac73a3276a07d26c9e (patch)
tree3bd24a004e5a3eb7c24f1dcc77f4bd8220cb82fe
parent63022be1e5c9c5a1971fcb99e64eefaa338c5a06 (diff)
downloadedk2-platforms-d2192f12b2d0b93416ff63ac73a3276a07d26c9e.tar.xz
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>
-rw-r--r--BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py7
1 files changed, 7 insertions, 0 deletions
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]