guidchk= org.tianocore.framework.tasks.GuidChkTask\r
gencrc32section=org.tianocore.framework.tasks.GenCRC32SectionTask\r
makedeps=org.tianocore.framework.tasks.MakeDeps\r
+edkStrip=org.tianocore.framework.tasks.StripTask\r
+splitfile=org.tianocore.framework.tasks.SplitfileTask\r
+genacpitable=org.tianocore.framework.tasks.GenAcpiTableTask\r
+genteimage=org.tianocore.framework.tasks.GenTeImageTask\r
+secfixup=org.tianocore.framework.tasks.SecFixupTask\r
+peirebase=org.tianocore.framework.tasks.PeiReBaseTask\r
+eficompress=org.tianocore.framework.tasks.EfiCompressTask\r
+zerodebugdata=org.tianocore.framework.tasks.ZeroDebugDataTask\r
+createmtfile=org.tianocore.framework.tasks.CreateMtFileTask\r
+efirom=org.tianocore.framework.tasks.EfiRomTask\r
+secapresetvectorfixup=org.tianocore.framework.tasks.SecApResetVectorFixupTask\r
+gencapsulehdr=org.tianocore.framework.tasks.GenCapsuleHdrTask\r
+flashmap=org.tianocore.framework.tasks.FlashMapTask\r
package org.tianocore.framework.tasks;\r
\r
import org.apache.tools.ant.BuildException;\r
-\r
/**\r
\r
Internal class: This class is to generate the compressed section header.\r
--- /dev/null
+/** @file\r
+ CreateMtFileTask class.\r
+\r
+ CreateMtFileTask is used to call CreateMtFile.exe to create MT file.\r
+ \r
+ \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ **/\r
+package org.tianocore.framework.tasks;\r
+\r
+import java.io.File;\r
+\r
+import org.apache.tools.ant.Task;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.BuildException;\r
+import org.apache.tools.ant.taskdefs.Execute;\r
+import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
+import org.apache.tools.ant.types.Commandline;\r
+import org.tianocore.logger.EdkLog;\r
+\r
+/**\r
+ CreateMtFileTask class.\r
+\r
+ CreateMtFileTask is used to call CreateMtFile.exe to create MT file.\r
+**/\r
+public class CreateMtFileTask extends Task implements EfiDefine {\r
+ ///\r
+ /// Tool name\r
+ ///\r
+ private String toolName="CreateMtFile";\r
+ ///\r
+ /// file size\r
+ ///\r
+ private String fileSize = "";\r
+\r
+ ///\r
+ /// output file\r
+ ///\r
+ private String outputFile = "";\r
+\r
+ ///\r
+ /// output directory, this variable is added by jave wrap\r
+ ///\r
+ private String outputDir = "";\r
+\r
+ /**\r
+ * execute\r
+ * \r
+ * StripTask execute function is to assemble tool command line & execute\r
+ * tool command line\r
+ * \r
+ * @throws BuidException\r
+ */\r
+ public void execute() throws BuildException {\r
+\r
+ Project project = this.getOwningTarget().getProject();\r
+ //\r
+ // set Logger\r
+ //\r
+ FrameworkLogger logger = new FrameworkLogger(project, "createmtfile");\r
+ EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));\r
+ EdkLog.setLogger(logger);\r
+ //\r
+ // absolute path of efi tools\r
+ //\r
+ String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
+ String command;\r
+ String argument;\r
+ if (path == null) {\r
+ command = toolName;\r
+ } else {\r
+ command = path + File.separatorChar + toolName;\r
+ }\r
+ //\r
+ // argument of tools\r
+ //\r
+ File file = new File(outputFile);\r
+ if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
+ argument = outputDir + File.separatorChar + outputFile + " " + this.fileSize;\r
+ \r
+ } else {\r
+ argument = outputFile + " " + this.fileSize;\r
+ }\r
+ //\r
+ // return value of fwimage execution\r
+ //\r
+ int revl = -1;\r
+\r
+ try {\r
+ Commandline cmdline = new Commandline();\r
+ cmdline.setExecutable(command);\r
+ cmdline.createArgument().setLine(argument);\r
+\r
+ LogStreamHandler streamHandler = new LogStreamHandler(this,\r
+ Project.MSG_INFO, Project.MSG_WARN);\r
+ Execute runner = new Execute(streamHandler, null);\r
+\r
+ runner.setAntRun(project);\r
+ runner.setCommandline(cmdline.getCommandline());\r
+ //\r
+ // Set debug log information.\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO, Commandline.toString(cmdline.getCommandline()));\r
+ \r
+ revl = runner.execute();\r
+ \r
+ if (EFI_SUCCESS == revl) {\r
+ //\r
+ // command execution success\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO,"CreateMtFile succeeded!");\r
+ } else {\r
+ //\r
+ // command execution fail\r
+ //\r
+ EdkLog.log(EdkLog.EDK_ERROR, "CreateMtFile failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+ throw new BuildException("CreateMtFile failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+\r
+ }\r
+ } catch (Exception e) {\r
+ throw new BuildException(e.getMessage());\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getFileSize\r
+ * \r
+ * This function is to get class member "fileSize".\r
+ * \r
+ * @return fileSize string of file size.\r
+ */\r
+ public String getFileSize() {\r
+ return this.fileSize;\r
+ }\r
+\r
+ /**\r
+ * setFileSize\r
+ * \r
+ * This function is to set class member "fileSize".\r
+ * \r
+ * @param fileSize\r
+ * string of file size value.\r
+ */\r
+ public void setFileSize(String fileSize) {\r
+ this.fileSize = fileSize;\r
+ }\r
+\r
+ /**\r
+ * getOutputFile\r
+ * \r
+ * This function is to get class member "outputFile"\r
+ * \r
+ * @return outputFile string of output file name.\r
+ */\r
+ public String getOutputFile() {\r
+ return outputFile;\r
+ }\r
+\r
+ /**\r
+ * setOutputFile\r
+ * \r
+ * This function is to set class member "outputFile"\r
+ * \r
+ * @param outputFile\r
+ * string of output file name.\r
+ */\r
+ public void setOutputFile(String outputFile) {\r
+ this.outputFile = outputFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputDir\r
+ * \r
+ * This function is to get class member "outputDir"\r
+ * \r
+ * @return outputDir string of output directory.\r
+ */\r
+ public String getOutputDir() {\r
+ return outputDir;\r
+ }\r
+\r
+ /**\r
+ * setOutputDir\r
+ * \r
+ * This function is to set class member "outputDir"\r
+ * \r
+ * @param outputDir\r
+ * string of output directory.\r
+ */\r
+ public void setOutputDir(String outputDir) {\r
+ this.outputDir = outputDir;\r
+ }\r
+}\r
--- /dev/null
+/** @file\r
+ EfiCompressTask class.\r
+\r
+ EfiCompressTask is used to call EfiCompress.exe to strip input file.\r
+ \r
+ \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ **/\r
+package org.tianocore.framework.tasks;\r
+\r
+import java.io.File;\r
+\r
+import org.apache.tools.ant.Task;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.BuildException;\r
+import org.apache.tools.ant.taskdefs.Execute;\r
+import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
+import org.apache.tools.ant.types.Commandline;\r
+import org.tianocore.logger.EdkLog;\r
+\r
+/**\r
+ EfiCompressTask class.\r
+\r
+ EfiCompressTask is used to call EfiCompress.exe to strip input file.\r
+**/\r
+public class EfiCompressTask extends Task implements EfiDefine {\r
+ // /\r
+ // / input file\r
+ // /\r
+ private String inputFile = "";\r
+\r
+ // /\r
+ // / output file\r
+ // /\r
+ private String outputFile = "";\r
+\r
+ // /\r
+ // / output directory, this variable is added by jave wrap\r
+ // /\r
+ private String outputDir = "";\r
+\r
+ /**\r
+ * execute\r
+ * \r
+ * EfiCompressTask execute function is to assemble tool command line & execute\r
+ * tool command line\r
+ * \r
+ * @throws BuidException\r
+ */\r
+ public void execute() throws BuildException {\r
+\r
+ Project project = this.getOwningTarget().getProject();\r
+ //\r
+ // set Logger\r
+ //\r
+ FrameworkLogger logger = new FrameworkLogger(project, "eficompress");\r
+ EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));\r
+ EdkLog.setLogger(logger);\r
+ //\r
+ // absolute path of efi tools\r
+ //\r
+ String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
+ String command;\r
+ String argument;\r
+ if (path == null) {\r
+ command = "EfiCompress";\r
+ } else {\r
+ command = path + File.separatorChar + "EfiCompress";\r
+ }\r
+ //\r
+ // argument of tools\r
+ //\r
+ File file = new File(outputFile);\r
+ if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
+ argument = inputFile + " " + outputDir + File.separatorChar\r
+ + outputFile;\r
+ } else {\r
+ argument = inputFile + " " + outputFile;\r
+ }\r
+ //\r
+ // return value of fwimage execution\r
+ //\r
+ int revl = -1;\r
+\r
+ try {\r
+ Commandline cmdline = new Commandline();\r
+ cmdline.setExecutable(command);\r
+ cmdline.createArgument().setLine(argument);\r
+\r
+ LogStreamHandler streamHandler = new LogStreamHandler(this,\r
+ Project.MSG_INFO, Project.MSG_WARN);\r
+ Execute runner = new Execute(streamHandler, null);\r
+\r
+ runner.setAntRun(project);\r
+ runner.setCommandline(cmdline.getCommandline());\r
+ //\r
+ // Set debug log information.\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO, Commandline.toString(cmdline.getCommandline()));\r
+ \r
+ revl = runner.execute();\r
+ \r
+ if (EFI_SUCCESS == revl) {\r
+ //\r
+ // command execution success\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO,"EfiCompress succeeded!");\r
+ } else {\r
+ //\r
+ // command execution fail\r
+ //\r
+ EdkLog.log(EdkLog.EDK_ERROR, "EfiCompress failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+ throw new BuildException("Strip failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+\r
+ }\r
+ } catch (Exception e) {\r
+ throw new BuildException(e.getMessage());\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getInputFile\r
+ * \r
+ * This function is to get class member "inputFile".\r
+ * \r
+ * @return string of input file name.\r
+ */\r
+ public String getInputFile() {\r
+ return inputFile;\r
+ }\r
+\r
+ /**\r
+ * setComponentType\r
+ * \r
+ * This function is to set class member "inputFile".\r
+ * \r
+ * @param inputFile\r
+ * string of input file name.\r
+ */\r
+ public void setInputFile(String inputFile) {\r
+ this.inputFile = inputFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputFile\r
+ * \r
+ * This function is to get class member "outputFile"\r
+ * \r
+ * @return outputFile string of output file name.\r
+ */\r
+ public String getOutputFile() {\r
+ return outputFile;\r
+ }\r
+\r
+ /**\r
+ * setOutputFile\r
+ * \r
+ * This function is to set class member "outputFile"\r
+ * \r
+ * @param outputFile\r
+ * string of output file name.\r
+ */\r
+ public void setOutputFile(String outputFile) {\r
+ this.outputFile = outputFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputDir\r
+ * \r
+ * This function is to get class member "outputDir"\r
+ * \r
+ * @return outputDir string of output directory.\r
+ */\r
+ public String getOutputDir() {\r
+ return outputDir;\r
+ }\r
+\r
+ /**\r
+ * setOutputDir\r
+ * \r
+ * This function is to set class member "outputDir"\r
+ * \r
+ * @param outputDir\r
+ * string of output directory.\r
+ */\r
+ public void setOutputDir(String outputDir) {\r
+ this.outputDir = outputDir;\r
+ }\r
+}\r
--- /dev/null
+/** @file\r
+ EfiRomTask class.\r
+\r
+ EfiRomTask is used to call FlashMap.exe to lay out the flash.\r
+ \r
+ \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ **/\r
+package org.tianocore.framework.tasks;\r
+\r
+import java.io.File;\r
+import java.io.InputStreamReader;\r
+import java.util.ArrayList;\r
+import java.util.Iterator;\r
+import java.util.LinkedList;\r
+import java.util.List;\r
+\r
+import org.apache.tools.ant.Task;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.BuildException;\r
+import org.tianocore.logger.EdkLog;\r
+\r
+/**\r
+ * SecFixupTask class.\r
+ * \r
+ * SecFixupTask is used to call SecFixup.exe to fix up sec image.\r
+ */\r
+public class EfiRomTask extends Task implements EfiDefine {\r
+ ///\r
+ /// tool name\r
+ ///\r
+ private final String toolName = "EfiRom";\r
+ \r
+ ///\r
+ /// Flash default file\r
+ ///\r
+ private String verbose = "";\r
+\r
+ ///\r
+ /// Flash device\r
+ ///\r
+ private String venderId = "";\r
+\r
+ ///\r
+ /// Flash device Image\r
+ ///\r
+ private String deviceId = "";\r
+ \r
+ ///\r
+ /// MCI file\r
+ ///\r
+ private String outputFile = "";\r
+ \r
+ ///\r
+ /// MCO file\r
+ ///\r
+ private List<Input> binaryFileList = new ArrayList<Input>();\r
+ \r
+ ///\r
+ /// Efi PE32 image file\r
+ ///\r
+ private List<Input> pe32FileList = new ArrayList<Input>();\r
+ \r
+ ///\r
+ /// Compress efi PE32 image file\r
+ ///\r
+ private List<Input> pe32ComprFileList = new ArrayList<Input>();\r
+ \r
+ ///\r
+ /// Hex class code in the PCI data strutor header\r
+ ///\r
+ private String classCode = "";\r
+ \r
+ ///\r
+ /// Hex revision in the PCI data header.\r
+ ///\r
+ private String revision = "";\r
+ \r
+ ///\r
+ /// Dump the headers of an existing option rom image.\r
+ ///\r
+ private String dump = "";\r
+ \r
+ \r
+ ///\r
+ /// output directory\r
+ ///\r
+ private String outputDir = "";\r
+ \r
+ \r
+ ///\r
+ /// command and argument list\r
+ ///\r
+ LinkedList<String> argList = new LinkedList<String>();\r
+ /**\r
+ * execute\r
+ * \r
+ * EfiRomTask execute function is to assemble tool command line & execute\r
+ * tool command line\r
+ * \r
+ * @throws BuidException\r
+ */\r
+ public void execute() throws BuildException {\r
+\r
+ Project project = this.getOwningTarget().getProject();\r
+ //\r
+ // set Logger\r
+ //\r
+ FrameworkLogger logger = new FrameworkLogger(project, "efirom");\r
+ EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));\r
+ EdkLog.setLogger(logger);\r
+ //\r
+ // absolute path of efi tools\r
+ //\r
+ String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
+ String command;\r
+ if (path == null) {\r
+ command = toolName;\r
+ } else {\r
+ command = path + File.separatorChar + toolName;\r
+ }\r
+ argList.addFirst(command);\r
+ \r
+ //\r
+ // add microcode binary files\r
+ //\r
+ if (this.binaryFileList.size() > 0){\r
+ argList.add("-b");\r
+ Iterator binList = this.binaryFileList.iterator();\r
+ while (binList.hasNext()){\r
+ argList.add(((Input)binList.next()).getFile());\r
+ }\r
+ }\r
+ \r
+ //\r
+ // add pe32 file\r
+ //\r
+ if (this.pe32FileList.size() > 0){\r
+ argList.add("-e");\r
+ Iterator pe32List = this.pe32FileList.iterator();\r
+ while (pe32List.hasNext()){\r
+ argList.add(((Input)pe32List.next()).getFile());\r
+ }\r
+ }\r
+ \r
+ //\r
+ // add compressed pe32 file\r
+ //\r
+ if (this.pe32ComprFileList.size() > 0){\r
+ argList.add("-ec");\r
+ Iterator pe32ComprList = this.pe32ComprFileList.iterator();\r
+ while (pe32ComprList.hasNext()){\r
+ argList.add(((Input)pe32ComprList.next()).getFile());\r
+ }\r
+ }\r
+ EdkLog.log(EdkLog.EDK_INFO, argList.toString().replaceAll(",",""));\r
+ \r
+ //\r
+ // lauch the program\r
+ //\r
+ ProcessBuilder pb = new ProcessBuilder(argList);\r
+ pb.directory(new File(outputDir));\r
+ int exitCode = 0;\r
+ try {\r
+ Process cmdProc = pb.start();\r
+ InputStreamReader cmdOut = new InputStreamReader(cmdProc.getInputStream());\r
+ char[] buf = new char[1024];\r
+\r
+ exitCode = cmdProc.waitFor();\r
+ if (exitCode != 0) {\r
+ int len = cmdOut.read(buf, 0, 1024);\r
+ EdkLog.log(EdkLog.EDK_ERROR,new String(buf, 0, len));\r
+ } else {\r
+ EdkLog.log(EdkLog.EDK_INFO, "FlashMap succeed!");\r
+ }\r
+ } catch (Exception e) {\r
+ throw new BuildException(e.getMessage());\r
+ } finally {\r
+ if (exitCode != 0) {\r
+ //throw new BuildException("GenFvImage: failed to generate FV file!");\r
+ }\r
+ }\r
+ }\r
+ \r
+ /**\r
+ * getVerbose\r
+ * \r
+ * This function is to get class member "verbose"\r
+ * \r
+ * @return verbose for verbose output.\r
+ */\r
+ public String getVerbose() {\r
+ return verbose;\r
+ }\r
+ \r
+ /**\r
+ * setVerbose\r
+ * \r
+ * This function is to set class member "verbose"\r
+ * \r
+ * @param verbose for verbose output.\r
+ */\r
+ public void setVerbose(boolean verbose) {\r
+ if (verbose){\r
+ this.verbose = "-p";\r
+ argList.add(this.verbose); \r
+ }\r
+ }\r
+ \r
+ /**\r
+ * getVenderId\r
+ * \r
+ * This function is to get class member "venderId"\r
+ * \r
+ * @return venderId String of venderId.\r
+ */\r
+ public String getVenderId() {\r
+ return venderId;\r
+ }\r
+ \r
+ /**\r
+ * setVenderId\r
+ * \r
+ * This function is to set class member "venderId"\r
+ * \r
+ * @param venderId String of venderId.\r
+ */\r
+ public void setVenderId(String VenderId) {\r
+ this.venderId = VenderId;\r
+ argList.add("-v");\r
+ argList.add(this.venderId);\r
+ }\r
+ \r
+ /**\r
+ * getDeviceId\r
+ * \r
+ * This function is to get class member "deviceId"\r
+ * \r
+ * @return deviceId String of device ID.\r
+ */\r
+ public String getDeviceId() {\r
+ return this.deviceId;\r
+ }\r
+ \r
+ /**\r
+ * setDeviceId\r
+ * \r
+ * This function is to set class member "deviceId"\r
+ * \r
+ * @param deviceId String of device ID.\r
+ */\r
+ public void setDeviceId(String deviceId) {\r
+ this.deviceId = deviceId;\r
+ argList.add("-d");\r
+ argList.add(this.deviceId);\r
+ }\r
+\r
+ \r
+ /**\r
+ * getOutputFile\r
+ * \r
+ * This function is to get class member "outputFile"\r
+ * \r
+ * @return outputFile name of output directory.\r
+ */\r
+ public String getOutputFile() {\r
+ return outputFile;\r
+ }\r
+ \r
+ /**\r
+ * setOutputFile\r
+ * \r
+ * This function is to set class member "dscFile"\r
+ * \r
+ * @param outputFile name of DSC file\r
+ */\r
+ public void setOutputFile(String outputFile) {\r
+ this.outputFile = outputFile;\r
+ \r
+ }\r
+ \r
+ /**\r
+ * getClassCode\r
+ * \r
+ * This function is to get class member "classCode"\r
+ * \r
+ * @return fdImage name of class code file.\r
+ */\r
+ public String getClassCode() {\r
+ return classCode;\r
+ }\r
+ \r
+ /**\r
+ * setclassCode\r
+ * \r
+ * This function is to set class member "fdImage"\r
+ * \r
+ * @param fdImage name of class code file.\r
+ */\r
+ public void setclassCode(String classCode) {\r
+ this.classCode = classCode;\r
+ argList.add("-cc");\r
+ argList.add(this.classCode);\r
+ }\r
+ \r
+ /**\r
+ * getRevision\r
+ * \r
+ * This function is to get class member "revision".\r
+ * \r
+ * @return revision hex revision in the PDI data header.\r
+ */\r
+ public String getRevision() {\r
+ return revision;\r
+ }\r
+ \r
+ /**\r
+ * setRevision\r
+ * \r
+ * This function is to set class member "revision"\r
+ * \r
+ * @param revision hex revision in the PDI data header.\r
+ */\r
+ public void setRevision(String revision) {\r
+ this.revision = revision;\r
+ argList.add("-rev");\r
+ argList.add(this.revision);\r
+ }\r
+ \r
+ /**\r
+ * getFlashDeviceImage\r
+ * \r
+ * This function is to get class member "flashDeviceImage"\r
+ * \r
+ * @return flashDeviceImage name of flash device image\r
+ */\r
+ public String getDump() {\r
+ return dump;\r
+ }\r
+ \r
+ /**\r
+ * setFlashDeviceImage\r
+ * \r
+ * This function is to set class member "flashDeviceImage"\r
+ * \r
+ * @param flashDeviceImage name of flash device image\r
+ */\r
+ public void setDump(boolean dump) {\r
+ if (dump){\r
+ this.dump = "-dump";\r
+ argList.add(this.dump);\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getOutputDir\r
+ * \r
+ * This function is to get class member "outputDir"\r
+ * \r
+ * @return outputDir string of output directory \r
+ */\r
+ public String getOutputDir() {\r
+ return outputDir;\r
+ }\r
+ \r
+ /**\r
+ * setOutputDir\r
+ * \r
+ * This function is to set class member "outputDir"\r
+ * \r
+ * @param outputDir string of output directory\r
+ */\r
+ public void setOutputDir(String outputDir) {\r
+ this.outputDir = outputDir;\r
+ }\r
+ /**\r
+ * addBinaryFile\r
+ * \r
+ * This function is to add binary file to binaryFile list.\r
+ * \r
+ * @param binaryFile name of binary file.\r
+ */\r
+ public void addBinaryFile(Input binaryFile){\r
+ this.binaryFileList.add(binaryFile);\r
+ }\r
+ \r
+ /**\r
+ * addPe32File\r
+ * \r
+ * This function is to add pe32 file to pe32File list. \r
+ * \r
+ * @param pe32File name of pe32 file.\r
+ */\r
+ public void addPe32File(Input pe32File){\r
+ this.pe32FileList.add(pe32File);\r
+ }\r
+ \r
+ /**\r
+ * addPe32ComprFile\r
+ * \r
+ * This function os to add compressed pe32 file to pe32ComprFile list.\r
+ * \r
+ * @param pe32ComprFile name of compressed pe32 file.\r
+ */\r
+ public void addPe32ComprFile(Input pe32ComprFile){\r
+ this.pe32ComprFileList.add(pe32ComprFile);\r
+ }\r
+}\r
--- /dev/null
+/** @file\r
+ FlashMapTask class.\r
+\r
+ FlashMapTask is used to call FlashMap.exe to lay out the flash.\r
+ \r
+ \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ **/\r
+package org.tianocore.framework.tasks;\r
+\r
+import java.io.File;\r
+import java.io.InputStreamReader;\r
+import java.util.ArrayList;\r
+import java.util.Iterator;\r
+import java.util.LinkedList;\r
+import java.util.List;\r
+\r
+import org.apache.tools.ant.Task;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.BuildException;\r
+import org.tianocore.logger.EdkLog;\r
+\r
+/**\r
+ * SecFixupTask class.\r
+ * \r
+ * SecFixupTask is used to call SecFixup.exe to fix up sec image.\r
+ */\r
+public class FlashMapTask extends Task implements EfiDefine {\r
+ // /\r
+ // / tool name\r
+ // /\r
+ private final String toolName = "FlashMap";\r
+\r
+ // /\r
+ // / Flash default file\r
+ // /\r
+ private String flashDefFile = "";\r
+\r
+ // /\r
+ // / Flash device\r
+ // /\r
+ private String flashDevice = "";\r
+\r
+ // /\r
+ // / Flash device Image\r
+ // /\r
+ private String flashDeviceImage = "";\r
+\r
+ // /\r
+ // / MCI file\r
+ // /\r
+ private String mciFile = "";\r
+\r
+ // /\r
+ // / MCO file\r
+ // /\r
+ private String mcoFile = "";\r
+\r
+ // /\r
+ // / Discover FD image\r
+ // /\r
+ private String fdImage = "";\r
+\r
+ // /\r
+ // / Dsc file\r
+ // /\r
+ private String dscFile = "";\r
+\r
+ // /\r
+ // / Asm INC file\r
+ // /\r
+ private String asmIncFile = "";\r
+\r
+ // /\r
+ // / Image out file\r
+ // /\r
+ private String imageOutFile = "";\r
+\r
+ // /\r
+ // / Header file\r
+ // /\r
+ private String headerFile = "";\r
+\r
+ // /\r
+ // / Input string file\r
+ // /\r
+ private String inStrFile = "";\r
+\r
+ // /\r
+ // / Output string file\r
+ // /\r
+ private String outStrFile = "";\r
+\r
+ // /\r
+ // / Base address\r
+ // /\r
+ private String baseAddr = "";\r
+\r
+ // /\r
+ // / Aligment\r
+ // /\r
+ private String aligment = "";\r
+\r
+ // /\r
+ // / Padding value\r
+ // /\r
+ private String padValue = "";\r
+\r
+ // /\r
+ // / output directory\r
+ // /\r
+ private String outputDir = "";\r
+\r
+ // /\r
+ // / MCI file array\r
+ // /\r
+ List<Input> mciFileArray = new ArrayList<Input>();\r
+\r
+ // /\r
+ // / command and argument list\r
+ // /\r
+ LinkedList<String> argList = new LinkedList<String>();\r
+\r
+ /**\r
+ * execute\r
+ * \r
+ * FlashMapTask execute function is to assemble tool command line & execute\r
+ * tool command line\r
+ * \r
+ * @throws BuidException\r
+ */\r
+ public void execute() throws BuildException {\r
+\r
+ Project project = this.getOwningTarget().getProject();\r
+ //\r
+ // set Logger\r
+ //\r
+ FrameworkLogger logger = new FrameworkLogger(project, "flashmap");\r
+ EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));\r
+ EdkLog.setLogger(logger);\r
+ //\r
+ // absolute path of efi tools\r
+ //\r
+ String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
+ String command;\r
+ if (path == null) {\r
+ command = toolName;\r
+ } else {\r
+ command = path + File.separatorChar + toolName;\r
+ }\r
+ argList.addFirst(command);\r
+\r
+ //\r
+ // add substituted input file and output file\r
+ //\r
+ if (this.inStrFile != null && this.outStrFile != null\r
+ && !this.inStrFile.equalsIgnoreCase("")\r
+ && !this.inStrFile.equalsIgnoreCase("")) {\r
+ argList.add("-strsub");\r
+ argList.add(this.inStrFile);\r
+ argList.add(this.outStrFile);\r
+ }\r
+ \r
+ \r
+ //\r
+ // add microcode binary files\r
+ //\r
+ if (mciFileArray.size() > 0) {\r
+ argList.add("-mcmerge");\r
+ Iterator mciList = mciFileArray.iterator();\r
+ while (mciList.hasNext()) {\r
+ argList.add(((Input) mciList.next()).getFile());\r
+ }\r
+ }\r
+\r
+ EdkLog.log(EdkLog.EDK_INFO, argList.toString().replace(",",""));\r
+ //\r
+ // lauch the program\r
+ //\r
+ ProcessBuilder pb = new ProcessBuilder(argList);\r
+ pb.directory(new File(outputDir));\r
+ int exitCode = 0;\r
+ try {\r
+ Process cmdProc = pb.start();\r
+ InputStreamReader cmdOut = new InputStreamReader(cmdProc\r
+ .getInputStream());\r
+ char[] buf = new char[1024];\r
+\r
+ exitCode = cmdProc.waitFor();\r
+ //\r
+ // log command line string.\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO, cmdProc.getOutputStream().toString());\r
+ if (exitCode != 0) {\r
+ int len = cmdOut.read(buf, 0, 1024);\r
+ EdkLog.log(EdkLog.EDK_ERROR, new String(buf, 0, len));\r
+ } else {\r
+ EdkLog.log(EdkLog.EDK_INFO, "FlashMap succeed!");\r
+ }\r
+ } catch (Exception e) {\r
+ throw new BuildException(e.getMessage());\r
+ } finally {\r
+ if (exitCode != 0) {\r
+ // throw new BuildException("GenFvImage: failed to generate FV\r
+ // file!");\r
+ }\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getFlashDefFile\r
+ * \r
+ * This function is to get class member "flashDefFile"\r
+ * \r
+ * @return flashDeFile Name of flash definition file.\r
+ */\r
+ public String getFlashDefFile() {\r
+ return flashDefFile;\r
+ }\r
+\r
+ /**\r
+ * setFlashDefFile\r
+ * \r
+ * This function is to set class member "flashDefFile"\r
+ * \r
+ * @param flashDefFile\r
+ * Name of flash definition file.\r
+ */\r
+ public void setFlashDefFile(String flashDefFile) {\r
+ this.flashDefFile = flashDefFile;\r
+ argList.add("-fdf");\r
+ argList.add(this.flashDefFile);\r
+ }\r
+\r
+ /**\r
+ * getAligment\r
+ * \r
+ * This function is to get class member "aligment"\r
+ * \r
+ * @return aligment String of aligment value.\r
+ */\r
+ public String getAligment() {\r
+ return aligment;\r
+ }\r
+\r
+ /**\r
+ * setAligment\r
+ * \r
+ * This function is to set class member "aligment"\r
+ * \r
+ * @param aligment\r
+ * String of aligment value.\r
+ */\r
+ public void setAligment(String aligment) {\r
+ this.aligment = aligment;\r
+ argList.add("-align");\r
+ argList.add(this.aligment);\r
+ }\r
+\r
+ /**\r
+ * getAsmIncFile\r
+ * \r
+ * This function is to get class member "asmIncFile"\r
+ * \r
+ * @return asmIncFile String of ASM include file.\r
+ */\r
+ public String getAsmIncFile() {\r
+ return asmIncFile;\r
+ }\r
+\r
+ /**\r
+ * setAsmIncFile\r
+ * \r
+ * This function is to set class member "asmIncFile"\r
+ * \r
+ * @param asmIncFile\r
+ * String of ASM include file.\r
+ */\r
+ public void setAsmIncFile(String asmIncFile) {\r
+ this.asmIncFile = asmIncFile;\r
+ argList.add("-asmincfile");\r
+ argList.add(this.asmIncFile);\r
+ }\r
+\r
+ /**\r
+ * getBaseAddr\r
+ * \r
+ * This function is to get class member "baseAddr"\r
+ * \r
+ * @return baseAddr String of base address value.\r
+ */\r
+ public String getBaseAddr() {\r
+ return baseAddr;\r
+ }\r
+\r
+ /**\r
+ * setBaseAddr\r
+ * \r
+ * This function is to set class member "baseAddr"\r
+ * \r
+ * @param baseAddr\r
+ * String of base address value.\r
+ */\r
+ public void setBaseAddr(String baseAddr) {\r
+ this.baseAddr = baseAddr;\r
+ argList.add("-baseaddr");\r
+ argList.add(this.baseAddr);\r
+ }\r
+\r
+ /**\r
+ * getDscFile\r
+ * \r
+ * This function is to get class member "dscFile"\r
+ * \r
+ * @return dscFile name of DSC file\r
+ */\r
+ public String getDscFile() {\r
+ return dscFile;\r
+ }\r
+\r
+ /**\r
+ * setDscFile\r
+ * \r
+ * This function is to set class member "dscFile"\r
+ * \r
+ * @param dscFile\r
+ * name of DSC file\r
+ */\r
+ public void setDscFile(String dscFile) {\r
+ this.dscFile = dscFile;\r
+ argList.add("-dsc");\r
+ argList.add(this.dscFile);\r
+ }\r
+\r
+ /**\r
+ * getFdImage\r
+ * \r
+ * This function is to get class member "fdImage"\r
+ * \r
+ * @return fdImage name of input FDI image file.\r
+ */\r
+ public String getFdImage() {\r
+ return fdImage;\r
+ }\r
+\r
+ /**\r
+ * setFdImage\r
+ * \r
+ * This function is to set class member "fdImage"\r
+ * \r
+ * @param fdImage\r
+ * name of input FDI image file.\r
+ */\r
+ public void setFdImage(String fdImage) {\r
+ this.fdImage = fdImage;\r
+ argList.add("-discover");\r
+ argList.add(this.fdImage);\r
+ }\r
+\r
+ /**\r
+ * getFlashDevice\r
+ * \r
+ * This function is to get class member "flashDevice".\r
+ * \r
+ * @return flashDevice name of flash device.\r
+ */\r
+ public String getFlashDevice() {\r
+ return flashDevice;\r
+ }\r
+\r
+ /**\r
+ * setFlashDevice\r
+ * \r
+ * This function is to set class member "flashDevice"\r
+ * \r
+ * @param flashDevice\r
+ * name of flash device.\r
+ */\r
+ public void setFlashDevice(String flashDevice) {\r
+ this.flashDevice = flashDevice;\r
+ argList.add("-flashdevice");\r
+ argList.add(this.flashDevice);\r
+ }\r
+\r
+ /**\r
+ * getFlashDeviceImage\r
+ * \r
+ * This function is to get class member "flashDeviceImage"\r
+ * \r
+ * @return flashDeviceImage name of flash device image\r
+ */\r
+ public String getFlashDeviceImage() {\r
+ return flashDeviceImage;\r
+ }\r
+\r
+ /**\r
+ * setFlashDeviceImage\r
+ * \r
+ * This function is to set class member "flashDeviceImage"\r
+ * \r
+ * @param flashDeviceImage\r
+ * name of flash device image\r
+ */\r
+ public void setFlashDeviceImage(String flashDeviceImage) {\r
+ this.flashDeviceImage = flashDeviceImage;\r
+ argList.add("-flashdeviceimage");\r
+ argList.add(this.flashDeviceImage);\r
+\r
+ }\r
+\r
+ /**\r
+ * getHeaderFile\r
+ * \r
+ * This function is to get class member "headerFile"\r
+ * \r
+ * @return headerFile name of include file\r
+ */\r
+ public String getHeaderFile() {\r
+ return headerFile;\r
+ }\r
+\r
+ /**\r
+ * setHeaderFile\r
+ * \r
+ * This function is to set class member "headerFile"\r
+ * \r
+ * @param headerFile\r
+ * name of include file\r
+ */\r
+ public void setHeaderFile(String headerFile) {\r
+ this.headerFile = headerFile;\r
+ argList.add("-hfile");\r
+ argList.add(this.headerFile);\r
+ }\r
+\r
+ /**\r
+ * getImageOutFile\r
+ * \r
+ * This function is to get class member "imageOutFile"\r
+ * \r
+ * @return imageOutFile name of output image file\r
+ */\r
+ public String getImageOutFile() {\r
+ return imageOutFile;\r
+ }\r
+\r
+ /**\r
+ * setImageOutFile\r
+ * \r
+ * This function is to set class member "ImageOutFile"\r
+ * \r
+ * @param imageOutFile\r
+ * name of output image file\r
+ */\r
+ public void setImageOutFile(String imageOutFile) {\r
+ this.imageOutFile = imageOutFile;\r
+ argList.add("-imageout");\r
+ argList.add(this.imageOutFile);\r
+ }\r
+\r
+ /**\r
+ * getInStrFile\r
+ * \r
+ * This function is to get class member "inStrFile"\r
+ * \r
+ * @return inStrFile name of input file which used to replace symbol names.\r
+ */\r
+ public String getInStrFile() {\r
+ return inStrFile;\r
+ }\r
+\r
+ /**\r
+ * setInStrFile\r
+ * \r
+ * This function is to set class member "inStrFile"\r
+ * \r
+ * @param inStrFile\r
+ * name of input file which used to replace symbol names.\r
+ */\r
+ public void setInStrFile(String inStrFile) {\r
+ this.inStrFile = inStrFile;\r
+ }\r
+\r
+ /**\r
+ * getMciFile\r
+ * \r
+ * This function is to get class member "mciFile"\r
+ * \r
+ * @return mciFile name of input microcode file\r
+ */\r
+ public String getMciFile() {\r
+ return mciFile;\r
+ }\r
+\r
+ /**\r
+ * setMciFile\r
+ * \r
+ * This function is to set class member "mciFile"\r
+ * \r
+ * @param mciFile\r
+ * name of input microcode file\r
+ */\r
+ public void setMciFile(String mciFile) {\r
+ this.mciFile = mciFile;\r
+ argList.add("-mci");\r
+ argList.add(this.mciFile);\r
+ }\r
+\r
+ /**\r
+ * getMcoFile\r
+ * \r
+ * This function is to get class member "mcoFile"\r
+ * \r
+ * @return mcoFile name of output binary microcode image\r
+ */\r
+ public String getMcoFile() {\r
+ return mcoFile;\r
+ }\r
+\r
+ /**\r
+ * setMcoFile\r
+ * \r
+ * This function is to set class member "mcoFile"\r
+ * \r
+ * @param mcoFile\r
+ * name of output binary microcode image\r
+ */\r
+ public void setMcoFile(String mcoFile) {\r
+ this.mcoFile = mcoFile;\r
+ argList.add("-mco");\r
+ argList.add(this.mcoFile);\r
+ }\r
+\r
+ /**\r
+ * getOutStrFile\r
+ * \r
+ * This function is to get class member "outStrFile"\r
+ * \r
+ * @return outStrFile name of output string substitution file\r
+ */\r
+ public String getOutStrFile() {\r
+ return outStrFile;\r
+ }\r
+\r
+ /**\r
+ * setOutStrFile\r
+ * \r
+ * This function is to set class member "outStrFile"\r
+ * \r
+ * @param outStrFile\r
+ * name of output string substitution file\r
+ */\r
+ public void setOutStrFile(String outStrFile) {\r
+ this.outStrFile = outStrFile;\r
+ }\r
+\r
+ /**\r
+ * getPadValue\r
+ * \r
+ * This function is to get class member "padValue"\r
+ * \r
+ * @return padValue string of byte value to use as padding\r
+ */\r
+ public String getPadValue() {\r
+ return padValue;\r
+ }\r
+\r
+ /**\r
+ * setPadValue\r
+ * \r
+ * This function is to set class member "padValue"\r
+ * \r
+ * @param padValue\r
+ * string of byte value to use as padding\r
+ */\r
+ public void setPadValue(String padValue) {\r
+ this.padValue = padValue;\r
+ argList.add("-padvalue");\r
+ argList.add(this.padValue);\r
+ }\r
+\r
+ /**\r
+ * addMciFile\r
+ * \r
+ * This function is to add Microcode binary file\r
+ * \r
+ * @param mciFile\r
+ * instance of input class\r
+ */\r
+ public void addMciFile(Input mciFile) {\r
+ this.mciFileArray.add(mciFile);\r
+ }\r
+\r
+ /**\r
+ * getOutputDir\r
+ * \r
+ * This function is to get class member "outputDir"\r
+ * \r
+ * @return outputDir string of output directory\r
+ */\r
+ public String getOutputDir() {\r
+ return outputDir;\r
+ }\r
+\r
+ /**\r
+ * setOutputDir\r
+ * \r
+ * This function is to set class member "outputDir"\r
+ * \r
+ * @param outputDir\r
+ * string of output directory\r
+ */\r
+ public void setOutputDir(String outputDir) {\r
+ this.outputDir = outputDir;\r
+ }\r
+}\r
--- /dev/null
+/*++\r
+\r
+Copyright (c) 2006, Intel Corporation\r
+All rights reserved. This program and the accompanying materials\r
+are licensed and made available under the terms and conditions of the BSD License\r
+which accompanies this distribution. The full text of the license may be found at\r
+http://opensource.org/licenses/bsd-license.php\r
+\r
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+Module Name:\r
+ FrameworkLogger.java\r
+\r
+Abstract:\r
+\r
+--*/\r
+\r
+package org.tianocore.framework.tasks;\r
+import org.apache.tools.ant.Project;\r
+import org.tianocore.logger.LogMethod;\r
+\r
+class FrameworkLogger implements LogMethod {\r
+ private Project project;\r
+ private String titleName;\r
+ public FrameworkLogger(Project project, String taskName) {\r
+ this.project = project;\r
+ this.titleName = taskName;\r
+ \r
+ \r
+ }\r
+\r
+ public void putMessage(Object msgSource, int msgLevel, String msg) {\r
+ \r
+ String frameworkMsg = " [" + this.titleName + "] " + msg;\r
+ this.project.log(frameworkMsg, Project.MSG_INFO);\r
+ }\r
+}
\ No newline at end of file
import org.apache.tools.ant.taskdefs.Execute;\r
import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
import org.apache.tools.ant.types.Commandline;\r
-import org.tianocore.build.*;\r
+\r
\r
/**\r
FwImageTask class.\r
--- /dev/null
+/** @file\r
+ GenAcpiTable class.\r
+\r
+ GenAcpiTable is used to call GenAcpiTable.exe to generate ACPI Table image .\r
+ \r
+ \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ **/\r
+package org.tianocore.framework.tasks;\r
+\r
+import java.io.File;\r
+\r
+import org.apache.tools.ant.Task;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.BuildException;\r
+import org.apache.tools.ant.taskdefs.Execute;\r
+import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
+import org.apache.tools.ant.types.Commandline;\r
+import org.tianocore.logger.EdkLog;\r
+\r
+/**\r
+ GenAcpiTable class.\r
+\r
+ GenAcpiTable is used to call GenAcpiTable.exe to generate ACPI Table image .\r
+**/\r
+public class GenAcpiTableTask extends Task implements EfiDefine {\r
+ // /\r
+ // / input file\r
+ // /\r
+ private String inputFile = "";\r
+\r
+ // /\r
+ // / output file\r
+ // /\r
+ private String outputFile = "";\r
+\r
+ // /\r
+ // / output directory, this variable is added by jave wrap\r
+ // /\r
+ private String outputDir = "";\r
+\r
+ /**\r
+ * execute\r
+ * \r
+ * StripTask execute function is to assemble tool command line & execute\r
+ * tool command line\r
+ * \r
+ * @throws BuidException\r
+ */\r
+ public void execute() throws BuildException {\r
+\r
+ Project project = this.getOwningTarget().getProject();\r
+ //\r
+ // set Logger\r
+ //\r
+ FrameworkLogger logger = new FrameworkLogger(project, "genacpitable");\r
+ EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));\r
+ EdkLog.setLogger(logger);\r
+ //\r
+ // absolute path of efi tools\r
+ //\r
+ String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
+ String command;\r
+ String argument;\r
+ if (path == null) {\r
+ command = "GenAcpiTable";\r
+ } else {\r
+ command = path + File.separatorChar + "GenAcpiTable";\r
+ }\r
+ //\r
+ // argument of tools\r
+ //\r
+ File file = new File(outputFile);\r
+ if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
+ argument = inputFile + " " + outputDir + File.separatorChar\r
+ + outputFile;\r
+ } else {\r
+ argument = inputFile + " " + outputFile;\r
+ }\r
+ //\r
+ // return value of fwimage execution\r
+ //\r
+ int revl = -1;\r
+\r
+ try {\r
+ Commandline cmdline = new Commandline();\r
+ cmdline.setExecutable(command);\r
+ cmdline.createArgument().setLine(argument);\r
+\r
+ LogStreamHandler streamHandler = new LogStreamHandler(this,\r
+ Project.MSG_INFO, Project.MSG_WARN);\r
+ Execute runner = new Execute(streamHandler, null);\r
+\r
+ runner.setAntRun(project);\r
+ runner.setCommandline(cmdline.getCommandline());\r
+ //\r
+ // Set debug log information.\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO, Commandline.toString(cmdline.getCommandline()));\r
+ \r
+ revl = runner.execute();\r
+ \r
+ if (EFI_SUCCESS == revl) {\r
+ //\r
+ // command execution success\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO,"GenAcpiTable successed!");\r
+ } else {\r
+ //\r
+ // command execution fail\r
+ //\r
+ EdkLog.log(EdkLog.EDK_ERROR, "GenAcpiTable failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+ throw new BuildException("GenAcpiTable failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+\r
+ }\r
+ } catch (Exception e) {\r
+ throw new BuildException(e.getMessage());\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getInputFile\r
+ * \r
+ * This function is to get class member "inputFile".\r
+ * \r
+ * @return string of input file name.\r
+ */\r
+ public String getInputFile() {\r
+ return inputFile;\r
+ }\r
+\r
+ /**\r
+ * setComponentType\r
+ * \r
+ * This function is to set class member "inputFile".\r
+ * \r
+ * @param inputFile\r
+ * string of input file name.\r
+ */\r
+ public void setInputFile(String inputFile) {\r
+ this.inputFile = inputFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputFile\r
+ * \r
+ * This function is to get class member "outputFile"\r
+ * \r
+ * @return outputFile string of output file name.\r
+ */\r
+ public String getOutputFile() {\r
+ return outputFile;\r
+ }\r
+\r
+ /**\r
+ * setOutputFile\r
+ * \r
+ * This function is to set class member "outputFile"\r
+ * \r
+ * @param outputFile\r
+ * string of output file name.\r
+ */\r
+ public void setOutputFile(String outputFile) {\r
+ this.outputFile = outputFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputDir\r
+ * \r
+ * This function is to get class member "outputDir"\r
+ * \r
+ * @return outputDir string of output directory.\r
+ */\r
+ public String getOutputDir() {\r
+ return outputDir;\r
+ }\r
+\r
+ /**\r
+ * setOutputDir\r
+ * \r
+ * This function is to set class member "outputDir"\r
+ * \r
+ * @param outputDir\r
+ * string of output directory.\r
+ */\r
+ public void setOutputDir(String outputDir) {\r
+ this.outputDir = outputDir;\r
+ }\r
+}\r
--- /dev/null
+/** @file\r
+ GenCapsuleHdrTask class.\r
+\r
+ GenCapsuleHdrTask is used to call GenCapsuleHdr.exe to generate capsule.\r
+ \r
+ \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ **/\r
+package org.tianocore.framework.tasks;\r
+\r
+import java.io.File;\r
+\r
+import org.apache.tools.ant.Task;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.BuildException;\r
+import org.apache.tools.ant.taskdefs.Execute;\r
+import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
+import org.apache.tools.ant.types.Commandline;\r
+import org.tianocore.logger.EdkLog;\r
+\r
+/**\r
+ GenCapsuleHdrTask class.\r
+\r
+ GenCapsuleHdrTask is used to call GenCapsuleHdr.exe to generate capsule.\r
+**/\r
+public class GenCapsuleHdrTask extends Task implements EfiDefine {\r
+ ///\r
+ /// tool name\r
+ ///\r
+ private String toolName = "GenCapsuleHdr";\r
+ \r
+ ///\r
+ /// script file\r
+ ///\r
+ private String scriptFile = "";\r
+\r
+ ///\r
+ /// output file\r
+ ///\r
+ private String outputFile = "";\r
+\r
+ ///\r
+ /// output directory, this variable is added by jave wrap\r
+ ///\r
+ private String outputDir = "";\r
+\r
+ ///\r
+ /// Verbose flag\r
+ ///\r
+ private String verbose = "";\r
+\r
+ ///\r
+ /// Dump flag\r
+ ///\r
+ private String dump = "";\r
+ \r
+ ///\r
+ /// Split size\r
+ ///\r
+ private String size = "";\r
+ \r
+ ///\r
+ /// capsule into one image flag\r
+ ///\r
+ private String joinFlag = "";\r
+ \r
+ ///\r
+ /// capsule file\r
+ ///\r
+ private String capsuleFile = "";\r
+\r
+\r
+ /**\r
+ * execute\r
+ * \r
+ * GenCapsuleHdrTask execute function is to assemble tool command line & execute\r
+ * tool command line\r
+ * \r
+ * @throws BuidException\r
+ */\r
+ public void execute() throws BuildException {\r
+\r
+ Project project = this.getOwningTarget().getProject();\r
+ //\r
+ // set Logger\r
+ //\r
+ FrameworkLogger logger = new FrameworkLogger(project, "gencapsulehdr");\r
+ EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));\r
+ EdkLog.setLogger(logger);\r
+ //\r
+ // absolute path of efi tools\r
+ //\r
+ String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
+ String command;\r
+ String argument;\r
+ if (path == null) {\r
+ command = toolName;\r
+ } else {\r
+ command = path + File.separatorChar + toolName;\r
+ }\r
+ //\r
+ // argument of tools\r
+ //\r
+ File file = new File(outputFile);\r
+ if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
+ argument = this.verbose + this.dump + "-o " +this.outputDir\r
+ + File.separatorChar + this.outputFile + " "\r
+ + this.scriptFile + " " + this.size + " " + this.joinFlag + this.capsuleFile;\r
+ } else {\r
+ argument = this.verbose + this.dump + "-o " + this.outputFile\r
+ + " " + this.scriptFile + " " + this.size + " " + this.joinFlag + this.capsuleFile;\r
+ }\r
+ //\r
+ // return value of fwimage execution\r
+ //\r
+ int revl = -1;\r
+\r
+ try {\r
+ Commandline cmdline = new Commandline();\r
+ cmdline.setExecutable(command);\r
+ cmdline.createArgument().setLine(argument);\r
+\r
+ LogStreamHandler streamHandler = new LogStreamHandler(this,\r
+ Project.MSG_INFO, Project.MSG_WARN);\r
+ Execute runner = new Execute(streamHandler, null);\r
+\r
+ runner.setAntRun(project);\r
+ runner.setCommandline(cmdline.getCommandline());\r
+ //\r
+ // Set debug log information.\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO, Commandline.toString(cmdline\r
+ .getCommandline()));\r
+\r
+ revl = runner.execute();\r
+\r
+ if (EFI_SUCCESS == revl) {\r
+ //\r
+ // command execution success\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO, "GenCapsuleHdr succeeded!");\r
+ } else {\r
+ //\r
+ // command execution fail\r
+ //\r
+ EdkLog.log(EdkLog.EDK_ERROR, "GenCapsuleHdr failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+ throw new BuildException("GenCapsuleHdr failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+\r
+ }\r
+ } catch (Exception e) {\r
+ throw new BuildException(e.getMessage());\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getInputFile\r
+ * \r
+ * This function is to get class member "scriptFile".\r
+ * \r
+ * @return string of input file name.\r
+ */\r
+ public String getScriptFile() {\r
+ return this.scriptFile;\r
+ }\r
+\r
+ /**\r
+ * setComponentType\r
+ * \r
+ * This function is to set class member "inputFile".\r
+ * \r
+ * @param inputFile\r
+ * string of input file name.\r
+ */\r
+ public void setScriptFile(String scriptFile) {\r
+ this.scriptFile = "-script " + scriptFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputFile\r
+ * \r
+ * This function is to get class member "outputFile"\r
+ * \r
+ * @return outputFile string of output file name.\r
+ */\r
+ public String getOutputFile() {\r
+ return outputFile;\r
+ }\r
+\r
+ /**\r
+ * setOutputFile\r
+ * \r
+ * This function is to set class member "outputFile"\r
+ * \r
+ * @param outputFile\r
+ * string of output file name.\r
+ */\r
+ public void setOutputFile(String outputFile) {\r
+ this.outputFile = outputFile + " ";\r
+ }\r
+\r
+ /**\r
+ * getOutputDir\r
+ * \r
+ * This function is to get class member "outputDir"\r
+ * \r
+ * @return outputDir string of output directory.\r
+ */\r
+ public String getOutputDir() {\r
+ return outputDir;\r
+ }\r
+\r
+ /**\r
+ * setOutputDir\r
+ * \r
+ * This function is to set class member "outputDir"\r
+ * \r
+ * @param outputDir\r
+ * string of output directory.\r
+ */\r
+ public void setOutputDir(String outputDir) {\r
+ this.outputDir = outputDir;\r
+ }\r
+\r
+ /**\r
+ * getVerbose\r
+ * \r
+ * This function is to get class member "verbose"\r
+ * \r
+ * @return verbose the flag of verbose.\r
+ */\r
+ public String getVerbose() {\r
+ return this.verbose;\r
+ }\r
+\r
+ /**\r
+ * setVerbose\r
+ * \r
+ * This function is to set class member "verbose"\r
+ * \r
+ * @param verbose\r
+ * True or False.\r
+ */\r
+ public void setVerbose(boolean verbose) {\r
+ if (verbose) {\r
+ this.verbose = "-v ";\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getDump\r
+ * \r
+ * This function is to get class member "dump"\r
+ * \r
+ * @return verbose the flag of dump.\r
+ */\r
+ public String getDump() {\r
+ return dump;\r
+ }\r
+\r
+ /**\r
+ * setDump\r
+ * \r
+ * This function is to set class member "dump".\r
+ * \r
+ * @param dump\r
+ * True or False.\r
+ */\r
+ public void setDump(boolean dump) {\r
+ if (dump) {\r
+ this.dump = "-dump ";\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getSize\r
+ * \r
+ * This function is to set class member "size".\r
+ * \r
+ * @return size string of size value\r
+ */\r
+ public String getSize() {\r
+ return size;\r
+ }\r
+\r
+ /**\r
+ * setSize\r
+ * \r
+ * This function is to set class member "size".\r
+ * \r
+ * @param size string of size value.\r
+ */\r
+ public void setSize(String size) {\r
+ this.size = "-split " + size;\r
+ }\r
+\r
+ /**\r
+ * getCapsuleFile\r
+ * \r
+ * This function is to get class member "capsuleFile"\r
+ * \r
+ * @return capsuleFile capsule file name\r
+ */\r
+ public String getCapsuleFile() {\r
+ return capsuleFile;\r
+ }\r
+\r
+ /**\r
+ * setCapsuleFile\r
+ * \r
+ * This function is to set class member "capsuleFile"\r
+ * \r
+ * @param capsuleFile capsule file name\r
+ */\r
+ public void setCapsuleFile(String capsuleFile) {\r
+ this.capsuleFile = capsuleFile;\r
+ }\r
+\r
+ /**\r
+ * isJoinFlag\r
+ * \r
+ * This function is to get class member "joinFlag"\r
+ * \r
+ * @return joinFlag flag of if need to join split capsule images into \r
+ * a single image.\r
+ */\r
+ public String getJoinFlag() {\r
+ return joinFlag;\r
+ }\r
+\r
+ /**\r
+ * setJoinFlag\r
+ * \r
+ * This function is to set class member "joinFlag"\r
+ * \r
+ * @param joinFlag flag of if need to join split capsule images into \r
+ * a single image. \r
+ */\r
+ public void setJoinFlag(boolean joinFlag) {\r
+ if (joinFlag){\r
+ this.joinFlag = "-j "; \r
+ }\r
+ \r
+ }\r
+}\r
--- /dev/null
+/** @file\r
+ GenTeImageTask class.\r
+\r
+ GenTeImageTask is used to call GenTEImage.exe to generate TE image .\r
+ \r
+ \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ **/\r
+package org.tianocore.framework.tasks;\r
+\r
+import java.io.File;\r
+\r
+import org.apache.tools.ant.Task;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.BuildException;\r
+import org.apache.tools.ant.taskdefs.Execute;\r
+import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
+import org.apache.tools.ant.types.Commandline;\r
+import org.tianocore.logger.EdkLog;\r
+\r
+/**\r
+ * GenTeImageTask class.\r
+ * \r
+ * GenTeImageTask is used to call GenAcpiTable.exe to generate ACPI Table image .\r
+ */\r
+public class GenTeImageTask extends Task implements EfiDefine {\r
+ ///\r
+ /// tool name\r
+ ///\r
+ private String toolName = "GenTeImage";\r
+ ///\r
+ /// input file\r
+ ///\r
+ private String inputFile = "";\r
+\r
+ ///\r
+ /// output file\r
+ ///\r
+ private String outputFile = "";\r
+\r
+ ///\r
+ /// output directory, this variable is added by jave wrap\r
+ ///\r
+ private String outputDir = "";\r
+\r
+ ///\r
+ /// Verbose flag\r
+ ///\r
+ private String verbose = "";\r
+\r
+ ///\r
+ /// Dump flag\r
+ ///\r
+ private String dump = "";\r
+\r
+ /**\r
+ * assemble tool command line & execute tool command line\r
+ * \r
+ * @throws BuildException\r
+ */\r
+ /**\r
+ * execute\r
+ * \r
+ * GenTeImgaeTask execute function is to assemble tool command line & execute\r
+ * tool command line\r
+ * \r
+ * @throws BuidException\r
+ */\r
+ public void execute() throws BuildException {\r
+\r
+ Project project = this.getOwningTarget().getProject();\r
+ //\r
+ // set Logger\r
+ //\r
+ FrameworkLogger logger = new FrameworkLogger(project, toolName.toLowerCase());\r
+ EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));\r
+ EdkLog.setLogger(logger);\r
+ //\r
+ // absolute path of efi tools\r
+ //\r
+ String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
+ String command;\r
+ String argument;\r
+ if (path == null) {\r
+ command = toolName;\r
+ } else {\r
+ command = path + File.separatorChar + toolName;\r
+ }\r
+ //\r
+ // argument of tools\r
+ //\r
+ File file = new File(outputFile);\r
+ if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
+ argument = this.verbose + this.dump + "-o " +this.outputDir\r
+ + File.separatorChar + this.outputFile + " "\r
+ + this.inputFile;\r
+ } else {\r
+ argument = this.verbose + this.dump + "-o " + this.outputFile\r
+ + " " + this.inputFile;\r
+ }\r
+ //\r
+ // return value of fwimage execution\r
+ //\r
+ int revl = -1;\r
+\r
+ try {\r
+ Commandline cmdline = new Commandline();\r
+ cmdline.setExecutable(command);\r
+ cmdline.createArgument().setLine(argument);\r
+\r
+ LogStreamHandler streamHandler = new LogStreamHandler(this,\r
+ Project.MSG_INFO, Project.MSG_WARN);\r
+ Execute runner = new Execute(streamHandler, null);\r
+\r
+ runner.setAntRun(project);\r
+ runner.setCommandline(cmdline.getCommandline());\r
+ //\r
+ // Set debug log information.\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO, Commandline.toString(cmdline\r
+ .getCommandline()));\r
+\r
+ revl = runner.execute();\r
+\r
+ if (EFI_SUCCESS == revl) {\r
+ //\r
+ // command execution success\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO, "GenTeImage succeeded!");\r
+ } else {\r
+ //\r
+ // command execution fail\r
+ //\r
+ EdkLog.log(EdkLog.EDK_ERROR, "GenTeImage failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+ throw new BuildException("GenTeImage failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+\r
+ }\r
+ } catch (Exception e) {\r
+ throw new BuildException(e.getMessage());\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getInputFile\r
+ * \r
+ * This function is to get class member "inputFile".\r
+ * \r
+ * @return string of input file name.\r
+ */\r
+ public String getInputFile() {\r
+ return inputFile;\r
+ }\r
+\r
+ /**\r
+ * setComponentType\r
+ * \r
+ * This function is to set class member "inputFile".\r
+ * \r
+ * @param inputFile\r
+ * string of input file name.\r
+ */\r
+ public void setInputFile(String inputFile) {\r
+ this.inputFile = inputFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputFile\r
+ * \r
+ * This function is to get class member "outputFile"\r
+ * \r
+ * @return outputFile string of output file name.\r
+ */\r
+ public String getOutputFile() {\r
+ return outputFile;\r
+ }\r
+\r
+ /**\r
+ * setOutputFile\r
+ * \r
+ * This function is to set class member "outputFile"\r
+ * \r
+ * @param outputFile\r
+ * string of output file name.\r
+ */\r
+ public void setOutputFile(String outputFile) {\r
+ this.outputFile = outputFile + " ";\r
+ }\r
+\r
+ /**\r
+ * getOutputDir\r
+ * \r
+ * This function is to get class member "outputDir"\r
+ * \r
+ * @return outputDir string of output directory.\r
+ */\r
+ public String getOutputDir() {\r
+ return outputDir;\r
+ }\r
+\r
+ /**\r
+ * setOutputDir\r
+ * \r
+ * This function is to set class member "outputDir"\r
+ * \r
+ * @param outputDir\r
+ * string of output directory.\r
+ */\r
+ public void setOutputDir(String outputDir) {\r
+ this.outputDir = outputDir;\r
+ }\r
+\r
+ /**\r
+ * getVerbose\r
+ * \r
+ * This function is to get class member "verbose"\r
+ * \r
+ * @return verbose the flag of verbose.\r
+ */\r
+ public String getVerbose() {\r
+ return this.verbose;\r
+ }\r
+\r
+ /**\r
+ * setVerbose\r
+ * \r
+ * This function is to set class member "verbose"\r
+ * \r
+ * @param verbose\r
+ * True or False.\r
+ */\r
+ public void setVerbose(boolean verbose) {\r
+ if (verbose) {\r
+ this.verbose = "-v ";\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getDump\r
+ * \r
+ * This function is to get class member "dump"\r
+ * \r
+ * @return verbose the flag of dump.\r
+ */\r
+ public String getDump() {\r
+ return dump;\r
+ }\r
+\r
+ /**\r
+ * setDump\r
+ * \r
+ * This function is to set class member "dump"\r
+ * \r
+ * @param dump\r
+ * True or False.\r
+ */\r
+ public void setDump(boolean dump) {\r
+ if (dump) {\r
+ this.dump = "-dump ";\r
+ }\r
+ }\r
+}\r
--- /dev/null
+/** @file\r
+ PeiReBaseTask class.\r
+\r
+ PeiReBaseTask is used to call PeiReBase.exe to rebase efi fv file.\r
+ \r
+ \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ **/\r
+package org.tianocore.framework.tasks;\r
+\r
+import java.io.File;\r
+\r
+import org.apache.tools.ant.Task;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.BuildException;\r
+import org.apache.tools.ant.taskdefs.Execute;\r
+import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
+import org.apache.tools.ant.types.Commandline;\r
+import org.tianocore.logger.EdkLog;\r
+\r
+/**\r
+ PeiReBaseTask class.\r
+\r
+ PeiReBaseTask is used to call PeiReBase.exe to rebase efi fv file.\r
+**/\r
+public class PeiReBaseTask extends Task implements EfiDefine {\r
+ ///\r
+ /// tool name\r
+ ///\r
+ private String toolName = "PeiReBase";\r
+ // /\r
+ // / Input file\r
+ // /\r
+ private String inputFile = "";\r
+\r
+ // /\r
+ // / Output file\r
+ // /\r
+ private String outputFile = "";\r
+\r
+ // /\r
+ // / Output directory, this variable is added by jave wrap\r
+ // /\r
+ private String outputDir = "";\r
+ \r
+ ///\r
+ /// Base address\r
+ ///\r
+ private String baseAddr = "";\r
+ \r
+ ///\r
+ /// Architecture \r
+ ///\r
+ private String arch = "";\r
+ \r
+ /**\r
+ * execute\r
+ * \r
+ * PeiReBaseTask execute function is to assemble tool command line & execute\r
+ * tool command line\r
+ * \r
+ * @throws BuidException\r
+ */\r
+ public void execute() throws BuildException {\r
+\r
+ Project project = this.getOwningTarget().getProject();\r
+ //\r
+ // set Logger\r
+ //\r
+ FrameworkLogger logger = new FrameworkLogger(project, toolName.toLowerCase());\r
+ EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));\r
+ EdkLog.setLogger(logger);\r
+ \r
+ //\r
+ // absolute path of efi tools\r
+ //\r
+ String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
+ String command;\r
+ String argument;\r
+ if (this.arch.equalsIgnoreCase("IA32")){\r
+ command = toolName + "_IA32";\r
+ }else if (this.arch.equalsIgnoreCase("X64")){\r
+ command = toolName + "_X64";\r
+ }else if (this.arch.equalsIgnoreCase("IPF")){\r
+ command = toolName + "_IPF";\r
+ }else {\r
+ command = toolName + "_IA32";\r
+ }\r
+ if (path != null) {\r
+ command = path + File.separatorChar + command;\r
+ }\r
+ \r
+ //\r
+ // argument of tools\r
+ //\r
+ File file = new File(outputFile);\r
+ if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
+ argument = inputFile + " " + "-O " + outputDir + File.separatorChar\r
+ + outputFile + " " + this.baseAddr;\r
+ } else {\r
+ argument = inputFile + " " + "-O " + outputFile + " " + this.baseAddr;\r
+ }\r
+ \r
+ //\r
+ // return value of fwimage execution\r
+ //\r
+ int revl = -1;\r
+\r
+ try {\r
+ Commandline cmdline = new Commandline();\r
+ cmdline.setExecutable(command);\r
+ cmdline.createArgument().setLine(argument);\r
+\r
+ LogStreamHandler streamHandler = new LogStreamHandler(this,\r
+ Project.MSG_INFO, Project.MSG_WARN);\r
+ Execute runner = new Execute(streamHandler, null);\r
+\r
+ runner.setAntRun(project);\r
+ runner.setCommandline(cmdline.getCommandline());\r
+ //\r
+ // Set debug log information.\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO, Commandline.toString(cmdline.getCommandline()));\r
+ \r
+ revl = runner.execute();\r
+ \r
+ if (EFI_SUCCESS == revl) {\r
+ //\r
+ // command execution success\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO,"PeiBase succeeded!");\r
+ } else {\r
+ //\r
+ // command execution fail\r
+ //\r
+ EdkLog.log(EdkLog.EDK_ERROR, "PeiBase failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+ throw new BuildException("PeiBase failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+\r
+ }\r
+ } catch (Exception e) {\r
+ throw new BuildException(e.getMessage());\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getInputFile\r
+ * \r
+ * This function is to get class member "inputFile".\r
+ * \r
+ * @return string of input file name.\r
+ */\r
+ public String getInputFile() {\r
+ return inputFile;\r
+ }\r
+\r
+ /**\r
+ * setComponentType\r
+ * \r
+ * This function is to set class member "inputFile".\r
+ * \r
+ * @param inputFile\r
+ * string of input file name.\r
+ */\r
+ public void setInputFile(String inputFile) {\r
+ this.inputFile = "-I " + inputFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputFile\r
+ * \r
+ * This function is to get class member "outputFile"\r
+ * \r
+ * @return outputFile string of output file name.\r
+ */\r
+ public String getOutputFile() {\r
+ return outputFile;\r
+ }\r
+\r
+ /**\r
+ * setOutputFile\r
+ * \r
+ * This function is to set class member "outputFile"\r
+ * \r
+ * @param outputFile\r
+ * string of output file name.\r
+ */\r
+ public void setOutputFile(String outputFile) {\r
+ this.outputFile = outputFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputDir\r
+ * \r
+ * This function is to get class member "outputDir"\r
+ * \r
+ * @return outputDir string of output directory.\r
+ */\r
+ public String getOutputDir() {\r
+ return outputDir;\r
+ }\r
+\r
+ /**\r
+ * setOutputDir\r
+ * \r
+ * This function is to set class member "outputDir"\r
+ * \r
+ * @param outputDir\r
+ * string of output directory.\r
+ */\r
+ public void setOutputDir(String outputDir) {\r
+ this.outputDir = outputDir;\r
+ }\r
+\r
+ /**\r
+ * getBaseAddr\r
+ * \r
+ * This function is to get class member "baseAddr"\r
+ * \r
+ * @return baseAddr string of base address.\r
+ */\r
+ public String getBaseAddr() {\r
+ return baseAddr;\r
+ }\r
+\r
+ /**\r
+ * setBaseAddr\r
+ * \r
+ * This function is to set class member "baseAddr"\r
+ * \r
+ * @param baseAddr string of base address\r
+ */\r
+ public void setBaseAddr(String baseAddr) {\r
+ this.baseAddr = "-B " + baseAddr;\r
+ }\r
+\r
+ /**\r
+ * getArch\r
+ * \r
+ * This function is to get class member "arch".\r
+ * \r
+ * @return arch Architecture\r
+ */\r
+ public String getArch() {\r
+ return arch;\r
+ }\r
+\r
+ /**\r
+ * setArch\r
+ * \r
+ * This function is to set class member "arch" \r
+ * \r
+ * @param arch Architecture\r
+ */\r
+ public void setArch(String arch) {\r
+ this.arch = arch;\r
+ }\r
+}\r
--- /dev/null
+/** @file\r
+ SecApResetVectorFixupTask class.\r
+\r
+ SecApResetVectorFixupTask is used to call SecApResetVectorFixup.exe to place\r
+ Ap reset vector.\r
+ \r
+ \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ **/\r
+package org.tianocore.framework.tasks;\r
+\r
+import java.io.File;\r
+\r
+import org.apache.tools.ant.Task;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.BuildException;\r
+import org.apache.tools.ant.taskdefs.Execute;\r
+import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
+import org.apache.tools.ant.types.Commandline;\r
+import org.tianocore.logger.EdkLog;\r
+\r
+/**\r
+ SecApResetVectorFixupTask class.\r
+\r
+ SecApResetVectorFixupTask is used to call SecApResetVectorFixup.exe to place\r
+ Ap reset vector.\r
+**/\r
+public class SecApResetVectorFixupTask extends Task implements EfiDefine {\r
+ ///\r
+ /// tool name\r
+ ///\r
+ private String toolName = "SecApResetVectorFixup";\r
+ // /\r
+ // / input FV recovery file\r
+ // /\r
+ private String fvInputFile = "";\r
+\r
+ // /\r
+ // / output file\r
+ // /\r
+ private String fvOutputFile = "";\r
+\r
+ // /\r
+ // / output directory, this variable is added by jave wrap\r
+ // /\r
+ private String outputDir = "";\r
+\r
+\r
+ /**\r
+ * execute\r
+ * \r
+ * SecApResetVectorFixupTask execute function is to assemble tool command line & execute\r
+ * tool command line\r
+ * \r
+ * @throws BuidException\r
+ */\r
+ public void execute() throws BuildException {\r
+\r
+ Project project = this.getOwningTarget().getProject();\r
+ //\r
+ // set Logger\r
+ //\r
+ FrameworkLogger logger = new FrameworkLogger(project, "secapresetvectorfixup");\r
+ EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));\r
+ EdkLog.setLogger(logger);\r
+ //\r
+ // absolute path of efi tools\r
+ //\r
+ String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
+ String command;\r
+ String argument;\r
+ if (path == null) {\r
+ command = toolName;\r
+ } else {\r
+ command = path + File.separatorChar + toolName;\r
+ }\r
+ //\r
+ // argument of tools\r
+ //\r
+ File file = new File(this.fvOutputFile);\r
+ if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
+ argument = this.fvInputFile + " " + outputDir + File.separatorChar\r
+ + this.fvOutputFile;\r
+ } else {\r
+ argument = this.fvInputFile + " " + this.fvOutputFile;\r
+ }\r
+ //\r
+ // return value of fwimage execution\r
+ //\r
+ int revl = -1;\r
+\r
+ try {\r
+ Commandline cmdline = new Commandline();\r
+ cmdline.setExecutable(command);\r
+ cmdline.createArgument().setLine(argument);\r
+\r
+ LogStreamHandler streamHandler = new LogStreamHandler(this,\r
+ Project.MSG_INFO, Project.MSG_WARN);\r
+ Execute runner = new Execute(streamHandler, null);\r
+\r
+ runner.setAntRun(project);\r
+ runner.setCommandline(cmdline.getCommandline());\r
+ //\r
+ // Set debug log information.\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO, Commandline.toString(cmdline.getCommandline()));\r
+ \r
+ revl = runner.execute();\r
+ \r
+ if (EFI_SUCCESS == revl) {\r
+ //\r
+ // command execution success\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO,"SecApResetVectorFixup succeeded!");\r
+ } else {\r
+ //\r
+ // command execution fail\r
+ //\r
+ EdkLog.log(EdkLog.EDK_ERROR, "SecApResetVectorFixup failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+ throw new BuildException("SecApResetVectorFixup failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+\r
+ }\r
+ } catch (Exception e) {\r
+ throw new BuildException(e.getMessage());\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getInputFile\r
+ * \r
+ * This function is to get class member "fvInputFile".\r
+ * \r
+ * @return string of input file name.\r
+ */\r
+ public String getfvInputFile() {\r
+ return this.fvInputFile;\r
+ }\r
+\r
+ /**\r
+ * setComponentType\r
+ * \r
+ * This function is to set class member "fvInputFile".\r
+ * \r
+ * @param inputFile\r
+ * string of input file name.\r
+ */\r
+ public void setFvInputFile(String inputFile) {\r
+ this.fvInputFile = inputFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputFile\r
+ * \r
+ * This function is to get class member "fvOutputFile"\r
+ * \r
+ * @return outputFile string of output file name.\r
+ */\r
+ public String getOutputFile() {\r
+ return this.fvOutputFile;\r
+ }\r
+\r
+ /**\r
+ * setOutputFile\r
+ * \r
+ * This function is to set class member "fvOutputFile"\r
+ * \r
+ * @param outputFile\r
+ * string of output file name.\r
+ */\r
+ public void setFvOutputFile(String outputFile) {\r
+ this.fvOutputFile = outputFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputDir\r
+ * \r
+ * This function is to get class member "outputDir"\r
+ * \r
+ * @return outputDir string of output directory.\r
+ */\r
+ public String getOutputDir() {\r
+ return outputDir;\r
+ }\r
+\r
+ /**\r
+ * setOutputDir\r
+ * \r
+ * This function is to set class member "outputDir"\r
+ * \r
+ * @param outputDir\r
+ * string of output directory.\r
+ */\r
+ public void setOutputDir(String outputDir) {\r
+ this.outputDir = outputDir;\r
+ }\r
+}\r
--- /dev/null
+/** @file\r
+ SecFixupTask class.\r
+\r
+ SecFixupTask is used to call SecFixup.exe to fix up sec image.\r
+ \r
+ \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ **/\r
+package org.tianocore.framework.tasks;\r
+\r
+import java.io.File;\r
+\r
+import org.apache.tools.ant.Task;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.BuildException;\r
+import org.apache.tools.ant.taskdefs.Execute;\r
+import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
+import org.apache.tools.ant.types.Commandline;\r
+import org.tianocore.logger.EdkLog;\r
+\r
+/**\r
+ * SecFixupTask class.\r
+ * \r
+ * SecFixupTask is used to call SecFixup.exe to fix up sec image.\r
+ */\r
+public class SecFixupTask extends Task implements EfiDefine {\r
+ // /\r
+ // / tool name\r
+ // /\r
+ private String toolName = "SecFixup";\r
+\r
+ // /\r
+ // / input file\r
+ // /\r
+ private String secExeFile = "";\r
+\r
+ // /\r
+ // / output file\r
+ // /\r
+ private String resetVectorDataFile = "";\r
+\r
+ // /\r
+ // / output directory, this variable is added by jave wrap\r
+ // /\r
+ private String outputFile = "";\r
+\r
+ // /\r
+ // / output directory\r
+ // /\r
+ private String outputDir = "";\r
+\r
+ /**\r
+ * execute\r
+ * \r
+ * SecFixupTask execute function is to assemble tool command line & execute\r
+ * tool command line\r
+ * \r
+ * @throws BuidException\r
+ */\r
+ public void execute() throws BuildException {\r
+\r
+ Project project = this.getOwningTarget().getProject();\r
+ //\r
+ // set Logger\r
+ //\r
+ FrameworkLogger logger = new FrameworkLogger(project, toolName\r
+ .toLowerCase());\r
+ EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));\r
+ EdkLog.setLogger(logger);\r
+ //\r
+ // absolute path of efi tools\r
+ //\r
+ String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
+ String command;\r
+ String argument;\r
+ if (path == null) {\r
+ command = toolName;\r
+ } else {\r
+ command = path + File.separatorChar + toolName;\r
+ }\r
+ //\r
+ // argument of tools\r
+ //\r
+ if (!this.outputDir.equalsIgnoreCase("")) {\r
+ argument = this.secExeFile + " " + this.resetVectorDataFile + " "\r
+ + this.outputDir + File.separatorChar + this.outputFile;\r
+ } else {\r
+ argument = this.secExeFile + " " + this.resetVectorDataFile + " "\r
+ + this.outputFile;\r
+ }\r
+\r
+ //\r
+ // return value of fwimage execution\r
+ //\r
+ int revl = -1;\r
+\r
+ try {\r
+ Commandline cmdline = new Commandline();\r
+ cmdline.setExecutable(command);\r
+ cmdline.createArgument().setLine(argument);\r
+\r
+ LogStreamHandler streamHandler = new LogStreamHandler(this,\r
+ Project.MSG_INFO, Project.MSG_WARN);\r
+ Execute runner = new Execute(streamHandler, null);\r
+\r
+ runner.setAntRun(project);\r
+ runner.setCommandline(cmdline.getCommandline());\r
+ //\r
+ // Set debug log information.\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO, Commandline.toString(cmdline\r
+ .getCommandline()));\r
+\r
+ revl = runner.execute();\r
+\r
+ if (EFI_SUCCESS == revl) {\r
+ //\r
+ // command execution success\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO, "SecFixup succeeded!");\r
+ } else {\r
+ //\r
+ // command execution fail\r
+ //\r
+ EdkLog.log(EdkLog.EDK_ERROR, "SecFixup failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+ throw new BuildException("SecFixup failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+\r
+ }\r
+ } catch (Exception e) {\r
+ throw new BuildException(e.getMessage());\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getSecExeFile\r
+ * \r
+ * This function is to get class member "secExeFile".\r
+ * \r
+ * @return string of sectExe file name.\r
+ */\r
+ public String getSecExeFile() {\r
+ return this.secExeFile;\r
+ }\r
+\r
+ /**\r
+ * setSecExeFile\r
+ * \r
+ * This function is to set class member "secExeFile".\r
+ * \r
+ * @param secExeFile\r
+ * string of secExe file name.\r
+ */\r
+ public void setSecExeFile(String secExeFile) {\r
+ this.secExeFile = secExeFile;\r
+ }\r
+\r
+ /**\r
+ * getResetVectorDataFile\r
+ * \r
+ * This function is to get class member "resetVectorDataFile"\r
+ * \r
+ * @return resetVectorDataFile string of resetVectorData file name.\r
+ */\r
+ public String getResetVectorDataFile() {\r
+ return this.resetVectorDataFile;\r
+ }\r
+\r
+ /**\r
+ * setResetVectorDataFile\r
+ * \r
+ * This function is to set class member "resetVectorDataFile"\r
+ * \r
+ * @param resetVectorDataFile\r
+ * string of resetVectorData file name.\r
+ */\r
+ public void setResetVectorDataFile(String resetVectorDataFile) {\r
+ this.resetVectorDataFile = resetVectorDataFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputFile\r
+ * \r
+ * This function is to get class member "outputFile"\r
+ * \r
+ * @return outputFile string of output file name.\r
+ */\r
+ public String getOutputFile() {\r
+ return outputFile;\r
+ }\r
+\r
+ /**\r
+ * setOutputFile\r
+ * \r
+ * This function is to set class member "outputFile"\r
+ * \r
+ * @param outputFile\r
+ * string of output file name.\r
+ */\r
+ public void setOutputFile(String outputFile) {\r
+ this.outputFile = outputFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputDir\r
+ * \r
+ * This function is to get class member "outputDir"\r
+ * \r
+ * @return outputDir name of output directory\r
+ */\r
+ public String getOutputDir() {\r
+ return outputDir;\r
+ }\r
+\r
+ /**\r
+ * setOutputDir\r
+ * \r
+ * This function is to set class member "outputDir"\r
+ * \r
+ * @param outputDir\r
+ * name of output directory\r
+ */\r
+ public void setOutputDir(String outputDir) {\r
+ this.outputDir = outputDir;\r
+ }\r
+}\r
--- /dev/null
+/** @file\r
+ SplitfileTask class.\r
+\r
+ SplitfileTask is used to call splitfile.exe to split input file to 2 output \r
+ file.\r
+ \r
+ \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ **/\r
+package org.tianocore.framework.tasks;\r
+\r
+import java.io.File;\r
+\r
+import org.apache.tools.ant.Task;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.BuildException;\r
+import org.apache.tools.ant.taskdefs.Execute;\r
+import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
+import org.apache.tools.ant.types.Commandline;\r
+import org.tianocore.logger.EdkLog;\r
+\r
+/**\r
+ SplitfileTask class.\r
+\r
+ SplitfileTask is used to call splitfile.exe to split input file to 2 output \r
+ file.\r
+**/\r
+public class SplitfileTask extends Task implements EfiDefine {\r
+ ///\r
+ /// input file\r
+ ///\r
+ private String inputFile = "";\r
+\r
+ ///\r
+ /// offset value\r
+ ///\r
+ private String offset = "";\r
+\r
+ \r
+ /**\r
+ * execute\r
+ * \r
+ * SplitfleTask execute function is to assemble tool command line & execute\r
+ * tool command line\r
+ * \r
+ * @throws BuidException\r
+ */\r
+ public void execute() throws BuildException {\r
+\r
+ Project project = this.getOwningTarget().getProject();\r
+ \r
+ //\r
+ // set Logger\r
+ //\r
+ FrameworkLogger logger = new FrameworkLogger(project, "splitfile");\r
+ EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));\r
+ EdkLog.setLogger(logger);\r
+ \r
+ //\r
+ // absolute path of efi tools\r
+ //\r
+ String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
+ String command;\r
+ String argument;\r
+ if (path == null) {\r
+ command = "SplitFile";\r
+ } else {\r
+ command = path + File.separatorChar + "SplitFile";\r
+ }\r
+ \r
+ //\r
+ // argument of tools\r
+ //\r
+ argument = inputFile + " " + offset;\r
+ \r
+ //\r
+ // return value of fwimage execution\r
+ //\r
+ int revl = -1;\r
+\r
+ try {\r
+ Commandline cmdline = new Commandline();\r
+ cmdline.setExecutable(command);\r
+ cmdline.createArgument().setLine(argument);\r
+\r
+ LogStreamHandler streamHandler = new LogStreamHandler(this,\r
+ Project.MSG_INFO, Project.MSG_WARN);\r
+ Execute runner = new Execute(streamHandler, null);\r
+\r
+ runner.setAntRun(project);\r
+ runner.setCommandline(cmdline.getCommandline());\r
+ \r
+ EdkLog.log(EdkLog.EDK_INFO, Commandline.toString(cmdline.getCommandline()));\r
+ revl = runner.execute();\r
+ if (EFI_SUCCESS == revl) {\r
+ //\r
+ // command execution success\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO, "splitfile succeeded!");\r
+ } else {\r
+ //\r
+ // command execution fail\r
+ //\r
+ EdkLog.log(EdkLog.EDK_ERROR, "splitfile failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+ throw new BuildException("splitfile failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+\r
+ }\r
+ } catch (Exception e) {\r
+ throw new BuildException(e.getMessage());\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getInputFile\r
+ * \r
+ * This function is to get class member "inputFile".\r
+ * \r
+ * @return string of input file name.\r
+ */\r
+ public String getInputFile() {\r
+ return inputFile;\r
+ }\r
+\r
+ /**\r
+ * setComponentType\r
+ * \r
+ * This function is to set class member "inputFile".\r
+ * \r
+ * @param inputFile\r
+ * string of input file name.\r
+ */\r
+ public void setInputFile(String inputFile) {\r
+ this.inputFile = inputFile;\r
+ }\r
+\r
+ /**\r
+ getOffset\r
+ \r
+ This function is to get class member "offset"\r
+ \r
+ @return offset value of string.\r
+ **/\r
+ public String getOffset() {\r
+ return offset;\r
+ }\r
+\r
+ /**\r
+ setOffset\r
+ \r
+ This function is to set class member "offset"\r
+ \r
+ @param offset\r
+ string of offset value.\r
+ **/\r
+ public void setOffset(String offset) {\r
+ this.offset = offset;\r
+ }\r
+ \r
+}\r
--- /dev/null
+/** @file\r
+ StripTask class.\r
+\r
+ StripTask is used to call Strip.exe to strip input file.\r
+ \r
+ \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ **/\r
+package org.tianocore.framework.tasks;\r
+\r
+import java.io.File;\r
+\r
+import org.apache.tools.ant.Task;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.BuildException;\r
+import org.apache.tools.ant.taskdefs.Execute;\r
+import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
+import org.apache.tools.ant.types.Commandline;\r
+import org.tianocore.logger.EdkLog;\r
+\r
+/**\r
+ StripTask class.\r
+\r
+ StripTask is used to call Strip.exe to strip input file.\r
+ */\r
+public class StripTask extends Task implements EfiDefine {\r
+ // /\r
+ // / input file\r
+ // /\r
+ private String inputFile = "";\r
+\r
+ // /\r
+ // / output file\r
+ // /\r
+ private String outputFile = "";\r
+\r
+ // /\r
+ // / output directory, this variable is added by jave wrap\r
+ // /\r
+ private String outputDir = "";\r
+\r
+ \r
+ /**\r
+ * execute\r
+ * \r
+ * StripTask execute function is to assemble tool command line & execute\r
+ * tool command line\r
+ * \r
+ * @throws BuidException\r
+ */\r
+ public void execute() throws BuildException {\r
+\r
+ Project project = this.getOwningTarget().getProject();\r
+ //\r
+ // set Logger\r
+ //\r
+ FrameworkLogger logger = new FrameworkLogger(project, "edkStrip");\r
+ EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));\r
+ EdkLog.setLogger(logger);\r
+ //\r
+ // absolute path of efi tools\r
+ //\r
+ String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
+ String command;\r
+ String argument;\r
+ if (path == null) {\r
+ command = "strip";\r
+ } else {\r
+ command = path + File.separatorChar + "Strip";\r
+ }\r
+ //\r
+ // argument of tools\r
+ //\r
+ File file = new File(outputFile);\r
+ if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
+ argument = inputFile + " " + outputDir + File.separatorChar\r
+ + outputFile;\r
+ } else {\r
+ argument = inputFile + " " + outputFile;\r
+ }\r
+ //\r
+ // return value of fwimage execution\r
+ //\r
+ int revl = -1;\r
+\r
+ try {\r
+ Commandline cmdline = new Commandline();\r
+ cmdline.setExecutable(command);\r
+ cmdline.createArgument().setLine(argument);\r
+\r
+ LogStreamHandler streamHandler = new LogStreamHandler(this,\r
+ Project.MSG_INFO, Project.MSG_WARN);\r
+ Execute runner = new Execute(streamHandler, null);\r
+\r
+ runner.setAntRun(project);\r
+ runner.setCommandline(cmdline.getCommandline());\r
+ //\r
+ // Set debug log information.\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO, Commandline.toString(cmdline.getCommandline()));\r
+ \r
+ revl = runner.execute();\r
+ \r
+ if (EFI_SUCCESS == revl) {\r
+ //\r
+ // command execution success\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO,"Strip succeeded!");\r
+ } else {\r
+ //\r
+ // command execution fail\r
+ //\r
+ EdkLog.log(EdkLog.EDK_ERROR, "Strip failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+ throw new BuildException("Strip failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+\r
+ }\r
+ } catch (Exception e) {\r
+ throw new BuildException(e.getMessage());\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getInputFile\r
+ * \r
+ * This function is to get class member "inputFile".\r
+ * \r
+ * @return string of input file name.\r
+ */\r
+ public String getInputFile() {\r
+ return inputFile;\r
+ }\r
+\r
+ /**\r
+ * setComponentType\r
+ * \r
+ * This function is to set class member "inputFile".\r
+ * \r
+ * @param inputFile\r
+ * string of input file name.\r
+ */\r
+ public void setInputFile(String inputFile) {\r
+ this.inputFile = inputFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputFile\r
+ * \r
+ * This function is to get class member "outputFile"\r
+ * \r
+ * @return outputFile string of output file name.\r
+ */\r
+ public String getOutputFile() {\r
+ return outputFile;\r
+ }\r
+\r
+ /**\r
+ * setOutputFile\r
+ * \r
+ * This function is to set class member "outputFile"\r
+ * \r
+ * @param outputFile\r
+ * string of output file name.\r
+ */\r
+ public void setOutputFile(String outputFile) {\r
+ this.outputFile = outputFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputDir\r
+ * \r
+ * This function is to get class member "outputDir"\r
+ * \r
+ * @return outputDir string of output directory.\r
+ */\r
+ public String getOutputDir() {\r
+ return outputDir;\r
+ }\r
+\r
+ /**\r
+ * setOutputDir\r
+ * \r
+ * This function is to set class member "outputDir"\r
+ * \r
+ * @param outputDir\r
+ * string of output directory.\r
+ */\r
+ public void setOutputDir(String outputDir) {\r
+ this.outputDir = outputDir;\r
+ }\r
+}\r
--- /dev/null
+/** @file\r
+ ZeroDebugDataTask class.\r
+\r
+ ZeroDebugDataTask is used to call ZeroDebugData.exe to remove debug data.\r
+ \r
+ \r
+ Copyright (c) 2006, Intel Corporation\r
+ All rights reserved. This program and the accompanying materials\r
+ are licensed and made available under the terms and conditions of the BSD License\r
+ which accompanies this distribution. The full text of the license may be found at\r
+ http://opensource.org/licenses/bsd-license.php\r
+ \r
+ THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
+ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+\r
+ **/\r
+package org.tianocore.framework.tasks;\r
+\r
+import java.io.File;\r
+\r
+import org.apache.tools.ant.Task;\r
+import org.apache.tools.ant.Project;\r
+import org.apache.tools.ant.BuildException;\r
+import org.apache.tools.ant.taskdefs.Execute;\r
+import org.apache.tools.ant.taskdefs.LogStreamHandler;\r
+import org.apache.tools.ant.types.Commandline;\r
+import org.tianocore.logger.EdkLog;\r
+\r
+/**\r
+ ZeroDebugDataTask class.\r
+\r
+ ZeroDebugDataTask is used to call ZeroDebugData.exe to remove debug data.\r
+**/\r
+public class ZeroDebugDataTask extends Task implements EfiDefine {\r
+ // /\r
+ // / input PE file\r
+ // /\r
+ private String peFile = "";\r
+\r
+ // /\r
+ // / output file\r
+ // /\r
+ private String outputFile = "DebugData.dat";\r
+\r
+ // /\r
+ // / output directory, this variable is added by jave wrap\r
+ // /\r
+ private String outputDir = "";\r
+\r
+\r
+ /**\r
+ * execute\r
+ * \r
+ * ZeroDebugDataTask execute function is to assemble tool command line & execute\r
+ * tool command line\r
+ * \r
+ * @throws BuidException\r
+ */\r
+ public void execute() throws BuildException {\r
+\r
+ Project project = this.getOwningTarget().getProject();\r
+ //\r
+ // set Logger\r
+ //\r
+ FrameworkLogger logger = new FrameworkLogger(project, "zerodebugdata");\r
+ EdkLog.setLogLevel(project.getProperty("env.LOGLEVEL"));\r
+ EdkLog.setLogger(logger);\r
+ //\r
+ // absolute path of efi tools\r
+ //\r
+ String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");\r
+ String command;\r
+ String argument;\r
+ if (path == null) {\r
+ command = "ZeroDebugData";\r
+ } else {\r
+ command = path + File.separatorChar + "ZeroDebugData";\r
+ }\r
+ //\r
+ // argument of tools\r
+ //\r
+ File file = new File(outputFile);\r
+ if (!file.isAbsolute() && (!this.outputDir.equalsIgnoreCase(""))) {\r
+ argument = this.peFile + " " + outputDir + File.separatorChar\r
+ + outputFile;\r
+ } else {\r
+ argument = this.peFile + " " + outputFile;\r
+ }\r
+ //\r
+ // return value of fwimage execution\r
+ //\r
+ int revl = -1;\r
+\r
+ try {\r
+ Commandline cmdline = new Commandline();\r
+ cmdline.setExecutable(command);\r
+ cmdline.createArgument().setLine(argument);\r
+\r
+ LogStreamHandler streamHandler = new LogStreamHandler(this,\r
+ Project.MSG_INFO, Project.MSG_WARN);\r
+ Execute runner = new Execute(streamHandler, null);\r
+\r
+ runner.setAntRun(project);\r
+ runner.setCommandline(cmdline.getCommandline());\r
+ //\r
+ // Set debug log information.\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO, Commandline.toString(cmdline.getCommandline()));\r
+ \r
+ revl = runner.execute();\r
+ \r
+ if (EFI_SUCCESS == revl) {\r
+ //\r
+ // command execution success\r
+ //\r
+ EdkLog.log(EdkLog.EDK_INFO,"ZeroDebug succeeded!");\r
+ } else {\r
+ //\r
+ // command execution fail\r
+ //\r
+ EdkLog.log(EdkLog.EDK_ERROR, "ZeroDebug failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+ throw new BuildException("ZeroDebug failed. (error="\r
+ + Integer.toHexString(revl) + ")");\r
+\r
+ }\r
+ } catch (Exception e) {\r
+ throw new BuildException(e.getMessage());\r
+ }\r
+ }\r
+\r
+ /**\r
+ * getPeFile\r
+ * \r
+ * This function is to get class member "inputFile".\r
+ * \r
+ * @return string of input file name.\r
+ */\r
+ public String getPeFile() {\r
+ return this.peFile;\r
+ }\r
+\r
+ /**\r
+ * setPeFile\r
+ * \r
+ * This function is to set class member "peFile".\r
+ * \r
+ * @param peFile\r
+ * string of input file name.\r
+ */\r
+ public void setPeFile(String peFile) {\r
+ this.peFile = peFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputFile\r
+ * \r
+ * This function is to get class member "outputFile"\r
+ * \r
+ * @return outputFile string of output file name.\r
+ */\r
+ public String getOutputFile() {\r
+ return outputFile;\r
+ }\r
+\r
+ /**\r
+ * setOutputFile\r
+ * \r
+ * This function is to set class member "outputFile"\r
+ * \r
+ * @param outputFile\r
+ * string of output file name.\r
+ */\r
+ public void setOutputFile(String outputFile) {\r
+ this.outputFile = outputFile;\r
+ }\r
+\r
+ /**\r
+ * getOutputDir\r
+ * \r
+ * This function is to get class member "outputDir"\r
+ * \r
+ * @return outputDir string of output directory.\r
+ */\r
+ public String getOutputDir() {\r
+ return outputDir;\r
+ }\r
+\r
+ /**\r
+ * setOutputDir\r
+ * \r
+ * This function is to set class member "outputDir"\r
+ * \r
+ * @param outputDir\r
+ * string of output directory.\r
+ */\r
+ public void setOutputDir(String outputDir) {\r
+ this.outputDir = outputDir;\r
+ }\r
+}\r