]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: make build report tolerant of FVs specified by name
authorEugene Cohen <eugene@hp.com>
Thu, 21 Jan 2016 09:10:55 +0000 (09:10 +0000)
committeryzhu52 <yzhu52@Edk2>
Thu, 21 Jan 2016 09:10:55 +0000 (09:10 +0000)
Check if the FV name is in the FV dictionary before using it which fixes
a crash during build report generation when FVs are specified by path in
the FDF.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Eugene Cohen <eugene@hp.com>
Reviewed-by: Yonghong Zhu <yonghong.zhu@intel.com>
git-svn-id: https://svn.code.sf.net/p/edk2/code/trunk/edk2@19705 6f19259b-4bc3-4df7-8a09-765794883524

BaseTools/Source/Python/build/BuildReport.py

index d459a0113acb089636f7e9547136f0e0c7c04aed..04a4d7dbd5b6d4de333a82dc7fc3b93abf9654ad 100644 (file)
@@ -4,7 +4,7 @@
 # This module contains the functionality to generate build report after\r
 # build all target completes successfully.\r
 #\r
-# Copyright (c) 2010 - 2014, Intel Corporation. All rights reserved.<BR>\r
+# Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
 # This program and the accompanying materials\r
 # are licensed and made available under the terms and conditions of the BSD License\r
 # which accompanies this distribution.  The full text of the license may be found at\r
@@ -1175,18 +1175,20 @@ class FdRegionReport(object):
     # @param Wa              Workspace context information\r
     #\r
     def _DiscoverNestedFvList(self, FvName, Wa):\r
-        for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList:\r
-            for Section in Ffs.SectionList:\r
-                try:\r
-                    for FvSection in Section.SectionList:\r
-                        if FvSection.FvName in self.FvList:\r
-                            continue\r
-                        self._GuidsDb[Ffs.NameGuid.upper()] = FvSection.FvName\r
-                        self.FvList.append(FvSection.FvName)\r
-                        self.FvInfo[FvSection.FvName] = ("Nested FV", 0, 0)\r
-                        self._DiscoverNestedFvList(FvSection.FvName, Wa)\r
-                except AttributeError:\r
-                    pass\r
+        FvDictKey=FvName.upper()\r
+        if FvDictKey in Wa.FdfProfile.FvDict:\r
+            for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList:\r
+                for Section in Ffs.SectionList:\r
+                    try:\r
+                        for FvSection in Section.SectionList:\r
+                            if FvSection.FvName in self.FvList:\r
+                                continue\r
+                            self._GuidsDb[Ffs.NameGuid.upper()] = FvSection.FvName\r
+                            self.FvList.append(FvSection.FvName)\r
+                            self.FvInfo[FvSection.FvName] = ("Nested FV", 0, 0)\r
+                            self._DiscoverNestedFvList(FvSection.FvName, Wa)\r
+                    except AttributeError:\r
+                        pass\r
 \r
     ##\r
     # Constructor function for class FdRegionReport\r
@@ -1264,27 +1266,29 @@ class FdRegionReport(object):
         # Collect the GUID map in the FV firmware volume\r
         #\r
         for FvName in self.FvList:\r
-            for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList:\r
-                try:\r
-                    #\r
-                    # collect GUID map for binary EFI file in FDF file.\r
-                    #\r
-                    Guid = Ffs.NameGuid.upper()\r
-                    Match = gPcdGuidPattern.match(Ffs.NameGuid)\r
-                    if Match:\r
-                        PcdTokenspace = Match.group(1)\r
-                        PcdToken = Match.group(2)\r
-                        if (PcdToken, PcdTokenspace) in PlatformPcds:\r
-                            GuidValue = PlatformPcds[(PcdToken, PcdTokenspace)]\r
-                            Guid = GuidStructureByteArrayToGuidString(GuidValue).upper()\r
-                    for Section in Ffs.SectionList:\r
-                        try:\r
-                            ModuleSectFile = mws.join(Wa.WorkspaceDir, Section.SectFileName)\r
-                            self._GuidsDb[Guid] = ModuleSectFile\r
-                        except AttributeError:\r
-                            pass\r
-                except AttributeError:\r
-                    pass\r
+            FvDictKey=FvName.upper()\r
+            if FvDictKey in Wa.FdfProfile.FvDict:\r
+                for Ffs in Wa.FdfProfile.FvDict[FvName.upper()].FfsList:\r
+                    try:\r
+                        #\r
+                        # collect GUID map for binary EFI file in FDF file.\r
+                        #\r
+                        Guid = Ffs.NameGuid.upper()\r
+                        Match = gPcdGuidPattern.match(Ffs.NameGuid)\r
+                        if Match:\r
+                            PcdTokenspace = Match.group(1)\r
+                            PcdToken = Match.group(2)\r
+                            if (PcdToken, PcdTokenspace) in PlatformPcds:\r
+                                GuidValue = PlatformPcds[(PcdToken, PcdTokenspace)]\r
+                                Guid = GuidStructureByteArrayToGuidString(GuidValue).upper()\r
+                        for Section in Ffs.SectionList:\r
+                            try:\r
+                                ModuleSectFile = mws.join(Wa.WorkspaceDir, Section.SectFileName)\r
+                                self._GuidsDb[Guid] = ModuleSectFile\r
+                            except AttributeError:\r
+                                pass\r
+                    except AttributeError:\r
+                        pass\r
 \r
 \r
     ##\r