]> git.proxmox.com Git - mirror_edk2.git/blob - BaseTools/Source/Python/GenFds/CapsuleData.py
Check In tool source code based on Build tool project revision r1655.
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / CapsuleData.py
1 ## @file
2 # generate capsule
3 #
4 # Copyright (c) 2007, Intel Corporation
5 #
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
10 #
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.
13 #
14
15 ##
16 # Import Modules
17 #
18 import Ffs
19 from GenFdsGlobalVariable import GenFdsGlobalVariable
20 import StringIO
21
22 ## base class for capsule data
23 #
24 #
25 class CapsuleData:
26 ## The constructor
27 #
28 # @param self The object pointer
29 def __init__(self):
30 pass
31
32 ## generate capsule data
33 #
34 # @param self The object pointer
35 def GenCapsuleSubItem(self):
36 pass
37
38 ## FFS class for capsule data
39 #
40 #
41 class CapsuleFfs (CapsuleData):
42 ## The constructor
43 #
44 # @param self The object pointer
45 #
46 def __init_(self) :
47 self.Ffs = None
48
49 ## generate FFS capsule data
50 #
51 # @param self The object pointer
52 # @retval string Generated file name
53 #
54 def GenCapsuleSubItem(self):
55 FfsFile = self.Ffs.GenFfs()
56 return FfsFile
57
58 ## FV class for capsule data
59 #
60 #
61 class CapsuleFv (CapsuleData):
62 ## The constructor
63 #
64 # @param self The object pointer
65 #
66 def __init__(self) :
67 self.FvName = None
68
69 ## generate FV capsule data
70 #
71 # @param self The object pointer
72 # @retval string Generated file name
73 #
74 def GenCapsuleSubItem(self):
75 if self.FvName.find('.fv') == -1:
76 if self.FvName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():
77 FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper())
78 FdBuffer = StringIO.StringIO('')
79 FvFile = FvObj.AddToBuffer(FdBuffer)
80 return FvFile
81
82 else:
83 FvFile = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FvName)
84 return FvFile