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
;
28 import org
.tianocore
.logger
.EdkLog
;
31 SecApResetVectorFixupTask class.
33 SecApResetVectorFixupTask is used to call SecApResetVectorFixup.exe to place
36 public class SecApResetVectorFixupTask
extends Task
implements EfiDefine
{
40 private String toolName
= "SecApResetVectorFixup";
42 // / input FV recovery file
44 private String fvInputFile
= "";
49 private String fvOutputFile
= "";
52 // / output directory, this variable is added by jave wrap
54 private String outputDir
= "";
60 * SecApResetVectorFixupTask execute function is to assemble tool command line & execute
63 * @throws BuidException
65 public void execute() throws BuildException
{
67 Project project
= this.getOwningTarget().getProject();
71 FrameworkLogger logger
= new FrameworkLogger(project
, "secapresetvectorfixup");
72 EdkLog
.setLogLevel(project
.getProperty("env.LOGLEVEL"));
73 EdkLog
.setLogger(logger
);
75 // absolute path of efi tools
77 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
83 command
= path
+ File
.separatorChar
+ toolName
;
88 File file
= new File(this.fvOutputFile
);
89 if (!file
.isAbsolute() && (!this.outputDir
.equalsIgnoreCase(""))) {
90 argument
= this.fvInputFile
+ " " + outputDir
+ File
.separatorChar
93 argument
= this.fvInputFile
+ " " + this.fvOutputFile
;
96 // return value of fwimage execution
101 Commandline cmdline
= new Commandline();
102 cmdline
.setExecutable(command
);
103 cmdline
.createArgument().setLine(argument
);
105 LogStreamHandler streamHandler
= new LogStreamHandler(this,
106 Project
.MSG_INFO
, Project
.MSG_WARN
);
107 Execute runner
= new Execute(streamHandler
, null);
109 runner
.setAntRun(project
);
110 runner
.setCommandline(cmdline
.getCommandline());
112 // Set debug log information.
114 EdkLog
.log(EdkLog
.EDK_INFO
, Commandline
.toString(cmdline
.getCommandline()));
116 revl
= runner
.execute();
118 if (EFI_SUCCESS
== revl
) {
120 // command execution success
122 EdkLog
.log(EdkLog
.EDK_INFO
,"SecApResetVectorFixup succeeded!");
125 // command execution fail
127 EdkLog
.log(EdkLog
.EDK_ERROR
, "SecApResetVectorFixup failed. (error="
128 + Integer
.toHexString(revl
) + ")");
129 throw new BuildException("SecApResetVectorFixup failed. (error="
130 + Integer
.toHexString(revl
) + ")");
133 } catch (Exception e
) {
134 throw new BuildException(e
.getMessage());
141 * This function is to get class member "fvInputFile".
143 * @return string of input file name.
145 public String
getfvInputFile() {
146 return this.fvInputFile
;
152 * This function is to set class member "fvInputFile".
155 * string of input file name.
157 public void setFvInputFile(String inputFile
) {
158 this.fvInputFile
= inputFile
;
164 * This function is to get class member "fvOutputFile"
166 * @return outputFile string of output file name.
168 public String
getOutputFile() {
169 return this.fvOutputFile
;
175 * This function is to set class member "fvOutputFile"
178 * string of output file name.
180 public void setFvOutputFile(String outputFile
) {
181 this.fvOutputFile
= outputFile
;
187 * This function is to get class member "outputDir"
189 * @return outputDir string of output directory.
191 public String
getOutputDir() {
198 * This function is to set class member "outputDir"
201 * string of output directory.
203 public void setOutputDir(String outputDir
) {
204 this.outputDir
= outputDir
;