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