]> git.proxmox.com Git - mirror_edk2.git/blame - BaseTools/Source/Python/GenFds/Fv.py
BaseTools: Various typo
[mirror_edk2.git] / BaseTools / Source / Python / GenFds / Fv.py
CommitLineData
30fdf114
LG
1## @file\r
2# process FV generation\r
3#\r
ff260aa7 4# Copyright (c) 2007 - 2018, Intel Corporation. All rights reserved.<BR>\r
30fdf114 5#\r
40d841f6 6# This program and the accompanying materials\r
30fdf114
LG
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
9e47e6f9 18from __future__ import absolute_import\r
1be2ed90 19import Common.LongFilePathOs as os\r
30fdf114 20import subprocess\r
86379ac4 21from io import BytesIO\r
b303ea72 22from struct import *\r
bfa65b61
GL
23from . import FfsFileStatement\r
24from .GenFdsGlobalVariable import GenFdsGlobalVariable\r
d0a0c52c 25from Common.Misc import SaveFileOnChange, PackGUID\r
1be2ed90
HC
26from Common.LongFilePathSupport import CopyLongFilePath\r
27from Common.LongFilePathSupport import OpenLongFilePath as open\r
91fa33ee 28from Common.DataType import *\r
30fdf114 29\r
0614d73b 30FV_UI_EXT_ENTY_GUID = 'A67DF1FA-8DE8-4E98-AF09-4BDF2EFFBC7C'\r
30fdf114
LG
31\r
32## generate FV\r
33#\r
34#\r
9e47e6f9 35class FV (object):\r
30fdf114
LG
36 ## The constructor\r
37 #\r
38 # @param self The object pointer\r
39 #\r
9ffaaac2
CJ
40 def __init__(self, Name=None):\r
41 self.UiFvName = Name\r
9e47e6f9
CJ
42 self.CreateFileName = None\r
43 self.BlockSizeList = []\r
44 self.DefineVarDict = {}\r
45 self.SetVarDict = {}\r
46 self.FvAlignment = None\r
47 self.FvAttributeDict = {}\r
48 self.FvNameGuid = None\r
49 self.FvNameString = None\r
50 self.AprioriSectionList = []\r
51 self.FfsList = []\r
52 self.BsBaseAddress = None\r
53 self.RtBaseAddress = None\r
30fdf114
LG
54 self.FvInfFile = None\r
55 self.FvAddressFile = None\r
56 self.BaseAddress = None\r
57 self.InfFileName = None\r
58 self.FvAddressFileName = None\r
fd171542 59 self.CapsuleName = None\r
4234283c 60 self.FvBaseAddress = None\r
79b74a03 61 self.FvForceRebase = None\r
135ae8c8 62 self.FvRegionInFD = None\r
9425b349 63 self.UsedSizeEnable = False\r
9ffaaac2
CJ
64 self.FvExtEntryTypeValue = []\r
65 self.FvExtEntryType = []\r
66 self.FvExtEntryData = []\r
30fdf114
LG
67 ## AddToBuffer()\r
68 #\r
69 # Generate Fv and add it to the Buffer\r
70 #\r
71 # @param self The object pointer\r
72 # @param Buffer The buffer generated FV data will be put\r
73 # @param BaseAddress base address of FV\r
74 # @param BlockSize block size of FV\r
75 # @param BlockNum How many blocks in FV\r
76 # @param ErasePolarity Flash erase polarity\r
30fdf114
LG
77 # @param MacroDict macro value pair\r
78 # @retval string Generated FV file path\r
79 #\r
39879ef2 80 def AddToBuffer (self, Buffer, BaseAddress=None, BlockSize= None, BlockNum=None, ErasePloarity='1', MacroDict = {}, Flag=False):\r
7de00838
GL
81 if BaseAddress is None and self.UiFvName.upper() + 'fv' in GenFdsGlobalVariable.ImageBinDict:\r
82 return GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper() + 'fv']\r
f7496d71 83\r
fd171542 84 #\r
85 # Check whether FV in Capsule is in FD flash region.\r
86 # If yes, return error. Doesn't support FV in Capsule image is also in FD flash region.\r
87 #\r
4231a819 88 if self.CapsuleName is not None:\r
9eb87141 89 for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():\r
fd171542 90 for RegionObj in FdObj.RegionList:\r
91fa33ee 91 if RegionObj.RegionType == BINARY_FILE_TYPE_FV:\r
fd171542 92 for RegionData in RegionObj.RegionDataList:\r
93 if RegionData.endswith(".fv"):\r
94 continue\r
7de00838 95 elif RegionData.upper() + 'fv' in GenFdsGlobalVariable.ImageBinDict:\r
fd171542 96 continue\r
97 elif self.UiFvName.upper() == RegionData.upper():\r
0d2711a6 98 GenFdsGlobalVariable.ErrorLogger("Capsule %s in FD region can't contain a FV %s in FD region." % (self.CapsuleName, self.UiFvName.upper()))\r
37de70b7
YZ
99 if not Flag:\r
100 GenFdsGlobalVariable.InfLogger( "\nGenerating %s FV" %self.UiFvName)\r
2bc3256c
LG
101 GenFdsGlobalVariable.LargeFileInFvFlags.append(False)\r
102 FFSGuid = None\r
f7496d71 103\r
4231a819 104 if self.FvBaseAddress is not None:\r
0d2711a6 105 BaseAddress = self.FvBaseAddress\r
37de70b7 106 if not Flag:\r
39879ef2 107 self._InitializeInf(BaseAddress, BlockSize, BlockNum, ErasePloarity)\r
30fdf114
LG
108 #\r
109 # First Process the Apriori section\r
110 #\r
111 MacroDict.update(self.DefineVarDict)\r
112\r
113 GenFdsGlobalVariable.VerboseLogger('First generate Apriori file !')\r
114 FfsFileList = []\r
115 for AprSection in self.AprioriSectionList:\r
37de70b7 116 FileName = AprSection.GenFfs (self.UiFvName, MacroDict, IsMakefile=Flag)\r
30fdf114
LG
117 FfsFileList.append(FileName)\r
118 # Add Apriori file name to Inf file\r
37de70b7 119 if not Flag:\r
d943b0c3 120 self.FvInfFile.append("EFI_FILE_NAME = " + \\r
37de70b7 121 FileName + \\r
ef4f218b 122 TAB_LINE_BREAK)\r
30fdf114
LG
123\r
124 # Process Modules in FfsList\r
9e47e6f9 125 for FfsFile in self.FfsList:\r
37de70b7
YZ
126 if Flag:\r
127 if isinstance(FfsFile, FfsFileStatement.FileStatement):\r
128 continue\r
129 if GenFdsGlobalVariable.EnableGenfdsMultiThread and GenFdsGlobalVariable.ModuleFile and GenFdsGlobalVariable.ModuleFile.Path.find(os.path.normpath(FfsFile.InfFileName)) == -1:\r
130 continue\r
a743986d 131 FileName = FfsFile.GenFfs(MacroDict, FvParentAddr=BaseAddress, IsMakefile=Flag, FvName=self.UiFvName)\r
30fdf114 132 FfsFileList.append(FileName)\r
37de70b7 133 if not Flag:\r
d943b0c3 134 self.FvInfFile.append("EFI_FILE_NAME = " + \\r
37de70b7 135 FileName + \\r
ef4f218b 136 TAB_LINE_BREAK)\r
37de70b7 137 if not Flag:\r
d943b0c3
FB
138 FvInfFile = ''.join(self.FvInfFile)\r
139 SaveFileOnChange(self.InfFileName, FvInfFile, False)\r
30fdf114
LG
140 #\r
141 # Call GenFv tool\r
142 #\r
143 FvOutputFile = os.path.join(GenFdsGlobalVariable.FvDir, self.UiFvName)\r
144 FvOutputFile = FvOutputFile + '.Fv'\r
145 # BUGBUG: FvOutputFile could be specified from FDF file (FV section, CreateFile statement)\r
4231a819 146 if self.CreateFileName is not None:\r
30fdf114
LG
147 FvOutputFile = self.CreateFileName\r
148\r
37de70b7 149 if Flag:\r
7de00838 150 GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile\r
37de70b7 151 return FvOutputFile\r
52302d4d 152\r
37de70b7
YZ
153 FvInfoFileName = os.path.join(GenFdsGlobalVariable.FfsDir, self.UiFvName + '.inf')\r
154 if not Flag:\r
155 CopyLongFilePath(GenFdsGlobalVariable.FvAddressFileName, FvInfoFileName)\r
156 OrigFvInfo = None\r
157 if os.path.exists (FvInfoFileName):\r
158 OrigFvInfo = open(FvInfoFileName, 'r').read()\r
159 if GenFdsGlobalVariable.LargeFileInFvFlags[-1]:\r
160 FFSGuid = GenFdsGlobalVariable.EFI_FIRMWARE_FILE_SYSTEM3_GUID\r
161 GenFdsGlobalVariable.GenerateFirmwareVolume(\r
162 FvOutputFile,\r
163 [self.InfFileName],\r
164 AddressFile=FvInfoFileName,\r
165 FfsList=FfsFileList,\r
166 ForceRebase=self.FvForceRebase,\r
167 FileSystemGuid=FFSGuid\r
168 )\r
169\r
170 NewFvInfo = None\r
171 if os.path.exists (FvInfoFileName):\r
172 NewFvInfo = open(FvInfoFileName, 'r').read()\r
4231a819 173 if NewFvInfo is not None and NewFvInfo != OrigFvInfo:\r
37de70b7
YZ
174 FvChildAddr = []\r
175 AddFileObj = open(FvInfoFileName, 'r')\r
176 AddrStrings = AddFileObj.readlines()\r
177 AddrKeyFound = False\r
178 for AddrString in AddrStrings:\r
179 if AddrKeyFound:\r
180 #get base address for the inside FvImage\r
181 FvChildAddr.append (AddrString)\r
182 elif AddrString.find ("[FV_BASE_ADDRESS]") != -1:\r
183 AddrKeyFound = True\r
184 AddFileObj.close()\r
185\r
186 if FvChildAddr != []:\r
187 # Update Ffs again\r
9e47e6f9 188 for FfsFile in self.FfsList:\r
ff260aa7 189 FileName = FfsFile.GenFfs(MacroDict, FvChildAddr, BaseAddress, IsMakefile=Flag, FvName=self.UiFvName)\r
37de70b7
YZ
190\r
191 if GenFdsGlobalVariable.LargeFileInFvFlags[-1]:\r
192 FFSGuid = GenFdsGlobalVariable.EFI_FIRMWARE_FILE_SYSTEM3_GUID;\r
193 #Update GenFv again\r
0385efa0 194 GenFdsGlobalVariable.GenerateFirmwareVolume(\r
37de70b7
YZ
195 FvOutputFile,\r
196 [self.InfFileName],\r
197 AddressFile=FvInfoFileName,\r
198 FfsList=FfsFileList,\r
199 ForceRebase=self.FvForceRebase,\r
200 FileSystemGuid=FFSGuid\r
201 )\r
202\r
203 #\r
204 # Write the Fv contents to Buffer\r
205 #\r
0e982cf0 206 if os.path.isfile(FvOutputFile) and os.path.getsize(FvOutputFile) >= 0x48:\r
37de70b7 207 FvFileObj = open(FvOutputFile, 'rb')\r
37de70b7
YZ
208 # PI FvHeader is 0x48 byte\r
209 FvHeaderBuffer = FvFileObj.read(0x48)\r
0e982cf0 210 Signature = FvHeaderBuffer[0x28:0x32]\r
d943b0c3 211 if Signature and Signature.startswith(b'_FVH'):\r
0e982cf0 212 GenFdsGlobalVariable.VerboseLogger("\nGenerate %s FV Successfully" % self.UiFvName)\r
213 GenFdsGlobalVariable.SharpCounter = 0\r
214\r
0e982cf0 215 FvFileObj.seek(0)\r
272ecccd 216 Buffer.write(FvFileObj.read())\r
0e982cf0 217 # FV alignment position.\r
d943b0c3 218 FvAlignmentValue = 1 << (ord(FvHeaderBuffer[0x2E:0x2F]) & 0x1F)\r
0e982cf0 219 if FvAlignmentValue >= 0x400:\r
220 if FvAlignmentValue >= 0x100000:\r
221 if FvAlignmentValue >= 0x1000000:\r
222 #The max alignment supported by FFS is 16M.\r
223 self.FvAlignment = "16M"\r
224 else:\r
b3e94a06 225 self.FvAlignment = str(FvAlignmentValue // 0x100000) + "M"\r
37de70b7 226 else:\r
b3e94a06 227 self.FvAlignment = str(FvAlignmentValue // 0x400) + "K"\r
e921f58d 228 else:\r
0e982cf0 229 # FvAlignmentValue is less than 1K\r
230 self.FvAlignment = str (FvAlignmentValue)\r
231 FvFileObj.close()\r
232 GenFdsGlobalVariable.ImageBinDict[self.UiFvName.upper() + 'fv'] = FvOutputFile\r
233 GenFdsGlobalVariable.LargeFileInFvFlags.pop()\r
2ff9e575 234 else:\r
0e982cf0 235 GenFdsGlobalVariable.ErrorLogger("Invalid FV file %s." % self.UiFvName)\r
52302d4d 236 else:\r
37de70b7 237 GenFdsGlobalVariable.ErrorLogger("Failed to generate %s FV file." %self.UiFvName)\r
30fdf114
LG
238 return FvOutputFile\r
239\r
29d960f9
YL
240 ## _GetBlockSize()\r
241 #\r
242 # Calculate FV's block size\r
243 # Inherit block size from FD if no block size specified in FV\r
244 #\r
245 def _GetBlockSize(self):\r
246 if self.BlockSizeList:\r
247 return True\r
248\r
9eb87141 249 for FdObj in GenFdsGlobalVariable.FdfParser.Profile.FdDict.values():\r
29d960f9 250 for RegionObj in FdObj.RegionList:\r
91fa33ee 251 if RegionObj.RegionType != BINARY_FILE_TYPE_FV:\r
29d960f9
YL
252 continue\r
253 for RegionData in RegionObj.RegionDataList:\r
254 #\r
255 # Found the FD and region that contain this FV\r
256 #\r
257 if self.UiFvName.upper() == RegionData.upper():\r
258 RegionObj.BlockInfoOfRegion(FdObj.BlockSizeList, self)\r
259 if self.BlockSizeList:\r
260 return True\r
261 return False\r
262\r
9e47e6f9 263 ## _InitializeInf()\r
30fdf114 264 #\r
fb0b35e0 265 # Initialize the inf file to create FV\r
30fdf114
LG
266 #\r
267 # @param self The object pointer\r
268 # @param BaseAddress base address of FV\r
269 # @param BlockSize block size of FV\r
270 # @param BlockNum How many blocks in FV\r
271 # @param ErasePolarity Flash erase polarity\r
30fdf114 272 #\r
39879ef2 273 def _InitializeInf (self, BaseAddress = None, BlockSize= None, BlockNum = None, ErasePloarity='1'):\r
30fdf114
LG
274 #\r
275 # Create FV inf file\r
276 #\r
277 self.InfFileName = os.path.join(GenFdsGlobalVariable.FvDir,\r
278 self.UiFvName + '.inf')\r
d943b0c3 279 self.FvInfFile = []\r
30fdf114
LG
280\r
281 #\r
282 # Add [Options]\r
283 #\r
d943b0c3 284 self.FvInfFile.append("[options]" + TAB_LINE_BREAK)\r
9e47e6f9 285 if BaseAddress is not None:\r
d943b0c3 286 self.FvInfFile.append("EFI_BASE_ADDRESS = " + \\r
30fdf114 287 BaseAddress + \\r
ef4f218b 288 TAB_LINE_BREAK)\r
30fdf114 289\r
4231a819 290 if BlockSize is not None:\r
d943b0c3 291 self.FvInfFile.append("EFI_BLOCK_SIZE = " + \\r
30fdf114 292 '0x%X' %BlockSize + \\r
ef4f218b 293 TAB_LINE_BREAK)\r
4231a819 294 if BlockNum is not None:\r
d943b0c3 295 self.FvInfFile.append("EFI_NUM_BLOCKS = " + \\r
30fdf114 296 ' 0x%X' %BlockNum + \\r
ef4f218b 297 TAB_LINE_BREAK)\r
30fdf114 298 else:\r
52302d4d 299 if self.BlockSizeList == []:\r
29d960f9
YL
300 if not self._GetBlockSize():\r
301 #set default block size is 1\r
d943b0c3 302 self.FvInfFile.append("EFI_BLOCK_SIZE = 0x1" + TAB_LINE_BREAK)\r
f7496d71 303\r
9e47e6f9 304 for BlockSize in self.BlockSizeList:\r
4231a819 305 if BlockSize[0] is not None:\r
d943b0c3 306 self.FvInfFile.append("EFI_BLOCK_SIZE = " + \\r
30fdf114 307 '0x%X' %BlockSize[0] + \\r
ef4f218b 308 TAB_LINE_BREAK)\r
30fdf114 309\r
4231a819 310 if BlockSize[1] is not None:\r
d943b0c3 311 self.FvInfFile.append("EFI_NUM_BLOCKS = " + \\r
30fdf114 312 ' 0x%X' %BlockSize[1] + \\r
ef4f218b 313 TAB_LINE_BREAK)\r
30fdf114 314\r
4231a819 315 if self.BsBaseAddress is not None:\r
d943b0c3 316 self.FvInfFile.append('EFI_BOOT_DRIVER_BASE_ADDRESS = ' + \\r
30fdf114 317 '0x%X' %self.BsBaseAddress)\r
4231a819 318 if self.RtBaseAddress is not None:\r
d943b0c3 319 self.FvInfFile.append('EFI_RUNTIME_DRIVER_BASE_ADDRESS = ' + \\r
30fdf114
LG
320 '0x%X' %self.RtBaseAddress)\r
321 #\r
322 # Add attribute\r
323 #\r
d943b0c3 324 self.FvInfFile.append("[attributes]" + TAB_LINE_BREAK)\r
30fdf114 325\r
d943b0c3 326 self.FvInfFile.append("EFI_ERASE_POLARITY = " + \\r
30fdf114 327 ' %s' %ErasePloarity + \\r
ef4f218b 328 TAB_LINE_BREAK)\r
4231a819 329 if not (self.FvAttributeDict is None):\r
9e47e6f9 330 for FvAttribute in self.FvAttributeDict.keys():\r
9425b349 331 if FvAttribute == "FvUsedSizeEnable":\r
9e47e6f9 332 if self.FvAttributeDict[FvAttribute].upper() in ('TRUE', '1'):\r
9425b349
YF
333 self.UsedSizeEnable = True\r
334 continue\r
d943b0c3 335 self.FvInfFile.append("EFI_" + \\r
30fdf114
LG
336 FvAttribute + \\r
337 ' = ' + \\r
338 self.FvAttributeDict[FvAttribute] + \\r
ef4f218b 339 TAB_LINE_BREAK )\r
4231a819 340 if self.FvAlignment is not None:\r
d943b0c3 341 self.FvInfFile.append("EFI_FVB2_ALIGNMENT_" + \\r
30fdf114
LG
342 self.FvAlignment.strip() + \\r
343 " = TRUE" + \\r
ef4f218b 344 TAB_LINE_BREAK)\r
f7496d71 345\r
30fdf114 346 #\r
b303ea72 347 # Generate FV extension header file\r
30fdf114 348 #\r
128d435f 349 if not self.FvNameGuid:\r
9425b349 350 if len(self.FvExtEntryType) > 0 or self.UsedSizeEnable:\r
b303ea72 351 GenFdsGlobalVariable.ErrorLogger("FV Extension Header Entries declared for %s with no FvNameGuid declaration." % (self.UiFvName))\r
128d435f 352 else:\r
b303ea72 353 TotalSize = 16 + 4\r
d943b0c3 354 Buffer = bytearray()\r
9425b349
YF
355 if self.UsedSizeEnable:\r
356 TotalSize += (4 + 4)\r
357 ## define EFI_FV_EXT_TYPE_USED_SIZE_TYPE 0x03\r
358 #typedef struct\r
359 # {\r
360 # EFI_FIRMWARE_VOLUME_EXT_ENTRY Hdr;\r
361 # UINT32 UsedSize;\r
362 # } EFI_FIRMWARE_VOLUME_EXT_ENTRY_USED_SIZE_TYPE;\r
363 Buffer += pack('HHL', 8, 3, 0)\r
364\r
aaf8aa7b
YL
365 if self.FvNameString == 'TRUE':\r
366 #\r
367 # Create EXT entry for FV UI name\r
368 # This GUID is used: A67DF1FA-8DE8-4E98-AF09-4BDF2EFFBC7C\r
369 #\r
370 FvUiLen = len(self.UiFvName)\r
371 TotalSize += (FvUiLen + 16 + 4)\r
372 Guid = FV_UI_EXT_ENTY_GUID.split('-')\r
373 #\r
374 # Layout:\r
9e47e6f9
CJ
375 # EFI_FIRMWARE_VOLUME_EXT_ENTRY: size 4\r
376 # GUID: size 16\r
aaf8aa7b
YL
377 # FV UI name\r
378 #\r
379 Buffer += (pack('HH', (FvUiLen + 16 + 4), 0x0002)\r
d0a0c52c 380 + PackGUID(Guid)\r
d943b0c3 381 + self.UiFvName.encode('utf-8'))\r
0614d73b 382\r
b303ea72
LG
383 for Index in range (0, len(self.FvExtEntryType)):\r
384 if self.FvExtEntryType[Index] == 'FILE':\r
f51461c8
LG
385 # check if the path is absolute or relative\r
386 if os.path.isabs(self.FvExtEntryData[Index]):\r
387 FileFullPath = os.path.normpath(self.FvExtEntryData[Index])\r
388 else:\r
389 FileFullPath = os.path.normpath(os.path.join(GenFdsGlobalVariable.WorkSpaceDir, self.FvExtEntryData[Index]))\r
390 # check if the file path exists or not\r
391 if not os.path.isfile(FileFullPath):\r
b303ea72 392 GenFdsGlobalVariable.ErrorLogger("Error opening FV Extension Header Entry file %s." % (self.FvExtEntryData[Index]))\r
ccaa7754
GL
393 FvExtFile = open (FileFullPath, 'rb')\r
394 FvExtFile.seek(0, 2)\r
b303ea72
LG
395 Size = FvExtFile.tell()\r
396 if Size >= 0x10000:\r
397 GenFdsGlobalVariable.ErrorLogger("The size of FV Extension Header Entry file %s exceeds 0x10000." % (self.FvExtEntryData[Index]))\r
398 TotalSize += (Size + 4)\r
399 FvExtFile.seek(0)\r
400 Buffer += pack('HH', (Size + 4), int(self.FvExtEntryTypeValue[Index], 16))\r
f7496d71 401 Buffer += FvExtFile.read()\r
b303ea72
LG
402 FvExtFile.close()\r
403 if self.FvExtEntryType[Index] == 'DATA':\r
404 ByteList = self.FvExtEntryData[Index].split(',')\r
405 Size = len (ByteList)\r
406 if Size >= 0x10000:\r
407 GenFdsGlobalVariable.ErrorLogger("The size of FV Extension Header Entry data %s exceeds 0x10000." % (self.FvExtEntryData[Index]))\r
408 TotalSize += (Size + 4)\r
409 Buffer += pack('HH', (Size + 4), int(self.FvExtEntryTypeValue[Index], 16))\r
410 for Index1 in range (0, Size):\r
411 Buffer += pack('B', int(ByteList[Index1], 16))\r
412\r
413 Guid = self.FvNameGuid.split('-')\r
d0a0c52c 414 Buffer = PackGUID(Guid) + pack('=L', TotalSize) + Buffer\r
b303ea72
LG
415\r
416 #\r
417 # Generate FV extension header file if the total size is not zero\r
418 #\r
419 if TotalSize > 0:\r
420 FvExtHeaderFileName = os.path.join(GenFdsGlobalVariable.FvDir, self.UiFvName + '.ext')\r
86379ac4 421 FvExtHeaderFile = BytesIO()\r
b303ea72 422 FvExtHeaderFile.write(Buffer)\r
a709adfa 423 Changed = SaveFileOnChange(FvExtHeaderFileName, FvExtHeaderFile.getvalue(), True)\r
b303ea72 424 FvExtHeaderFile.close()\r
a709adfa
LG
425 if Changed:\r
426 if os.path.exists (self.InfFileName):\r
427 os.remove (self.InfFileName)\r
d943b0c3 428 self.FvInfFile.append("EFI_FV_EXT_HEADER_FILE_NAME = " + \\r
b303ea72 429 FvExtHeaderFileName + \\r
ef4f218b 430 TAB_LINE_BREAK)\r
30fdf114 431\r
b303ea72
LG
432 #\r
433 # Add [Files]\r
434 #\r
d943b0c3 435 self.FvInfFile.append("[files]" + TAB_LINE_BREAK)\r