+ for FvName in FdfParserObj.Profile.FvDict:\r
+ for FfsObj in FdfParserObj.Profile.FvDict[FvName].FfsList:\r
+ if not isinstance(FfsObj, FfsFileStatement.FileStatement):\r
+ InfPath = PathClass(NormPath(mws.join(GenFdsGlobalVariable.WorkSpaceDir, FfsObj.InfFileName)))\r
+ FdfModule = BuildDb.BuildObject[InfPath, Arch, GenFdsGlobalVariable.TargetName, GenFdsGlobalVariable.ToolChainTag]\r
+ if FdfModule in ModuleList:\r
+ continue\r
+ else:\r
+ ModuleList.append(FdfModule)\r
+ GuidXRefFile.write("%s %s\n" % (FdfModule.Guid, FdfModule.BaseName))\r
+ for key, item in FdfModule.Protocols.items():\r
+ GuidDict[key] = item\r
+ for key, item in FdfModule.Guids.items():\r
+ GuidDict[key] = item\r
+ for key, item in FdfModule.Ppis.items():\r
+ GuidDict[key] = item\r
+ else:\r
+ FileStatementGuid = FfsObj.NameGuid\r
+ if FileStatementGuid in FileGuidList:\r
+ continue\r
+ else:\r
+ FileGuidList.append(FileStatementGuid)\r
+ Name = []\r
+ FfsPath = os.path.join(GenFdsGlobalVariable.FvDir, 'Ffs')\r
+ FfsPath = glob.glob(os.path.join(FfsPath, FileStatementGuid) + '*')\r
+ if not FfsPath:\r
+ continue\r
+ if not os.path.exists(FfsPath[0]):\r
+ continue\r
+ MatchDict = {}\r
+ ReFileEnds = re.compile('\S+(.ui)$|\S+(fv.sec.txt)$|\S+(.pe32.txt)$|\S+(.te.txt)$|\S+(.pic.txt)$|\S+(.raw.txt)$|\S+(.ffs.txt)$')\r
+ FileList = os.listdir(FfsPath[0])\r
+ for File in FileList:\r
+ Match = ReFileEnds.search(File)\r
+ if Match:\r
+ for Index in range(1, 8):\r
+ if Match.group(Index) and Match.group(Index) in MatchDict:\r
+ MatchDict[Match.group(Index)].append(File)\r
+ elif Match.group(Index):\r
+ MatchDict[Match.group(Index)] = [File]\r
+ if not MatchDict:\r
+ continue\r
+ if '.ui' in MatchDict:\r
+ for File in MatchDict['.ui']:\r
+ with open(os.path.join(FfsPath[0], File), 'rb') as F:\r
+ F.read()\r
+ length = F.tell()\r
+ F.seek(4)\r
+ TmpStr = unpack('%dh' % ((length - 4) // 2), F.read())\r
+ Name = ''.join(chr(c) for c in TmpStr[:-1])\r
+ else:\r
+ FileList = []\r
+ if 'fv.sec.txt' in MatchDict:\r
+ FileList = MatchDict['fv.sec.txt']\r
+ elif '.pe32.txt' in MatchDict:\r
+ FileList = MatchDict['.pe32.txt']\r
+ elif '.te.txt' in MatchDict:\r
+ FileList = MatchDict['.te.txt']\r
+ elif '.pic.txt' in MatchDict:\r
+ FileList = MatchDict['.pic.txt']\r
+ elif '.raw.txt' in MatchDict:\r
+ FileList = MatchDict['.raw.txt']\r
+ elif '.ffs.txt' in MatchDict:\r
+ FileList = MatchDict['.ffs.txt']\r
+ else:\r
+ pass\r
+ for File in FileList:\r
+ with open(os.path.join(FfsPath[0], File), 'r') as F:\r
+ Name.append((F.read().split()[-1]))\r
+ if not Name:\r
+ continue\r
+\r
+ Name = ' '.join(Name) if isinstance(Name, type([])) else Name\r
+ GuidXRefFile.write("%s %s\n" %(FileStatementGuid, Name))\r
+\r