From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga03.intel.com (mga03.intel.com [134.134.136.65]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ml01.01.org (Postfix) with ESMTPS id B8C5581914 for ; Tue, 27 Dec 2016 02:06:24 -0800 (PST) Received: from fmsmga004.fm.intel.com ([10.253.24.48]) by orsmga103.jf.intel.com with ESMTP; 27 Dec 2016 02:06:24 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.33,415,1477983600"; d="scan'208";a="207113946" Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.121]) by fmsmga004.fm.intel.com with ESMTP; 27 Dec 2016 02:06:23 -0800 From: Yonghong Zhu To: edk2-devel@lists.01.org Cc: Liming Gao Date: Tue, 27 Dec 2016 18:06:19 +0800 Message-Id: <1482833179-28356-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [Patch] BaseTools: Fix the bug for RAW file alignment value support X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 27 Dec 2016 10:06:24 -0000 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 --- BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py index c3f3624..d02befe 100644 --- a/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py +++ b/BaseTools/Source/Python/GenFds/GenFdsGlobalVariable.py @@ -427,15 +427,22 @@ class GenFdsGlobalVariable: @staticmethod 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] for I in range(0, len(Input)): Cmd += ("-i", Input[I]) -- 2.6.1.windows.1