]>
git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/GenFds/Capsule.py
4 # Copyright (c) 2007, Intel Corporation
6 # All rights reserved. This program and the accompanying materials
7 # are licensed and made available under the terms and conditions of the BSD License
8 # which accompanies this distribution. The full text of the license may be found at
9 # http://opensource.org/licenses/bsd-license.php
11 # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 from GenFdsGlobalVariable
import GenFdsGlobalVariable
19 from CommonDataClass
.FdfClass
import CapsuleClassObject
23 from Common
.Misc
import SaveFileOnChange
28 ## create inf file describes what goes into capsule and call GenFv to generate capsule
31 class Capsule (CapsuleClassObject
) :
34 # @param self The object pointer
37 CapsuleClassObject
.__init
__(self
)
45 # @param self The object pointer
48 CapInfFile
= self
.GenCapInf()
49 CapInfFile
.writelines("[files]" + T_CHAR_LF
)
51 for CapsuleDataObj
in self
.CapsuleDataList
:
52 FileName
= CapsuleDataObj
.GenCapsuleSubItem()
53 CapInfFile
.writelines("EFI_FILE_NAME = " + \
56 SaveFileOnChange(self
.CapInfFileName
, CapInfFile
.getvalue(), False)
59 # Call GenFv tool to generate capsule
61 CapOutputFile
= os
.path
.join(GenFdsGlobalVariable
.FvDir
, self
.UiCapsuleName
)
62 CapOutputFile
= CapOutputFile
+ '.Cap'
63 GenFdsGlobalVariable
.GenerateFirmwareVolume(
65 [self
.CapInfFileName
],
68 GenFdsGlobalVariable
.SharpCounter
= 0
70 ## Generate inf file for capsule
72 # @param self The object pointer
73 # @retval file inf file object
76 self
.CapInfFileName
= os
.path
.join(GenFdsGlobalVariable
.FvDir
,
77 self
.UiCapsuleName
+ "_Cap" + '.inf')
78 CapInfFile
= StringIO
.StringIO() #open (self.CapInfFileName , 'w+')
80 CapInfFile
.writelines("[options]" + T_CHAR_LF
)
82 for Item
in self
.TokensDict
.keys():
83 CapInfFile
.writelines("EFI_" + \
86 self
.TokensDict
.get(Item
) + \