1## @file 2# This file is used to define a class object to describe a platform 3# 4# Copyright (c) 2007 - 2016, Intel Corporation. All rights reserved.<BR> 5# This program and the accompanying materials 6# are licensed and made available under the terms and conditions of the BSD License 7# which accompanies this distribution. The full text of the license may be found at 8# http://opensource.org/licenses/bsd-license.php 9# 10# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS, 11# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. 12 13## 14# Import Modules 15# 16from CommonClass import * 17 18## SkuInfoListClass 19# 20# This class defined sku info list item used in platform file 21# 22# @param IncludeStatementClass: Inherited from IncludeStatementClass class 23# 24# @var SkuInfoList: To store value for SkuInfoList, it is a set structure as 25# { SkuName : SkuId } 26# 27class SkuInfoListClass(IncludeStatementClass): 28 def __init__(self): 29 IncludeStatementClass.__init__(self) 30 self.SkuInfoList = {} 31 32## PlatformHeaderClass 33# 34# This class defined header items used in Platform file 35# 36# @param IdentificationClass: Inherited from IdentificationClass class 37# @param CommonHeaderClass: Inherited from CommonHeaderClass class 38# @param DefineClass: Inherited from DefineClass class 39# 40# @var DscSpecification: To store value for DscSpecification 41# @var SupArchList: To store value for SupArchList, selection scope is in below list 42# EBC | IA32 | X64 | IPF | ARM | PPC | AARCH64 43# @var BuildTargets: To store value for BuildTargets, selection scope is in below list 44# RELEASE | DEBUG 45# @var IntermediateDirectories: To store value for IntermediateDirectories, selection scope is in below list 46# MODULE | UNIFIED 47# @var OutputDirectory: To store value for OutputDirectory 48# @var ForceDebugTarget: To store value for ForceDebugTarget 49# @var SkuIdName: To store value for SkuIdName 50# @var BuildNumber: To store value for BuildNumber 51# @var MakefileName: To store value for MakefileName 52# @var ClonedFrom: To store value for ClonedFrom, it is a list structure as 53# [ ClonedRecordClass, ... ] 54# 55class PlatformHeaderClass(IdentificationClass, CommonHeaderClass, DefineClass): 56 def __init__(self): 57 IdentificationClass.__init__(self) 58 CommonHeaderClass.__init__(self) 59 DefineClass.__init__(self) 60 self.DscSpecification = '' 61 self.SupArchList = [] 62 self.BuildTargets = [] 63 self.IntermediateDirectories = '' 64 self.OutputDirectory = '' 65 self.ForceDebugTarget = '' 66 self.SkuIdName = [] 67 self.BuildNumber = '' 68 self.MakefileName = '' 69 self.ClonedFrom = [] 70 71## PlatformFlashDefinitionFileClass 72# 73# This class defined FlashDefinitionFile item used in platform file 74# 75# @param object: Inherited from object class 76# 77# @var Id: To store value for Id 78# @var UiName: To store value for UiName 79# @var Preferred: To store value for Preferred 80# @var FilePath: To store value for FilePath 81# 82class PlatformFlashDefinitionFileClass(object): 83 def __init__(self): 84 self.Id = '' 85 self.UiName = '' 86 self.Preferred = False 87 self.FilePath = '' 88 89## BuildScriptClass 90# 91# This class defined PREBUILD/POSTBUILD item used in platform file 92# 93# @param object: Inherited from object class 94# 95# @var Id: To store value for Id 96# @var UiName: To store value for UiName 97# @var Preferred: To store value for Preferred 98# @var FilePath: To store value for FilePath 99# 100class BuildScriptClass(object): 101 def __init__(self): 102 self.Id = '' 103 self.UiName = '' 104 self.Preferred = False 105 self.FilePath = '' 106 107## PlatformFvImageOptionClass 108# 109# This class defined FvImageOption item used in platform file 110# 111# @param object: Inherited from object class 112# 113# @var FvImageOptionName: To store value for FvImageOptionName 114# @var FvImageOptionValues: To store value for FvImageOptionValues 115# 116class PlatformFvImageOptionClass(object): 117 def __init__(self): 118 self.FvImageOptionName = '' 119 self.FvImageOptionValues = [] 120 121## PlatformFvImageClass 122# 123# This class defined FvImage item used in platform file 124# 125# @param object: Inherited from object class 126# 127# @var Name: To store value for Name 128# @var Value: To store value for Value 129# @var Type: To store value for Type, selection scope is in below list 130# Attributes | Options | Components | ImageName 131# @var FvImageNames: To store value for FvImageNames 132# @var FvImageOptions: To store value for FvImageOptions, it is a list structure as 133# [ PlatformFvImageOption, ...] 134# 135class PlatformFvImageClass(object): 136 def __init__(self): 137 self.Name = '' 138 self.Value = '' 139 self.Type = '' 140 self.FvImageNames = [] 141 self.FvImageOptions = [] 142 143## PlatformFvImageNameClass 144# 145# This class defined FvImageName item used in platform file 146# 147# @param object: Inherited from object class 148# 149# @var Name: To store value for Name 150# @var Type: To store value for Type, selection scope is in below list 151# FV_MAIN | FV_MAIN_COMPACT | NV_STORAGE | FV_RECOVERY | FV_RECOVERY_FLOPPY | FV_FILE | CAPSULE_CARGO | NULL | USER_DEFINED 152# @var FvImageOptions: To store value for FvImageOptions, it is a list structure as 153# [ PlatformFvImageOption, ...] 154# 155class PlatformFvImageNameClass(object): 156 def __init__(self): 157 self.Name = '' 158 self.Type = '' 159 self.FvImageOptions = [] 160 161## PlatformFvImagesClass 162# 163# This class defined FvImages item used in platform file 164# 165# @param object: Inherited from object class 166# 167# @var FvImages: To store value for FvImages 168# 169class PlatformFvImagesClass(object): 170 def __init__(self): 171 self.FvImages = [] 172 173## PlatformAntTaskClass 174# 175# This class defined AntTask item used in platform file 176# 177# @param object: Inherited from object class 178# 179# @var Id: To store value for Id 180# @var AntCmdOptions: To store value for AntCmdOptions 181# @var FilePath: To store value for FilePath 182# 183class PlatformAntTaskClass(object): 184 def __init__(self): 185 self.Id = '' 186 self.AntCmdOptions = '' 187 self.FilePath = '' 188 189## PlatformFfsSectionClass 190# 191# This class defined FfsSection item used in platform file 192# 193# @param CommonClass: Inherited from CommonClass class 194# 195# @var BindingOrder: To store value for BindingOrder 196# @var Compressible: To store value for Compressible 197# @var SectionType: To store value for SectionType 198# @var EncapsulationType: To store value for EncapsulationType 199# @var ToolName: To store value for ToolName 200# @var Filenames: To store value for Filenames 201# @var Args: To store value for Args 202# @var OutFile: To store value for OutFile 203# @var OutputFileExtension: To store value for OutputFileExtension 204# @var ToolNameElement: To store value for ToolNameElement 205# 206class PlatformFfsSectionClass(CommonClass): 207 def __init__(self): 208 CommonClass.__init__(self) 209 self.BindingOrder = '' 210 self.Compressible = '' 211 self.SectionType = '' 212 self.EncapsulationType = '' 213 self.ToolName = '' 214 self.Filenames = [] 215 self.Args = '' 216 self.OutFile = '' 217 self.OutputFileExtension = '' 218 self.ToolNameElement = '' 219 220## PlatformFfsSectionsClass 221# 222# This class defined FfsSections item used in platform file 223# 224# @param CommonClass: Inherited from CommonClass class 225# 226# @var BindingOrder: To store value for BindingOrder 227# @var Compressible: To store value for Compressible 228# @var SectionType: To store value for SectionType 229# @var EncapsulationType: To store value for EncapsulationType 230# @var ToolName: To store value for ToolName 231# @var Section: To store value for Section, it is a list structure as 232# [ PlatformFfsSectionClass, ... ] 233# @var Sections: To store value for Sections, it is a list structure as 234# [ PlatformFfsSectionsClass, ...] 235# 236class PlatformFfsSectionsClass(CommonClass): 237 def __init__(self): 238 CommonClass.__init__(self) 239 self.BindingOrder = '' 240 self.Compressible = '' 241 self.SectionType = '' 242 self.EncapsulationType = '' 243 self.ToolName = '' 244 self.Section = [] 245 self.Sections = [] 246 247## PlatformFfsClass 248# 249# This class defined Ffs item used in platform file 250# 251# @param object: Inherited from object class 252# 253# @var Attribute: To store value for Attribute, it is a set structure as 254# { [(Name, PlatformFfsSectionsClass)] : Value} 255# @var Sections: To store value for Sections, it is a list structure as 256# [ PlatformFfsSectionsClass] 257# @var ToolName: To store value for ToolName 258# 259class PlatformFfsClass(object): 260 def __init__(self): 261 self.Attribute = {} 262 self.Sections = [] 263 self.Key = '' 264 265## PlatformBuildOptionClass 266# 267# This class defined BuildOption item used in platform file 268# 269# @param object: Inherited from object class 270# 271# @var UserDefinedAntTasks: To store value for UserDefinedAntTasks, it is a set structure as 272# { [Id] : PlatformAntTaskClass, ...} 273# @var Options: To store value for Options, it is a list structure as 274# [ BuildOptionClass, ...] 275# @var UserExtensions: To store value for UserExtensions, it is a set structure as 276# { [(UserID, Identifier)] : UserExtensionsClass, ...} 277# @var FfsKeyList: To store value for FfsKeyList, it is a set structure as 278# { [FfsKey]: PlatformFfsClass, ...} 279# 280class PlatformBuildOptionClass(object): 281 def __init__(self): 282 self.UserDefinedAntTasks = {} 283 self.Options = [] 284 self.UserExtensions = {} 285 self.FfsKeyList = {} 286 287## PlatformBuildOptionClasses 288# 289# This class defined BuildOption item list used in platform file 290# 291# @param IncludeStatementClass: Inherited from IncludeStatementClass class 292# 293# @var FvBinding: To store value for FvBinding 294# @var FfsFileNameGuid: To store value for FfsFileNameGuid 295# @var FfsFormatKey: To store value for FfsFormatKey 296# @var BuildOptionList: To store value for BuildOptionList, it is a list structure as 297# [ BuildOptionClass, ... ] 298# 299class PlatformBuildOptionClasses(IncludeStatementClass): 300 def __init__(self): 301 IncludeStatementClass.__init__(self) 302 self.FvBinding = '' 303 self.FfsFileNameGuid = '' 304 self.FfsFormatKey = '' 305 self.BuildOptionList = [] 306 307## PlatformLibraryClass 308# 309# This class defined Library item used in platform file 310# 311# @param CommonClass: Inherited from CommonClass class 312# @param DefineClass: Inherited from DefineClass class 313# @param Name: Input value for Name, default is '' 314# @param FilePath: Input value for FilePath, default is '' 315# 316# @var Name: To store value for Name 317# @var FilePath: To store value for FilePath 318# @var ModuleType: To store value for ModuleType 319# @var SupModuleList: To store value for SupModuleList 320# @var ModuleGuid: To store value for ModuleGuid 321# @var ModuleVersion: To store value for ModuleVersion 322# @var PackageGuid: To store value for PackageGuid 323# @var PackageVersion: To store value for PackageVersion 324# 325class PlatformLibraryClass(CommonClass, DefineClass): 326 def __init__(self, Name = '', FilePath = ''): 327 CommonClass.__init__(self) 328 DefineClass.__init__(self) 329 self.Name = Name 330 self.FilePath = FilePath 331 self.ModuleType = [] 332 self.SupModuleList = [] 333 self.ModuleGuid = '' 334 self.ModuleVersion = '' 335 self.PackageGuid = '' 336 self.PackageVersion = '' 337 338## PlatformLibraryClasses 339# 340# This class defined Library item list used in platform file 341# 342# @param IncludeStatementClass: Inherited from IncludeStatementClass class 343# 344# @var LibraryList: To store value for LibraryList, it is a list structure as 345# [ PlatformLibraryClass, ... ] 346# 347class PlatformLibraryClasses(IncludeStatementClass): 348 def __init__(self): 349 IncludeStatementClass.__init__(self) 350 self.LibraryList = [] 351 352## PlatformModuleClass 353# 354# This class defined Module item used in platform file 355# 356# @param CommonClass: Inherited from CommonClass class 357# @param DefineClass: Inherited from DefineClass class 358# @param IncludeStatementClass: Inherited from IncludeStatementClass class 359# 360# @var Name: To store value for Name (Library name or libraryclass name or module name) 361# @var FilePath: To store value for FilePath 362# @var Type: To store value for Type, selection scope is in below list 363# LIBRARY | LIBRARY_CLASS | MODULE 364# @var ModuleType: To store value for ModuleType 365# @var ExecFilePath: To store value for ExecFilePath 366# @var LibraryClasses: To store value for LibraryClasses, it is a structure as 367# PlatformLibraryClasses 368# @var PcdBuildDefinitions: To store value for PcdBuildDefinitions, it is a list structure as 369# [ PcdClass, ...] 370# @var ModuleSaBuildOption: To store value for ModuleSaBuildOption, it is a structure as 371# PlatformBuildOptionClasses 372# @var Specifications: To store value for Specifications, it is a list structure as 373# [ '', '', ...] 374# 375class PlatformModuleClass(CommonClass, DefineClass, IncludeStatementClass): 376 def __init__(self): 377 CommonClass.__init__(self) 378 DefineClass.__init__(self) 379 self.Name = '' 380 self.FilePath = '' 381 self.Type = '' 382 self.ModuleType = '' 383 self.ExecFilePath = '' 384 self.LibraryClasses = PlatformLibraryClasses() 385 self.PcdBuildDefinitions = [] 386 self.ModuleSaBuildOption = PlatformBuildOptionClasses() 387 self.Specifications = [] 388 self.SourceOverridePath = '' 389 390## PlatformModuleClasses 391# 392# This class defined Module item list used in platform file 393# 394# @param IncludeStatementClass: Inherited from IncludeStatementClass class 395# 396# @var ModuleList: To store value for ModuleList, it is a list structure as 397# [ PlatformModuleClass, ... ] 398# 399class PlatformModuleClasses(IncludeStatementClass): 400 def __init__(self): 401 IncludeStatementClass.__init__(self) 402 self.ModuleList = [] 403 404## PlatformClass 405# 406# This class defined a complete platform item 407# 408# @param object: Inherited from object class 409# 410# @var Header: To store value for Header, it is a structure as 411# {Arch : PlatformHeaderClass()} 412# @var SkuInfos: To store value for SkuInfos, it is a structure as 413# SkuInfoListClass 414# @var Libraries: To store value for Libraries, it is a structure as 415# PlatformLibraryClasses 416# @var LibraryClasses: To store value for LibraryClasses, it is a structure as 417# PlatformLibraryClasses 418# @var Modules: To store value for Modules, it is a structure as 419# PlatformModuleClasses 420# @var FlashDefinitionFile: To store value for FlashDefinitionFile, it is a structure as 421# PlatformFlashDefinitionFileClass 422# @var Prebuild: To store value for PREBUILD, it is a structure as 423# BuildScriptClass 424# @var Postbuild: To store value for POSTBUILD, it is a structure as 425# BuildScriptClass 426# @var BuildOptions: To store value for BuildOptions, it is a structure as 427# PlatformBuildOptionClasses 428# @var DynamicPcdBuildDefinitions: To store value for DynamicPcdBuildDefinitions, it is a list structure as 429# [ PcdClass, ...] 430# @var Fdf: To store value for Fdf, it is a list structure as 431# [ FdfClass, ...] 432# @var UserExtensions: To store value for UserExtensions, it is a list structure as 433# [ UserExtensionsClass, ...] 434# 435class PlatformClass(object): 436 def __init__(self): 437 self.Header = {} 438 self.SkuInfos = SkuInfoListClass() 439 self.Libraries = PlatformLibraryClasses() 440 self.LibraryClasses = PlatformLibraryClasses() 441 self.Modules = PlatformModuleClasses() 442 self.FlashDefinitionFile = PlatformFlashDefinitionFileClass() 443 self.Prebuild = BuildScriptClass() 444 self.Postbuild = BuildScriptClass() 445 self.BuildOptions = PlatformBuildOptionClasses() 446 self.DynamicPcdBuildDefinitions = [] 447 self.Fdf = [] 448 self.UserExtensions = [] 449 450## 451# 452# This acts like the main() function for the script, unless it is 'import'ed into another 453# script. 454# 455if __name__ == '__main__': 456 P = PlatformClass() 457