(FdsCommandDict, WorkSpaceDataBase=None)
| 105 | GenFdsGlobalVariable.ImageBinDict = {} |
| 106 | |
| 107 | def GenFdsApi(FdsCommandDict, WorkSpaceDataBase=None): |
| 108 | global Workspace |
| 109 | Workspace = "" |
| 110 | ArchList = None |
| 111 | ReturnCode = 0 |
| 112 | resetFdsGlobalVariable() |
| 113 | |
| 114 | try: |
| 115 | if FdsCommandDict.get("verbose"): |
| 116 | EdkLogger.SetLevel(EdkLogger.VERBOSE) |
| 117 | GenFdsGlobalVariable.VerboseMode = True |
| 118 | |
| 119 | if FdsCommandDict.get("FixedAddress"): |
| 120 | GenFdsGlobalVariable.FixedLoadAddress = True |
| 121 | |
| 122 | if FdsCommandDict.get("quiet"): |
| 123 | EdkLogger.SetLevel(EdkLogger.QUIET) |
| 124 | if FdsCommandDict.get("debug"): |
| 125 | EdkLogger.SetLevel(FdsCommandDict.get("debug") + 1) |
| 126 | GenFdsGlobalVariable.DebugLevel = FdsCommandDict.get("debug") |
| 127 | else: |
| 128 | EdkLogger.SetLevel(EdkLogger.INFO) |
| 129 | |
| 130 | if not FdsCommandDict.get("Workspace",os.environ.get('WORKSPACE')): |
| 131 | EdkLogger.error("GenFds", OPTION_MISSING, "WORKSPACE not defined", |
| 132 | ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.") |
| 133 | elif not os.path.exists(FdsCommandDict.get("Workspace",os.environ.get('WORKSPACE'))): |
| 134 | EdkLogger.error("GenFds", PARAMETER_INVALID, "WORKSPACE is invalid", |
| 135 | ExtraData="Please use '-w' switch to pass it or set the WORKSPACE environment variable.") |
| 136 | else: |
| 137 | Workspace = os.path.normcase(FdsCommandDict.get("Workspace",os.environ.get('WORKSPACE'))) |
| 138 | GenFdsGlobalVariable.WorkSpaceDir = Workspace |
| 139 | if FdsCommandDict.get("debug"): |
| 140 | GenFdsGlobalVariable.VerboseLogger("Using Workspace:" + Workspace) |
| 141 | if FdsCommandDict.get("GenfdsMultiThread"): |
| 142 | GenFdsGlobalVariable.EnableGenfdsMultiThread = True |
| 143 | else: |
| 144 | GenFdsGlobalVariable.EnableGenfdsMultiThread = False |
| 145 | os.chdir(GenFdsGlobalVariable.WorkSpaceDir) |
| 146 | |
| 147 | # set multiple workspace |
| 148 | PackagesPath = os.getenv("PACKAGES_PATH") |
| 149 | mws.setWs(GenFdsGlobalVariable.WorkSpaceDir, PackagesPath) |
| 150 | |
| 151 | if FdsCommandDict.get("fdf_file"): |
| 152 | FdfFilename = FdsCommandDict.get("fdf_file")[0].Path |
| 153 | FdfFilename = GenFdsGlobalVariable.ReplaceWorkspaceMacro(FdfFilename) |
| 154 | |
| 155 | if FdfFilename[0:2] == '..': |
| 156 | FdfFilename = os.path.realpath(FdfFilename) |
| 157 | if not os.path.isabs(FdfFilename): |
| 158 | FdfFilename = mws.join(GenFdsGlobalVariable.WorkSpaceDir, FdfFilename) |
| 159 | if not os.path.exists(FdfFilename): |
| 160 | EdkLogger.error("GenFds", FILE_NOT_FOUND, ExtraData=FdfFilename) |
| 161 | |
| 162 | GenFdsGlobalVariable.FdfFile = FdfFilename |
| 163 | GenFdsGlobalVariable.FdfFileTimeStamp = os.path.getmtime(FdfFilename) |
| 164 | else: |
no test coverage detected