public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: Yonghong Zhu <yonghong.zhu@intel.com>
To: edk2-devel@lists.01.org
Cc: Liming Gao <liming.gao@intel.com>
Subject: [Patch] BaseTools: GenFds get the Size info for FV image in the FD region
Date: Wed, 15 Mar 2017 09:22:58 +0800	[thread overview]
Message-ID: <1489540978-18452-1-git-send-email-yonghong.zhu@intel.com> (raw)

When the FV size is specify in the FD region, Tool generate the FV file
may not use the correct size.

Fixes: https://bugzilla.tianocore.org/show_bug.cgi?id=387
Cc: Liming Gao <liming.gao@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BaseTools/Source/Python/GenFds/Fv.py     |  3 ++-
 BaseTools/Source/Python/GenFds/GenFds.py | 19 +++++++++++++++++++
 2 files changed, 21 insertions(+), 1 deletion(-)

diff --git a/BaseTools/Source/Python/GenFds/Fv.py b/BaseTools/Source/Python/GenFds/Fv.py
index ab3f8b2..f6ccb59 100644
--- a/BaseTools/Source/Python/GenFds/Fv.py
+++ b/BaseTools/Source/Python/GenFds/Fv.py
@@ -1,9 +1,9 @@
 ## @file
 # process FV generation
 #
-#  Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR>
+#  Copyright (c) 2007 - 2017, Intel Corporation. All rights reserved.<BR>
 #
 #  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
@@ -48,10 +48,11 @@ class FV (FvClassObject):
         self.InfFileName = None
         self.FvAddressFileName = None
         self.CapsuleName = None
         self.FvBaseAddress = None
         self.FvForceRebase = None
+        self.FvRegionInFD = None
         
     ## AddToBuffer()
     #
     #   Generate Fv and add it to the Buffer
     #
diff --git a/BaseTools/Source/Python/GenFds/GenFds.py b/BaseTools/Source/Python/GenFds/GenFds.py
index a8a68da..aa8c041 100644
--- a/BaseTools/Source/Python/GenFds/GenFds.py
+++ b/BaseTools/Source/Python/GenFds/GenFds.py
@@ -301,10 +301,29 @@ def main():
             CheckBuildOptionPcd()
 
         """Modify images from build output if the feature of loading driver at fixed address is on."""
         if GenFdsGlobalVariable.FixedLoadAddress:
             GenFds.PreprocessImage(BuildWorkSpace, GenFdsGlobalVariable.ActivePlatform)
+
+        # Record the FV Region info that may specific in the FD
+        if FdfParserObj.Profile.FvDict and FdfParserObj.Profile.FdDict:
+            for Fv in FdfParserObj.Profile.FvDict:
+                FvObj = FdfParserObj.Profile.FvDict[Fv]
+                for Fd in FdfParserObj.Profile.FdDict:
+                    FdObj = FdfParserObj.Profile.FdDict[Fd]
+                    for RegionObj in FdObj.RegionList:
+                        if RegionObj.RegionType != 'FV':
+                            continue
+                        for RegionData in RegionObj.RegionDataList:
+                            if FvObj.UiFvName.upper() == RegionData.upper():
+                                if FvObj.FvRegionInFD:
+                                    if FvObj.FvRegionInFD != RegionObj.Size:
+                                        EdkLogger.error("GenFds", FORMAT_INVALID, "The FV %s's region is specified in multiple FD with different value." %FvObj.UiFvName)
+                                else:
+                                    FvObj.FvRegionInFD = RegionObj.Size
+                                    RegionObj.BlockInfoOfRegion(FdObj.BlockSizeList, FvObj)
+
         """Call GenFds"""
         GenFds.GenFd('', FdfParserObj, BuildWorkSpace, ArchList)
 
         """Generate GUID cross reference file"""
         GenFds.GenerateGuidXRefFile(BuildWorkSpace, ArchList)
-- 
2.6.1.windows.1



             reply	other threads:[~2017-03-15  1:23 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-15  1:22 Yonghong Zhu [this message]
2017-03-15  5:46 ` [Patch] BaseTools: GenFds get the Size info for FV image in the FD region Gao, Liming

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1489540978-18452-1-git-send-email-yonghong.zhu@intel.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox