+ if fmp.Existed:\r
+ FwMgrHdr.write(pack('=Q', PreSize))\r
+ PreSize += len(fmp.Buffer)\r
+ Content.write(fmp.Buffer)\r
+ continue\r
+ if fmp.ImageFile:\r
+ for Obj in fmp.ImageFile:\r
+ fmp.ImageFile = Obj.GenCapsuleSubItem()\r
+ if fmp.VendorCodeFile:\r
+ for Obj in fmp.VendorCodeFile:\r
+ fmp.VendorCodeFile = Obj.GenCapsuleSubItem()\r
+ if fmp.Certificate_Guid:\r
+ ExternalTool, ExternalOption = FindExtendTool([], GenFdsGlobalVariable.ArchList, fmp.Certificate_Guid)\r
+ CmdOption = ''\r
+ CapInputFile = fmp.ImageFile\r
+ if not os.path.isabs(fmp.ImageFile):\r
+ CapInputFile = os.path.join(GenFdsGlobalVariable.WorkSpaceDir, fmp.ImageFile)\r
+ CapOutputTmp = os.path.join(GenFdsGlobalVariable.FvDir, self.UiCapsuleName) + '.tmp'\r
+ if ExternalTool == None:\r
+ EdkLogger.error("GenFds", GENFDS_ERROR, "No tool found with GUID %s" % fmp.Certificate_Guid)\r
+ else:\r
+ CmdOption += ExternalTool\r
+ if ExternalOption:\r
+ CmdOption = CmdOption + ' ' + ExternalOption\r
+ CmdOption += ' -e ' + ' --monotonic-count ' + str(fmp.MonotonicCount) + ' -o ' + CapOutputTmp + ' ' + CapInputFile\r
+ CmdList = CmdOption.split()\r
+ GenFdsGlobalVariable.CallExternalTool(CmdList, "Failed to generate FMP auth capsule")\r
+ if uuid.UUID(fmp.Certificate_Guid) == EFI_CERT_TYPE_PKCS7_GUID:\r
+ dwLength = 4 + 2 + 2 + 16 + os.path.getsize(CapOutputTmp) - os.path.getsize(CapInputFile)\r
+ else:\r
+ dwLength = 4 + 2 + 2 + 16 + 16 + 256 + 256\r
+ fmp.ImageFile = CapOutputTmp\r
+ AuthData = [fmp.MonotonicCount, dwLength, WIN_CERT_REVISION, WIN_CERT_TYPE_EFI_GUID, fmp.Certificate_Guid]\r
+ fmp.Buffer = fmp.GenCapsuleSubItem(AuthData)\r
+ else:\r
+ fmp.Buffer = fmp.GenCapsuleSubItem()\r