2 SecApResetVectorFixupTask class.
4 SecApResetVectorFixupTask is used to call SecApResetVectorFixup.exe to place
8 Copyright (c) 2006, Intel Corporation
9 All rights reserved. This program and the accompanying materials
10 are licensed and made available under the terms and conditions of the BSD License
11 which accompanies this distribution. The full text of the license may be found at
12 http://opensource.org/licenses/bsd-license.php
14 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
18 package org
.tianocore
.framework
.tasks
;
22 import org
.apache
.tools
.ant
.Task
;
23 import org
.apache
.tools
.ant
.Project
;
24 import org
.apache
.tools
.ant
.BuildException
;
25 import org
.apache
.tools
.ant
.taskdefs
.Execute
;
26 import org
.apache
.tools
.ant
.taskdefs
.LogStreamHandler
;
27 import org
.apache
.tools
.ant
.types
.Commandline
;
29 import org
.tianocore
.common
.logger
.EdkLog
;
32 SecApResetVectorFixupTask class.
34 SecApResetVectorFixupTask is used to call SecApResetVectorFixup.exe to place
37 public class SecApResetVectorFixupTask
extends Task
implements EfiDefine
{
41 private String toolName
= "SecApResetVectorFixup";
43 // / input FV recovery file
45 private String fvInputFile
= "";
50 private String fvOutputFile
= "";
53 // / output directory, this variable is added by jave wrap
55 private String outputDir
= "";
61 * SecApResetVectorFixupTask execute function is to assemble tool command line & execute
64 * @throws BuidException
66 public void execute() throws BuildException
{
68 Project project
= this.getOwningTarget().getProject();
70 // absolute path of efi tools
72 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
78 command
= path
+ File
.separatorChar
+ toolName
;
83 File file
= new File(this.fvOutputFile
);
84 if (!file
.isAbsolute() && (!this.outputDir
.equalsIgnoreCase(""))) {
85 argument
= this.fvInputFile
+ " " + outputDir
+ File
.separatorChar
88 argument
= this.fvInputFile
+ " " + this.fvOutputFile
;
91 // return value of fwimage execution
96 Commandline cmdline
= new Commandline();
97 cmdline
.setExecutable(command
);
98 cmdline
.createArgument().setLine(argument
);
100 LogStreamHandler streamHandler
= new LogStreamHandler(this,
101 Project
.MSG_INFO
, Project
.MSG_WARN
);
102 Execute runner
= new Execute(streamHandler
, null);
104 runner
.setAntRun(project
);
105 runner
.setCommandline(cmdline
.getCommandline());
107 // Set debug log information.
109 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, Commandline
.toString(cmdline
.getCommandline()));
110 EdkLog
.log(this, EdkLog
.EDK_INFO
, (new File(this.fvInputFile
)).getName());
112 revl
= runner
.execute();
114 if (EFI_SUCCESS
== revl
) {
116 // command execution success
118 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, "SecApResetVectorFixup succeeded!");
121 // command execution fail
123 EdkLog
.log(this, EdkLog
.EDK_INFO
, "ERROR = " + Integer
.toHexString(revl
));
124 throw new BuildException("SecApResetVectorFixup failed!");
126 } catch (Exception e
) {
127 throw new BuildException(e
.getMessage());
134 * This function is to get class member "fvInputFile".
136 * @return string of input file name.
138 public String
getfvInputFile() {
139 return this.fvInputFile
;
145 * This function is to set class member "fvInputFile".
148 * string of input file name.
150 public void setFvInputFile(String inputFile
) {
151 this.fvInputFile
= inputFile
;
157 * This function is to get class member "fvOutputFile"
159 * @return outputFile string of output file name.
161 public String
getOutputFile() {
162 return this.fvOutputFile
;
168 * This function is to set class member "fvOutputFile"
171 * string of output file name.
173 public void setFvOutputFile(String outputFile
) {
174 this.fvOutputFile
= outputFile
;
180 * This function is to get class member "outputDir"
182 * @return outputDir string of output directory.
184 public String
getOutputDir() {
191 * This function is to set class member "outputDir"
194 * string of output directory.
196 public void setOutputDir(String outputDir
) {
197 this.outputDir
= outputDir
;