From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) (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 CC58321EA35DA for ; Tue, 5 Sep 2017 01:40:27 -0700 (PDT) Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by orsmga102.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 05 Sep 2017 01:43:16 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.41,479,1498546800"; d="scan'208";a="147561963" Received: from shwdeopenpsi168.ccr.corp.intel.com ([10.239.158.121]) by fmsmga005.fm.intel.com with ESMTP; 05 Sep 2017 01:43:14 -0700 From: Yonghong Zhu To: edk2-devel@lists.01.org Cc: Liming Gao Date: Tue, 5 Sep 2017 16:43:11 +0800 Message-Id: <1504600991-61552-1-git-send-email-yonghong.zhu@intel.com> X-Mailer: git-send-email 2.6.1.windows.1 Subject: [Patch] BaseTools: Fix the bug that same region print twice in the build log X-BeenThere: edk2-devel@lists.01.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: EDK II Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 05 Sep 2017 08:40:28 -0000 This patch fixed the bug that same region print twice in the build log. Cc: Liming Gao Contributed-under: TianoCore Contribution Agreement 1.1 Signed-off-by: Yonghong Zhu --- BaseTools/Source/Python/GenFds/Fd.py | 58 ++++++++++++++++++++---------------- 1 file changed, 32 insertions(+), 26 deletions(-) diff --git a/BaseTools/Source/Python/GenFds/Fd.py b/BaseTools/Source/Python/GenFds/Fd.py index 684b5ce..f330a7e 100644 --- a/BaseTools/Source/Python/GenFds/Fd.py +++ b/BaseTools/Source/Python/GenFds/Fd.py @@ -1,9 +1,9 @@ ## @file # process FD generation # -# Copyright (c) 2007 - 2014, Intel Corporation. All rights reserved.
+# Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.
# # This program and the accompanying materials # are licensed and made available under the terms and conditions of the BSD License # which accompanies this distribution. The full text of the license may be found at # http://opensource.org/licenses/bsd-license.php @@ -65,36 +65,42 @@ class FD(FDClassObject): GenFdsGlobalVariable.VerboseLogger(FvObj) GenFdsGlobalVariable.VerboseLogger('################### Gen VTF ####################') self.GenVtfFile() - TempFdBuffer = StringIO.StringIO('') - PreviousRegionStart = -1 - PreviousRegionSize = 1 - - for RegionObj in self.RegionList : + HasCapsuleRegion = False + for RegionObj in self.RegionList: if RegionObj.RegionType == 'CAPSULE': - continue - if RegionObj.Offset + RegionObj.Size <= PreviousRegionStart: - pass - elif RegionObj.Offset <= PreviousRegionStart or (RegionObj.Offset >=PreviousRegionStart and RegionObj.Offset < PreviousRegionStart + PreviousRegionSize): - pass - elif RegionObj.Offset > PreviousRegionStart + PreviousRegionSize: - GenFdsGlobalVariable.InfLogger('Padding region starting from offset 0x%X, with size 0x%X' %(PreviousRegionStart + PreviousRegionSize, RegionObj.Offset - (PreviousRegionStart + PreviousRegionSize))) - PadRegion = Region.Region() - PadRegion.Offset = PreviousRegionStart + PreviousRegionSize - PadRegion.Size = RegionObj.Offset - PadRegion.Offset - PadRegion.AddToBuffer(TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict) - PreviousRegionStart = RegionObj.Offset - PreviousRegionSize = RegionObj.Size - # - # Call each region's AddToBuffer function - # - if PreviousRegionSize > self.Size: - pass - GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function') - RegionObj.AddToBuffer (TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict) + HasCapsuleRegion = True + break + if HasCapsuleRegion: + TempFdBuffer = StringIO.StringIO('') + PreviousRegionStart = -1 + PreviousRegionSize = 1 + + for RegionObj in self.RegionList : + if RegionObj.RegionType == 'CAPSULE': + continue + if RegionObj.Offset + RegionObj.Size <= PreviousRegionStart: + pass + elif RegionObj.Offset <= PreviousRegionStart or (RegionObj.Offset >=PreviousRegionStart and RegionObj.Offset < PreviousRegionStart + PreviousRegionSize): + pass + elif RegionObj.Offset > PreviousRegionStart + PreviousRegionSize: + GenFdsGlobalVariable.InfLogger('Padding region starting from offset 0x%X, with size 0x%X' %(PreviousRegionStart + PreviousRegionSize, RegionObj.Offset - (PreviousRegionStart + PreviousRegionSize))) + PadRegion = Region.Region() + PadRegion.Offset = PreviousRegionStart + PreviousRegionSize + PadRegion.Size = RegionObj.Offset - PadRegion.Offset + PadRegion.AddToBuffer(TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict) + PreviousRegionStart = RegionObj.Offset + PreviousRegionSize = RegionObj.Size + # + # Call each region's AddToBuffer function + # + if PreviousRegionSize > self.Size: + pass + GenFdsGlobalVariable.VerboseLogger('Call each region\'s AddToBuffer function') + RegionObj.AddToBuffer (TempFdBuffer, self.BaseAddress, self.BlockSizeList, self.ErasePolarity, GenFds.ImageBinDict, self.vtfRawDict, self.DefineVarDict) FdBuffer = StringIO.StringIO('') PreviousRegionStart = -1 PreviousRegionSize = 1 for RegionObj in self.RegionList : -- 2.6.1.windows.1