]>
Commit | Line | Data |
---|---|---|
a15bb0d3 | 1 | /** @file\r |
2 | FlashMapTask class.\r | |
3 | \r | |
4 | FlashMapTask is used to call FlashMap.exe to lay out the flash.\r | |
ff225cbb | 5 | \r |
6 | \r | |
a15bb0d3 | 7 | Copyright (c) 2006, Intel Corporation\r |
8 | All rights reserved. This program and the accompanying materials\r | |
9 | are licensed and made available under the terms and conditions of the BSD License\r | |
10 | which accompanies this distribution. The full text of the license may be found at\r | |
11 | http://opensource.org/licenses/bsd-license.php\r | |
ff225cbb | 12 | \r |
a15bb0d3 | 13 | THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r |
14 | WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r | |
15 | \r | |
16 | **/\r | |
17 | package org.tianocore.framework.tasks;\r | |
18 | \r | |
19 | import java.io.File;\r | |
a15bb0d3 | 20 | import org.apache.tools.ant.Task;\r |
21 | import org.apache.tools.ant.Project;\r | |
22 | import org.apache.tools.ant.BuildException;\r | |
93f5dd0a | 23 | import org.apache.tools.ant.taskdefs.Execute;\r |
24 | import org.apache.tools.ant.taskdefs.LogStreamHandler;\r | |
25 | import org.apache.tools.ant.types.Commandline;\r | |
ff225cbb | 26 | \r |
27 | import org.tianocore.common.logger.EdkLog;\r | |
a15bb0d3 | 28 | \r |
29 | /**\r | |
219e2247 | 30 | * FlashMapTask class.\r |
ff225cbb | 31 | *\r |
219e2247 | 32 | * FlashMapTask is used to call FlashMap.exe to generate flash map defition files and fd files.\r |
a15bb0d3 | 33 | */\r |
34 | public class FlashMapTask extends Task implements EfiDefine {\r | |
93f5dd0a | 35 | //\r |
36 | // tool name\r | |
37 | //\r | |
a15bb0d3 | 38 | private final String toolName = "FlashMap";\r |
39 | \r | |
93f5dd0a | 40 | //\r |
41 | // Flash definition file\r | |
42 | //\r | |
43 | private FileArg flashDefFile = new FileArg();\r | |
44 | \r | |
45 | //\r | |
46 | // Flash device\r | |
47 | //\r | |
48 | private ToolArg flashDevice = new ToolArg();\r | |
49 | \r | |
50 | //\r | |
51 | // Flash device Image\r | |
52 | //\r | |
53 | private ToolArg flashDeviceImage = new ToolArg();\r | |
54 | \r | |
55 | //\r | |
56 | // MCI file\r | |
57 | //\r | |
58 | private FileArg mciFile = new FileArg();\r | |
59 | \r | |
60 | //\r | |
61 | // MCO file\r | |
62 | //\r | |
63 | private FileArg mcoFile = new FileArg();\r | |
64 | \r | |
65 | //\r | |
66 | // Discover FD image\r | |
67 | //\r | |
68 | private ToolArg fdImage = new ToolArg();\r | |
69 | \r | |
70 | //\r | |
71 | // Dsc file\r | |
72 | //\r | |
73 | private FileArg dscFile = new FileArg();\r | |
74 | \r | |
75 | //\r | |
76 | // Asm INC file\r | |
77 | //\r | |
78 | private FileArg asmIncFile = new FileArg();\r | |
79 | \r | |
80 | //\r | |
81 | // Image out file\r | |
82 | //\r | |
83 | private FileArg imageOutFile = new FileArg();\r | |
84 | \r | |
85 | //\r | |
86 | // Header file\r | |
87 | //\r | |
88 | private FileArg headerFile = new FileArg();\r | |
89 | \r | |
90 | //\r | |
91 | // Input string file\r | |
92 | //\r | |
a15bb0d3 | 93 | private String inStrFile = "";\r |
94 | \r | |
93f5dd0a | 95 | //\r |
96 | // Output string file\r | |
97 | //\r | |
a15bb0d3 | 98 | private String outStrFile = "";\r |
99 | \r | |
93f5dd0a | 100 | //\r |
76c86b3a | 101 | //\r |
102 | //\r | |
93f5dd0a | 103 | private FileArg strFile = new FileArg();\r |
104 | //\r | |
105 | // Base address\r | |
106 | //\r | |
107 | private ToolArg baseAddr = new ToolArg();\r | |
108 | \r | |
109 | //\r | |
110 | // Aligment\r | |
111 | //\r | |
112 | private ToolArg aligment = new ToolArg();\r | |
113 | \r | |
114 | //\r | |
115 | // Padding value\r | |
116 | //\r | |
117 | private ToolArg padValue = new ToolArg();\r | |
118 | \r | |
119 | //\r | |
120 | // output directory\r | |
121 | //\r | |
57cc2ee7 | 122 | private String outputDir = ".";\r |
a15bb0d3 | 123 | \r |
93f5dd0a | 124 | //\r |
125 | // MCI file array\r | |
126 | //\r | |
127 | FileArg mciFileArray = new FileArg();\r | |
a15bb0d3 | 128 | \r |
129 | /**\r | |
93f5dd0a | 130 | execute\r |
76c86b3a | 131 | \r |
93f5dd0a | 132 | FlashMapTask execute function is to assemble tool command line & execute\r |
133 | tool command line\r | |
76c86b3a | 134 | \r |
93f5dd0a | 135 | @throws BuidException\r |
136 | **/\r | |
a15bb0d3 | 137 | public void execute() throws BuildException {\r |
76c86b3a | 138 | /*\r |
d946661a | 139 | if (isUptodate()) {\r |
76c86b3a | 140 | EdkLog.log(this, EdkLog.EDK_VERBOSE, headerFile.toFileList()\r |
d946661a | 141 | + imageOutFile.toFileList()\r |
142 | + mcoFile.toFileList()\r | |
143 | + dscFile.toFileList()\r | |
144 | + asmIncFile.toFileList()\r | |
145 | + outStrFile\r | |
146 | + " is/are up-to-date!");\r | |
147 | return;\r | |
148 | }\r | |
76c86b3a | 149 | */\r |
a15bb0d3 | 150 | \r |
151 | Project project = this.getOwningTarget().getProject();\r | |
152 | //\r | |
a15bb0d3 | 153 | // absolute path of efi tools\r |
154 | //\r | |
155 | String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r | |
156 | String command;\r | |
157 | if (path == null) {\r | |
158 | command = toolName;\r | |
159 | } else {\r | |
93f5dd0a | 160 | command = path + File.separator + toolName;\r |
a15bb0d3 | 161 | }\r |
a15bb0d3 | 162 | \r |
163 | //\r | |
164 | // add substituted input file and output file\r | |
165 | //\r | |
166 | if (this.inStrFile != null && this.outStrFile != null\r | |
93f5dd0a | 167 | && this.inStrFile.length() > 0 && this.outStrFile.length() > 0) {\r |
168 | strFile.setPrefix(" -strsub ");\r | |
169 | strFile.insValue(this.inStrFile);\r | |
170 | strFile.insValue(this.outStrFile);\r | |
a15bb0d3 | 171 | }\r |
ff225cbb | 172 | \r |
93f5dd0a | 173 | String argument = "" + flashDefFile + flashDevice + flashDeviceImage\r |
174 | + mciFile + mcoFile + fdImage + dscFile + asmIncFile\r | |
175 | + imageOutFile + headerFile + strFile + baseAddr\r | |
176 | + aligment + padValue + mciFileArray;\r | |
ff225cbb | 177 | \r |
a15bb0d3 | 178 | \r |
a15bb0d3 | 179 | //\r |
180 | // lauch the program\r | |
181 | //\r | |
93f5dd0a | 182 | // ProcessBuilder pb = new ProcessBuilder(argList);\r |
183 | // pb.directory(new File(outputDir));\r | |
a15bb0d3 | 184 | int exitCode = 0;\r |
185 | try {\r | |
93f5dd0a | 186 | Commandline cmdline = new Commandline();\r |
187 | cmdline.setExecutable(command);\r | |
188 | cmdline.createArgument().setLine(argument);\r | |
189 | \r | |
190 | LogStreamHandler streamHandler = new LogStreamHandler(this,\r | |
191 | Project.MSG_INFO, Project.MSG_WARN);\r | |
192 | Execute runner = new Execute(streamHandler, null);\r | |
a15bb0d3 | 193 | \r |
93f5dd0a | 194 | runner.setAntRun(project);\r |
195 | runner.setCommandline(cmdline.getCommandline());\r | |
196 | \r | |
197 | if (outputDir != null) {\r | |
76c86b3a | 198 | runner.setWorkingDirectory(new File(outputDir));\r |
93f5dd0a | 199 | }\r |
a15bb0d3 | 200 | //\r |
201 | // log command line string.\r | |
202 | //\r | |
93f5dd0a | 203 | EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));\r |
76c86b3a | 204 | EdkLog.log(this, flashDefFile.toFileList()\r |
93f5dd0a | 205 | + mciFile.toFileList()\r |
206 | + mciFileArray.toFileList()\r | |
207 | + fdImage.toFileList()\r | |
208 | + inStrFile\r | |
76c86b3a | 209 | + " => "\r |
210 | + headerFile.toFileList()\r | |
93f5dd0a | 211 | + imageOutFile.toFileList()\r |
212 | + mcoFile.toFileList()\r | |
213 | + dscFile.toFileList()\r | |
214 | + asmIncFile.toFileList()\r | |
215 | + outStrFile);\r | |
216 | \r | |
217 | exitCode = runner.execute();\r | |
a15bb0d3 | 218 | if (exitCode != 0) {\r |
93f5dd0a | 219 | EdkLog.log(this, "ERROR = " + Integer.toHexString(exitCode));\r |
a15bb0d3 | 220 | } else {\r |
91f7d582 | 221 | EdkLog.log(this, EdkLog.EDK_VERBOSE, "FlashMap succeeded!");\r |
a15bb0d3 | 222 | }\r |
223 | } catch (Exception e) {\r | |
224 | throw new BuildException(e.getMessage());\r | |
225 | } finally {\r | |
226 | if (exitCode != 0) {\r | |
219e2247 | 227 | throw new BuildException("FlashMap failed!");\r |
a15bb0d3 | 228 | }\r |
229 | }\r | |
230 | }\r | |
231 | \r | |
232 | /**\r | |
93f5dd0a | 233 | getFlashDefFile\r |
76c86b3a | 234 | \r |
93f5dd0a | 235 | This function is to get class member "flashDefFile"\r |
76c86b3a | 236 | \r |
93f5dd0a | 237 | @return flashDeFile Name of flash definition file.\r |
238 | **/\r | |
a15bb0d3 | 239 | public String getFlashDefFile() {\r |
93f5dd0a | 240 | return this.flashDefFile.getValue();\r |
a15bb0d3 | 241 | }\r |
242 | \r | |
243 | /**\r | |
93f5dd0a | 244 | setFlashDefFile\r |
76c86b3a | 245 | \r |
93f5dd0a | 246 | This function is to set class member "flashDefFile"\r |
76c86b3a | 247 | \r |
93f5dd0a | 248 | @param flashDefFile\r |
249 | Name of flash definition file.\r | |
250 | **/\r | |
a15bb0d3 | 251 | public void setFlashDefFile(String flashDefFile) {\r |
93f5dd0a | 252 | this.flashDefFile.setArg(" -fdf ", flashDefFile);\r |
a15bb0d3 | 253 | }\r |
254 | \r | |
255 | /**\r | |
93f5dd0a | 256 | getAligment\r |
76c86b3a | 257 | \r |
93f5dd0a | 258 | This function is to get class member "aligment"\r |
76c86b3a | 259 | \r |
93f5dd0a | 260 | @return aligment String of aligment value.\r |
261 | **/\r | |
a15bb0d3 | 262 | public String getAligment() {\r |
93f5dd0a | 263 | return this.aligment.getValue();\r |
a15bb0d3 | 264 | }\r |
265 | \r | |
266 | /**\r | |
93f5dd0a | 267 | setAligment\r |
76c86b3a | 268 | \r |
93f5dd0a | 269 | This function is to set class member "aligment"\r |
76c86b3a | 270 | \r |
93f5dd0a | 271 | @param aligment\r |
272 | String of aligment value.\r | |
273 | **/\r | |
a15bb0d3 | 274 | public void setAligment(String aligment) {\r |
93f5dd0a | 275 | this.aligment.setArg(" -align ", aligment);\r |
a15bb0d3 | 276 | }\r |
277 | \r | |
278 | /**\r | |
93f5dd0a | 279 | getAsmIncFile\r |
76c86b3a | 280 | \r |
93f5dd0a | 281 | This function is to get class member "asmIncFile"\r |
76c86b3a | 282 | \r |
93f5dd0a | 283 | @return asmIncFile String of ASM include file.\r |
284 | **/\r | |
a15bb0d3 | 285 | public String getAsmIncFile() {\r |
93f5dd0a | 286 | return this.asmIncFile.getValue();\r |
a15bb0d3 | 287 | }\r |
288 | \r | |
289 | /**\r | |
93f5dd0a | 290 | setAsmIncFile\r |
76c86b3a | 291 | \r |
93f5dd0a | 292 | This function is to set class member "asmIncFile"\r |
76c86b3a | 293 | \r |
93f5dd0a | 294 | @param asmIncFile\r |
295 | String of ASM include file.\r | |
296 | **/\r | |
a15bb0d3 | 297 | public void setAsmIncFile(String asmIncFile) {\r |
93f5dd0a | 298 | this.asmIncFile.setArg(" -asmincfile ", asmIncFile);\r |
a15bb0d3 | 299 | }\r |
300 | \r | |
301 | /**\r | |
93f5dd0a | 302 | getBaseAddr\r |
76c86b3a | 303 | \r |
93f5dd0a | 304 | This function is to get class member "baseAddr"\r |
76c86b3a | 305 | \r |
93f5dd0a | 306 | @return baseAddr String of base address value.\r |
307 | **/\r | |
a15bb0d3 | 308 | public String getBaseAddr() {\r |
93f5dd0a | 309 | return this.baseAddr.getValue();\r |
a15bb0d3 | 310 | }\r |
311 | \r | |
312 | /**\r | |
93f5dd0a | 313 | setBaseAddr\r |
76c86b3a | 314 | \r |
93f5dd0a | 315 | This function is to set class member "baseAddr"\r |
76c86b3a | 316 | \r |
93f5dd0a | 317 | @param baseAddr\r |
318 | String of base address value.\r | |
319 | **/\r | |
a15bb0d3 | 320 | public void setBaseAddr(String baseAddr) {\r |
93f5dd0a | 321 | this.baseAddr.setArg(" -baseaddr ", baseAddr);\r |
a15bb0d3 | 322 | }\r |
323 | \r | |
324 | /**\r | |
93f5dd0a | 325 | getDscFile\r |
76c86b3a | 326 | \r |
93f5dd0a | 327 | This function is to get class member "dscFile"\r |
76c86b3a | 328 | \r |
93f5dd0a | 329 | @return dscFile name of DSC file\r |
330 | **/\r | |
a15bb0d3 | 331 | public String getDscFile() {\r |
93f5dd0a | 332 | return this.dscFile.getValue();\r |
a15bb0d3 | 333 | }\r |
334 | \r | |
335 | /**\r | |
93f5dd0a | 336 | setDscFile\r |
76c86b3a | 337 | \r |
93f5dd0a | 338 | This function is to set class member "dscFile"\r |
76c86b3a | 339 | \r |
93f5dd0a | 340 | @param dscFile\r |
341 | name of DSC file\r | |
342 | **/\r | |
a15bb0d3 | 343 | public void setDscFile(String dscFile) {\r |
93f5dd0a | 344 | this.dscFile.setArg(" -dsc ", dscFile);\r |
a15bb0d3 | 345 | }\r |
346 | \r | |
347 | /**\r | |
93f5dd0a | 348 | getFdImage\r |
76c86b3a | 349 | \r |
93f5dd0a | 350 | This function is to get class member "fdImage"\r |
76c86b3a | 351 | \r |
93f5dd0a | 352 | @return fdImage name of input FDI image file.\r |
353 | **/\r | |
a15bb0d3 | 354 | public String getFdImage() {\r |
93f5dd0a | 355 | return this.fdImage.getValue();\r |
a15bb0d3 | 356 | }\r |
357 | \r | |
358 | /**\r | |
93f5dd0a | 359 | setFdImage\r |
76c86b3a | 360 | \r |
93f5dd0a | 361 | This function is to set class member "fdImage"\r |
76c86b3a | 362 | \r |
93f5dd0a | 363 | @param fdImage\r |
364 | name of input FDI image file.\r | |
365 | **/\r | |
a15bb0d3 | 366 | public void setFdImage(String fdImage) {\r |
93f5dd0a | 367 | this.fdImage.setArg(" -discover ", fdImage);\r |
a15bb0d3 | 368 | }\r |
369 | \r | |
370 | /**\r | |
93f5dd0a | 371 | getFlashDevice\r |
76c86b3a | 372 | \r |
93f5dd0a | 373 | This function is to get class member "flashDevice".\r |
76c86b3a | 374 | \r |
93f5dd0a | 375 | @return flashDevice name of flash device.\r |
376 | **/\r | |
a15bb0d3 | 377 | public String getFlashDevice() {\r |
93f5dd0a | 378 | return this.flashDevice.getValue();\r |
a15bb0d3 | 379 | }\r |
380 | \r | |
381 | /**\r | |
93f5dd0a | 382 | setFlashDevice\r |
76c86b3a | 383 | \r |
93f5dd0a | 384 | This function is to set class member "flashDevice"\r |
76c86b3a | 385 | \r |
93f5dd0a | 386 | @param flashDevice\r |
387 | name of flash device.\r | |
388 | **/\r | |
a15bb0d3 | 389 | public void setFlashDevice(String flashDevice) {\r |
93f5dd0a | 390 | this.flashDevice.setArg(" -flashdevice ", flashDevice);\r |
a15bb0d3 | 391 | }\r |
392 | \r | |
393 | /**\r | |
93f5dd0a | 394 | getFlashDeviceImage\r |
76c86b3a | 395 | \r |
93f5dd0a | 396 | This function is to get class member "flashDeviceImage"\r |
76c86b3a | 397 | \r |
93f5dd0a | 398 | @return flashDeviceImage name of flash device image\r |
399 | **/\r | |
a15bb0d3 | 400 | public String getFlashDeviceImage() {\r |
93f5dd0a | 401 | return this.flashDeviceImage.getValue();\r |
a15bb0d3 | 402 | }\r |
403 | \r | |
404 | /**\r | |
93f5dd0a | 405 | setFlashDeviceImage\r |
76c86b3a | 406 | \r |
93f5dd0a | 407 | This function is to set class member "flashDeviceImage"\r |
76c86b3a | 408 | \r |
93f5dd0a | 409 | @param flashDeviceImage\r |
410 | name of flash device image\r | |
411 | **/\r | |
a15bb0d3 | 412 | public void setFlashDeviceImage(String flashDeviceImage) {\r |
93f5dd0a | 413 | this.flashDeviceImage.setArg(" -flashdeviceimage ", flashDeviceImage);\r |
a15bb0d3 | 414 | \r |
415 | }\r | |
416 | \r | |
417 | /**\r | |
93f5dd0a | 418 | getHeaderFile\r |
76c86b3a | 419 | \r |
93f5dd0a | 420 | This function is to get class member "headerFile"\r |
76c86b3a | 421 | \r |
93f5dd0a | 422 | @return headerFile name of include file\r |
423 | **/\r | |
a15bb0d3 | 424 | public String getHeaderFile() {\r |
93f5dd0a | 425 | return this.headerFile.getValue();\r |
a15bb0d3 | 426 | }\r |
427 | \r | |
428 | /**\r | |
93f5dd0a | 429 | setHeaderFile\r |
76c86b3a | 430 | \r |
93f5dd0a | 431 | This function is to set class member "headerFile"\r |
76c86b3a | 432 | \r |
93f5dd0a | 433 | @param headerFile\r |
434 | name of include file\r | |
435 | **/\r | |
a15bb0d3 | 436 | public void setHeaderFile(String headerFile) {\r |
93f5dd0a | 437 | this.headerFile.setArg(" -hfile ", headerFile);\r |
a15bb0d3 | 438 | }\r |
439 | \r | |
440 | /**\r | |
93f5dd0a | 441 | getImageOutFile\r |
76c86b3a | 442 | \r |
93f5dd0a | 443 | This function is to get class member "imageOutFile"\r |
76c86b3a | 444 | \r |
93f5dd0a | 445 | @return imageOutFile name of output image file\r |
446 | **/\r | |
a15bb0d3 | 447 | public String getImageOutFile() {\r |
93f5dd0a | 448 | return this.imageOutFile.getValue();\r |
a15bb0d3 | 449 | }\r |
450 | \r | |
451 | /**\r | |
93f5dd0a | 452 | setImageOutFile\r |
76c86b3a | 453 | \r |
93f5dd0a | 454 | This function is to set class member "ImageOutFile"\r |
76c86b3a | 455 | \r |
93f5dd0a | 456 | @param imageOutFile\r |
457 | name of output image file\r | |
458 | **/\r | |
a15bb0d3 | 459 | public void setImageOutFile(String imageOutFile) {\r |
93f5dd0a | 460 | this.imageOutFile.setArg(" -imageout ", imageOutFile);\r |
a15bb0d3 | 461 | }\r |
462 | \r | |
463 | /**\r | |
93f5dd0a | 464 | getInStrFile\r |
76c86b3a | 465 | \r |
93f5dd0a | 466 | This function is to get class member "inStrFile"\r |
76c86b3a | 467 | \r |
93f5dd0a | 468 | @return inStrFile name of input file which used to replace symbol names.\r |
469 | **/\r | |
a15bb0d3 | 470 | public String getInStrFile() {\r |
93f5dd0a | 471 | return this.inStrFile;\r |
a15bb0d3 | 472 | }\r |
473 | \r | |
474 | /**\r | |
93f5dd0a | 475 | setInStrFile\r |
76c86b3a | 476 | \r |
93f5dd0a | 477 | This function is to set class member "inStrFile"\r |
76c86b3a | 478 | \r |
93f5dd0a | 479 | @param inStrFile\r |
480 | name of input file which used to replace symbol names.\r | |
481 | **/\r | |
a15bb0d3 | 482 | public void setInStrFile(String inStrFile) {\r |
483 | this.inStrFile = inStrFile;\r | |
484 | }\r | |
485 | \r | |
486 | /**\r | |
93f5dd0a | 487 | getMciFile\r |
76c86b3a | 488 | \r |
93f5dd0a | 489 | This function is to get class member "mciFile"\r |
76c86b3a | 490 | \r |
93f5dd0a | 491 | @return mciFile name of input microcode file\r |
492 | **/\r | |
a15bb0d3 | 493 | public String getMciFile() {\r |
93f5dd0a | 494 | return this.mciFile.getValue();\r |
a15bb0d3 | 495 | }\r |
496 | \r | |
497 | /**\r | |
93f5dd0a | 498 | setMciFile\r |
76c86b3a | 499 | \r |
93f5dd0a | 500 | This function is to set class member "mciFile"\r |
76c86b3a | 501 | \r |
93f5dd0a | 502 | @param mciFile\r |
503 | name of input microcode file\r | |
504 | **/\r | |
a15bb0d3 | 505 | public void setMciFile(String mciFile) {\r |
93f5dd0a | 506 | this.mciFile.setArg(" -mci ", mciFile);\r |
a15bb0d3 | 507 | }\r |
508 | \r | |
509 | /**\r | |
93f5dd0a | 510 | getMcoFile\r |
76c86b3a | 511 | \r |
93f5dd0a | 512 | This function is to get class member "mcoFile"\r |
76c86b3a | 513 | \r |
93f5dd0a | 514 | @return mcoFile name of output binary microcode image\r |
515 | **/\r | |
a15bb0d3 | 516 | public String getMcoFile() {\r |
93f5dd0a | 517 | return this.mcoFile.getValue();\r |
a15bb0d3 | 518 | }\r |
519 | \r | |
520 | /**\r | |
93f5dd0a | 521 | setMcoFile\r |
76c86b3a | 522 | \r |
93f5dd0a | 523 | This function is to set class member "mcoFile"\r |
76c86b3a | 524 | \r |
93f5dd0a | 525 | @param mcoFile\r |
526 | name of output binary microcode image\r | |
527 | **/\r | |
a15bb0d3 | 528 | public void setMcoFile(String mcoFile) {\r |
93f5dd0a | 529 | this.mcoFile.setArg(" -mco ", mcoFile);\r |
a15bb0d3 | 530 | }\r |
531 | \r | |
532 | /**\r | |
93f5dd0a | 533 | getOutStrFile\r |
76c86b3a | 534 | \r |
93f5dd0a | 535 | This function is to get class member "outStrFile"\r |
76c86b3a | 536 | \r |
93f5dd0a | 537 | @return outStrFile name of output string substitution file\r |
538 | **/\r | |
a15bb0d3 | 539 | public String getOutStrFile() {\r |
93f5dd0a | 540 | return this.outStrFile;\r |
a15bb0d3 | 541 | }\r |
542 | \r | |
543 | /**\r | |
93f5dd0a | 544 | setOutStrFile\r |
76c86b3a | 545 | \r |
93f5dd0a | 546 | This function is to set class member "outStrFile"\r |
76c86b3a | 547 | \r |
93f5dd0a | 548 | @param outStrFile\r |
549 | name of output string substitution file\r | |
550 | **/\r | |
a15bb0d3 | 551 | public void setOutStrFile(String outStrFile) {\r |
552 | this.outStrFile = outStrFile;\r | |
553 | }\r | |
554 | \r | |
555 | /**\r | |
93f5dd0a | 556 | getPadValue\r |
76c86b3a | 557 | \r |
93f5dd0a | 558 | This function is to get class member "padValue"\r |
76c86b3a | 559 | \r |
93f5dd0a | 560 | @return padValue string of byte value to use as padding\r |
561 | **/\r | |
a15bb0d3 | 562 | public String getPadValue() {\r |
93f5dd0a | 563 | return this.padValue.getValue();\r |
a15bb0d3 | 564 | }\r |
565 | \r | |
566 | /**\r | |
93f5dd0a | 567 | setPadValue\r |
76c86b3a | 568 | \r |
93f5dd0a | 569 | This function is to set class member "padValue"\r |
76c86b3a | 570 | \r |
93f5dd0a | 571 | @param padValue\r |
572 | string of byte value to use as padding\r | |
573 | **/\r | |
a15bb0d3 | 574 | public void setPadValue(String padValue) {\r |
93f5dd0a | 575 | this.padValue.setArg(" -padvalue ", padValue);\r |
a15bb0d3 | 576 | }\r |
577 | \r | |
578 | /**\r | |
93f5dd0a | 579 | addMciFile\r |
76c86b3a | 580 | \r |
93f5dd0a | 581 | This function is to add Microcode binary file\r |
76c86b3a | 582 | \r |
93f5dd0a | 583 | @param mciFile\r |
584 | instance of input class\r | |
585 | **/\r | |
586 | public void addConfiguredMciFile(FileArg mciFile) {\r | |
587 | this.mciFileArray.setPrefix(" -mcmerge ");\r | |
588 | this.mciFileArray.insert(mciFile);\r | |
a15bb0d3 | 589 | }\r |
590 | \r | |
591 | /**\r | |
93f5dd0a | 592 | getOutputDir\r |
76c86b3a | 593 | \r |
93f5dd0a | 594 | This function is to get class member "outputDir"\r |
76c86b3a | 595 | \r |
93f5dd0a | 596 | @return outputDir string of output directory\r |
597 | **/\r | |
a15bb0d3 | 598 | public String getOutputDir() {\r |
599 | return outputDir;\r | |
600 | }\r | |
601 | \r | |
602 | /**\r | |
93f5dd0a | 603 | setOutputDir\r |
76c86b3a | 604 | \r |
93f5dd0a | 605 | This function is to set class member "outputDir"\r |
76c86b3a | 606 | \r |
93f5dd0a | 607 | @param outputDir\r |
608 | string of output directory\r | |
609 | **/\r | |
a15bb0d3 | 610 | public void setOutputDir(String outputDir) {\r |
611 | this.outputDir = outputDir;\r | |
612 | }\r | |
d946661a | 613 | \r |
614 | //\r | |
615 | // Dependency check\r | |
76c86b3a | 616 | //\r |
d946661a | 617 | private boolean isUptodate() {\r |
618 | long srcTimeStamp = 0;\r | |
619 | String srcName = "";\r | |
620 | long dstTimeStamp = 0;\r | |
621 | String dstName = "";\r | |
622 | long timeStamp = 0;\r | |
623 | \r | |
624 | if (!flashDefFile.isEmpty()) {\r | |
625 | srcName = flashDefFile.getValue();\r | |
626 | timeStamp = new File(srcName).lastModified();\r | |
627 | if (timeStamp > srcTimeStamp) {\r | |
628 | srcTimeStamp = timeStamp;\r | |
629 | }\r | |
630 | }\r | |
631 | \r | |
632 | if (!mciFile.isEmpty()) {\r | |
633 | srcName = mciFile.getValue();\r | |
634 | timeStamp = new File(srcName).lastModified();\r | |
635 | if (timeStamp > srcTimeStamp) {\r | |
636 | srcTimeStamp = timeStamp;\r | |
637 | }\r | |
638 | }\r | |
639 | \r | |
640 | if (!fdImage.isEmpty()) {\r | |
641 | srcName = fdImage.getValue();\r | |
642 | timeStamp = new File(srcName).lastModified();\r | |
643 | if (timeStamp > srcTimeStamp) {\r | |
644 | srcTimeStamp = timeStamp;\r | |
645 | }\r | |
646 | }\r | |
647 | \r | |
648 | if (inStrFile.length() != 0) {\r | |
649 | srcName = inStrFile;\r | |
650 | timeStamp = new File(srcName).lastModified();\r | |
651 | if (timeStamp > srcTimeStamp) {\r | |
652 | srcTimeStamp = timeStamp;\r | |
653 | }\r | |
654 | }\r | |
655 | \r | |
656 | if (!mciFileArray.isEmpty()) {\r | |
657 | for (int i = 0; i < mciFileArray.nameList.size(); ++i) {\r | |
658 | srcName += mciFileArray.nameList.get(i) + " ";\r | |
659 | timeStamp = new File(mciFileArray.nameList.get(i)).lastModified();\r | |
660 | if (timeStamp > srcTimeStamp) {\r | |
661 | srcTimeStamp = timeStamp;\r | |
662 | }\r | |
663 | }\r | |
664 | }\r | |
665 | \r | |
666 | if (!headerFile.isEmpty()) {\r | |
667 | dstName = headerFile.getValue();\r | |
668 | File dstFile = new File(dstName);\r | |
669 | if (!dstFile.isAbsolute()) {\r | |
670 | dstName = outputDir + File.separator + dstName;\r | |
671 | dstFile = new File(dstName);\r | |
672 | }\r | |
673 | \r | |
674 | if (srcTimeStamp > dstFile.lastModified()) {\r | |
675 | EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");\r | |
676 | return false;\r | |
677 | }\r | |
678 | }\r | |
679 | \r | |
680 | if (!imageOutFile.isEmpty()) {\r | |
681 | dstName = imageOutFile.getValue();\r | |
682 | File dstFile = new File(dstName);\r | |
683 | if (!dstFile.isAbsolute()) {\r | |
684 | dstName = outputDir + File.separator + dstName;\r | |
685 | dstFile = new File(dstName);\r | |
686 | }\r | |
687 | \r | |
688 | if (srcTimeStamp > dstFile.lastModified()) {\r | |
689 | EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");\r | |
690 | return false;\r | |
691 | }\r | |
692 | }\r | |
693 | \r | |
694 | if (!mcoFile.isEmpty()) {\r | |
695 | dstName = mcoFile.getValue();\r | |
696 | File dstFile = new File(dstName);\r | |
697 | if (!dstFile.isAbsolute()) {\r | |
698 | dstName = outputDir + File.separator + dstName;\r | |
699 | dstFile = new File(dstName);\r | |
700 | }\r | |
701 | \r | |
702 | if (srcTimeStamp > dstFile.lastModified()) {\r | |
703 | EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");\r | |
704 | return false;\r | |
705 | }\r | |
706 | }\r | |
707 | \r | |
708 | if (!dscFile.isEmpty()) {\r | |
709 | dstName = dscFile.getValue();\r | |
710 | File dstFile = new File(dstName);\r | |
711 | if (!dstFile.isAbsolute()) {\r | |
712 | dstName = outputDir + File.separator + dstName;\r | |
713 | dstFile = new File(dstName);\r | |
714 | }\r | |
715 | \r | |
716 | if (srcTimeStamp > dstFile.lastModified()) {\r | |
717 | EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");\r | |
718 | return false;\r | |
719 | }\r | |
720 | }\r | |
721 | \r | |
722 | if (!asmIncFile.isEmpty()) {\r | |
723 | dstName = asmIncFile.getValue();\r | |
724 | File dstFile = new File(dstName);\r | |
725 | if (!dstFile.isAbsolute()) {\r | |
726 | dstName = outputDir + File.separator + dstName;\r | |
727 | dstFile = new File(dstName);\r | |
728 | }\r | |
729 | \r | |
730 | if (srcTimeStamp > dstFile.lastModified()) {\r | |
731 | EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");\r | |
732 | return false;\r | |
733 | }\r | |
734 | }\r | |
735 | \r | |
736 | if (outStrFile.length() != 0) {\r | |
737 | dstName = outStrFile;\r | |
738 | File dstFile = new File(dstName);\r | |
739 | if (!dstFile.isAbsolute()) {\r | |
740 | dstName = outputDir + File.separator + dstName;\r | |
741 | dstFile = new File(dstName);\r | |
742 | }\r | |
743 | \r | |
744 | if (srcTimeStamp > dstFile.lastModified()) {\r | |
745 | EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");\r | |
746 | return false;\r | |
747 | }\r | |
748 | }\r | |
749 | \r | |
750 | return true;\r | |
751 | }\r | |
a15bb0d3 | 752 | }\r |