]> git.proxmox.com Git - mirror_edk2.git/blame - 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
CommitLineData
30fdf114
LG
1## @file\r
2# generate capsule\r
3#\r
4# Copyright (c) 2007, Intel Corporation\r
5#\r
6# All rights reserved. This program and the accompanying materials\r
7# are licensed and made available under the terms and conditions of the BSD License\r
8# which accompanies this distribution. The full text of the license may be found at\r
9# http://opensource.org/licenses/bsd-license.php\r
10#\r
11# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
12# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
13#\r
14\r
15##\r
16# Import Modules\r
17#\r
18import Ffs\r
19from GenFdsGlobalVariable import GenFdsGlobalVariable\r
20import StringIO\r
21\r
22## base class for capsule data\r
23#\r
24#\r
25class CapsuleData:\r
26 ## The constructor\r
27 #\r
28 # @param self The object pointer\r
29 def __init__(self):\r
30 pass\r
31 \r
32 ## generate capsule data\r
33 #\r
34 # @param self The object pointer\r
35 def GenCapsuleSubItem(self):\r
36 pass\r
37 \r
38## FFS class for capsule data\r
39#\r
40#\r
41class CapsuleFfs (CapsuleData):\r
42 ## The constructor\r
43 #\r
44 # @param self The object pointer\r
45 #\r
46 def __init_(self) :\r
47 self.Ffs = None\r
48\r
49 ## generate FFS capsule data\r
50 #\r
51 # @param self The object pointer\r
52 # @retval string Generated file name\r
53 #\r
54 def GenCapsuleSubItem(self):\r
55 FfsFile = self.Ffs.GenFfs()\r
56 return FfsFile\r
57\r
58## FV class for capsule data\r
59#\r
60#\r
61class CapsuleFv (CapsuleData):\r
62 ## The constructor\r
63 #\r
64 # @param self The object pointer\r
65 #\r
66 def __init__(self) :\r
67 self.FvName = None\r
68\r
69 ## generate FV capsule data\r
70 #\r
71 # @param self The object pointer\r
72 # @retval string Generated file name\r
73 #\r
74 def GenCapsuleSubItem(self):\r
75 if self.FvName.find('.fv') == -1:\r
76 if self.FvName.upper() in GenFdsGlobalVariable.FdfParser.Profile.FvDict.keys():\r
77 FvObj = GenFdsGlobalVariable.FdfParser.Profile.FvDict.get(self.FvName.upper())\r
78 FdBuffer = StringIO.StringIO('')\r
79 FvFile = FvObj.AddToBuffer(FdBuffer)\r
80 return FvFile\r
81 \r
82 else:\r
83 FvFile = GenFdsGlobalVariable.ReplaceWorkspaceMacro(self.FvName)\r
84 return FvFile\r