summaryrefslogtreecommitdiff
path: root/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks
diff options
context:
space:
mode:
Diffstat (limited to 'Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks')
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Compress.java78
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressHeader.java77
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java213
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CreateMtFileTask.java192
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Database.java30
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiCompressTask.java194
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiDefine.java56
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiRomTask.java376
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsHeader.java185
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsTypes.java115
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FileArg.java65
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java848
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FwImageTask.java198
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenAcpiTableTask.java194
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCRC32SectionTask.java142
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCapsuleHdrTask.java341
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenDepexTask.java167
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFfsFileTask.java1010
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFvImageTask.java274
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenSectionTask.java398
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenTeImageTask.java253
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GuidChkTask.java368
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/IncludePath.java26
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Input.java24
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/InputFile.java24
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java381
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ModifyInfTask.java221
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/NestElement.java366
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/PeiReBaseTask.java290
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java196
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecFixupTask.java224
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SectFile.java116
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Section.java26
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SetStampTask.java162
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SkipExt.java24
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SplitfileTask.java195
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StrGatherTask.java471
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java197
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java266
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ToolArg.java151
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java213
-rw-r--r--Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ZeroDebugDataTask.java195
42 files changed, 0 insertions, 9542 deletions
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Compress.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Compress.java
deleted file mode 100644
index 4410ecdda1..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Compress.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/** @file
- Compress class.
-
- This class is to call CompressDll.dll to compress section.
-
- 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;
-
-/**
-
- This class is to call CompressDll.dll to compress section.
-
-**/
-public class Compress {
- byte[] inputBuffer;
- byte[] outputBuffer;
- int size;
-
- static {
- String dllPath;
-
- dllPath = GenFfsFileTask.path;
- dllPath = dllPath +
- File.separator +
- "CompressDll.dll";
-
- System.load(dllPath);
- }
-
- /**
- CallCompress
-
- This function is to call the compressDll.dll to compress the contents in
- buffer.
-
- @param inputBuffer The input buffer.
- @param size The size of buffer in byte.
- @param dllPath The compressDll.dll path.
- @return The buffer contained the comrpessed input.
- **/
- public native byte[] CallCompress (byte[] inputBuffer, int size, String dllPath);
-
- /**
- Construct function
-
- This function is to initialize the class member and call the compress
- function.
-
- @param inBuffer The input buffer.
- @param size The size of buffer in byte.
- **/
- public Compress (byte[] inBuffer, int size){
- this.inputBuffer = inBuffer;
- this.size = size;
- String path = GenFfsFileTask.path;
-
- //
- // Call Compress function.
- //
- this.outputBuffer = CallCompress (
- this.inputBuffer,
- this.size,
- path
- );
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressHeader.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressHeader.java
deleted file mode 100644
index e1823329ff..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressHeader.java
+++ /dev/null
@@ -1,77 +0,0 @@
-/** @file
- CompressHeader class.
-
- This class is to generate the compressed section header.
-
- 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 org.apache.tools.ant.BuildException;
-/**
-
- Internal class: This class is to generate the compressed section header.
-
-**/
-public class CompressHeader {
-
- /**
- CommonSectionHeader
-
- This class define the compressed header structor.
-
- **/
- public class CommonSectionHeader {
- byte[] Size = new byte[3];
- byte type;
- }
-
- ///
- /// Section header.
- ///
- public CommonSectionHeader SectionHeader = new CommonSectionHeader();
-
- ///
- /// Length of uncompress section in byte.
- ///
- public int UncompressLen;
- ///
- /// Compress type.
- ///
- public byte CompressType;
-
- ///
- /// The size of compress header in byte.
- ///
- public int GetSize (){
- return 9;
- }
-
- ///
- /// Write class member to buffer.
- ///
- public void StructToBuffer (byte[] Buffer){
- if (Buffer.length != GetSize()) {
- throw new BuildException ("CompressHeader Buffer size is not correct!");
- }
- for (int i = 0; i < 3; i++){
- Buffer[i] = SectionHeader.Size[i];
- }
- Buffer[3] = SectionHeader.type;
- Buffer[4] = (byte)(UncompressLen & 0xff);
- Buffer[5] = (byte)((UncompressLen & 0xff00)>>8);
- Buffer[6] = (byte)((UncompressLen & 0xff0000)>>16);
- Buffer[7] = (byte)((UncompressLen & 0xff000000)>>24);
- Buffer[8] = CompressType;
- }
-
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java
deleted file mode 100644
index 3e2a98f695..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CompressSection.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/** @file
- CompressSection class.
-
- CompressSection indicate that all section which in it should be compressed.
-
- 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.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.tools.ant.BuildException;
-
-
-/**
- CompressSection
-
- CompressSection indicate that all section which in it should be compressed.
-
-**/
-public class CompressSection implements Section, FfsTypes {
- private int alignment = 0;
- //
- // The attribute of compressName.
- //
- private String compressName = "";
- //
- // The list contained the SectFile element.
- //
- private List<Section> sectList = new ArrayList<Section>();
-
- public static Object semaphore = new Object();
- /**
- toBuffer
-
- This function is to collect all sectFile and compress it , then output
- the result to buffer.
-
- @param Buffer The point of output buffer
-
- **/
- public void toBuffer (DataOutputStream buffer){
-
- Section sect;
-
- //
- // Get section file in compress node.
- //
- try{
-
- ByteArrayOutputStream bo = new ByteArrayOutputStream ();
- DataOutputStream Do = new DataOutputStream (bo);
-
- //
- // Get each section which under the compress {};
- // And add it is contains to File;
- //
- Iterator SectionIter = sectList.iterator();
- while (SectionIter.hasNext()){
- sect = (Section)SectionIter.next();
-
- //
- // Call each section class's toBuffer function.
- //
- try {
- sect.toBuffer(Do);
- }
- catch (BuildException e) {
- System.out.print(e.getMessage());
- throw new BuildException ("Compress.toBuffer failed at section");
- }
-
- }
- Do.close();
-
- synchronized (semaphore) {
- //
- // Call compress
- //
- byte[] fileBuffer = bo.toByteArray();
- Compress myCompress = new Compress(fileBuffer, fileBuffer.length);
-
- //
- // Add Compress header
- //
- CompressHeader Ch = new CompressHeader();
- Ch.SectionHeader.Size[0] = (byte)((myCompress.outputBuffer.length +
- Ch.GetSize()) &
- 0xff
- );
- Ch.SectionHeader.Size[1] = (byte)(((myCompress.outputBuffer.length +
- Ch.GetSize())&
- 0xff00) >> 8
- );
- Ch.SectionHeader.Size[2] = (byte)(((myCompress.outputBuffer.length +
- Ch.GetSize()) &
- 0xff0000) >> 16
- );
- Ch.SectionHeader.type = (byte) EFI_SECTION_COMPRESSION;
-
- //
- // Note: The compressName was not efsfective now. Using the
- // EFI_STANDARD_COMPRSSION for compressType .
- // That is follow old Genffsfile tools. Some code will be added for
- // the different compressName;
- //
- Ch.UncompressLen = fileBuffer.length;
- Ch.CompressType = EFI_STANDARD_COMPRESSION;
-
- //
- // Change header struct to byte buffer
- //
- byte [] headerBuffer = new byte[Ch.GetSize()];
- Ch.StructToBuffer(headerBuffer);
-
- //
- // First add CompressHeader to Buffer, then add Compress data.
- //
- buffer.write (headerBuffer);
- buffer.write(myCompress.outputBuffer);
-
- //
- // Buffer 4 Byte aligment
- //
- int size = Ch.GetSize() + myCompress.outputBuffer.length;
-
- while ((size & 0x03) != 0){
- size ++;
- buffer.writeByte(0);
- }
- //
- // Delete temp file
- //
- //di.close();
- //compressOut.delete();
- }
-
- }
- catch (Exception e){
- throw new BuildException("compress.toBuffer failed!\n");
- }
- }
-
- /**
- getCompressName
-
- This function is to get compressName.
-
- @return The compressName.
- **/
- public String getCompressName() {
- return compressName;
- }
-
- /**
- setCompressName
-
- This function is to set compressName.
-
- @param compressName The string of compressName
- **/
- public void setCompressName(String compressName) {
- this.compressName = compressName;
- }
-
- /**
- addSectFile
-
- This function is to add sectFile element to SectList.
-
- @param sectFile SectFile element which succeed from section class.
- **/
- public void addSectFile (SectFile sectFile) {
- sectList.add(sectFile);
-
- }
-
- /**
- addTool
-
- This function is to add tool element to SectList.
- @param tool Tool element which succeed from section class.
- **/
- public void addTool (Tool tool) {
- sectList.add(tool);
- }
-
- public int getAlignment() {
- return alignment;
- }
-
- public void setAlignment(int alignment) {
- if (alignment > 7) {
- this.alignment = 7;
- } else {
- this.alignment = alignment;
- }
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CreateMtFileTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CreateMtFileTask.java
deleted file mode 100644
index 773df8e13b..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/CreateMtFileTask.java
+++ /dev/null
@@ -1,192 +0,0 @@
-/** @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.common.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 ToolArg fileSize = new ToolArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // 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();
-
- //
- // 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.separator + toolName;
- }
- //
- // argument of tools
- //
- argument = "" + outputFile + 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());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, this.outputFile.toFileList());
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_ERROR, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } 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.getValue();
- }
-
- /**
- setFileSize
-
- This function is to set class member "fileSize".
-
- @param fileSize
- string of file size value.
- **/
- public void setFileSize(String fileSize) {
- this.fileSize.setArg(" ", fileSize);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" ", 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/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Database.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Database.java
deleted file mode 100644
index ade950807c..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Database.java
+++ /dev/null
@@ -1,30 +0,0 @@
-/** @file
- Database class.
-
- Database represents an exceplicity name list of database 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;
-
-/**
- Database represents an exceplicity name list of database file.
-**/
-public class Database extends NestElement {
- /**
- Override NestElement.toString() to return a string with leading "-db"
-
- @return String
- **/
- public String toString() {
- return super.toString(" -db ");
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiCompressTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiCompressTask.java
deleted file mode 100644
index f36aad6481..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiCompressTask.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/** @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.common.logger.EdkLog;
-
-/**
- EfiCompressTask class.
-
- EfiCompressTask is used to call EfiCompress.exe to strip input file.
-**/
-public class EfiCompressTask extends Task implements EfiDefine {
- //
- //
- //
- private final static String toolName = "EfiCompress";
- //
- // input file
- //
- private FileArg inputFile = new FileArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // 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();
-
- //
- // 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.separator + toolName;
- }
- //
- // argument of tools
- //
- 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());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, this.inputFile.toFileList() + " => "
- + this.outputFile.toFileList());
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_ERROR, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
-
- }
- } 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.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "inputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setInputFile(String inputFile) {
- this.inputFile.setArg(" ", inputFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" ", 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/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiDefine.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiDefine.java
deleted file mode 100644
index 6f12f00f43..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiDefine.java
+++ /dev/null
@@ -1,56 +0,0 @@
-/** @file
- EfiDefine class.
-
- EfiDefine class records the UEFI return status value.
-
- 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;
-
-/**
- EfiDefine class.
-
- EfiDefine class records the UEFI return status value.
-**/
-public interface EfiDefine {
- //
- // EFI define Interface for define constant related to UEFI.
- //
- static final int EFI_SUCCESS = 0;
- static final int EFI_LOAD_ERROR = 0x80000001;
- static final int EFI_INVALID_PARAMETER = 0x80000002;
- static final int EFI_UNSUPPORTED = 0x80000003;
- static final int EFI_BAD_BUFFER_SIZE = 0x80000004;
- static final int EFI_BUFFER_TOO_SMALL = 0x80000005;
- static final int EFI_NOT_READY = 0x80000006;
- static final int EFI_DEVICE_ERROR = 0x80000007;
- static final int EFI_WRITE_PROTECTED = 0x80000008;
- static final int EFI_OUT_OF_RESOURCES = 0x80000009;
- static final int EFI_VOLUME_CORRUPTED = 0x8000000a;
- static final int EFI_VOLUME_FULL = 0x8000000b;
- static final int EFI_NO_MEDIA = 0x8000000c;
- static final int EFI_MEDIA_CHANGED = 0x8000000d;
- static final int EFI_NOT_FOUND = 0x8000000e;
- static final int EFI_ACCESS_DENIED = 0x8000000f;
- static final int EFI_NO_RESPONSE = 0x80000010;
- static final int EFI_NO_MAPPING = 0x80000011;
- static final int EFI_TIMEOUT = 0x80000012;
- static final int EFI_NOT_STARTED = 0x80000013;
- static final int EFI_ALREADY_STARTED = 0x80000014;
- static final int EFI_ABORTED = 0x80000015;
- static final int EFI_ICMP_ERROR = 0x80000016;
- static final int EFI_TFTP_ERROR = 0x80000017;
- static final int EFI_PROTOCOL_ERROR = 0x80000018;
- static final int EFI_INCOMPATIBLE_VERSION = 0x80000019;
- static final int EFI_SECURITY_VIOLATION = 0x80000020;
- static final int EFI_CRC_ERROR = 0x80000021;
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiRomTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiRomTask.java
deleted file mode 100644
index acfb2ba572..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/EfiRomTask.java
+++ /dev/null
@@ -1,376 +0,0 @@
-/** @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.util.LinkedList;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.tianocore.common.logger.EdkLog;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-/**
- 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 static String toolName = "EfiRom";
-
- //
- // Flash default file
- //
- private ToolArg verbose = new ToolArg();
-
- //
- // Flash device
- //
- private ToolArg venderId = new ToolArg();
-
- //
- // Flash device Image
- //
- private ToolArg deviceId = new ToolArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // binary file
- //
- private Input binaryFileList = new Input();
-
- //
- // Efi PE32 image file
- //
- private Input pe32FileList = new Input();
-
- //
- // Compress efi PE32 image file
- //
- private Input pe32ComprFileList = new Input();
-
- //
- // Hex class code in the PCI data strutor header
- //
- private ToolArg classCode = new ToolArg();
-
- //
- // Hex revision in the PCI data header.
- //
- private ToolArg revision = new ToolArg();
-
- //
- // Dump the headers of an existing option rom image.
- //
- private ToolArg dump = new ToolArg();
-
- //
- // 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();
-
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
-
- String argument = "" + verbose + venderId + deviceId + dump + revision + classCode
- + binaryFileList.toStringWithSinglepPrefix(" -b ")
- + pe32FileList.toStringWithSinglepPrefix(" -e ")
- + pe32ComprFileList.toStringWithSinglepPrefix(" -ec ")
- + outputFile;
-
- 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());
- runner.setWorkingDirectory(new File(outputDir));
-
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, binaryFileList.toFileList()
- + pe32FileList.toFileList() + pe32ComprFileList.toFileList()
- + " => " + outputFile.toFileList());
-
- int exitCode = runner.execute();
- if (exitCode != 0) {
- //
- // command execution fail
- //
- EdkLog.log(this, "ERROR = " + Integer.toHexString(exitCode));
- throw new BuildException(toolName + " failed!");
- } else {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getVerbose
-
- This function is to get class member "verbose"
-
- @return verbose for verbose output.
- **/
- public String getVerbose() {
- return verbose.getValue();
- }
-
- /**
- setVerbose
-
- This function is to set class member "verbose"
-
- @param verbose for verbose output.
- **/
- public void setVerbose(boolean verbose) {
- if (verbose){
- this.verbose.setArg(" -", "p");
- }
- }
-
- /**
- getVenderId
-
- This function is to get class member "venderId"
-
- @return venderId String of venderId.
- **/
- public String getVenderId() {
- return venderId.getValue();
- }
-
- /**
- setVenderId
-
- This function is to set class member "venderId"
-
- @param venderId String of venderId.
- **/
- public void setVenderId(String venderId) {
- this.venderId.setArg(" -v ", venderId);
- }
-
- /**
- getDeviceId
-
- This function is to get class member "deviceId"
-
- @return deviceId String of device ID.
- **/
- public String getDeviceId() {
- return this.deviceId.getValue();
- }
-
- /**
- setDeviceId
-
- This function is to set class member "deviceId"
-
- @param deviceId String of device ID.
- **/
- public void setDeviceId(String deviceId) {
- this.deviceId.setArg(" -d ", deviceId);
- }
-
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile name of output directory.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "dscFile"
-
- @param outputFile name of DSC file
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" -o ", outputFile);
- }
-
- /**
- getClassCode
-
- This function is to get class member "classCode"
-
- @return fdImage name of class code file.
- **/
- public String getClassCode() {
- return classCode.getValue();
- }
-
- /**
- setclassCode
-
- This function is to set class member "classCode"
-
- @param fdImage name of class code file.
- **/
- public void setclassCode(String classCode) {
- this.classCode.setArg(" -cc ", classCode);
- }
-
- /**
- getRevision
-
- This function is to get class member "revision".
-
- @return revision hex revision in the PDI data header.
- **/
- public String getRevision() {
- return revision.getValue();
- }
-
- /**
- 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.setArg(" -rev ", revision);
- }
-
- /**
- getFlashDeviceImage
-
- This function is to get class member "dump"
-
- @return flashDeviceImage name of flash device image
- **/
- public String getDump() {
- return dump.getValue();
- }
-
- /**
- setFlashDeviceImage
-
- This function is to set class member "dump"
-
- @param flashDeviceImage name of flash device image
- **/
- public void setDump(boolean dump) {
- if (dump) {
- this.dump.setArg(" -", "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 addConfiguredBinaryFile(Input binaryFile){
- this.binaryFileList.insert(binaryFile);
- }
-
- /**
- addPe32File
-
- This function is to add pe32 file to pe32File list.
-
- @param pe32File name of pe32 file.
- **/
- public void addConfiguredPe32File(Input pe32File){
- this.pe32FileList.insert(pe32File);
- }
-
- /**
- addPe32ComprFile
-
- This function os to add compressed pe32 file to pe32ComprFile list.
-
- @param pe32ComprFile name of compressed pe32 file.
- **/
- public void addConfiguredPe32ComprFile(Input pe32ComprFile){
- this.pe32ComprFileList.insert(pe32ComprFile);
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsHeader.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsHeader.java
deleted file mode 100644
index 24cb3df266..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsHeader.java
+++ /dev/null
@@ -1,185 +0,0 @@
-/** @file
- FfsHeader
-
- FfsHeader class describe the struct of Ffs file header.
-
- 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 org.apache.tools.ant.BuildException;
-
-/**
- FfsHeader
-
- FfsHeader class describe the struct of Ffs file header.
-**/
-public class FfsHeader {
-
- /**
- FfsGuid
-
- FfsGuid is interal class of FfsHeader, it describe the struct of Guid.
- **/
- public class FfsGuid {
-
- int data1 = 0;
- short data2 = 0;
- short data3 = 0;
- byte[] data4 = new byte[8];
- byte[] dataBuffer = new byte[16];
-
- /**
- bufferToStruct
-
- This function is to convert GUID to ffsGuid class member.
-
- @param dataBuffer Buffer contained the GUID value in byte.
- For example: if the input string as : "A6F691AC
- 31C8 4444 854C E2C1A6950F92"
- Then Data1: AC91F6A6
- Data2: C831
- Data3: 4444
- Data4: 4C85E2C1A6950F92
- **/
- public void bufferToStruct (byte[] dataBuffer){
- if (dataBuffer.length != 16) {
- throw new BuildException ("Buffer is not sized [" + dataBuffer.length + "] for data type, GUID!");
- }
-
- data1 = (int)(dataBuffer[3]& 0xff);
- data1 = data1 << 8;
- data1 = (int)data1 | (dataBuffer[2]& 0xff);
- data1 = ((data1 << 8) & 0xffff00) | (dataBuffer[1]& 0xff);
- data1 = ((data1 << 8) & 0xffffff00) | (dataBuffer[0]& 0xff);
-
-
- data2 = (short) (dataBuffer[5] & 0xff);
- data2 = (short)((data2 << 8) | (dataBuffer[4]& 0xff));
-
- data3 = (short)(dataBuffer[7] & 0xff);
- data3 = (short)((data3 << 8) | (dataBuffer[6] & 0xff));
-
- for (int i = 0; i < 8; i++) {
- data4[i] = dataBuffer[i+8];
- }
-
- }
-
- /**
- structToBuffer
-
- This function is to store ffsHeader class member to buffer.
-
- @return Byte buffer which contained the ffsHeader class member
- **/
- public byte[] structToBuffer (){
-
- byte[] buffer = new byte [16];
-
- buffer[3] = (byte)(data1 & 0x000000ff);
- buffer[2] = (byte)((data1 & 0x0000ff00)>> 8);
- buffer[1] = (byte)((data1 & 0x00ff0000)>> 16);
- buffer[0] = (byte)((data1 & 0xff000000)>> 24);
-
- buffer[5] = (byte)(data2 & 0x00ff);
- buffer[4] = (byte)((data2 & 0xff00)>> 8);
-
- buffer[7] = (byte)(data3 & 0x00ff);
- buffer[6] = (byte)((data3 & 0xff00)>> 8);
-
- for (int i = 8; i < 16; i++) {
- buffer[i] = data4[i-8];
- }
- return buffer;
- }
-
-
- }
-
- /**
- integrityCheckSum
-
- This class is used to record the struct of checksum.
- **/
- public class IntegrityCheckSum {
- byte header;
- byte file;
- }
-
- ///
- /// Guid
- ///
- FfsGuid name = new FfsGuid();
-
- ///
- /// CheckSum
- ///
- IntegrityCheckSum integrityCheck = new IntegrityCheckSum();
-
- ///
- /// File type
- ///
- byte fileType;
- ///
- /// Ffs attributes.
- ///
- byte ffsAttributes;
- ///
- /// Ffs file size
- ///
- byte[] ffsFileSize = new byte[3];
- ///
- /// Ffs state.
- ///
- byte ffsState;
-
- /**
- structToBuffer
-
- This function is to store FfsHeader class member to buffer.
-
- @return Byte buffer which contained the FfsHeader class member.
- **/
- public byte[] structToBuffer () {
- int i;
- byte[] buffer1;
- byte[] buffer = new byte[24];
- buffer1 = name.structToBuffer();
-
- for (i = 0; i < 16; i++) {
- buffer[i] = buffer1[i];
- }
-
- buffer[16] = integrityCheck.header;
- buffer[17] = integrityCheck.file;
- buffer[18] = fileType;
- buffer[19] = ffsAttributes;
-
- for (i=20; i < 23; i++) {
- buffer[i] = ffsFileSize[i-20];
- }
-
- buffer[23] = ffsState;
- return buffer;
- }
-
- /**
- getSize
-
- This function is to get the size of FfsHeader in byte.
-
- @return The size of FfsHeader.
- **/
- public int getSize(){
- return 24;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsTypes.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsTypes.java
deleted file mode 100644
index 6afc3a90ad..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FfsTypes.java
+++ /dev/null
@@ -1,115 +0,0 @@
-/** @file
- FfsTypes class.
-
- FfsType class record the costant value of Ffs File attribute, type, and
- architecture.
-
- 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;
-
-/**
- FfsType
-
- FfsType class record the costant value of Ffs File attribute, type, and
- architecture.
-
-**/
-public interface FfsTypes {
- //
- // Ffs file attributes
- //
- static final int FFS_ATTRIB_TAIL_PRESENT = 0x01;
-
- static final int FFS_ATTRIB_RECOVERY = 0x02;
-
- static final int FFS_ATTRIB_HEADER_EXTENSION = 0x04;
-
- static final int FFS_ATTRIB_DATA_ALIGNMENT = 0x38;
-
- static final int FFS_ATTRIB_CHECKSUM = 0x40;
-
- //
- // Ffs states difinitions
- //
- static final int EFI_FILE_HEADER_CONSTRUCTION = 0x01;
-
- static final int EFI_FILE_HEADER_VALID = 0x02;
-
- static final int EFI_FILE_DATA_VALID = 0x04;
-
- static final int EFI_FILE_MARKED_FOR_UPDATE = 0x08;
-
- static final int EFI_FILE_DELETED = 0x10;
-
- static final int EFI_FILE_HEADER_INVALID = 0x20;
-
- //
- // FFS_FIXED_CHECKSUM is the default checksum value used when the
- // FFS_ATTRIB_CHECKSUM attribute bit is clear note this is NOT an
- // architecturally defined value, but is in this file for implementation
- // convenience
- //
- static final int FFS_FIXED_CHECKSUM = 0x5a;
-
- //
- // Architectural file types
- //
- static final int EFI_FV_FILETYPE_ALL = 0x00;
-
- static final int EFI_FV_FILETYPE_RAW = 0x01;
-
- static final int EFI_FV_FILETYPE_FREEFORM = 0x02;
-
- static final int EFI_FV_FILETYPE_SECURITY_CORE = 0x03;
-
- static final int EFI_FV_FILETYPE_PEI_CORE = 0x04;
-
- static final int EFI_FV_FILETYPE_DXE_CORE = 0x05;
-
- static final int EFI_FV_FILETYPE_PEIM = 0x06;
-
- static final int EFI_FV_FILETYPE_DRIVER = 0x07;
-
- static final int EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER = 0x08;
-
- static final int EFI_FV_FILETYPE_APPLICATION = 0x09;
-
- static final int EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE = 0x0B;
-
- static final int EFI_FV_FILETYPE_FFS_PAD = 0xF0;
-
- //
- // Ffs file type
- //
- static final String EFI_FV_FFS_FILETYPE_STR = ".FFS";
- static final String EFI_FV_DXE_FILETYPE_STR = ".DXE";
- static final String EFI_FV_PEI_FILETYPE_STR = ".PEI";
- static final String EFI_FV_APP_FILETYPE_STR = ".APP";
- static final String EFI_FV_FVI_FILETYPE_STR = ".FVI";
- static final String EFI_FV_SEC_FILETYPE_STR = ".SEC";
-
- //
- // Section Type copy from EfiImageFormat.h
- //
- static final int EFI_SECTION_COMPRESSION = 0x01;
- static final int EFI_SECTION_GUID_DEFINED = 0x02;
-
- //
- // CompressionType values, we currently don't support
- // "EFI_CUSTOMIZED_COMPRESSION".
- //
- static final int EFI_NOT_COMPRESSED = 0x00;
- static final int EFI_STANDARD_COMPRESSION = 0x01;
- static final int EFI_CUSTOMIZED_COMPRESSION = 0x02;
-
-
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FileArg.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FileArg.java
deleted file mode 100644
index 86adb07581..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FileArg.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/** @file
-This file is used to nest elements which is meant for file path
-
-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;
-
-/**
- FileArg class is defined to represent tool's argument which specifies file path.
- **/
-public class FileArg extends ToolArg {
- /**
- Default constructor
- **/
- public FileArg() {
- }
-
- /**
- Constructor which accepts argument prefix and its value as parameters
-
- @param prefix The prefix of argument
- @param value The value of argument
- **/
- public FileArg(String prefix, String value) {
- super(prefix);
- this.setValue(value);
- }
-
- /**
- Set the prefix and value of an argument
-
- @param prefix The prefix of argument
- @param value The value of argument
- **/
- public void setArg(String prefix, String value) {
- super.setPrefix(prefix);
- this.setValue(value);
- }
-
- /**
- Set the value of an argument
-
- @param value The value of the argument
- **/
- public void setValue(String value) {
- super.setFile(value);
- }
-
- /**
- Add a value of an argument
-
- @param value The value of the argument
- **/
- public void insValue(String value) {
- super.insFile(value);
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java
deleted file mode 100644
index 9a3c61e6c8..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FlashMapTask.java
+++ /dev/null
@@ -1,848 +0,0 @@
-/** @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.FileReader;
-import java.io.BufferedReader;
-
-import java.util.List;
-import java.util.ArrayList;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-
-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.common.logger.EdkLog;
-
-/**
- * FlashMapTask class.
- *
- * FlashMapTask is used to call FlashMap.exe to generate flash map defition files and fd files.
- */
-public class FlashMapTask extends Task implements EfiDefine {
- //
- // tool name
- //
- private static final String toolName = "FlashMap";
-
- //
- //
- //
- private static Pattern fileBlock = Pattern.compile("\\s*File\\s*\\{([^\\{\\}]+)\\}");
- private static Pattern fileNameDef = Pattern.compile("\\bName\\s*=\\s*\"([^\"]+)\"");
-
- //
- // Flash definition file
- //
- private FileArg flashDefFile = new FileArg();
-
- //
- // Flash device
- //
- private ToolArg flashDevice = new ToolArg();
-
- //
- // Flash device Image
- //
- private ToolArg flashDeviceImage = new ToolArg();
-
- //
- // MCI file
- //
- private FileArg mciFile = new FileArg();
-
- //
- // MCO file
- //
- private FileArg mcoFile = new FileArg();
-
- //
- // Discover FD image
- //
- private ToolArg fdImage = new ToolArg();
-
- //
- // Dsc file
- //
- private FileArg dscFile = new FileArg();
-
- //
- // Asm INC file
- //
- private FileArg asmIncFile = new FileArg();
-
- //
- // Image out file
- //
- private FileArg imageOutFile = new FileArg();
-
- //
- // Header file
- //
- private FileArg headerFile = new FileArg();
-
- //
- // Input string file
- //
- private String inStrFile = "";
-
- //
- // Output string file
- //
- private String outStrFile = "";
-
- //
- //
- //
- private FileArg strFile = new FileArg();
- //
- // Base address
- //
- private ToolArg baseAddr = new ToolArg();
-
- //
- // Aligment
- //
- private ToolArg aligment = new ToolArg();
-
- //
- // Padding value
- //
- private ToolArg padValue = new ToolArg();
-
- //
- // output directory
- //
- private String outputDir = ".";
-
- //
- // MCI file array
- //
- FileArg mciFileArray = new FileArg();
-
- /**
- execute
-
- FlashMapTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
- if (isUptodate()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, headerFile.toFileList()
- + imageOutFile.toFileList()
- + mcoFile.toFileList()
- + dscFile.toFileList()
- + asmIncFile.toFileList()
- + outStrFile
- + " is up-to-date!");
- return;
- }
-
- Project project = this.getOwningTarget().getProject();
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
-
- //
- // add substituted input file and output file
- //
- if (this.inStrFile != null && this.outStrFile != null
- && this.inStrFile.length() > 0 && this.outStrFile.length() > 0) {
- strFile.setPrefix(" -strsub ");
- strFile.insValue(this.inStrFile);
- strFile.insValue(this.outStrFile);
- }
-
- String argument = "" + flashDefFile + flashDevice + flashDeviceImage
- + mciFile + mcoFile + fdImage + dscFile + asmIncFile
- + imageOutFile + headerFile + strFile + baseAddr
- + aligment + padValue + mciFileArray;
-
-
- //
- // lauch the program
- //
- // ProcessBuilder pb = new ProcessBuilder(argList);
- // pb.directory(new File(outputDir));
- int exitCode = 0;
- 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());
-
- if (outputDir != null) {
- runner.setWorkingDirectory(new File(outputDir));
- }
- //
- // log command line string.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, flashDefFile.toFileList()
- + mciFile.toFileList()
- + mciFileArray.toFileList()
- + fdImage.toFileList()
- + inStrFile
- + " => "
- + headerFile.toFileList()
- + imageOutFile.toFileList()
- + mcoFile.toFileList()
- + dscFile.toFileList()
- + asmIncFile.toFileList()
- + outStrFile);
-
- exitCode = runner.execute();
- if (exitCode != 0) {
- EdkLog.log(this, "ERROR = " + Integer.toHexString(exitCode));
- } else {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "FlashMap succeeded!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- } finally {
- if (exitCode != 0) {
- throw new BuildException("FlashMap failed!");
- }
- }
- }
-
- /**
- getFlashDefFile
-
- This function is to get class member "flashDefFile"
-
- @return flashDeFile Name of flash definition file.
- **/
- public String getFlashDefFile() {
- return this.flashDefFile.getValue();
- }
-
- /**
- setFlashDefFile
-
- This function is to set class member "flashDefFile"
-
- @param flashDefFile
- Name of flash definition file.
- **/
- public void setFlashDefFile(String flashDefFile) {
- this.flashDefFile.setArg(" -fdf ", flashDefFile);
- }
-
- /**
- getAligment
-
- This function is to get class member "aligment"
-
- @return aligment String of aligment value.
- **/
- public String getAligment() {
- return this.aligment.getValue();
- }
-
- /**
- setAligment
-
- This function is to set class member "aligment"
-
- @param aligment
- String of aligment value.
- **/
- public void setAligment(String aligment) {
- this.aligment.setArg(" -align ", aligment);
- }
-
- /**
- getAsmIncFile
-
- This function is to get class member "asmIncFile"
-
- @return asmIncFile String of ASM include file.
- **/
- public String getAsmIncFile() {
- return this.asmIncFile.getValue();
- }
-
- /**
- setAsmIncFile
-
- This function is to set class member "asmIncFile"
-
- @param asmIncFile
- String of ASM include file.
- **/
- public void setAsmIncFile(String asmIncFile) {
- this.asmIncFile.setArg(" -asmincfile ", asmIncFile);
- }
-
- /**
- getBaseAddr
-
- This function is to get class member "baseAddr"
-
- @return baseAddr String of base address value.
- **/
- public String getBaseAddr() {
- return this.baseAddr.getValue();
- }
-
- /**
- setBaseAddr
-
- This function is to set class member "baseAddr"
-
- @param baseAddr
- String of base address value.
- **/
- public void setBaseAddr(String baseAddr) {
- this.baseAddr.setArg(" -baseaddr ", baseAddr);
- }
-
- /**
- getDscFile
-
- This function is to get class member "dscFile"
-
- @return dscFile name of DSC file
- **/
- public String getDscFile() {
- return this.dscFile.getValue();
- }
-
- /**
- setDscFile
-
- This function is to set class member "dscFile"
-
- @param dscFile
- name of DSC file
- **/
- public void setDscFile(String dscFile) {
- this.dscFile.setArg(" -dsc ", dscFile);
- }
-
- /**
- getFdImage
-
- This function is to get class member "fdImage"
-
- @return fdImage name of input FDI image file.
- **/
- public String getFdImage() {
- return this.fdImage.getValue();
- }
-
- /**
- setFdImage
-
- This function is to set class member "fdImage"
-
- @param fdImage
- name of input FDI image file.
- **/
- public void setFdImage(String fdImage) {
- this.fdImage.setArg(" -discover ", fdImage);
- }
-
- /**
- getFlashDevice
-
- This function is to get class member "flashDevice".
-
- @return flashDevice name of flash device.
- **/
- public String getFlashDevice() {
- return this.flashDevice.getValue();
- }
-
- /**
- setFlashDevice
-
- This function is to set class member "flashDevice"
-
- @param flashDevice
- name of flash device.
- **/
- public void setFlashDevice(String flashDevice) {
- this.flashDevice.setArg(" -flashdevice ", flashDevice);
- }
-
- /**
- getFlashDeviceImage
-
- This function is to get class member "flashDeviceImage"
-
- @return flashDeviceImage name of flash device image
- **/
- public String getFlashDeviceImage() {
- return this.flashDeviceImage.getValue();
- }
-
- /**
- setFlashDeviceImage
-
- This function is to set class member "flashDeviceImage"
-
- @param flashDeviceImage
- name of flash device image
- **/
- public void setFlashDeviceImage(String flashDeviceImage) {
- this.flashDeviceImage.setArg(" -flashdeviceimage ", flashDeviceImage);
-
- }
-
- /**
- getHeaderFile
-
- This function is to get class member "headerFile"
-
- @return headerFile name of include file
- **/
- public String getHeaderFile() {
- return this.headerFile.getValue();
- }
-
- /**
- setHeaderFile
-
- This function is to set class member "headerFile"
-
- @param headerFile
- name of include file
- **/
- public void setHeaderFile(String headerFile) {
- this.headerFile.setArg(" -hfile ", headerFile);
- }
-
- /**
- getImageOutFile
-
- This function is to get class member "imageOutFile"
-
- @return imageOutFile name of output image file
- **/
- public String getImageOutFile() {
- return this.imageOutFile.getValue();
- }
-
- /**
- setImageOutFile
-
- This function is to set class member "ImageOutFile"
-
- @param imageOutFile
- name of output image file
- **/
- public void setImageOutFile(String imageOutFile) {
- this.imageOutFile.setArg(" -imageout ", 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 this.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 this.mciFile.getValue();
- }
-
- /**
- setMciFile
-
- This function is to set class member "mciFile"
-
- @param mciFile
- name of input microcode file
- **/
- public void setMciFile(String mciFile) {
- this.mciFile.setArg(" -mci ", mciFile);
- }
-
- /**
- getMcoFile
-
- This function is to get class member "mcoFile"
-
- @return mcoFile name of output binary microcode image
- **/
- public String getMcoFile() {
- return this.mcoFile.getValue();
- }
-
- /**
- setMcoFile
-
- This function is to set class member "mcoFile"
-
- @param mcoFile
- name of output binary microcode image
- **/
- public void setMcoFile(String mcoFile) {
- this.mcoFile.setArg(" -mco ", mcoFile);
- }
-
- /**
- getOutStrFile
-
- This function is to get class member "outStrFile"
-
- @return outStrFile name of output string substitution file
- **/
- public String getOutStrFile() {
- return this.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 this.padValue.getValue();
- }
-
- /**
- 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.setArg(" -padvalue ", padValue);
- }
-
- /**
- addMciFile
-
- This function is to add Microcode binary file
-
- @param mciFile
- instance of input class
- **/
- public void addConfiguredMciFile(FileArg mciFile) {
- this.mciFileArray.setPrefix(" -mcmerge ");
- this.mciFileArray.insert(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;
- }
-
- //
- // Dependency check
- //
- private boolean isUptodate() {
- long srcTimeStamp = 0;
- String srcName = "";
- String dstName = "";
- long timeStamp = 0;
-
- if (!flashDefFile.isEmpty()) {
- srcName = flashDefFile.getValue();
- timeStamp = new File(srcName).lastModified();
- if (timeStamp > srcTimeStamp) {
- srcTimeStamp = timeStamp;
- }
- }
-
- if (!mciFile.isEmpty()) {
- srcName = mciFile.getValue();
- timeStamp = new File(srcName).lastModified();
- if (timeStamp > srcTimeStamp) {
- srcTimeStamp = timeStamp;
- }
- }
-
- if (!fdImage.isEmpty()) {
- srcName = fdImage.getValue();
- timeStamp = new File(srcName).lastModified();
- if (timeStamp > srcTimeStamp) {
- srcTimeStamp = timeStamp;
- }
- }
-
- if (inStrFile.length() != 0) {
- srcName = inStrFile;
- timeStamp = new File(srcName).lastModified();
- if (timeStamp > srcTimeStamp) {
- srcTimeStamp = timeStamp;
- }
- }
-
- if (!mciFileArray.isEmpty()) {
- for (int i = 0; i < mciFileArray.nameList.size(); ++i) {
- srcName += mciFileArray.nameList.get(i) + " ";
- timeStamp = new File(mciFileArray.nameList.get(i)).lastModified();
- if (timeStamp > srcTimeStamp) {
- srcTimeStamp = timeStamp;
- }
- }
- }
-
- if (!headerFile.isEmpty()) {
- dstName = headerFile.getValue();
- File dstFile = new File(dstName);
- if (!dstFile.isAbsolute()) {
- dstName = outputDir + File.separator + dstName;
- dstFile = new File(dstName);
- }
-
- if (srcTimeStamp > dstFile.lastModified()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");
- return false;
- }
- }
-
- if (!imageOutFile.isEmpty()) {
- dstName = imageOutFile.getValue();
- File dstFile = new File(dstName);
- if (!dstFile.isAbsolute()) {
- dstName = outputDir + File.separator + dstName;
- dstFile = new File(dstName);
- }
-
- if (srcTimeStamp > dstFile.lastModified()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");
- return false;
- }
-
- //
- // we need to check the time stamp of each FV file specified in fdf file
- //
- if (!isFdUptodate(dstName, getFvFiles(flashDefFile.getValue()))) {
- return false;
- }
- }
-
- if (!mcoFile.isEmpty()) {
- dstName = mcoFile.getValue();
- File dstFile = new File(dstName);
- if (!dstFile.isAbsolute()) {
- dstName = outputDir + File.separator + dstName;
- dstFile = new File(dstName);
- }
-
- if (srcTimeStamp > dstFile.lastModified()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");
- return false;
- }
- }
-
- if (!dscFile.isEmpty()) {
- dstName = dscFile.getValue();
- File dstFile = new File(dstName);
- if (!dstFile.isAbsolute()) {
- dstName = outputDir + File.separator + dstName;
- dstFile = new File(dstName);
- }
-
- if (srcTimeStamp > dstFile.lastModified()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");
- return false;
- }
- }
-
- if (!asmIncFile.isEmpty()) {
- dstName = asmIncFile.getValue();
- File dstFile = new File(dstName);
- if (!dstFile.isAbsolute()) {
- dstName = outputDir + File.separator + dstName;
- dstFile = new File(dstName);
- }
-
- if (srcTimeStamp > dstFile.lastModified()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");
- return false;
- }
- }
-
- if (outStrFile.length() != 0) {
- dstName = outStrFile;
- File dstFile = new File(dstName);
- if (!dstFile.isAbsolute()) {
- dstName = outputDir + File.separator + dstName;
- dstFile = new File(dstName);
- }
-
- if (srcTimeStamp > dstFile.lastModified()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, srcName + " has been changed since last build!");
- return false;
- }
- }
-
- return true;
- }
-
- //
- // Parse the flash definition file and find out the FV file names
- //
- private List<String> getFvFiles(String fdfFileName) {
- File fdfFile = new File(fdfFileName);
- int fileLength = (int)fdfFile.length();
- char[] fdfContent = new char[fileLength];
- List<String> fileList = new ArrayList<String>();
-
- try {
- FileReader reader = new FileReader(fdfFile);
- BufferedReader in = new BufferedReader(reader);
-
- in.read(fdfContent, 0, fileLength);
- String str = new String(fdfContent);
-
- //
- // match the
- // File {
- // ...
- // }
- // block
- //
- Matcher matcher = fileBlock.matcher(str);
- while (matcher.find()) {
- String fileBlockContent = str.substring(matcher.start(1), matcher.end(1));
- //
- // match the definition like
- // Name = "..."
- //
- Matcher nameMatcher = fileNameDef.matcher(fileBlockContent);
- if (nameMatcher.find()) {
- fileList.add(fileBlockContent.substring(nameMatcher.start(1), nameMatcher.end(1)));
- }
- }
-
- in.close();
- reader.close();
- } catch (Exception ex) {
- throw new BuildException(ex.getMessage());
- }
-
- return fileList;
- }
-
- private boolean isFdUptodate(String fdFile, List<String> fvFileList) {
- String fvDir = ".";
- File fd = new File(fdFile);
-
- if (outputDir.equals(".")) {
- if (!fd.isAbsolute()) {
- //
- // If we cannot get the absolute path of fd file, we caanot
- // get its time stamp. Re-generate it always in such situation.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "Cannot retrieve the time stamp of " + fdFile);
- return false;
- }
- fvDir = fd.getParent();
- } else {
- fvDir = outputDir;
- if (!fd.isAbsolute()) {
- fd = new File(fvDir + File.separator + fdFile);
- }
- }
-
- long fdTimeStamp = fd.lastModified();
- for (int i = 0; i < fvFileList.size(); ++i) {
- File fv = new File(fvDir + File.separator + fvFileList.get(i));
- if (fv.lastModified() > fdTimeStamp) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, fv.getPath() + " has been changed since last build!");
- return false;
- }
- }
-
- return true;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FwImageTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FwImageTask.java
deleted file mode 100644
index 78d9cbeb18..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/FwImageTask.java
+++ /dev/null
@@ -1,198 +0,0 @@
-/** @file
- FwImageTask class.
-
- FwImageTask is used to call FwImage.ext to generate the FwImage.
-
-
- 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.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- FwImageTask class.
-
- FwImageTask is used to call FwImage.ext to generate the FwImage.
-**/
-public class FwImageTask extends Task implements EfiDefine {
- //
- // fwimage tool name
- //
- private static String toolName = "FwImage";
- //
- // time&data
- //
- private ToolArg time = new ToolArg();
- //
- // input PE image
- //
- private FileArg peImage = new FileArg();
- //
- // output EFI image
- //
- private FileArg outImage = new FileArg();
- //
- // component type
- //
- private ToolArg componentType = new ToolArg();
-
- /**
- execute
-
- FwimageTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
- //
- // argument of tools
- //
- String argument = "" + time + componentType + peImage + outImage;
- //
- // 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(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, peImage.toFileList() + " => " + outImage.toFileList());
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "FwImage succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException("FwImage failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- setTime
-
- This function is to set operation of class member "time".
-
- @param time string of time
- **/
- public void setTime(String time) {
- this.time.setArg(" -t ", time);
- }
-
- /**
- getTime
-
- This function is to get class member "time"
- @return time string of time
- **/
- public String getTime() {
- return this.time.getValue();
- }
-
- /**
- getPeImage
-
- This function is to get class member "peImage".
- @return name of PE image
- **/
- public String getPeImage() {
- return this.peImage.getValue();
- }
-
- /**
- setPeImage
-
- This function is to set class member "peImage"
- @param peImage name of PE image
- **/
- public void setPeImage(String peImage) {
- this.peImage.setArg(" ", peImage);
- }
-
- /**
- getOutImage
-
- This function is to get class member "outImage".
- @return name of output EFI image
- **/
- public String getOutImage() {
- return this.outImage.getValue();
- }
-
- /**
- setOutImage
-
- This function is to set class member "outImage".
- @param outImage name of output EFI image
- **/
- public void setOutImage(String outImage) {
- this.outImage.setArg(" ", outImage);
- }
-
- /**
- getComponentType
-
- This function is to get class member "componentType".
-
- @return string of componentType
- **/
- public String getComponentType() {
- return this.componentType.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "componentType".
- @param componentType string of component type
- **/
- public void setComponentType(String componentType) {
- this.componentType.setArg(" ", componentType);
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenAcpiTableTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenAcpiTableTask.java
deleted file mode 100644
index 40d38f349f..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenAcpiTableTask.java
+++ /dev/null
@@ -1,194 +0,0 @@
-/** @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.common.logger.EdkLog;
-
-/**
- GenAcpiTable class.
-
- GenAcpiTable is used to call GenAcpiTable.exe to generate ACPI Table image .
-**/
-public class GenAcpiTableTask extends Task implements EfiDefine {
- //
- // Tool name
- //
- private static String toolName = "GenAcpiTable";
-
- //
- // input file
- //
- private FileArg inputFile = new FileArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // 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();
- //
- // 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.separator + toolName;
- }
- //
- // argument of tools
- //
- 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());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, this.inputFile.toFileList() + " => "
- + this.outputFile.toFileList());
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } 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.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "inputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setInputFile(String inputFile) {
- this.inputFile.setArg(" ", inputFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" ", 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/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCRC32SectionTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCRC32SectionTask.java
deleted file mode 100644
index d9273acf7b..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCRC32SectionTask.java
+++ /dev/null
@@ -1,142 +0,0 @@
-/** @file
- GenCRC32SectionTask class.
-
- GenCRC32SectionTask is to call GenCRC32Section.exe to generate crc32 section.
-
- 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.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- GenCRC32SectionTask
-
- GenCRC32SectionTask is to call GenCRC32Section.exe to generate crc32 section.
-
-**/
-public class GenCRC32SectionTask extends Task implements EfiDefine {
- //
- // Tool name
- //
- private static String toolName = "GenCRC32Section";
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
- //
- // inputFile list
- //
- private InputFile inputFileList = new InputFile();
-
- //
- // Project
- //
- static private Project project;
-
- /**
- execute
-
- GenCRC32SectionTask execute is to assemble tool command line & execute
- tool command line
-
- @throws BuildException
- **/
- public void execute() throws BuildException {
-
- project = this.getOwningTarget().getProject();
- ///
- /// absolute path of efi tools
- ///
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName ;
- }
- //
- // assemble argument
- //
- String argument = "" + inputFileList.toStringWithSinglepPrefix(" -i ") + 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());
-
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, inputFileList.toFileList() + " => " + outputFile.toFileList());
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl){
- //
- // command execution success
- //
- EdkLog.log(this, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, "ERROR = " + Integer.toHexString(revl));
- // LAH Added This Line
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- addInputFile
-
- This function is to add a inputFile element into list
- @param inputFile : inputFile element
- **/
- public void addConfiguredInputfile(InputFile inputFile) {
- inputFileList.insert(inputFile);
- }
-
- /**
- get class member "outputFile"
- @return name of output file
- **/
- public String getOutputFile() {
- return this.outputFile.getValue();
- }
- /**
- set class member "outputFile"
- @param outputFile : outputFile parameter
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" -o ", outputFile);
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCapsuleHdrTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCapsuleHdrTask.java
deleted file mode 100644
index c5b74b5d7e..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenCapsuleHdrTask.java
+++ /dev/null
@@ -1,341 +0,0 @@
-/** @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.common.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 FileArg scriptFile = new FileArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // output directory, this variable is added by jave wrap
- //
- private String outputDir = ".";
-
- //
- // Verbose flag
- //
- private ToolArg verbose = new ToolArg();
-
- //
- // Dump flag
- //
- private ToolArg dump = new ToolArg();
-
- //
- // Split size
- //
- private ToolArg size = new ToolArg();
-
- //
- // capsule into one image flag
- //
- private ToolArg joinFlag = new ToolArg();
-
- //
- // capsule file
- //
- private FileArg capsuleFile = new FileArg();
-
-
- /**
- 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();
- //
- // 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.separator + toolName;
- }
- //
- // argument of tools
- //
- argument = "" + this.verbose + this.dump + 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());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, scriptFile.toFileList() + " => " +
- outputFile.toFileList() + capsuleFile.toFileList());
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_ERROR, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } 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.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "inputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setScriptFile(String scriptFile) {
- this.scriptFile.setArg(" -script ", scriptFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" -o ", 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.getValue();
- }
-
- /**
- setVerbose
-
- This function is to set class member "verbose"
-
- @param verbose
- True or False.
- **/
- public void setVerbose(boolean verbose) {
- if (verbose) {
- this.verbose.setArg(" -", "v");
- }
- }
-
- /**
- getDump
-
- This function is to get class member "dump"
-
- @return verbose the flag of dump.
- **/
- public String getDump() {
- return dump.getValue();
- }
-
- /**
- setDump
-
- This function is to set class member "dump".
-
- @param dump
- True or False.
- **/
- public void setDump(boolean dump) {
- if (dump) {
- this.dump.setArg(" -", "dump");
- }
- }
-
- /**
- getSize
-
- This function is to set class member "size".
-
- @return size string of size value
- **/
- public String getSize() {
- return size.getValue();
- }
-
- /**
- setSize
-
- This function is to set class member "size".
-
- @param size string of size value.
- **/
- public void setSize(String size) {
- this.size.setArg(" -split ", size);
- }
-
- /**
- getCapsuleFile
-
- This function is to get class member "capsuleFile"
-
- @return capsuleFile capsule file name
- **/
- public String getCapsuleFile() {
- return capsuleFile.getValue();
- }
-
- /**
- setCapsuleFile
-
- This function is to set class member "capsuleFile"
-
- @param capsuleFile capsule file name
- **/
- public void setCapsuleFile(String capsuleFile) {
- this.capsuleFile.setArg(" ", 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.getValue();
- }
-
- /**
- 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.setArg(" -", "j");
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenDepexTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenDepexTask.java
deleted file mode 100644
index 0e0ad9cc2f..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenDepexTask.java
+++ /dev/null
@@ -1,167 +0,0 @@
-/** @file
- GenDepexTask class.
-
- GenDepexTask is to call GenDepex.exe to generate depex section.
-
- 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.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- GenDepexTask
-
- GenDepexTask is to call GenDepex.exe to generate depex section.
-
-**/
-public class GenDepexTask extends Task implements EfiDefine {
- private static String toolName = "GenDepex";
- //
- // output binary dependency files name
- //
- private FileArg outputFile = new FileArg();
- //
- // input pre-processed dependency text files name
- //
- private FileArg inputFile = new FileArg();
- //
- // padding integer value
- //
- private ToolArg padding = new FileArg();
- /**
- execute
-
- GenDepexTask execute is to assemble tool command line & execute tool
- command line.
- */
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
- //
- // absolute path of edk tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
- //
- // argument of GenDepex tool
- //
- String argument = "" + inputFile + outputFile + padding;
- //
- // reture value of GenDepex execution
- //
- int returnVal = -1;
-
- try {
- Commandline commandLine = new Commandline();
- commandLine.setExecutable(command);
- commandLine.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(commandLine.getCommandline());
-
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(commandLine.getCommandline()));
- EdkLog.log(this, inputFile.toFileList() + " => " + outputFile.toFileList());
-
- returnVal = runner.execute();
- if (EFI_SUCCESS == returnVal) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenDepex succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, "ERROR = " + Integer.toHexString(returnVal));
- throw new BuildException("GenDepex failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
- @param outputFileName name of output file
- **/
- public void setOutputFile(String outputFileName) {
- this.outputFile.setArg(" -O ", outputFileName);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile".
-
- @return name of ouput file
- **/
- public String getOutputFile() {
- return this.outputFile.getValue();
- }
-
- /**
- setInputFile
-
- This function is to set class member "inputFile".
- @param inputFileName name of inputFile
- **/
- public void setInputFile(String inputFileName) {
- this.inputFile.setArg(" -I ", inputFileName);
- }
-
- /**
- getInputFile
-
- This function is to get class member "inputFile"
- @return name of input file
- **/
- public String getInputFile() {
- return this.inputFile.getValue();
- }
-
- /**
- setPadding
-
- This function is to set class member "padding"
- @param paddingNum padding value
- **/
- public void setPadding(String paddingNum) {
- this.padding.setArg(" -P ", paddingNum);
- }
-
- /**
- getPadding
-
- This function is to get class member "padding"
- @return value of padding
- **/
- public String getPadding() {
- return this.padding.getValue();
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFfsFileTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFfsFileTask.java
deleted file mode 100644
index ebc26b92a4..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFfsFileTask.java
+++ /dev/null
@@ -1,1010 +0,0 @@
-/** @file
- GenFfsFileTask class.
-
- GenFfsFileTaks is to generate ffs 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.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.tianocore.common.logger.EdkLog;
-
-/**
- GenFfsFileTask
-
- GenFfsFileTaks is to generate ffs file.
-
-**/
-public class GenFfsFileTask extends Task implements EfiDefine, FfsTypes {
- /**
- * GenFfsFile Task Class
- * class member
- * -baseName : module baseName
- * -ffsFileGuid : module Guid.
- * -ffsFileType : Ffs file type.
- * -ffsAttributeRecovery : The file is required for recovery.
- * -ffsAligment : The file data alignment (0 if none required). See FFS
- * specification for supported alignments (0-7 are only possible
- * values). *
- * -ffsAttributeCheckSum : The file data is checksummed. If this is FALSE a
- * value of 0x5A will be inserted in the file
- * checksum field of the file header. *
- * -sectFileDir : specifies the full path to the component build directory.
- * Required.
- * -ffsAttrib : Data recorde attribute added result.
- * -sectionList : List recorded all section elemet in task.
- */
- ///
- /// module baseName
- ///
- String baseName = "";
- ///
- ///
- ///
- String moduleType;
- ///
- /// module Guid
- ///
- String ffsFileGuid = "";
- ///
- /// Ffs file type
- ///
- String ffsFileType = "";
- ///
- /// ffsAttribHeaderExtension value is used to set the corresponding bit in
- /// the output FFS file header
- ///
- boolean ffsAttribHeaderExtension = false;
- ///
- /// ffsAttribTailPresent value is used to set the corresponding bit in the
- /// output FFS file header
- ///
- boolean ffsAttribTailPresent = false;
- ///
- /// ffsAttribRecovery value is used to set the corresponding bit in the
- /// output FFS file header
- ///
- boolean ffsAttribRecovery = false;
- ///
- /// ffsAttribDataAlignment value is used to set the corresponding bit in the output
- /// FFS file header.The specified FFS alignment must be a value between 0
- /// and 7 inclusive
- ///
- int ffsAttribDataAlignment = 0;
- ///
- /// ffsAttribChecksum value is used to set the corresponding bit in the
- /// output FFS file header
- ///
- boolean FfsAttribChecksum = false;
- ///
- /// Attribute is used to record the sum of all bit in the output FFS file.
- ///
- byte attributes = 0;
- ///
- /// The output directory of ffs file.
- ///
- String outputDir = "";
- ///
- /// List of section.
- ///
- List<Object> sectionList = new ArrayList<Object>();
-
- ///
- /// The path of Framewor_Tools_Paht.
- ///
- static String path = "";
-
- ///
- /// Gensection
- ///
- List<GenSectionTask> genSectList = new ArrayList<GenSectionTask>();
-
- /**
- execute
-
- GenFfsFileTask execute is to generate ffs file according to input section
- dscriptive information.
- **/
- public void execute() throws BuildException {
-
- String ffsSuffix = "";
- String outputPath = "";
-
- //
- // Get Fraemwork_Tools_Path
- //
- Project pj = this.getOwningTarget().getProject();
- path = pj.getProperty("env.FRAMEWORK_TOOLS_PATH");
-
- //
- // Check does the BaseName, Guid, FileType set value.
- //
- if (this.baseName.equals("")) {
- throw new BuildException ("Must set OutputFileBasename!\n");
- }
-
- if (this.ffsFileGuid.equals("")) {
- throw new BuildException ("Must set ffsFileGuid!\n");
- }
-
- if (this.ffsFileType.equals("")) {
- throw new BuildException ("Must set ffsFileType!\n");
- }
- //
- // Create ffs file. File name = FfsFileGuid + BaseName + ffsSuffix.
- // If outputDir's value was set, file will output to the outputDir.
- //
- ffsSuffix = TypeToSuffix (this.moduleType);
- if (!this.outputDir.equals("")) {
- String temp;
- outputPath = this.outputDir;
- temp = outputPath.replace('\\', File.separatorChar);
- outputPath = temp.replace('/', File.separatorChar);
- if (outputPath.charAt(outputPath.length()-1) != File.separatorChar) {
- outputPath = outputPath + File.separator;
- }
-
- }
-
- String ffsFilePath = outputPath + this.ffsFileGuid + '-' + this.baseName + ffsSuffix;
- File ffsFile = new File (ffsFilePath);
- try{
- genFfs(ffsFile);
- }catch (BuildException e){
- if (ffsFile != null && ffsFile.exists()){
- ffsFile.deleteOnExit();
- }
- throw new BuildException(e.getMessage());
-
- }
-
- }
-
- /**
- addCompress
-
- This function is to add compress section to section list.
- @param compress Section of compress
- **/
- public void addCompress(CompressSection compress) {
- this.sectionList.add(compress);
- }
-
- /**
- addTool
-
- This function is to add tool section to section list.
- @param tool Section of tool
- **/
- public void addTool(Tool tool) {
- this.sectionList.add(tool);
- }
-
- /**
- addSectionFile
-
- This function is to add sectFile section to section list.
- @param sectFile Section of sectFile.
- **/
- public void addSectFile (SectFile sectFile) {
- this.sectionList.add(sectFile);
- }
-
- /**
- getBaseName
-
- This function is to get basename
-
- @return String of base name
- **/
- public String getBaseName() {
- return this.baseName;
- }
-
- /**
- setBaseName
-
- This function is to set base name.
- @param baseName
- **/
- public void setBaseName(String baseName) {
- this.baseName = baseName.trim();
- }
-
- /**
- getFfsAligment
-
- This function is to get the ffsAligment
- @return The value of ffsAligment.
- **/
- public int getFfsAttribDataAlignment() {
- return this.ffsAttribDataAlignment;
- }
-
- /**
- setFfsAligment
-
- This function is to set ffsAligment
- @param ffsAligment The value of ffsAligment.
- **/
- public void setFfsAttribDataAlignment(String ffsAligment) {
- this.ffsAttribDataAlignment = stringToInt(ffsAligment.replaceAll(" ", "").toLowerCase());
- if (this.ffsAttribDataAlignment < 0 || this.ffsAttribDataAlignment > 7) {
- throw new BuildException ("FFS_ATTRIB_DATA_ALIGMENT must be an integer value from 0 through 7, inclusive");
- } else {
- attributes |= (((byte)this.ffsAttribDataAlignment) << 3);
- }
- }
-
- /**
- getFfsAttribCheckSum
-
- This function is to get ffsAttribCheckSum
-
- @return Value of ffsAttribChecksum
- **/
- public boolean getFfsAttribChecksum() {
- return this.FfsAttribChecksum;
- }
-
- /**
- setFfsAttribChecksum
-
- This function is to set ffsAttribChecksum
- @param ffsAttributeCheckSum Value of ffsAttribCheckSum
- **/
- public void setFfsAttribChecksum(boolean ffsAttributeCheckSum) {
- this.FfsAttribChecksum = ffsAttributeCheckSum;
- if (ffsAttributeCheckSum) {
- attributes |= FFS_ATTRIB_CHECKSUM;
- }
- }
-
- /**
- getFfsAttribRecovery
-
- This function is to get ffsAttribRecovery
- @return Value of ffsAttribRecovery
- **/
- public boolean getFfsAttribRecovery() {
- return this.ffsAttribRecovery;
- }
-
- /**
- setRecovery
-
- This function is to set ffsAttributeRecovery
-
- @param ffsAttributeRecovery Value of ffsAttributeRecovery
- **/
- public void setRecovery(boolean ffsAttributeRecovery) {
- this.ffsAttribRecovery = ffsAttributeRecovery;
- if (ffsAttributeRecovery) {
- attributes |= FFS_ATTRIB_RECOVERY;
- }
- }
-
- /**
- getFileGuid
-
- This function is to get fileGuid
- @return Guid
- **/
- public String getFileGuid() {
- return this.ffsFileGuid;
- }
-
- /**
- setFileGuid
-
- This function is to set fileGuid
- @param ffsFileGuid String of GUID
- **/
- public void setFileGuid(String ffsFileGuid) {
- this.ffsFileGuid = ffsFileGuid.trim();
- }
-
- /**
- getFfsFileType
-
- This function is to get ffsFileType.
-
- @return value of ffsFileType
- **/
- public String getFfsFileType() {
- return this.ffsFileType;
- }
-
- /**
- setFfsFileType
-
- This function is to set ffsFileType.
-
- @param ffsFileType
- **/
- public void setFfsFileType(String ffsFileType) {
- this.ffsFileType = ffsFileType.trim();
- }
-
- /**
- ffsAttribHeaderExtension
-
- This function is to get ffsAttribHeaderExtension
-
- @return Value of ffsAttribHeaderExtension
- **/
- public boolean isFfsAttribHeaderExtension() {
- return this.ffsAttribHeaderExtension;
- }
-
- /**
- setHeaderExension
-
- This function is to set headerExtension
- @param headerExtension Value of headerExension
- **/
- public void setHeaderExtension(boolean headerExtension) {
- this.ffsAttribHeaderExtension = headerExtension;
- if (headerExtension) {
- attributes |= FFS_ATTRIB_HEADER_EXTENSION;
- }
- }
-
- /**
- isFfsAttribTailPresent
-
- This function is to get ffsAttribTailPresent value.
- @return Value of ffsAttribTailPresent.
- **/
- public boolean isFfsAttribTailPresent() {
- return this.ffsAttribTailPresent;
- }
-
- /**
- setFfsAttribTailPresent
-
- This function is to set ffsAttribTailPresent.
- @param tailPresent Value of ffsAttribTailPresent.
- **/
- public void setFfsAttribTailPresent(boolean tailPresent) {
- this.ffsAttribTailPresent = tailPresent;
- if (tailPresent) {
- attributes |= FFS_ATTRIB_TAIL_PRESENT;
- }
- }
-
-
- /**
- stringToGuid
-
- This function is to convert string to GUID.
- * @param GuidStr String of GUID.
- * @param Guid GUID form.
- */
- private void stringToGuid (String GuidStr, FfsHeader.FfsGuid Guid){
-
- int i = 0;
- int j = 0;
- int k = 0;
- char [] charArry;
- String [] SplitStr;
-
- byte[] buffer = new byte[16];
- if (GuidStr.length()!=36) {
- throw new BuildException ("The GUID length [" + GuidStr.length() + "] is not correct!");
- }
-
-
- SplitStr = GuidStr.split("-");
- if (SplitStr.length != 5) {
- throw new BuildException ("The GUID format is not correct!");
- }
-
-
-
- for (i= 0; i < SplitStr.length; i++) {
- String str = SplitStr[i];
- charArry = str.toCharArray();
-
- for (j =0; j < (str.toCharArray().length)/2; j++) {
-
- buffer[k] = hexCharToByte (charArry[j*2]);
- buffer[k] = (byte)( buffer[k]& 0x0f);
- buffer[k] = (byte)((buffer[k]<< 4));
- buffer[k] = (byte)( buffer[k]& 0xf0);
- buffer[k] = (byte)( buffer[k]|hexCharToByte(charArry[j*2+1]));
- k++;
- }
- }
- Guid.bufferToStruct(buffer);
- }
-
- /**
- typeToSuffix
-
- This function is to get suffix of ffs file according to ffsFileType.
-
- @param ffsFileType ffsFileType
- @return The suffix of ffs file
- **/
- private String TypeToSuffix (String ffsFileType){
- String[][] suffix = { { "BASE", ".FFS"},
- { "SEC", ".SEC" }, { "PEI_CORE", ".PEI" },
- { "PEIM", ".PEI" }, { "DXE_CORE", ".DXE" },
- { "DXE_DRIVER", ".DXE" }, { "DXE_RUNTIME_DRIVER", ".DXE" },
- { "DXE_SAL_DRIVER", ".DXE" }, { "DXE_SMM_DRIVER", ".DXE" },
- { "TOOL", ".FFS" }, { "UEFI_DRIVER", ".DXE" },
- { "UEFI_APPLICATION", ".APP" }, { "USER_DEFINED", ".FFS" } };
-
- for (int i = 0; i < suffix.length; i++) {
- if (suffix[i][0].equalsIgnoreCase(moduleType)) {
- return suffix[i][1];
- }
- }
-
- return ".FFS";
- }
-
-
- /**
- stringToType
-
- This function is to get ffsFileType integer value according to ffsFileType.
- @param ffsFileType String value of ffsFileType
- @return Integer value of ffsFileType.
- **/
- private byte stringToType (String ffsFileType){
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_ALL")) {
- return(byte)EFI_FV_FILETYPE_ALL;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_RAW")) {
- return(byte)EFI_FV_FILETYPE_RAW;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_FREEFORM")) {
- return(byte)EFI_FV_FILETYPE_FREEFORM;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_SECURITY_CORE")) {
- return(byte)EFI_FV_FILETYPE_SECURITY_CORE;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_PEI_CORE")) {
- return(byte) EFI_FV_FILETYPE_PEI_CORE;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_DXE_CORE")) {
- return(byte)EFI_FV_FILETYPE_DXE_CORE;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_PEIM")) {
- return(byte)EFI_FV_FILETYPE_PEIM;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_DRIVER")) {
- return(byte) EFI_FV_FILETYPE_DRIVER;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER")) {
- return(byte)EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_APPLICATION")) {
- return(byte)EFI_FV_FILETYPE_APPLICATION;
- }
-
- if (ffsFileType.equals("EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE")) {
- return(byte)EFI_FV_FILETYPE_FIRMWARE_VOLUME_IMAGE;
- }
- if (ffsFileType.equals("EFI_FV_FILETYPE_FFS_PAD")) {
- return(byte) EFI_FV_FILETYPE_FFS_PAD;
- }
-
- return -1;
- }
-
-
-
- /**
- calculateCheckSum8
-
- This function is to calculate the value needed for a valid UINT8 checksum
- @param buffer Byte buffer containing byte data of component.
- @param size Size of the buffer.
- @return The 8 bit checksum value needed.
- **/
- private byte calculateChecksum8 (byte[] buffer, int size){
- return(byte) (0x100 - calculateSum8 (buffer, size));
- }
-
-
- /**
- calculateSum8
-
- This function is to calculate the UINT8 sum for the requested region.
- @param buffer Byte buffer containing byte data of component
- @param size Size of the buffer.
- @return The 8 bit checksum value needed.
- **/
- private short calculateSum8 (byte[] buffer, int size){
- int Index;
- byte Sum;
- Sum = 0;
-
- //
- // Perform the word sum for buffer
- //
- for (Index = 0; Index < size; Index++) {
- Sum = (byte) (Sum + buffer[Index]);
- }
-
- return(byte) Sum;
- }
-
- /**
- hexCharToByte
-
- This function is to convert hex character to byte
-
- @param hexChar hex character
- @return Byte which corresponding to the character.
- **/
- private byte hexCharToByte (char hexChar){
- switch (hexChar) {
- case '0':
- return(byte)0x00;
- case '1':
- return(byte)0x01;
- case '2':
- return(byte)0x02;
- case '3':
- return(byte)0x03;
- case '4':
- return(byte)0x04;
- case '5':
- return(byte)0x05;
- case '6':
- return(byte)0x06;
- case '7':
- return(byte)0x07;
- case '8':
- return(byte)0x08;
- case '9':
- return(byte)0x09;
- case 'a':
- case 'A':
- return(byte)0x0a;
- case 'b':
- case 'B':
- return(byte)0x0b;
- case 'c':
- case 'C':
- return(byte)0x0c;
-
- case 'd':
- case 'D':
- return(byte)0x0d;
-
- case 'e':
- case 'E':
- return(byte)0x0e;
- case 'f':
- case 'F':
- return(byte)0x0f;
-
- default:
- return(byte)0xff;
- }
- }
-
- /**
- adjustFileSize
-
- This function is used to adjusts file size to insure sectioned file is exactly the right length such
- that it ends on exactly the last byte of the last section. ProcessScript()
- may have padded beyond the end of the last section out to a 4 byte boundary.
- This padding is stripped.
-
- @param buffer Byte buffer contains a section stream
- @return Corrected size of file.
- **/
- private int adjustFileSize (byte[] buffer){
-
- int orignalLen = buffer.length;
- int adjustLen = 0;
- int sectionPoint = 0;
- int nextSectionPoint = 0;
- int sectionLen = 0;
- int totalLen = 0;
- int firstSectionHeader = 0;
-
-
- firstSectionHeader = buffer[0]& 0xff;
- firstSectionHeader = ((buffer[1]&0xff)<<8) | firstSectionHeader;
- firstSectionHeader = ((buffer[2]&0xff)<<16)| firstSectionHeader;
-
-
- while (sectionPoint < buffer.length) {
- sectionLen = buffer[0 + sectionPoint]& 0xff;
- sectionLen = ((buffer[1 + sectionPoint]&0xff)<<8)| sectionLen;
- sectionLen = ((buffer[2 + sectionPoint]&0xff)<<16)| sectionLen;
- totalLen = totalLen + sectionLen;
-
- if (totalLen == orignalLen) {
- return totalLen;
- }
-
- sectionPoint = sectionPoint + sectionLen;
- adjustLen = sectionPoint;
-
- nextSectionPoint = (sectionPoint + 0x03) & (~0x03);
- totalLen = totalLen + nextSectionPoint - sectionLen;
- sectionPoint = nextSectionPoint;
- }
- return adjustLen;
- }
-
- /**
- getOutputDir
-
- This function is to get output directory.
-
- @return Path of output directory.
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set output directory.
-
- @param outputDir The output direcotry.
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-
- /**
- getModuleTyp
-
- This function is to get string of module type.
-
- @return moduleType The string of module type.
- **/
- public String getModuleType() {
- return this.moduleType;
- }
-
- /**
- setModuleType
-
- This function is to set moduleType.
-
- @param moduleType The string of module type.
- **/
- public void setModuleType(String moduleType) {
- this.moduleType = moduleType;
- }
-
- /**
- Convert a string to a integer.
-
- @param intString The string representing a integer
-
- @retval int The value of integer represented by the
- given string; -1 is returned if the format
- of the string is wrong.
- **/
- private int stringToInt(String intString) {
- int value;
- int hexPrefixPos = intString.indexOf("0x");
- int radix = 10;
- String intStringNoPrefix;
-
- if (hexPrefixPos >= 0) {
- radix = 16;
- intStringNoPrefix = intString.substring(hexPrefixPos + 2, intString.length());
- } else {
- intStringNoPrefix = intString;
- }
-
- try {
- value = Integer.parseInt(intStringNoPrefix, radix);
- } catch (NumberFormatException e) {
- EdkLog.log(this, EdkLog.EDK_ERROR, "Incorrect format of int [" + intString + "]. -1 is assumed");
- return -1;
- }
-
- return value;
- }
-
- private void alignSection(DataOutputStream dataBuffer, int dataSize, int alignment) throws BuildException {
- if (alignment == 0) {
- return;
- }
- dataSize += 4; // take the section header into account
- int[] alignedBytes = {0, 16, 128, 512, 1024, 4096, 32768, 65536};
- int padSize = (alignedBytes[alignment] - dataSize) & (alignedBytes[alignment] - 1);
- if (padSize == 0) {
- //
- // already aligned
- //
- return;
- }
- //
- // if the pad size is not times of 4, there must be something wrong in previous sections
- //
- if (((4 - padSize) & (4 - 1)) != 0) {
- EdkLog.log(this, EdkLog.EDK_ERROR, "PAD section size must be 4-byte aligned (" + padSize + ")!");
- throw new BuildException ("Alignment can't be satisfied!");
- }
- byte[] pad = new byte[padSize];
- //
- // first three byte stores the section size
- //
- pad[0] = (byte)(padSize & 0xff);
- pad[1] = (byte)((padSize >> 8) & 0xff);
- pad[2] = (byte)((padSize >> 16) & 0xff);
- //
- // the fourth byte are section type. use raw type (0x19)
- //
- pad[3] = 0x19;
- try {
- dataBuffer.write(pad);
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- genFfs
-
- This function is to generate FFS file.
-
- @param ffsFile Name of FFS file.
- @param isOrg Flag to indicate generate ORG ffs file or not.
- **/
- private void genFfs(File ffsFile) throws BuildException {
- Section sect;
- int fileSize;
- int fileDataSize;
- FfsHeader ffsHeader = new FfsHeader();
- FfsHeader orgFfsHeader = new FfsHeader();
-
- EdkLog.log(this, EdkLog.EDK_INFO, ffsFile.getName());
-
- try {
- //
- // Create file output stream -- dataBuffer.
- //
- FileOutputStream dataFs = new FileOutputStream (ffsFile.getAbsolutePath());
- DataOutputStream dataBuffer = new DataOutputStream (dataFs);
-
- //
- // Search SectionList find earch section and call it's
- // ToBuffer function.
- //
- Iterator sectionIter = this.sectionList.iterator();
- while (sectionIter.hasNext()) {
- sect = (Section)sectionIter.next();
-
- try {
- int alignment = sect.getAlignment();
- if (this.ffsAttribDataAlignment < alignment) {
- this.ffsAttribDataAlignment = alignment;
- }
- alignSection(dataBuffer, dataBuffer.size(), alignment);
- //
- // The last section don't need 4 byte ffsAligment.
- //
- sect.toBuffer((DataOutputStream)dataBuffer);
- } catch (Exception e) {
- if (dataBuffer != null){
- dataBuffer.close();
- }
- throw new BuildException (e.getMessage());
- }
- }
- dataBuffer.close();
- } catch (Exception e) {
- throw new BuildException (e.getMessage());
- }
-
- //
- // Creat Ffs file header
- //
- try {
-
- //
- // create input stream to read file data
- //
- byte[] fileBuffer = new byte[(int)ffsFile.length()];
- FileInputStream fi = new FileInputStream (ffsFile.getAbsolutePath());
- DataInputStream di = new DataInputStream (fi);
- di.read(fileBuffer);
- di.close();
-
- //
- // Add GUID to header struct
- //
- if (this.ffsFileGuid != null) {
- stringToGuid (this.ffsFileGuid, ffsHeader.name);
- }
-
- //
- // because we may have changed the ffsAttribDataAlignment, we need to refresh attributes
- //
- this.attributes &= ~(((byte)7) << 3);
- this.attributes |= (((byte)this.ffsAttribDataAlignment) << 3);
-
- ffsHeader.ffsAttributes = this.attributes;
- if ((ffsHeader.fileType = stringToType(this.ffsFileType))== -1) {
- throw new BuildException ("FFS_FILE_TYPE unknow!\n");
- }
-
- //
- // Copy ffsHeader.ffsAttribute and fileType to orgFfsHeader.ffsAttribute
- // and fileType
- //
- orgFfsHeader.ffsAttributes = ffsHeader.ffsAttributes;
- orgFfsHeader.fileType = ffsHeader.fileType;
-
- //
- // Adjust file size. The function is used to tripe the last
- // section padding of 4 binary boundary.
- //
- //
- if (ffsHeader.fileType != EFI_FV_FILETYPE_RAW) {
-
- fileDataSize = adjustFileSize (fileBuffer);
- } else {
- fileDataSize = fileBuffer.length;
- }
-
- //
- // 1. add header size to file size
- //
- fileSize = fileDataSize + ffsHeader.getSize();
-
- if ((ffsHeader.ffsAttributes & FFS_ATTRIB_TAIL_PRESENT) != 0) {
- if (ffsHeader.fileType == EFI_FV_FILETYPE_FFS_PAD) {
-
- throw new BuildException (
- "FFS_ATTRIB_TAIL_PRESENT=TRUE is " +
- "invalid for PAD files"
- );
- }
- if (fileSize == ffsHeader.getSize()) {
- throw new BuildException (
- "FFS_ATTRIB_TAIL_PRESENT=TRUE is " +
- "invalid for 0-length files"
- );
- }
- fileSize = fileSize + 2;
- }
-
- //
- // 2. set file size to header struct
- //
- ffsHeader.ffsFileSize[0] = (byte)(fileSize & 0x00FF);
- ffsHeader.ffsFileSize[1] = (byte)((fileSize & 0x00FF00)>>8);
- ffsHeader.ffsFileSize[2] = (byte)(((int)fileSize & 0xFF0000)>>16);
-
- //
- // Fill in checksums and state, these must be zero for checksumming
- //
- ffsHeader.integrityCheck.header = calculateChecksum8 (
- ffsHeader.structToBuffer(),
- ffsHeader.getSize()
- );
-
- if ((this.attributes & FFS_ATTRIB_CHECKSUM) != 0) {
- if ((this.attributes & FFS_ATTRIB_TAIL_PRESENT) != 0) {
- ffsHeader.integrityCheck.file = calculateChecksum8 (
- fileBuffer,
- fileDataSize
- );
- } else {
- ffsHeader.integrityCheck.file = calculateChecksum8 (
- fileBuffer,
- fileDataSize
- );
- }
- } else {
- ffsHeader.integrityCheck.file = FFS_FIXED_CHECKSUM;
- orgFfsHeader.integrityCheck.file = FFS_FIXED_CHECKSUM;
- }
-
- //
- // Set the state now. Spec says the checksum assumes the state is 0.
- //
- ffsHeader.ffsState = EFI_FILE_HEADER_CONSTRUCTION |
- EFI_FILE_HEADER_VALID |
- EFI_FILE_DATA_VALID;
-
- //
- // create output stream to first write header data in file, then write sect data in file.
- //
- FileOutputStream headerFfs = new FileOutputStream (ffsFile.getAbsolutePath());
- DataOutputStream ffsBuffer = new DataOutputStream (headerFfs);
-
- //
- // Add header struct and file data to FFS file
- //
- ffsBuffer.write(ffsHeader.structToBuffer());
- ffsBuffer.write(fileBuffer, 0, fileDataSize);
-
-
-
- //
- // If there is a tail, then set it
- //
- if ((this.attributes & FFS_ATTRIB_TAIL_PRESENT) != 0) {
- short tailValue ;
- byte [] tailByte = new byte[2];
-
- //
- // reverse tailvalue , integritycheck.file as hight byte, and
- // integritycheck.header as low byte.
- //
- tailValue = (short)(ffsHeader.integrityCheck.header & 0xff);
- tailValue = (short)((tailValue) | ((ffsHeader.integrityCheck.file << 8) & 0xff00));
- tailValue = (short)~tailValue;
-
- //
- // Change short to byte[2]
- //
- tailByte[0] = (byte)(tailValue & 0xff);
- tailByte[1] = (byte)((tailValue & 0xff00)>>8);
- ffsBuffer.write(tailByte[0]);
- ffsBuffer.write(tailByte[1]);
-
- }
-
- //
- // close output stream. Note if don't close output stream
- // the buffer can't be rewritten to file.
- //
- ffsBuffer.close();
- } catch (Exception e) {
- EdkLog.log(this, EdkLog.EDK_ERROR, "genffsfile failed!");
- throw new BuildException (e.getMessage());
- }
-
- }
-
- /**
- addGenSection
-
- This function is to add gensection instance to list
-
- @param task Instance of GenSectionTask
- **/
- public void addGenSection (GenSectionTask task){
- this.sectionList.add(task);
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFvImageTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFvImageTask.java
deleted file mode 100644
index 0f25032f7f..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFvImageTask.java
+++ /dev/null
@@ -1,274 +0,0 @@
-/** @file
- GenFvImageTask class.
-
- GenFvImageTask is to call GenFvImage.exe to generate FvImage.
-
- 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 org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import java.io.File;
-import java.util.LinkedList;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-import java.util.List;
-import java.util.Iterator;
-import java.io.BufferedReader;
-import java.io.FileReader;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- GenFvImageTask
-
- GenFvImageTask is to call GenFvImage.exe to generate the FvImage.
-
-**/
-public class GenFvImageTask extends Task implements EfiDefine{
- //
- // tool name
- //
- static final private String toolName = "GenFvImage";
- //
- // Pattern to match the section header (e.g. [options], [files])
- //
- static final private Pattern sectionHeader = Pattern.compile("\\[([^\\[\\]]+)\\]");
- //
- // The name of input inf file
- //
- private FileArg infFile = new FileArg();
- //
- // Output directory
- //
- private String outputDir = ".";
-
- /**
- execute
-
- GenFvImageTask execute is to assemble tool command line & execute tool
- command line.
- **/
- public void execute() throws BuildException {
- Project project = this.getOwningTarget().getProject();
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
-
- if (isUptodate()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, infFile.toFileList() + " is uptodate!");
- return;
- }
-
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
-
- String argument = "" + infFile;
- //
- // lauch the program
- //
- int exitCode = 0;
- 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());
- runner.setWorkingDirectory(new File(outputDir));
- //
- // log command line string.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, infFile.toFileList());
-
- exitCode = runner.execute();
- if (exitCode != 0) {
- EdkLog.log(this, "ERROR = " + Integer.toHexString(exitCode));
- } else {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "GenFvImage succeeded!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- } finally {
- if (exitCode != 0) {
- throw new BuildException("GenFvImage: failed to generate FV file!");
- }
- }
- }
- /**
- getInfFile
-
- This function is to get class member of infFile
- @return String name of infFile
- **/
- public String getInfFile() {
- return infFile.getValue();
- }
-
- /**
- setInfFile
-
- This function is to set class member of infFile.
-
- @param infFile name of infFile
- **/
- public void setInfFile(String infFile) {
- this.infFile.setArg(" -I ", infFile);
- }
-
- /**
- getOutputDir
-
- This function is to get output directory.
-
- @return Path of output directory.
- **/
- public String getOutputDir() {
- return outputDir;
- }
-
- /**
- setOutputDir
-
- This function is to set output directory.
-
- @param outputDir The output direcotry.
- **/
- public void setOutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-
- //
- // dependency check
- //
- private boolean isUptodate() {
- String infName = this.infFile.getValue();
- String fvName = "";
- List<String> ffsFiles = new LinkedList<String>();
- File inf = new File(infName);
-
- try {
- FileReader reader = new FileReader(inf);
- BufferedReader in = new BufferedReader(reader);
- String str;
-
- //
- // Read the inf file line by line
- //
- boolean inFiles = false;
- boolean inOptions = false;
- while ((str = in.readLine()) != null) {
- str = str.trim();
- if (str.length() == 0) {
- continue;
- }
-
- Matcher matcher = sectionHeader.matcher(str);
- if (matcher.find()) {
- //
- // We take care of only "options" and "files" section
- //
- String sectionName = str.substring(matcher.start(1), matcher.end(1));
- if (sectionName.equalsIgnoreCase("options")) {
- inOptions = true;
- inFiles = false;
- } else if (sectionName.equalsIgnoreCase("files")) {
- inFiles = true;
- inOptions = false;
- } else {
- inFiles = false;
- inOptions = false;
- }
- continue;
- }
-
- //
- // skip invalid line
- //
- int equalMarkPos = str.indexOf("=");
- if (equalMarkPos < 0) {
- continue;
- }
-
- //
- // we have only interest in EFI_FILE_NAME
- //
- String fileNameFlag = str.substring(0, equalMarkPos).trim();
- String fileName = str.substring(equalMarkPos + 1).trim();
- if (!fileNameFlag.equalsIgnoreCase("EFI_FILE_NAME")
- || fileName.length() == 0) {
- continue;
- }
-
- if (inFiles) {
- //
- // files specified beneath the [files] section are source files
- //
- ffsFiles.add(fileName);
- } else if (inOptions) {
- //
- // file specified beneath the [options] section is the target file
- //
- fvName = outputDir + File.separator + fileName;
- }
- }
- } catch (Exception ex) {
- throw new BuildException(ex.getMessage());
- }
-
- //
- // if destionation file doesn't exist, we need to generate it.
- //
- File fvFile = new File(fvName);
- if (!fvFile.exists()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, fvName + " doesn't exist!");
- return false;
- }
-
- //
- // the inf file itself will be taken as source file, check its timestamp
- // against the target file
- //
- long fvFileTimeStamp = fvFile.lastModified();
- if (inf.lastModified() > fvFileTimeStamp) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, infName + " has been changed since last build!");
- return false;
- }
-
- //
- // no change in the inf file, we need to check each source files in it
- // against the target file
- //
- for (Iterator it = ffsFiles.iterator(); it.hasNext(); ) {
- String fileName = (String)it.next();
- File file = new File(fileName);
- if (file.lastModified() > fvFileTimeStamp) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, fileName + " has been changed since last build!");
- return false;
- }
- }
-
- return true;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenSectionTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenSectionTask.java
deleted file mode 100644
index 82844f080f..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenSectionTask.java
+++ /dev/null
@@ -1,398 +0,0 @@
-/** @file
- GenSectionTask class.
-
- GenSectionTask is to call GenSection.exe to generate Section.
-
- 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.ByteArrayOutputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-import org.tianocore.common.logger.EdkLog;
-
-public class GenSectionTask extends Task implements EfiDefine, Section, FfsTypes {
- private int alignment = 0;
- //
- // Tool name
- //
- private final static String toolName = "GenSection";
- //
- // inputfile name
- //
- private FileArg inputFile = new FileArg();
-
- //
- // outputfile name
- //
- private FileArg outputFile = new FileArg();
-
- //
- // section type
- //
- private ToolArg sectionType = new ToolArg();
-
- //
- // version number
- //
- private ToolArg versionNum = new ToolArg();
-
- //
- // interface string
- //
- private ToolArg interfaceString = new ToolArg();
-
- //
- // Section file list
- //
- private List<Section> sectFileList = new ArrayList<Section>();
-
- //
- // flag indicated the <tool> element
- //
- private boolean haveTool = false;
-
- /**
- execute
-
- GenSectionTaks execute is to assemble tool command line & execute tool
- command line.
-
- @throws BuildException
- **/
- public void execute() throws BuildException {
- String command;
- Project project = this.getOwningTarget().getProject();
- //
- // absolute path of efi tools
- //
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
- //
- // argument of tools
- //
- String argument = "" + inputFile + outputFile + sectionType + versionNum + interfaceString;
- //
- // return value of gensection 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(this, inputFile.toFileList() + versionNum.getValue()
- + interfaceString.getValue() + " => " + outputFile.toFileList());
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getInputFile
-
- This function is to get class member "inputFile".
-
- @return name of input file
- **/
- public String getInputFile() {
- return this.inputFile.getValue();
- }
-
- /**
- setInputFile
-
- This function is to set class member "inputFile".
-
- @param inputFile name of input file
- **/
- public void setInputFile(String inputFile) {
- this.inputFile.setArg(" -i ", inputFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile".
-
- @return name of output file
- **/
- public String getOutputFile() {
- return this.outputFile.getValue();
- }
-
- /**
- setOutputfile
-
- This function is to set class member "outputFile".
- @param outputFile name of output file
- **/
- public void setOutputfile(String outputFile) {
- this.outputFile.setArg(" -o ", outputFile);
- }
-
- /**
- getSectionType
-
- This function is to get class member "sectionType".
-
- @return sectoin type
- **/
- public String getSectionType() {
- return this.sectionType.getValue();
- }
-
- /**
- setSectionType
-
- This function is to set class member "sectionType".
-
- @param sectionType section type
- **/
- public void setSectionType(String sectionType) {
- this.sectionType.setArg(" -s ", sectionType);
- }
-
- /**
- getVersionNum
-
- This function is to get class member "versionNum".
- @return version number
- **/
- public String getVersionNum() {
- return this.versionNum.getValue();
- }
-
- /**
- setVersionNume
-
- This function is to set class member "versionNum".
- @param versionNum version number
- **/
- public void setVersionNum(String versionNum) {
- this.versionNum.setArg(" -v ", versionNum);
- }
-
- /**
- getInterfaceString
-
- This function is to get class member "interfaceString".
- @return interface string
- **/
- public String getInterfaceString() {
- return this.interfaceString.getValue();
- }
-
- /**
- setInterfaceString
-
- This funcion is to set class member "interfaceString".
- @param interfaceString interface string
- **/
- public void setInterfaceString(String interfaceString) {
- this.interfaceString.setArg(" -a ", "\"" + interfaceString + "\"");
- }
-
- /**
- addSectFile
-
- This function is to add sectFile to list.
-
- @param sectFile instance of sectFile.
- **/
- public void addSectFile(SectFile sectFile){
- this.sectFileList.add(sectFile);
- }
-
- /**
- setTool
-
- This function is to set the class member "Tool";
-
- @param tool
- **/
- public void addTool(Tool tool) {
- this.sectFileList.add(tool);
- this.haveTool = true;
- }
-
- /**
- addGenSection
-
- This function is to add GenSectin element to list
- @param task Instance of genSection
- **/
- public void addGenSection(GenSectionTask task){
- this.sectFileList.add(task);
- }
-
- public int getAlignment() {
- return alignment;
- }
-
- public void setAlignment(int alignment) {
- if (alignment > 7) {
- this.alignment = 7;
- } else {
- this.alignment = alignment;
- }
- }
-
- public void toBuffer(DataOutputStream buffer){
- //
- // Search SectionList find earch section and call it's
- // ToBuffer function.
- //
- if (this.sectionType.getValue().equalsIgnoreCase(
- "EFI_SECTION_COMPRESSION")
- && !this.haveTool) {
- Section sect;
-
- //
- // Get section file in compress node.
- //
- try {
- ByteArrayOutputStream bo = new ByteArrayOutputStream();
- DataOutputStream Do = new DataOutputStream(bo);
-
- //
- // Get each section which under the compress {};
- // And add it is contains to File;
- //
- Iterator SectionIter = this.sectFileList.iterator();
- while (SectionIter.hasNext()) {
- sect = (Section) SectionIter.next();
-
- //
- // Call each section class's toBuffer function.
- //
- try {
- sect.toBuffer(Do);
- } catch (BuildException e) {
- System.out.print(e.getMessage());
- throw new BuildException(
- "Compress.toBuffer failed at section");
- } finally {
- if (Do != null){
- Do.close();
- }
- }
- }
- //
- // Call compress
- //
- byte[] fileBuffer = bo.toByteArray();
-
- synchronized (CompressSection.semaphore) {
- Compress myCompress = new Compress(fileBuffer,
- fileBuffer.length);
-
- //
- // Add Compress header
- //
- CompressHeader Ch = new CompressHeader();
- Ch.SectionHeader.Size[0] = (byte) ((myCompress.outputBuffer.length + Ch
- .GetSize()) & 0xff);
- Ch.SectionHeader.Size[1] = (byte) (((myCompress.outputBuffer.length + Ch
- .GetSize()) & 0xff00) >> 8);
- Ch.SectionHeader.Size[2] = (byte) (((myCompress.outputBuffer.length + Ch
- .GetSize()) & 0xff0000) >> 16);
- Ch.SectionHeader.type = (byte) EFI_SECTION_COMPRESSION;
-
- //
- // Note: The compressName was not efsfective now. Using the
- // EFI_STANDARD_COMPRSSION for compressType .
- // That is follow old Genffsfile tools. Some code will be
- // added for
- // the different compressName;
- //
- Ch.UncompressLen = fileBuffer.length;
- Ch.CompressType = EFI_STANDARD_COMPRESSION;
-
- //
- // Change header struct to byte buffer
- //
- byte[] headerBuffer = new byte[Ch.GetSize()];
- Ch.StructToBuffer(headerBuffer);
-
- //
- // First add CompressHeader to Buffer, then add Compress
- // data.
- //
- buffer.write(headerBuffer);
- buffer.write(myCompress.outputBuffer);
-
- //
- // Buffer 4 Byte aligment
- //
- int size = Ch.GetSize() + myCompress.outputBuffer.length;
-
- while ((size & 0x03) != 0) {
- size++;
- buffer.writeByte(0);
- }
- }
- } catch (Exception e) {
- throw new BuildException("GenSection<SectionType=EFI_SECTION_COMPRESSION> to Buffer failed!\n");
- }
- } else {
- Section sect;
- Iterator sectionIter = this.sectFileList.iterator();
- while (sectionIter.hasNext()) {
- sect = (Section) sectionIter.next();
- try {
- //
- // The last section don't need 4 byte ffsAligment.
- //
- sect.toBuffer(buffer);
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenTeImageTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenTeImageTask.java
deleted file mode 100644
index 34a7987f43..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GenTeImageTask.java
+++ /dev/null
@@ -1,253 +0,0 @@
-/** @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.common.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 FileArg inputFile = new FileArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // output directory, this variable is added by jave wrap
- //
- private String outputDir = "";
-
- //
- // Verbose flag
- //
- private ToolArg verbose = new ToolArg();
-
- //
- // Dump flag
- //
- private ToolArg dump = new ToolArg();
-
- /**
- 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();
- //
- // 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.separator + toolName;
- }
- //
- // argument of tools
- //
- argument = "" + this.verbose + this.dump + 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());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, this.inputFile.toFileList()
- + " => " + this.outputFile.toFileList());
-
- revl = runner.execute();
-
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = "+ Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } 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.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "inputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setInputFile(String inputFile) {
- this.inputFile.setArg(" ", inputFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" -o ", 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.getValue();
- }
-
- /**
- setVerbose
-
- This function is to set class member "verbose"
-
- @param verbose
- True or False.
- **/
- public void setVerbose(boolean verbose) {
- if (verbose) {
- this.verbose.setArg(" -", "v");
- }
- }
-
- /**
- getDump
-
- This function is to get class member "dump"
-
- @return verbose the flag of dump.
- **/
- public String getDump() {
- return dump.getValue();
- }
-
- /**
- setDump
-
- This function is to set class member "dump"
-
- @param dump
- True or False.
- **/
- public void setDump(boolean dump) {
- if (dump) {
- this.dump.setArg(" -", "dump");
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GuidChkTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GuidChkTask.java
deleted file mode 100644
index 2f892a7cd4..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/GuidChkTask.java
+++ /dev/null
@@ -1,368 +0,0 @@
-/** @file
- GuidChkTask class.
-
- GuidChkTask is to call GuidChk.exe to generate Section.
-
- 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.BufferedReader;
-import java.io.InputStreamReader;
-import java.io.PrintWriter;
-import java.io.File;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- GuidChkTask
-
- GuidChkTask is to call GuidChk.exe to generate Section.
-
-**/
-public class GuidChkTask extends Task implements EfiDefine{
- /**
- * GuidChk task class
- * class member
- * -exDir : directory name of exclusion searching
- * -exFile : file name of exclusion searching
- * -exExt : extension name of exclusion searching
- * -exSubDir: extesnion name of sub dir which excluded searching
- * -outFile : out put file wrote internal GUID+basename list
- * -chkGui : check for duplicate guids
- * -chkSign : check for duplicate signatures
- * -printGuiDef : if set will print guid+defined symbol name
- * -printAllGuid: if set will print all GUIDS found
- * -outPut : redirection file name
- * -fos : out put redirect to this file
- *
- */
- //
- // Tool name
- //
- private static String toolName = "GuidChk";
- //
- // Directory name of exclusion searching
- //
- private FileArg exDir = new FileArg();
- //
- // File name of exclusion searching.
- //
- private FileArg exFile = new FileArg();
- //
- // Extension name of exclusion searching.
- //
- private FileArg exExt = new FileArg();
- //
- // Extesnion name of sub dir which excluded searching.
- //
- private FileArg exSubDir = new FileArg();
- //
- // Out put file wrote internal GUID+basename list
- //
- private FileArg outFile = new FileArg();
- //
- // Check for duplicate guids.
- //
- private ToolArg chkGui = new ToolArg();
- //
- // Check for duplicate signatures
- //
- private ToolArg chkSign = new ToolArg();
- //
- // If set will print guid+defined symbol name
- //
- private ToolArg printGuiDef = new ToolArg();
- //
- // If set will print all GUIDS found
- //
- private ToolArg printAllGuid = new ToolArg();
- //
- // redirection file name.
- //
- private String outPut = "";
- //
- // out put redirect to this file.
- //
- protected PrintWriter fos = null;
-
- //
- // overload class execute method
- //
- public void execute() throws BuildException {
- Project project = this.getOwningTarget().getProject();
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separatorChar + toolName;
- }
- String argument = "" + exDir +
- exFile +
- exExt +
- exSubDir +
- outFile +
- chkGui +
- chkSign +
- printGuiDef +
- printAllGuid;
- try {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, command + " " + argument);
- //
- // execute command line
- //
- Process proc = Runtime.getRuntime().exec(command + " " + argument);
- //
- // if set output, redirect out put to output file, else print output to screen
- //
- if ( !this.outPut.equals("")) {
- fos = new PrintWriter(this.outPut);
- BufferedReader bin = new BufferedReader(new InputStreamReader(proc.getInputStream()));
- String line = bin.readLine();
- while (line != null ){
- fos.println(line);
- line = bin.readLine();
- }
- fos.close();
- }
- else {
- BufferedReader bin = new BufferedReader(new InputStreamReader(proc.getInputStream()));
- String line = bin.readLine();
- while (line != null ){
- line = bin.readLine();
- }
- }
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " Succeeded!");
- } catch (Exception e) {
- throw new BuildException(toolName + " failed!");
- }
- }
- /**
- getChkGui
-
- This function is to get the string of flag of ChkGui
-
- @return string of flag of ChkGui
- **/
- public String getChkGui() {
- return chkGui.getValue();
- }
-
- /**
- setChkGui
-
- This function is to set chkGui
-
- @param chkGui set class member of chkGui
- **/
- public void setChkGui(boolean chkGui) {
- if (chkGui) {
- this.chkGui.setArg(" -", "g");
- }
- }
-
- /**
- getChkSign
-
- This function is to get chkSign
-
- @return chkSign
- **/
- public String getChkSign() {
- return chkSign.getValue();
- }
-
- /**
- setChkSign
-
- This function is to set class member of chkSign
- * @param chkSign
- */
- public void setChkSign(boolean chkSign) {
- if (chkSign){
- this.chkSign.setArg(" -", "s");
- }
- }
- /**
- getExDir
-
- This function is to get class member of exDir
-
- @return exDir
- **/
- public String getExDir() {
- return exDir.getValue();
- }
-
- /**
- setExDir
-
- This function is to set class member of exDir
-
- @param exDir
- **/
- public void setExDir(String exDir) {
- this.exDir.setArg(" -d ", exDir);
- }
-
- /**
- getExExt
-
- This function is to get class member of exExt
-
- @return exExt
- **/
- public String getExExt() {
- return exExt.getValue();
- }
-
- /**
- setExExt
-
- This function is to set class member of exExt
- @param exExt
- **/
- public void setExExt(String exExt) {
- this.exExt.setArg(" -e ", exExt);
- }
-
- /**
- getExFile
-
- This function is to get class member of exFile
- @return exFile
- **/
- public String getExFile() {
- return exFile.getValue();
- }
-
- /**
- setExFile
-
- This function is to set class member of exFile.
-
- @param exFile
- **/
- public void setExFile(String exFile) {
- this.exFile.setArg(" -f ", exFile);
- }
-
- /**
- getExSubDir
-
- This function is to get class member of exSubDir
-
- @return exSubDir
- **/
- public String getExSubDir() {
- return exSubDir.getValue();
- }
-
- /**
- setExSubDir
-
- This function is to set class member of exSubDir.
- @param exSubDir
- **/
- public void setExSubDir(String exSubDir) {
- this.exSubDir.setArg(" -u ", exSubDir);
- }
-
- /**
- getOutFile
-
- This function is to get outFile
-
- @return outFile
- **/
- public String getOutFile() {
- return outFile.getValue();
- }
- /**
- * set class member of outFile
- * @param outFile
- */
- public void setOutFile(String outFile) {
- this.outFile.setArg(" -b ", outFile);
- }
- /**
- getPrintGuidDef
-
- This function is to get printGuidDef
-
- @return flage of printing (guid+defined symbol name)
- **/
- public String getPrintGuiDef() {
- return printGuiDef.getValue();
- }
-
-
- /**
- setPrintGuidDef
-
- This function is to set class member of printGuiDef.
- @param printGuiDef
- **/
- public void setPrintGuiDef(boolean printGuiDef) {
- if (printGuiDef){
- this.printGuiDef.setArg(" -", "x");
- }
-
- }
-
- /**
- getOutput
-
- This function is to get output
-
- @return name of outPut file
- **/
- public String getOutPut() {
- return outPut;
- }
-
- /**
- setOutPut
-
- This function is to set class member of outPut.
- @param outPut
- **/
- public void setOutPut(String outPut) {
- this.outPut = outPut;
- }
-
- /**
- getPrintAllGuid
-
- This function is to get printAllGuid
- @return printAllGuid
- **/
- public String getPrintAllGuid() {
- return printAllGuid.getValue();
- }
-
- /**
- setPrintAllGuid
-
- This function is to set class member of printAllGuid.
- @param printAllGuid
- **/
- public void setPrintAllGuid(boolean printAllGuid) {
- if (printAllGuid) {
- this.printAllGuid.setArg(" -", "p");
- }
- }
-}
-
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/IncludePath.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/IncludePath.java
deleted file mode 100644
index 4591406bbf..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/IncludePath.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/** @file
-This file is used to nest elements which is meant for include path name
-
-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;
-
-/**
- IncludePath class is generally used to pass arguments with "-i" before each
- of them.
- **/
-public class IncludePath extends NestElement {
- public String toString() {
- return super.toString(" -i ");
- }
-}
-
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Input.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Input.java
deleted file mode 100644
index 088d37883b..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Input.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file
-This file is used to nest elements which is meant for file path
-
-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;
-
-/**
- Input class is defined to be as nested elements of other elements, to specify
- the path of file(s).
- **/
-public class Input extends NestElement {
- public String toString() {
- return super.toString(" -f ");
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/InputFile.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/InputFile.java
deleted file mode 100644
index fe0cc83eb2..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/InputFile.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file
-This file is used to nest elements which is meant for specifying files
-
-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;
-
-/**
- InputFile is always used to pass arguments separated by space
- **/
-public class InputFile extends NestElement {
- public String toString() {
- return super.toString(" ");
- }
-}
-
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java
deleted file mode 100644
index 86f39adafc..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/MakeDeps.java
+++ /dev/null
@@ -1,381 +0,0 @@
-/** @file
-This file is to wrap MakeDeps.exe tool as ANT task, which is used to generate
-dependency files for source code.
-
-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.BufferedInputStream;
-import java.io.BufferedReader;
-import java.io.BufferedWriter;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileReader;
-import java.io.FileWriter;
-import java.io.IOException;
-import java.io.LineNumberReader;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.LinkedHashSet;
-import java.util.List;
-import java.util.Set;
-import java.util.Stack;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Task;
-import org.tianocore.common.cache.FileTimeStamp;
-import org.tianocore.common.logger.EdkLog;
-
-/**
- Class MakeDeps is used to wrap MakeDeps.exe as an ANT task.
- **/
-public class MakeDeps extends Task {
-
- //
- // private members, use set/get to access them
- //
- private String targetFile = "";
- private String depsFilePath = "";
- private IncludePath includePathList = new IncludePath();
- private Input inputFileList = new Input();
- //
- // cache the including files to speed up dependency check
- //
- private static HashMap<String, Set<String>> includesCache = new HashMap<String, Set<String>>();
- //
- // regular expression for "#include ..." directive
- //
- private static final Pattern incPattern = Pattern.compile("[\n\r \t#]*include[ \t]+[\"<]*([^\n\r\"<>]+)[>\" \t]*");
-
- public MakeDeps() {
-
- }
-
- /**
- The Standard execute method for ANT task. It will check if it's necessary
- to generate the dependency list file. If no file is found or the dependency
- is changed, it will compose the command line and call MakeDeps.exe to
- generate the dependency list file.
-
- @throws BuildException
- **/
- public void execute() throws BuildException {
- //
- // if target file is specified and it hasn't been generated, don't generate
- // dep file
- //
- if (targetFile.length() != 0 && (new File(targetFile)).exists() == false) {
- return;
- }
- //
- // check if the dependency list file is uptodate or not
- //
- if (isUptodate()) {
- return;
- }
-
- //
- // if no include path is specified, try locally
- //
- if (includePathList.isEmpty()) {
- includePathList.insPath(".");
- }
-
- Set<String> depFiles = getDependencies(inputFileList.toArray());
-
- File depsFile = new File(depsFilePath);
- FileWriter fileWriter = null;
- BufferedWriter bufWriter = null;
-
- try {
- fileWriter = new FileWriter(depsFile);
- bufWriter = new BufferedWriter(fileWriter);
-
-
- for (Iterator it = depFiles.iterator(); it.hasNext();) {
- String depFile = (String)it.next();
- bufWriter.write(depFile, 0, depFile.length());
- bufWriter.write("\n", 0, 1);
- }
- //
- // put a "tab" at the end of file as file ending flag
- //
- bufWriter.write("\t", 0, 1);
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- } finally {
- try {
- if (bufWriter != null) {
- bufWriter.close();
- }
- if (fileWriter != null) {
- fileWriter.close();
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- //
- // update time stamp of dependency file
- //
- FileTimeStamp.update(depsFilePath, depsFile.lastModified());
- }
-
- public void setTargetFile(String name) {
- targetFile = name;
- }
-
- public String getTargetFile() {
- return targetFile;
- }
-
- /**
- Set method for "DepsFile" attribute
-
- @param name The name of dependency list file
- **/
- public void setDepsFile(String name) {
- depsFilePath = name;
- }
-
- /**
- Get method for "DepsFile" attribute
-
- @returns The name of dependency list file
- **/
- public String getDepsFile() {
- return depsFilePath;
- }
-
- /**
- Add method for "IncludePath" nested element
-
- @param path The IncludePath object from nested IncludePath type of element
- **/
- public void addConfiguredIncludepath(IncludePath path) {
- includePathList.insert(path);
- }
-
- /**
- Add method for "Input" nested element
-
- @param input The Input object from nested Input type of element
- **/
- public void addConfiguredInput(Input inputFile) {
- inputFileList.insert(inputFile);
- }
-
- /**
- Check if the dependency list file should be (re-)generated or not.
-
- @returns true The dependency list file is uptodate. No re-generation is needed.
- @returns false The dependency list file is outofdate. Re-generation is needed.
- **/
- private boolean isUptodate() {
- File df = new File(depsFilePath);
- if (!df.exists()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, depsFilePath + " doesn't exist!");
- return false;
- }
-
- //
- // If the source file(s) is newer than dependency list file, we need to
- // re-generate the dependency list file
- //
- long depsFileTimeStamp = FileTimeStamp.get(depsFilePath);
- List<String> fileList = inputFileList.getNameList();
- for (int i = 0, length = fileList.size(); i < length; ++i) {
- String sf = fileList.get(i);
- if (FileTimeStamp.get(sf) > depsFileTimeStamp) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, sf + " has been changed since last build!");
- return false;
- }
- }
-
- //
- // If the source files haven't been changed since last time the dependency
- // list file was generated, we need to check each file in the file list to
- // see if any of them is changed or not. If anyone of them is newer than
- // the dependency list file, MakeDeps.exe is needed to run again.
- //
- LineNumberReader lineReader = null;
- FileReader fileReader = null;
- boolean ret = false;
- try {
- fileReader = new FileReader(df);
- lineReader = new LineNumberReader(fileReader);
-
- String line = null;
- int lines = 0;
- while ((line = lineReader.readLine()) != null) {
- //
- // check file end flag "\t" to see if the .dep was generated correctly
- //
- if (line.equals("\t")) {
- ret = true;
- continue;
- }
- line = line.trim();
- //
- // skip empty line
- //
- if (line.length() == 0) {
- continue;
- }
- ++lines;
-
- //
- // If a file cannot be found (moved or removed) or newer, regenerate the dep file
- //
- File sourceFile = new File(line);
- if ((!sourceFile.exists()) || (FileTimeStamp.get(line) > depsFileTimeStamp)) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, sourceFile.getPath() + " has been (re)moved or changed since last build!");
- ret = false;
- break;
- }
- }
-
- //
- // check if the .dep file is empty
- //
- if (lines == 0) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, depsFilePath + " is empty!");
- ret = false;
- }
- } catch (IOException e) {
- throw new BuildException(e.getMessage());
- } finally {
- try {
- if (lineReader != null) {
- lineReader.close();
- }
- if (fileReader != null) {
- fileReader.close();
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- return ret;
- }
-
- //
- // get dependent files list by parsing "#include" directive
- //
- private synchronized Set<String> getDependencies(String[] sourceFiles) {
- Set<String> dependencies = new LinkedHashSet<String>();
- String[] searchPathList = includePathList.toArray();
-
- Stack<String> pendingFiles = new Stack<String>();
- for (int i = 0; i < sourceFiles.length; ++i) {
- File srcFile = new File(sourceFiles[i]);
- if (srcFile.exists()) {
- //
- // a file must depend itself
- //
- dependencies.add(srcFile.getAbsolutePath());
- pendingFiles.push(sourceFiles[i]);
- }
- }
-
- while (!pendingFiles.empty()) {
- String src = pendingFiles.pop();
- File srcFile = new File(src);
- int fileLength = (int)srcFile.length();
- if (!srcFile.exists() || fileLength == 0) {
- continue;
- }
- //
- // try cache first
- //
- Set<String> incFiles = includesCache.get(src);
- if (incFiles == null) {
- incFiles = new HashSet<String>();
- FileInputStream fileReader = null;
- BufferedInputStream bufReader = null;
- String fileContent = "";
-
- try {
- fileReader = new FileInputStream(srcFile);
- bufReader = new BufferedInputStream(fileReader);
- byte[] buf = new byte[fileLength];
-
- bufReader.read(buf, 0, fileLength);
- //
- // check if the file is utf-16 encoded
- //
- if (buf[0] == (byte)0xff || buf[0] == (byte)0xfe) {
- fileContent = new String(buf, "UTF-16");
- buf = fileContent.getBytes("UTF-8");
- }
- fileContent = new String(buf);
- } catch (IOException e) {
- throw new BuildException(e.getMessage());
- } finally {
- try {
- if (bufReader != null) {
- bufReader.close();
- }
- if (fileReader != null) {
- fileReader.close();
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- //
- // find out all "#include" lines
- //
- Matcher matcher = incPattern.matcher(fileContent);
- while (matcher.find()) {
- String incFilePath = fileContent.substring(matcher.start(1), matcher.end(1));
- incFiles.add(incFilePath);
- }
-
- //
- // put the includes in cache to avoid re-parsing
- //
- includesCache.put(src, incFiles);
- }
-
- //
- // try each include search path to see if the include file exists or not
- //
- for (Iterator<String> it = incFiles.iterator(); it.hasNext();) {
- String depFilePath = it.next();
-
- for (int i = 0; i < searchPathList.length; ++i) {
- File depFile = new File(searchPathList[i] + File.separator + depFilePath);
- String filePath = depFile.getAbsolutePath();
- //
- // following check is a must. it can prevent dead loop if two
- // files include each other
- //
- if (depFile.exists() && !dependencies.contains(filePath)) {
- dependencies.add(filePath);
- pendingFiles.push(filePath);
- break;
- }
- }
- }
- }
-
- return dependencies;
- }
-}
-
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ModifyInfTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ModifyInfTask.java
deleted file mode 100644
index 5892064509..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ModifyInfTask.java
+++ /dev/null
@@ -1,221 +0,0 @@
-/** @file
- ModifyInfTask class.
-
- ModifyInfTask is used to call Modify.exe to generate inf 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.common.logger.EdkLog;
-
-/**
- ModifyInfTask class.
-
- ModifyInfTask is used to call Modify.exe to generate inf file.
-**/
-public class ModifyInfTask extends Task implements EfiDefine {
- //
- // tool name
- //
- private String toolName = "ModifyInf";
-
- //
- // input FV inf file
- //
- private FileArg inputFVInfFile = new FileArg();
-
- //
- // output FV inf file
- //
- private FileArg outputFVInfFile = new FileArg();
-
- //
- // pattern string
- //
- private ToolArg patternStr = new ToolArg();
-
- //
- // Output dir
- //
- private String outputDir = ".";
-
- /**
- execute
-
- ModifyInfTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
- //
- // 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
- //
- argument = "" + this.inputFVInfFile + this.outputFVInfFile + this.patternStr;
- //
- // 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());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, this.inputFVInfFile.toFileList()
- + " => " + this.inputFVInfFile.toFileList());
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- getinputFVInfFile
-
- This function is to get class member "inputFVInfFile".
-
- @return string of input inf file name.
- **/
- public String getinputFVInfFile() {
- return this.inputFVInfFile.getValue();
- }
-
- /**
- setinputFVInfFile
-
- This function is to set class member "inputFVInfFile".
-
- @param inputFile
- string of input inf file name.
- **/
- public void setinputFVInfFile(String inputFVInfFileName) {
- this.inputFVInfFile.setArg(" ", inputFVInfFileName);
- }
-
- /**
- getoutputFVInfFile
-
- This function is to get class member "outputFVInfFile"
-
- @return outputFVInfFile string of output inf file name.
- **/
- public String getoutputFVInfFile() {
- return this.outputFVInfFile.getValue();
- }
-
- /**
- setoutputFVInfFile
-
- This function is to set class member "outputFVInfFile"
-
- @param outputFVInfFile
- string of output inf file name.
- **/
- public void setoutputFVInfFile(String outputFVInfFileName) {
- this.outputFVInfFile.setArg(" ", outputFVInfFileName);
- }
-
- /**
- getpatternStr
-
- This function is to get class member "patternStr"
-
- @return patternStr string of pattern.
- **/
- public String getpatternStr() {
- return this.patternStr.getValue();
- }
-
- /**
- setpatternStr
-
- This function is to set class member "patternStr"
-
- @param patternStr
- string of patternStr.
- **/
- public void setpatternStr(String patternStr) {
- this.patternStr.setArg(" ", patternStr);
- }
-
- /**
- getoutputDir
-
- This function is to get class member "outputDir"
-
- @return outputDir string of output directory.
- **/
- public String getoutputDir() {
- return this.outputDir;
- }
-
- /**
- setoutputDir
-
- This function is to set class member "outputDir"
-
- @param patternStr
- string of output directory.
- **/
- public void setoutputDir(String outputDir) {
- this.outputDir = outputDir;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/NestElement.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/NestElement.java
deleted file mode 100644
index dd36c9127b..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/NestElement.java
+++ /dev/null
@@ -1,366 +0,0 @@
-/** @file
-This file is to define common interfaces for nested element of frameworktasks
-
-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.util.List;
-import java.util.ArrayList;
-import java.io.FileReader;
-import java.io.BufferedReader;
-import java.util.StringTokenizer;
-
-import org.apache.tools.ant.types.DataType;
-import org.apache.tools.ant.types.Path;
-import org.apache.tools.ant.BuildException;
-
-/**
- Interface NestElement is to define common interfaces for nested element
- **/
-public class NestElement extends DataType {
- //
- // The name list. All the name strings got from setXXX methods will be put
- // in here.
- //
- protected List<String> nameList = new ArrayList<String>();
-
- /**
- Insert content in the newElement into this NestElement
-
- @param newElement The new NestElement
- **/
- public void insert(NestElement newElement) {
- this.nameList.addAll(newElement.getNameList());
- }
-
- /**
- Handle "name" attribute. No delimiter and special treatment are assumed.
-
- @param name A single string value of "name" attribute
- **/
- public void setName(String name) {
- if (name.length() > 0) {
- this.nameList.clear();
- this.nameList.add(name);
- }
- }
-
- public void insName(String name) {
- if (name.length() > 0) {
- this.nameList.add(name);
- }
- }
-
- /**
- Handle "list" attribute. The value of "list" is assumed as string
- separated by space, tab, comma or semmicolon.
-
- @param nameList The value of "list" separated by " \t,;"
- **/
- public void setList(String nameList) {
- if (nameList.length() == 0) {
- return;
- }
-
- this.nameList.clear();
- StringTokenizer tokens = new StringTokenizer(nameList, " \t,;", false);
- while (tokens.hasMoreTokens()) {
- String name = tokens.nextToken().trim();
- if (name.length() > 0) {
- this.nameList.add(name);
- }
- }
- }
-
- /**
- Handle "ListFile" attribute. The value of "ListFile" should be the path of
- a file which contains name strings, one name per line.
-
- @param listFileName The file path
- **/
- public void setListFile(String listFileName) {
- FileReader fileReader = null;
- BufferedReader in = null;
- String str;
-
- //
- // Check if the file exists or not
- //
- File file = new File(listFileName);
- if (!file.exists()) {
- throw new BuildException("The file, " + file + " does not exist!");
- }
-
- try {
- fileReader = new FileReader(file);
- in = new BufferedReader(fileReader);
-
- //
- // Read line by line
- //
- nameList.clear();
- while((str = in.readLine()) != null){
- str = str.trim();
- if (str.length() == 0){
- continue;
- }
-
- //getProject().replaceProperties(str);
- this.nameList.add(str);
- }
- } catch (Exception e){
- throw new BuildException(e.getMessage());
- } finally {
- try {
- //
- // close the file
- //
- if (in != null) {
- in.close();
- }
- if (fileReader != null) {
- fileReader.close();
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
- }
-
- /**
- Handle "file" attribute. The value of "file" should be a path.
-
- @param file The path name of a file
- **/
- public void setFile(String file) {
- setPath(file);
- }
-
- /**
- Add a file or file list into the file list
-
- @param file The path of a file
- **/
- public void insFile(String file) {
- insPath(file);
- }
-
- /**
- Handle "path" attribute. The value of "path" may contain compound path
- separator (/ or \) which should be cleaned up. Because the "path" string
- will always be passed to external native program which may not handle
- non-native path separator, the clean-up action is a must. And the value
- of "path" may contains several path separated by space, tab, comma or
- semmicolon. We need to split it and put each part in nameList.
-
- @param path String value of a file system path
- **/
- public void setPath(String path) {
- this.nameList.clear();
- insPath(path);
- }
-
- /**
- Add a path or path list into the path list
-
- @param path The path string
- **/
- public void insPath(String path) {
- if (path.length() == 0) {
- return;
- }
-
- //
- // split the value of "path" into separated single path
- //
- StringTokenizer tokens = new StringTokenizer(path, " \t,;", false);
- while (tokens.hasMoreTokens()) {
- String pathName = tokens.nextToken().trim();
- if (pathName.length() > 0) {
- //
- // Make clean the path string before storing it
- //
- this.nameList.add(cleanupPath(pathName));
- }
- }
- }
-
- /**
- Handle "FileName" attribute. The value of "FileName" should be the path
- of a file which contains path strings, one path per line.
-
- @param pathFileName
- **/
- public void setPathFile(String pathFileName) {
- FileReader fileReader = null;
- BufferedReader in = null;
- String path;
-
- //
- // Check if the file exists or not
- //
- File file = new File(pathFileName);
- if (!file.exists()) {
- throw new BuildException("The file, " + file + " does not exist!");
- }
-
- try {
- fileReader = new FileReader(file);
- in = new BufferedReader(fileReader);
-
- //
- // Read the file line by line, skipping empty ones
- //
- nameList.clear();
- while((path = in.readLine()) != null){
- path = path.trim();
- if (path.length() == 0){
- continue;
- }
- //getProject().replaceProperties(path);
-
- //
- // Make clean the path string before storing it.
- //
- nameList.add(cleanupPath(path));
- }
- } catch (Exception e){
- throw new BuildException(e.getMessage());
- } finally {
- try {
- //
- // close the file
- //
- if (in != null) {
- in.close();
- }
- if (fileReader != null) {
- fileReader.close();
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
- }
-
- /**
- Return the name list.
-
- @return List<String> The list contains the name(path) strings
- **/
- public List<String> getNameList() {
- return nameList;
- }
-
- /**
- Compose and return the the name/path string without any delimiter. The trick
- here is that it's actually used to return the value of nameList which
- has just one name/string.
-
- @return String
- **/
- public String toString() {
- return toString("");
- }
-
- /**
- Compose and return the name/path string concatenated by leading "prefix".
-
- @param prefix The string will be put before each name/string in nameList
-
- @return String The string concatenated with "prefix"
- **/
- public String toString(String prefix) {
- StringBuffer string = new StringBuffer(1024);
- int length = nameList.size();
-
- for (int i = 0; i < length; ++i) {
- string.append(prefix);
- string.append(nameList.get(i));
- }
-
- return string.toString();
- }
-
- /**
- Compose and return the name/path string concatenated by space and
- with only one "prefix".
-
- @param prefix The prefix at the beginning of the string
-
- @return String The string with one prefix at the beginning
- **/
- public String toStringWithSinglepPrefix(String prefix) {
- return prefix + toString(" ");
- }
-
- /**
- Compose a string list with file names only, separated by spcified string
-
- @param separator The separator string
-
- @return String The file list
- **/
- public String toFileList(String separator) {
- StringBuffer string = new StringBuffer(1024);
- int length = nameList.size();
-
- for (int i = 0; i < length; ++i) {
- File file = new File(nameList.get(i));
- string.append(file.getName());
- string.append(separator);
- }
-
- return string.toString();
- }
-
- /**
- Compose a string list with file names only, separated by space
-
- @return String The list string
- **/
- public String toFileList() {
- return toFileList(" ");
- }
-
- /**
- Get the array of names
-
- @return String[] The array contains the names
- **/
- public String[] toArray() {
- return nameList.toArray(new String[nameList.size()]);
- }
-
- /**
- Check if we have any name or not
-
- @return boolean
- **/
- public boolean isEmpty() {
- return nameList.isEmpty();
- }
-
- //
- // Remove any duplicated path separator or inconsistent path separator
- //
- private String cleanupPath(String path) {
- String separator = "\\" + File.separator;
- String duplicateSeparator = separator + "{2}";
-
- path = Path.translateFile(path);
- path = path.replaceAll(duplicateSeparator, separator);
-
- return path;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/PeiReBaseTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/PeiReBaseTask.java
deleted file mode 100644
index ab563823e8..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/PeiReBaseTask.java
+++ /dev/null
@@ -1,290 +0,0 @@
-/** @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.common.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 FileArg inputFile = new FileArg();
- //
- // Output file
- //
- private FileArg outputFile = new FileArg();
- //
- // Base address
- //
- private ToolArg baseAddr = new ToolArg();
- //
- // Fv.inf file
- //
- private FileArg fvinfFile = new FileArg();
- //
- // map file
- //
- private FileArg mapFile = new FileArg();
- //
- // Architecture
- //
- private String arch = "IA32";
-
- /**
- execute
-
- PeiReBaseTask execute function is to assemble tool command line & execute
- tool command line
-
- @throws BuidException
- **/
- public void execute() throws BuildException {
- if (isUptodate()) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, outputFile.toFileList() + " is up-to-date!");
- return;
- }
-
- Project project = this.getOwningTarget().getProject();
-
- //
- // 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.separator + command;
- }
-
- //
- // argument of tools
- //
- if (mapFile.getValue().length() == 0) {
- mapFile.setArg(" -M ", outputFile.getValue() + ".map");
- }
- argument = "" + inputFile + outputFile + baseAddr + fvinfFile;
-
- //
- // 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(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, inputFile.toFileList() + " => "
- + outputFile.toFileList()
- + mapFile.toFileList());
-
- revl = runner.execute();
-
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "PeiReBase succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException("PeiReBase failed!");
- }
- } 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.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "inputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setInputFile(String inputFile) {
- this.inputFile.setArg(" -I ", inputFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" -O ", outputFile);
- }
-
- /**
- getBaseAddr
-
- This function is to get class member "baseAddr"
-
- @return baseAddr string of base address.
- **/
- public String getBaseAddr() {
- return baseAddr.getValue();
- }
-
- /**
- setBaseAddr
-
- This function is to set class member "baseAddr"
-
- @param baseAddr string of base address
- **/
- public void setBaseAddr(String baseAddr) {
- this.baseAddr.setArg(" -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;
- }
-
- /**
- Get the value of fv.inf file
-
- @return String The fv.inf file path
- **/
- public String getFvInfFile() {
- return fvinfFile.getValue();
- }
-
- /**
- Set "-F FvinfFile" argument
-
- @param fvinfFile The path of fv.inf file
- **/
- public void setFvInfFile(String fvinfFile) {
- this.fvinfFile.setArg(" -F ", fvinfFile);
- }
-
- /**
- Get the value of map file
-
- @return String The map file path
- **/
- public String getMapFile() {
- return mapFile.getValue();
- }
-
- /**
- Set "-M MapFile" argument
-
- @param mapFile The path of map file
- **/
- public void setMapFile(String mapFile) {
- this.mapFile.setArg(" -M ", mapFile);
- }
-
- //
- // Dependency check
- //
- private boolean isUptodate() {
- File srcFile = new File(inputFile.getValue());
- File dstFile = new File(outputFile.getValue());
-
- if (srcFile.lastModified() > dstFile.lastModified()) {
- return false;
- }
-
- return true;
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java
deleted file mode 100644
index 310cb6a814..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecApResetVectorFixupTask.java
+++ /dev/null
@@ -1,196 +0,0 @@
-/** @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.common.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 FileArg fvInputFile = new FileArg();
-
- //
- // output file
- //
- private FileArg fvOutputFile = new FileArg();
-
- //
- // 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();
- //
- // 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.separator + toolName;
- }
- //
- // argument of tools
- //
- 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());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, this.fvInputFile.toFileList()
- + " => " + this.fvOutputFile.toFileList());
-
- revl = runner.execute();
-
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } 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.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "fvInputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setFvInputFile(String inputFile) {
- this.fvInputFile.setArg(" ", inputFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "fvOutputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return this.fvOutputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "fvOutputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setFvOutputFile(String outputFile) {
- this.fvOutputFile.setArg(" ", 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/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecFixupTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecFixupTask.java
deleted file mode 100644
index 2f9bc46b8f..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SecFixupTask.java
+++ /dev/null
@@ -1,224 +0,0 @@
-/** @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.common.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 FileArg secExeFile = new FileArg();
-
- //
- // output file
- //
- private FileArg resetVectorDataFile = new FileArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // output directory, this variable is added by jave wrap
- //
- 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();
-
- //
- // 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
- //
- argument = "" + secExeFile + resetVectorDataFile + 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());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, secExeFile.toFileList()
- + resetVectorDataFile.toFileList() + " => " + outputFile.toFileList());
-
- revl = runner.execute();
-
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = "+ Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } 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.getValue();
- }
-
- /**
- setSecExeFile
-
- This function is to set class member "secExeFile".
-
- @param secExeFile
- string of secExe file name.
- **/
- public void setSecExeFile(String secExeFile) {
- this.secExeFile.setArg(" ", secExeFile);
- }
-
- /**
- getResetVectorDataFile
-
- This function is to get class member "resetVectorDataFile"
-
- @return resetVectorDataFile string of resetVectorData file name.
- **/
- public String getResetVectorDataFile() {
- return this.resetVectorDataFile.getValue();
- }
-
- /**
- setResetVectorDataFile
-
- This function is to set class member "resetVectorDataFile"
-
- @param resetVectorDataFile
- string of resetVectorData file name.
- **/
- public void setResetVectorDataFile(String resetVectorDataFile) {
- this.resetVectorDataFile.setArg(" ", resetVectorDataFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return this.outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" ", 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/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SectFile.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SectFile.java
deleted file mode 100644
index 9d53a21999..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SectFile.java
+++ /dev/null
@@ -1,116 +0,0 @@
-/** @file
-This file is to define nested element which is meant for specifying section 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.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import org.apache.tools.ant.BuildException;
-
-/**
- Class SectFile is to define a class corresponding to ANT nested element. It's
- used to specify section file(s) when used with GenFfsFile task
- **/
-public class SectFile implements Section {
- private String fileName = ""; /// section file name
- private int alignment = 0;
-
- /**
- Get method of ANT task/datatype for "FileName" attribute
-
- @returns The name of section file
- **/
- public String getFileName() {
- return fileName;
- }
-
- /**
- Set method of ANT task/datatype for "FileName" attribute
-
- @param fileName The name of section file
- **/
- public void setFileName(String fileName) {
- this.fileName = fileName;
- }
-
- public int getAlignment() {
- return alignment;
- }
-
- public void setAlignment(int alignment) {
- if (alignment > 7) {
- this.alignment = 7;
- } else {
- this.alignment = alignment;
- }
- }
-
- public SectFile (){
- }
-
- /**
- Put the content of section file into specified buffer with extra bytes for
- alignment requirement.
-
- @param Buffer buffer to contain the section file content with alignment
- **/
- public void toBuffer (DataOutputStream buffer){
- File sectFile;
- int fileLen;
-
- ///
- /// open file
- ///
- sectFile = new File (this.fileName);
-
- ///
- /// check if file exist.
- ///
- if (! sectFile.exists()) {
- throw new BuildException("The file " + this.fileName + " is not exist!\n");
- }
-
-
- ///
- /// Read section file and add it's contains to buffer.
- ///
- try {
-
- FileInputStream fs = new FileInputStream (sectFile.getAbsoluteFile());
- DataInputStream In = new DataInputStream (fs);
- fileLen = (int)sectFile.length();
- byte[] sectBuffer = new byte[fileLen];
- In.read(sectBuffer);
- buffer.write(sectBuffer);
-
- ///
- /// 4 byte alignment
- ///
- while ((fileLen & 0x03)!= 0) {
- fileLen ++;
- buffer.writeByte(0);
- }
-
- ///
- /// close inputStream
- ///
- In.close();
-
- } catch (Exception e) {
- System.out.print(e.getMessage());
- throw new BuildException("SectFile, toBuffer failed!\n");
- }
- }
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Section.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Section.java
deleted file mode 100644
index ff4c6d6d11..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Section.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/** @file
-This file is to define interface for manipulating section 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.DataOutputStream;
-
-/**
- Section interface is for geting the contain buffer form compress, tool, and sectFile
- **/
-public interface Section {
- int alignment = 0;
- public void toBuffer (DataOutputStream buffer);
- public void setAlignment(int alignment);
- public int getAlignment();
-} \ No newline at end of file
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SetStampTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SetStampTask.java
deleted file mode 100644
index dc3a96e8e5..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SetStampTask.java
+++ /dev/null
@@ -1,162 +0,0 @@
-/** @file
-This file is to define an ANT task to wrap setstamp.exe tool
-
-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.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- Class SetStampTask is a wrap class for setstamp.exe.
- **/
-public class SetStampTask extends Task implements EfiDefine {
- /**
- SetStamp Task Class
- class member
- -peFile : file of PE
- -timeFile: Txt file of time
- **/
-
- private static String toolName = "SetStamp";
-
- private FileArg peFile = new FileArg();
-
- private FileArg timeFile = new FileArg();
-
- private String outputDir = ".";
-
- /**
- assemble tool command line & execute tool command line
-
- @throws BuildException
- **/
- public void execute() throws BuildException {
-
- Project project = this.getOwningTarget().getProject();
- ///
- /// absolute path of edk tools
- ///
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
- ///
- /// argument of SetStamp tool
- ///
- String argument = "" + peFile + timeFile;
- ///
- /// reture value of SetStamp execution
- ///
- int returnVal = -1;
-
- try {
- Commandline commandLine = new Commandline();
- commandLine.setExecutable(command);
- commandLine.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(commandLine.getCommandline());
- runner.setWorkingDirectory(new File(outputDir));
-
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(commandLine.getCommandline()));
- EdkLog.log(this, peFile.toFileList() + " < " + timeFile.toFileList());
-
- returnVal = runner.execute();
- if (EFI_SUCCESS == returnVal) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- ///
- /// command execution fail
- ///
- EdkLog.log(this, "ERROR = " + Integer.toHexString(returnVal));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- set operation of class member "peFile"
-
- @param peFile name of PE File
- **/
- public void setPeFile(String peFile) {
- this.peFile.setArg(" ", peFile);
- }
-
- /**
- get operation of class member "peFile"
-
- @return peFile name of PE file
- **/
- public String getPeFile() {
- return this.peFile.getValue();
- }
-
- /**
- set operation of class member "timeFile"
-
- @param timeFile name of time file
- **/
- public void setTimeFile(String timeFile) {
- this.timeFile.setArg(" ", timeFile);
- }
-
- /**
- get class member "timeFile"
-
- @returns name of time file
- **/
- public String getTimeFile() {
- return this.timeFile.getValue();
- }
-
- /**
- 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/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SkipExt.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SkipExt.java
deleted file mode 100644
index 20883c98e3..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SkipExt.java
+++ /dev/null
@@ -1,24 +0,0 @@
-/** @file
-This file is to define nested element which is meant for specifying skipped file list
-
-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;
-
-/**
- SkipExt nested element Class
- **/
-public class SkipExt extends NestElement {
- public String toString() {
- return super.toString(" -skipext ");
- }
-}
-
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SplitfileTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SplitfileTask.java
deleted file mode 100644
index 7c1882aaf0..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/SplitfileTask.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/** @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.common.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 {
- //
- // Tool name
- //
- private static String toolName = "SplitFile";
-
- //
- // input file
- //
- private FileArg inputFile = new FileArg();
-
- //
- // offset value
- //
- private ToolArg offset = new ToolArg();
-
- //
- // Output directory
- //
- private String outputDir = ".";
-
- /**
- 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();
-
- //
- // 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.separator + toolName;
- }
-
- //
- // 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());
- runner.setWorkingDirectory(new File(outputDir));
-
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- String fileName = inputFile.toFileList();
- EdkLog.log(this, EdkLog.EDK_INFO, fileName + " => " + fileName + "1 " + fileName + "2");
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } 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.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "inputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setInputFile(String inputFile) {
- this.inputFile.setArg(" ", inputFile);
- }
-
- /**
- getOffset
-
- This function is to get class member "offset"
-
- @return offset value of string.
- **/
- public String getOffset() {
- return offset.getValue();
- }
-
- /**
- setOffset
-
- This function is to set class member "offset"
-
- @param offset
- string of offset value.
- **/
- public void setOffset(String offset) {
- this.offset.setArg(" ", offset);
- }
-
- /**
- 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/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StrGatherTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StrGatherTask.java
deleted file mode 100644
index 541e96f54f..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StrGatherTask.java
+++ /dev/null
@@ -1,471 +0,0 @@
-/** @file
-This file is to define an ANT task which wraps StrGather.exe tool.
-
-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.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-import org.tianocore.common.logger.EdkLog;
-
-/**
- StrGather Task Class
- class memberg
- -commandType : command type [parse/scan/dump]
- -baseName : base name of component
- -verbose : level of verbose [all/read/write]
- -outputDatabase : file name of output database file
- -databaseList : file name list of database files
- -inputFileList : file name list of input files
- -newDatabase : whether to need new database [ture/false]
- -unquotedString : whether to unquoted strings are used [ture/false]
- -includePathList: path list of include paths
- -ignoreNotFound : whether to ignore a given STRING_TOKEN(STR) is not found in database [ture/false]
- -skipExtList : skip scan of files with extension name
- -outputString : write string data to filename
- -outputDefines : write string defines to filename
- -outputUnicode : dump database to unicode file filename
- -lang : only dump for the language
- -indirectionFile: specify an indirection file
- -outputHpk : create an HII export pack of the strings
- **/
-public class StrGatherTask extends Task implements EfiDefine {
- //
- // Tool name
- //
- private static String toolName = "StrGather";
-
- //
- // common options
- //
- private ToolArg commandType = new ToolArg();
-
- private ToolArg baseName = new ToolArg();
-
- //
- // "all/read/write"
- //
- private ToolArg verbose = new ToolArg();
-
- private FileArg outputDatabase = new FileArg();
-
- private Database databaseList = new Database();
-
- private InputFile inputFileList = new InputFile();
-
- //
- // parse options newDatabase -- "ture/false" unquoteString -- "ture/false"
- //
- private ToolArg newDatabase = new ToolArg();
-
- private ToolArg unquotedString = new ToolArg();
-
- private IncludePath includePathList = new IncludePath();
-
- //
- // scan options ignoreNotFound -- "ture/false"
- //
- private ToolArg ignoreNotFound = new ToolArg();
-
- private SkipExt skipExtList = new SkipExt();
-
- //
- // dump options
- //
- private ToolArg outputString = new ToolArg();
-
- private ToolArg outputDefines = new ToolArg();
-
- private ToolArg outputUnicode = new ToolArg();
-
- private ToolArg lang = new ToolArg();
-
- private FileArg indirectionFile = new FileArg();
-
- private FileArg outputHpk = new FileArg();
-
- //
- // global variable
- //
- static private Project project;
-
- /**
- assemble tool command line & execute tool command line
-
- @throws BuildException
- **/
- public void execute() throws BuildException {
-
- project = this.getOwningTarget().getProject();
- ///
- /// absolute path of efi tools
- ///
- String path = project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (path == null) {
- command = toolName;
- } else {
- command = path + File.separator + toolName;
- }
-
- ///
- /// assemble argument
- ///
- String argument = "" + commandType + verbose + databaseList + baseName
- + outputDatabase + includePathList + newDatabase + unquotedString
- + skipExtList + ignoreNotFound + outputString + outputDefines
- + outputUnicode + lang + indirectionFile + outputHpk
- + inputFileList;
- ///
- /// 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());
-
- String cmdType = getCommandType();
- if (cmdType.equalsIgnoreCase("parse")) {
- EdkLog.log(this, "(parse) " + inputFileList.toFileList() + " => "
- + databaseList.toFileList());
- } else if (cmdType.equalsIgnoreCase("scan")) {
- EdkLog.log(this, "(scan) " + databaseList.toFileList() + " => "
- + outputDatabase.toFileList());
- } else {
- EdkLog.log(this, "(dump) " + databaseList.toFileList() + " => "
- + outputDefines.toFileList() + outputString.toFileList() + outputHpk.toFileList());
- }
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
-
- revl = runner.execute();
- if (EFI_SUCCESS == revl) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- ///
- /// command execution fail
- ///
- EdkLog.log(this, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } catch (Exception e) {
- throw new BuildException(e.getMessage());
- }
- }
-
- /**
- get class member "commandType"
-
- @returns commandType parameter
- **/
- public String getCommandType() {
- return this.commandType.getValue();
- }
-
- /**
- set class member ""
-
- @param commandType type of strgather command [parse/scan/dump]
- **/
- public void setCommandType(String commandType) {
- this.commandType.setArg(" -", commandType);
- }
-
- /**
- get class member "verbose"
-
- @returns verbose parameter
- **/
- public String getVerbose() {
- return this.verbose.getValue();
- }
-
- /**
- set class member "verbose"
-
- @param verbose verbose level [all/read/write]
- **/
- public void setVerbose(String verbose) {
- if (verbose.equals("all")) {
- ///
- /// for verbose output
- ///
- this.verbose.setArg(" -", "v");
- } else if (verbose.equals("read")) {
- ///
- /// for verbose output when reading database
- ///
- this.verbose.setArg(" -", "vdbr");
- } else if (verbose.equals("write")) {
- ///
- /// for verbose output when writing database
- ///
- this.verbose.setArg(" -", "vdbw");
- }
- }
-
- /**
- get class member baseName
-
- @returns baseName parameter
- **/
- public String getBaseName() {
- return this.baseName.getValue();
- }
-
- /**
- set class member baseName
-
- @param baseName name of the output files of .c and .h
- **/
- public void setBaseName(String baseName) {
- this.baseName.setArg(" -bn ", baseName);
- }
-
- /**
- get class member "outputDatabase"
-
- @returns outputDatabase parameter
- **/
- public String getOutputDatabase() {
- return this.outputDatabase.getValue();
- }
-
- /**
- set class member "outputDatabase"
-
- @param outputDatabase filename of output database file
- **/
- public void setOutputDatabase(String outputDatabase) {
- this.outputDatabase.setArg(" -od ", outputDatabase);
- }
-
- /**
- get class member "newDatabase"
-
- @returns newDatabase parameter
- **/
- public boolean getNewDatabse() {
- return this.newDatabase.getPrefix().length() > 0;
- }
-
- /**
- set class member "newDatabase"
-
- @param newDatabase whether to not read in existing database file
- **/
- public void setNewDatabase(boolean newDatabase) {
- if (newDatabase) {
- this.newDatabase.setArg(" -", "newdb");
- }
- }
-
- /**
- get class member "unquotedString"
-
- @returns unquotedString parameter
- **/
- public boolean getUnquotedString() {
- return this.unquotedString.getValue().length() > 0;
- }
-
- /**
- set class member "unquotedString"
-
- @param unquotedString :
- whether to indicate that unquoted strings are used
- **/
- public void setUnquotedString(boolean unquotedString) {
- if (unquotedString) {
- this.unquotedString.setArg(" -", "uqs");
- }
- }
-
- /**
- get class member "ignoreNotFound"
-
- @returns ignoreNotFound parameter
- **/
- public boolean getIgnoreNotFound() {
- return this.ignoreNotFound.getValue().length() > 0;
- }
-
- /**
- set class member "ignoreNotFound"
-
- @param ignoreNotFound whether to ignore if a given STRING_TOKEN(STR)
- is not found in the database
- **/
- public void setIgnoreNotFound(boolean ignoreNotFound) {
- if (ignoreNotFound) {
- this.ignoreNotFound.setArg(" -", "ignorenotfound");
- }
- }
-
- /**
- get class member "outputString"
-
- @returns outputString parameter
- **/
- public String getOutputString() {
- return this.outputString.getValue();
- }
-
- /**
- set class member "outputString"
-
- @param outputString filename of string data file
- **/
- public void setOutputString(String outputString) {
- this.outputString.setArg(" -oc ", outputString);
- }
-
- /**
- get class member "outputDefines"
-
- @returns outputDefines parameter
- **/
- public String getOutputDefines() {
- return this.outputDefines.getValue();
- }
-
- /**
- set class member "outputDefines"
-
- @param outputDefines filename of string defines file
- **/
- public void setOutputDefines(String outputDefines) {
- this.outputDefines.setArg(" -oh ", outputDefines);
- }
-
- /**
- get class member "outputUnicode"
-
- @returns outputUnicode parameter
- **/
- public String getOutputUnicode() {
- return this.outputUnicode.getValue();
- }
-
- /**
- set class member "outputUnicode"
-
- @param outputUnicode filename of unicode file to be dumped database
- **/
- public void setOutputUnicode(String outputUnicode) {
- this.outputUnicode.setArg(" -ou ", outputUnicode);
- }
-
- /**
- get class member "lang"
-
- @returns lang parameter
- **/
- public String getLang() {
- return this.lang.getValue();
- }
-
- /**
- set class member "lang"
-
- @param lang language of dump
- **/
- public void setLang(String lang) {
- this.lang.setArg(" -lang ", lang);
- }
-
- /**
- get class member "indirectionFile"
-
- @returns indirectionFile parameter
- **/
- public String getIndirectionFile() {
- return this.indirectionFile.getValue();
- }
-
- /**
- set class member "indirectionFile"
-
- @param indirectionFile filename of indirection file
- **/
- public void setIndirectionFile(String indirectionFile) {
- this.indirectionFile.setArg(" -if ", indirectionFile);
- }
-
- /**
- get class member "outputHpk"
-
- @returns outputHpk parameter
- **/
- public String getOutputHpk() {
- return this.outputHpk.getValue();
- }
-
- /**
- set class member "outputHpk"
-
- @param outputHpk filename of output HII export pack of the strings
- **/
- public void setOutputHpk(String outputHpk) {
- this.outputHpk.setArg(" -hpk ", outputHpk);
- }
-
- /**
- add a skipExt element into list
-
- @param skipExt skipExt element
- **/
- public void addConfiguredSkipext(SkipExt skipExt) {
- this.skipExtList.insert(skipExt);
- };
-
- /**
- add a includePath element into list
-
- @param includePath includePath element
- **/
- public void addConfiguredIncludepath(IncludePath includePath) {
- this.includePathList.insert(includePath);
- };
-
- /**
- add a inputFile element into list
-
- @param inputFile inputFile element
- **/
- public void addConfiguredInputfile(InputFile inputFile) {
- this.inputFileList.insert(inputFile);
- };
-
- /**
- add a database element into list
-
- @param database :
- database element
- **/
- public void addConfiguredDatabase(Database database) {
- this.databaseList.insert(database);
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java
deleted file mode 100644
index 9558f703b9..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/StripTask.java
+++ /dev/null
@@ -1,197 +0,0 @@
-/** @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.common.logger.EdkLog;
-
-/**
- StripTask class.
-
- StripTask is used to call Strip.exe to strip input file.
- */
-public class StripTask extends Task implements EfiDefine {
- //
- //
- //
- private static String toolName = "Strip";
- //
- // input file
- //
- private FileArg inputFile = new FileArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg();
-
- //
- // 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();
-
- //
- // 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.separator + toolName;
- }
-
- //
- // argument of tools
- //
- 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());
- runner.setWorkingDirectory(new File(outputDir));
-
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, inputFile.toFileList() + " => " + outputFile.toFileList());
-
- revl = runner.execute();
-
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, toolName + " succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException(toolName + " failed!");
- }
- } 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.getValue();
- }
-
- /**
- setComponentType
-
- This function is to set class member "inputFile".
-
- @param inputFile
- string of input file name.
- **/
- public void setInputFile(String inputFile) {
- this.inputFile.setArg(" ", inputFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" ", 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/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java
deleted file mode 100644
index ea320366b1..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/Tool.java
+++ /dev/null
@@ -1,266 +0,0 @@
-/** @file
-This file is to define nested element which is meant for specifying a tool
-
-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.DataInputStream;
-import java.io.DataOutputStream;
-import java.io.File;
-import java.io.FileInputStream;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.util.ArrayList;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Random;
-
-import org.apache.tools.ant.BuildException;
-import org.tianocore.common.logger.EdkLog;
-
-/**
- Class Tool is to define an external tool to be used for genffsfile
- **/
-public class Tool implements EfiDefine, Section {
-
- private int alignment = 0;
- private String toolName = "";
- private ToolArg toolArgList = new ToolArg();
- private Input inputFiles = new Input();
- private Input tempInputFile = new Input();
- private String outputPath;
- private String outputFileName ;
- private static Random ran = new Random(9999);
- private List<Section> gensectList = new ArrayList<Section>();
- /**
- Call extern tool
-
- @param buffer The buffer to put the result with alignment
- **/
- public void toBuffer (DataOutputStream buffer){
- ///
- /// call extern tool
- ///
- try {
- executeTool ();
- } catch (Exception e) {
- throw new BuildException("Call to executeTool failed!\n" + e.getMessage());
- }
-
- ///
- /// check if file exist
- ///
- File outputFile = new File (this.outputFileName);
- if (!outputFile.exists()) {
- throw new BuildException("The file " + outputFile.getPath() + " does not exist!\n");
- }
-
- ///
- /// Read output file and write it's cotains to buffer
- ///
- FileInputStream fs = null;
- DataInputStream in = null;
- try {
- fs = new FileInputStream (outputFile);
- in = new DataInputStream (fs);
-
-
- int fileLen = (int)outputFile.length();
- byte[] data = new byte[fileLen];
- in.read(data);
- buffer.write(data, 0, fileLen);
-
- ///
- /// 4 byte alignment
- ///
- while ((fileLen & 0x03) != 0) {
- fileLen++;
- buffer.writeByte(0);
- }
- } catch (Exception e) {
- EdkLog.log(e.getMessage());
- throw new BuildException("Tool call, toBuffer failed!\n");
- } finally {
- try {
- if (in != null) {
- in.close();
- }
- if (fs != null) {
- fs.close();
- }
- outputFile.delete();
- } catch (Exception e) {
- EdkLog.log("WARNING: Cannot close " + outputFile.getPath());
- }
- }
- }
-
- ///
- /// execute external tool for genffsfile
- ///
- private void executeTool () {
- String command = "";
- String argument = "";
- command = toolName;
-
- //
- // Get each section which under the compress {};
- // And add it is contains to File;
- //
- Section sect;
- try{
- Iterator SectionIter = this.gensectList.iterator();
- while (SectionIter.hasNext()){
- sect = (Section)SectionIter.next();
- //
- // Parse <genSection> element
- //
- File outputFile = File.createTempFile("temp", "sec1", new File(outputPath));
- FileOutputStream bo = new FileOutputStream(outputFile);
- DataOutputStream Do = new DataOutputStream (bo);
- //
- // Call each section class's toBuffer function.
- //
- try {
- sect.toBuffer(Do);
- }
- catch (BuildException e) {
- EdkLog.log(e.getMessage());
- throw new BuildException ("GenSection failed at Tool!");
- } finally {
- if (Do != null){
- Do.close();
- }
-
- }
- this.tempInputFile.insFile(outputFile.getPath());
- }
- } catch (IOException e){
- throw new BuildException ("Gensection failed at tool!");
- }
-
- try {
- this.outputFileName = "Temp" + getRand();
- argument = toolArgList + inputFiles.toStringWithSinglepPrefix(" -i ")
- + tempInputFile.toString(" ")+ " -o " + outputFileName;
- EdkLog.log(this, EdkLog.EDK_VERBOSE, command + " " + argument);
- ///
- /// execute command line
- ///
- Process process = Runtime.getRuntime().exec(command + " " + argument);
- process.waitFor();
- Iterator tempFile = tempInputFile.getNameList().iterator();
- while (tempFile.hasNext()){
- File file = new File((String)tempFile.next());
- if (file.exists()) {
- file.delete();
- }
- }
- } catch (Exception e) {
- EdkLog.log(e.getMessage());
- throw new BuildException("Execution of externalTool task failed!\n");
- }
- }
-
- /**
- Add method of ANT task/datatype for nested ToolArg type of element
-
- @param toolArg The ToolArg object containing arguments for the tool
- **/
- public void addConfiguredToolArg (ToolArg toolArg) {
- toolArgList.insert(toolArg);
- }
-
- /**
- Get method of ANT task/datatype for attribute "OutputPath"
-
- @returns The name of output path
- **/
- public String getOutputPath() {
- return outputPath;
- }
-
- /**
- Set method of ANT task/datatype for attribute "OutputPath"
-
- @param outputPath The name of output path
- **/
- public void setOutputPath(String outPutPath) {
- this.outputPath = outPutPath;
- }
-
- /**
- Get method of ANT task/datatype for attribute "ToolName"
-
- @returns The name of the tool.
- **/
- public String getToolName() {
- return toolName;
- }
-
- /**
- Set method of ANT task/datatype for attribute "ToolName"
-
- @param toolName The name of the tool
- **/
- public void setToolName(String toolName) {
- this.toolName = toolName;
- }
-
- /**
- Add method of ANT task/datatype for nested Input type of element
-
- @param file The Input objec which represents a file
- **/
- public void addConfiguredInput(Input file) {
- inputFiles.insert(file);
- }
-
-// /**
-// addTool
-//
-// This function is to add instance of Tool to list.
-//
-// @param tool instance of Tool.
-// **/
-// public void addTool(Tool tool){
-// this.toolList.add(tool);
-// }
-
- public void addGenSection(GenSectionTask genSect){
- this.gensectList.add(genSect);
- }
-
- /**
- Get random number.
-
- @returns The random integer.
- **/
- public synchronized int getRand() {
- return ran.nextInt();
- }
-
- public int getAlignment() {
- return alignment;
- }
-
- public void setAlignment(int alignment) {
- if (alignment > 7) {
- this.alignment = 7;
- } else {
- this.alignment = alignment;
- }
- }
-
-}
-
-
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ToolArg.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ToolArg.java
deleted file mode 100644
index ade6817955..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ToolArg.java
+++ /dev/null
@@ -1,151 +0,0 @@
-/** @file
-This file is used to nest elements which is meant for tool's argument
-
-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;
-
-/**
- ToolArg class is defined to represent the argument of a tool. The argument
- includes the prefix (e.g. -I, -o) and the value.
- **/
-public class ToolArg extends NestElement {
- ///
- /// A constant which is used to represent an empty argument
- ///
- public final static ToolArg EMPTY_ARG = new ToolArg();
-
- //
- // Keep track the prefix of this argument
- //
- private String prefix = "";
-
- /**
- Default constructor
- **/
- public ToolArg() {
- }
-
- /**
- Constructor which will initialize the prefix of this argument
-
- @param prefix The string of prefix
- */
- public ToolArg(String prefix) {
- this.prefix = prefix;
- }
-
- /**
- Constructor which will initialize both the prefix and value of this argument
-
- @param prefix The prefix of this argument
- @param value The value of this argument
- */
- public ToolArg(String prefix, String value) {
- setArg(prefix, value);
- }
-
- /**
- Set the prefix and value of this argument
-
- @param prefix The prefix of this argument
- @param value The value of this argument
- */
- public void setArg(String prefix, String value) {
- this.prefix = prefix;
- super.setName(value);
- }
-
- /**
- Set the prefix of this argument
-
- @param prefix The prefix of this argument
- */
- public void setPrefix(String prefix) {
- this.prefix = prefix;
- }
-
- /**
- Get the prefix of this argument
-
- @return String The prefix of this argument
- */
- public String getPrefix() {
- return this.prefix.trim();
- }
-
- /**
- Set the value of this argument
-
- @param value The value of this argument
- */
- public void setValue(String value) {
- super.setName(value);
- }
-
- /**
- Add a value for this argument
-
- @param value The value of this argument
- */
- public void insValue(String value) {
- super.insName(value);
- }
-
- /**
- Get the value list of this argument, separated by space
-
- @return String The value list
- */
- public String getValue() {
- return super.toString(" ").trim();
- }
-
- /**
- Set the argument as a whole
-
- @param line The argument string line
- */
- public void setLine(String line) {
- //
- // Since the prefix is in the "line", we don't need another prefix.
- //
- this.prefix = " ";
- super.setName(line);
- }
-
- /**
- Get the argument line
-
- @return String The argument string line
- */
- public String getLine() {
- return this.toString();
- }
-
- /**
- Compose a complete argument string.
-
- @return String The complete argument
- */
- public String toString() {
- return super.toString(prefix);
- }
-
- /**
- Check if the argument is empty or not
-
- @return boolean
- **/
- public boolean isEmpty() {
- return (prefix.length() == 0) && (nameList.isEmpty());
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java
deleted file mode 100644
index 178e92ae66..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/VfrCompilerTask.java
+++ /dev/null
@@ -1,213 +0,0 @@
-/** @file
-This file is to define an ANT task which wraps VfrCompile.exe tool
-
-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.IOException;
-
-import org.apache.tools.ant.BuildException;
-import org.apache.tools.ant.Project;
-import org.apache.tools.ant.Task;
-import org.apache.tools.ant.taskdefs.Execute;
-import org.apache.tools.ant.taskdefs.LogStreamHandler;
-import org.apache.tools.ant.types.Commandline;
-
-import org.tianocore.common.logger.EdkLog;
-
-/**
- VfrcompilerTask Task Class
- class member
- -createListFile : create an output IFR listing file.
- -outPutDir : deposit all output files to directory OutputDir (default=cwd)
- -createIfrBinFile: create an IFR HII pack file
- -vfrFile : name of the input VFR script file
- -processArg : c processer argument
- -includepathList : add IncPath to the search path for VFR included files
- **/
-public class VfrCompilerTask extends Task implements EfiDefine {
- private static String toolName = "VfrCompile";
-
- private ToolArg createListFile = new ToolArg();
- private ToolArg createIfrBinFile = new ToolArg();
- private ToolArg processerArg = new ToolArg();
- private FileArg vfrFile = new FileArg();
- private IncludePath includepathList = new IncludePath();
- private FileArg outPutDir = new FileArg(" -od ", ".");
- private String dllPath = "";
-
- /**
- get class member of createList file
-
- @returns file name of createList
- **/
- public boolean getCreateListFile() {
- return this.createListFile.getValue().length() > 0;
- }
-
- /**
- set class member of createList file
-
- @param createListFile if createList string equal "on" set '-l' flag
- **/
- public void setCreateListFile(boolean createListFile) {
- if (createListFile) {
- this.createListFile.setArg(" -", "l");
- }
- }
-
- /**
- get output dir
-
- @returns name of output dir
- **/
- public String getOutPutDir() {
- return this.outPutDir.getValue();
- }
-
- /**
- set class member of outPutDir
-
- @param outPutDir The directory name for ouput file
- **/
- public void setOutPutDir(String outPutDir) {
- this.outPutDir.setArg(" -od ", outPutDir);
- }
-
-
- /**
- get class member of ifrBinFile
-
- @return file name of ifrBinFile
- **/
- public boolean getCreateIfrBinFile() {
- return this.createIfrBinFile.getValue().length() > 0;
- }
-
- /**
- set class member of ifrBinFile
-
- @param createIfrBinFile The flag to specify if the IFR binary file should
- be generated or not
- */
- public void setCreateIfrBinFile(boolean createIfrBinFile) {
- if (createIfrBinFile) {
- this.createIfrBinFile.setArg(" -", "ibin");
- }
- }
-
- /**
- get class member of vfrFile
-
- @returns name of vfrFile
- **/
- public String getVfrFile() {
- return this.vfrFile.getValue();
- }
-
- /**
- set class member of vfrFile
-
- @param vfrFile The name of VFR file
- **/
- public void setVfrFile(String vfrFile) {
- this.vfrFile.setArg(" ", vfrFile);
- }
-
- /**
- add includePath in includepath List
-
- @param includepath The IncludePath object which represents include path
- **/
- public void addConfiguredIncludepath(IncludePath includepath){
- this.includepathList.insert(includepath);
- }
-
- /**
- get class member of processerArg
-
- @returns processer argument
- **/
- public String getProcesserArg() {
- return this.processerArg.getValue();
- }
-
-
- /**
- set class member of processerArg
-
- @param processerArg The processor argument
- */
- public void setProcesserArg(String processerArg) {
- this.processerArg.setArg(" -ppflag ", processerArg);
- }
-
- public void setDllPath(String dllPath) {
- this.dllPath = dllPath;
- }
-
- /**
- The standard execute method of ANT task.
- **/
- public void execute() throws BuildException {
- Project project = this.getProject();
- String toolPath= project.getProperty("env.FRAMEWORK_TOOLS_PATH");
- String command;
- if (toolPath == null) {
- command = toolName;
- } else {
- command = toolPath + File.separator + toolName;
- }
-
- String argument = "" + createIfrBinFile
- + processerArg
- + includepathList
- + outPutDir
- + createListFile
- + vfrFile;
- try {
- ///
- /// constructs the command-line
- ///
- Commandline commandLine = new Commandline();
- commandLine.setExecutable(command);
- commandLine.createArgument().setLine(argument);
-
- ///
- /// configures the Execute object
- ///
- LogStreamHandler streamHandler = new LogStreamHandler(this,
- Project.MSG_INFO,
- Project.MSG_WARN);
-
- Execute runner = new Execute(streamHandler,null);
- runner.setAntRun(project);
- runner.setCommandline(commandLine.getCommandline());
- runner.setWorkingDirectory(new File(outPutDir.getValue()));
- runner.setEnvironment(new String[]{"PATH", dllPath});
-
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(commandLine.getCommandline()));
- EdkLog.log(this, vfrFile.toFileList());
-
- int returnVal = runner.execute();
- if (EFI_SUCCESS == returnVal) {
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "VfrCompile succeeded!");
- } else {
- EdkLog.log(this, "ERROR = " + Integer.toHexString(returnVal));
- throw new BuildException("VfrCompile failed!");
- }
- } catch (IOException e) {
- throw new BuildException(e.getMessage());
- }
- }
-}
diff --git a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ZeroDebugDataTask.java b/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ZeroDebugDataTask.java
deleted file mode 100644
index f60b8a6bb8..0000000000
--- a/Tools/Java/Source/FrameworkTasks/org/tianocore/framework/tasks/ZeroDebugDataTask.java
+++ /dev/null
@@ -1,195 +0,0 @@
-/** @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.common.logger.EdkLog;
-
-/**
- ZeroDebugDataTask class.
-
- ZeroDebugDataTask is used to call ZeroDebugData.exe to remove debug data.
-**/
-public class ZeroDebugDataTask extends Task implements EfiDefine {
- //
- // Tool name
- //
- private static String toolName = "ZeroDebugData";
- //
- // input PE file
- //
- private FileArg peFile = new FileArg();
-
- //
- // output file
- //
- private FileArg outputFile = new FileArg(" ", "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();
-
- //
- // 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
- //
- argument = "" + 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());
- runner.setWorkingDirectory(new File(outputDir));
- //
- // Set debug log information.
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, Commandline.toString(cmdline.getCommandline()));
- EdkLog.log(this, EdkLog.EDK_INFO, peFile.toFileList() + " => " + outputFile.toFileList());
-
- revl = runner.execute();
-
- if (EFI_SUCCESS == revl) {
- //
- // command execution success
- //
- EdkLog.log(this, EdkLog.EDK_VERBOSE, "ZeroDebugData succeeded!");
- } else {
- //
- // command execution fail
- //
- EdkLog.log(this, EdkLog.EDK_INFO, "ERROR = " + Integer.toHexString(revl));
- throw new BuildException("ZeroDebugData failed!");
- }
- } 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.getValue();
- }
-
- /**
- setPeFile
-
- This function is to set class member "peFile".
-
- @param peFile
- string of input file name.
- **/
- public void setPeFile(String peFile) {
- this.peFile.setArg(" ", peFile);
- }
-
- /**
- getOutputFile
-
- This function is to get class member "outputFile"
-
- @return outputFile string of output file name.
- **/
- public String getOutputFile() {
- return this.outputFile.getValue();
- }
-
- /**
- setOutputFile
-
- This function is to set class member "outputFile"
-
- @param outputFile
- string of output file name.
- **/
- public void setOutputFile(String outputFile) {
- this.outputFile.setArg(" ", 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;
- }
-}