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();
72 FrameworkLogger logger
= new FrameworkLogger(project
, "secapresetvectorfixup");
73 EdkLog
.setLogLevel(project
.getProperty("env.LOGLEVEL"));
74 EdkLog
.setLogger(logger
);
76 // absolute path of efi tools
78 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
84 command
= path
+ File
.separatorChar
+ toolName
;
89 File file
= new File(this.fvOutputFile
);
90 if (!file
.isAbsolute() && (!this.outputDir
.equalsIgnoreCase(""))) {
91 argument
= this.fvInputFile
+ " " + outputDir
+ File
.separatorChar
94 argument
= this.fvInputFile
+ " " + this.fvOutputFile
;
97 // return value of fwimage execution
102 Commandline cmdline
= new Commandline();
103 cmdline
.setExecutable(command
);
104 cmdline
.createArgument().setLine(argument
);
106 LogStreamHandler streamHandler
= new LogStreamHandler(this,
107 Project
.MSG_INFO
, Project
.MSG_WARN
);
108 Execute runner
= new Execute(streamHandler
, null);
110 runner
.setAntRun(project
);
111 runner
.setCommandline(cmdline
.getCommandline());
113 // Set debug log information.
115 EdkLog
.log(EdkLog
.EDK_VERBOSE
, Commandline
.toString(cmdline
.getCommandline()));
116 EdkLog
.log(EdkLog
.EDK_INFO
, (new File(this.fvInputFile
)).getName());
118 revl
= runner
.execute();
120 if (EFI_SUCCESS
== revl
) {
122 // command execution success
124 EdkLog
.log(EdkLog
.EDK_VERBOSE
, "SecApResetVectorFixup succeeded!");
127 // command execution fail
129 EdkLog
.log(EdkLog
.EDK_INFO
, "ERROR = " + Integer
.toHexString(revl
));
130 throw new BuildException("SecApResetVectorFixup failed!");
132 } catch (Exception e
) {
133 throw new BuildException(e
.getMessage());
140 * This function is to get class member "fvInputFile".
142 * @return string of input file name.
144 public String
getfvInputFile() {
145 return this.fvInputFile
;
151 * This function is to set class member "fvInputFile".
154 * string of input file name.
156 public void setFvInputFile(String inputFile
) {
157 this.fvInputFile
= inputFile
;
163 * This function is to get class member "fvOutputFile"
165 * @return outputFile string of output file name.
167 public String
getOutputFile() {
168 return this.fvOutputFile
;
174 * This function is to set class member "fvOutputFile"
177 * string of output file name.
179 public void setFvOutputFile(String outputFile
) {
180 this.fvOutputFile
= outputFile
;
186 * This function is to get class member "outputDir"
188 * @return outputDir string of output directory.
190 public String
getOutputDir() {
197 * This function is to set class member "outputDir"
200 * string of output directory.
202 public void setOutputDir(String outputDir
) {
203 this.outputDir
= outputDir
;