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_VERBOSE
, Commandline
.toString(cmdline
.getCommandline()));
115 EdkLog
.log(EdkLog
.EDK_INFO
, (new File(this.fvInputFile
)).getName());
117 revl
= runner
.execute();
119 if (EFI_SUCCESS
== revl
) {
121 // command execution success
123 EdkLog
.log(EdkLog
.EDK_VERBOSE
, "SecApResetVectorFixup succeeded!");
126 // command execution fail
128 EdkLog
.log(EdkLog
.EDK_INFO
, "ERROR = " + Integer
.toHexString(revl
));
129 throw new BuildException("SecApResetVectorFixup failed!");
131 } catch (Exception e
) {
132 throw new BuildException(e
.getMessage());
139 * This function is to get class member "fvInputFile".
141 * @return string of input file name.
143 public String
getfvInputFile() {
144 return this.fvInputFile
;
150 * This function is to set class member "fvInputFile".
153 * string of input file name.
155 public void setFvInputFile(String inputFile
) {
156 this.fvInputFile
= inputFile
;
162 * This function is to get class member "fvOutputFile"
164 * @return outputFile string of output file name.
166 public String
getOutputFile() {
167 return this.fvOutputFile
;
173 * This function is to set class member "fvOutputFile"
176 * string of output file name.
178 public void setFvOutputFile(String outputFile
) {
179 this.fvOutputFile
= outputFile
;
185 * This function is to get class member "outputDir"
187 * @return outputDir string of output directory.
189 public String
getOutputDir() {
196 * This function is to set class member "outputDir"
199 * string of output directory.
201 public void setOutputDir(String outputDir
) {
202 this.outputDir
= outputDir
;