4 SecFixupTask is used to call SecFixup.exe to fix up sec image.
7 Copyright (c) 2006, Intel Corporation
8 All rights reserved. This program and the accompanying materials
9 are licensed and made available under the terms and conditions of the BSD License
10 which accompanies this distribution. The full text of the license may be found at
11 http://opensource.org/licenses/bsd-license.php
13 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
17 package org
.tianocore
.framework
.tasks
;
21 import org
.apache
.tools
.ant
.Task
;
22 import org
.apache
.tools
.ant
.Project
;
23 import org
.apache
.tools
.ant
.BuildException
;
24 import org
.apache
.tools
.ant
.taskdefs
.Execute
;
25 import org
.apache
.tools
.ant
.taskdefs
.LogStreamHandler
;
26 import org
.apache
.tools
.ant
.types
.Commandline
;
28 import org
.tianocore
.common
.logger
.EdkLog
;
33 * SecFixupTask is used to call SecFixup.exe to fix up sec image.
35 public class SecFixupTask
extends Task
implements EfiDefine
{
39 private String toolName
= "SecFixup";
44 private String secExeFile
= "";
49 private String resetVectorDataFile
= "";
52 // / output directory, this variable is added by jave wrap
54 private String outputFile
= "";
59 private String outputDir
= "";
64 * SecFixupTask execute function is to assemble tool command line & execute
67 * @throws BuidException
69 public void execute() throws BuildException
{
71 Project project
= this.getOwningTarget().getProject();
75 FrameworkLogger logger
= new FrameworkLogger(project
, toolName
77 EdkLog
.setLogLevel(project
.getProperty("env.LOGLEVEL"));
78 EdkLog
.setLogger(logger
);
80 // absolute path of efi tools
82 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
88 command
= path
+ File
.separatorChar
+ toolName
;
93 if (!this.outputDir
.equalsIgnoreCase("")) {
94 argument
= this.secExeFile
+ " " + this.resetVectorDataFile
+ " "
95 + this.outputDir
+ File
.separatorChar
+ this.outputFile
;
97 argument
= this.secExeFile
+ " " + this.resetVectorDataFile
+ " "
102 // return value of fwimage execution
107 Commandline cmdline
= new Commandline();
108 cmdline
.setExecutable(command
);
109 cmdline
.createArgument().setLine(argument
);
111 LogStreamHandler streamHandler
= new LogStreamHandler(this,
112 Project
.MSG_INFO
, Project
.MSG_WARN
);
113 Execute runner
= new Execute(streamHandler
, null);
115 runner
.setAntRun(project
);
116 runner
.setCommandline(cmdline
.getCommandline());
118 // Set debug log information.
120 EdkLog
.log(EdkLog
.EDK_VERBOSE
, Commandline
.toString(cmdline
.getCommandline()));
122 revl
= runner
.execute();
124 if (EFI_SUCCESS
== revl
) {
126 // command execution success
128 EdkLog
.log(EdkLog
.EDK_VERBOSE
, "SecFixup succeeded!");
131 // command execution fail
133 EdkLog
.log(EdkLog
.EDK_INFO
, "ERROR = "+ Integer
.toHexString(revl
));
134 throw new BuildException("SecFixup failed!");
136 } catch (Exception e
) {
137 throw new BuildException(e
.getMessage());
144 * This function is to get class member "secExeFile".
146 * @return string of sectExe file name.
148 public String
getSecExeFile() {
149 return this.secExeFile
;
155 * This function is to set class member "secExeFile".
158 * string of secExe file name.
160 public void setSecExeFile(String secExeFile
) {
161 this.secExeFile
= secExeFile
;
165 * getResetVectorDataFile
167 * This function is to get class member "resetVectorDataFile"
169 * @return resetVectorDataFile string of resetVectorData file name.
171 public String
getResetVectorDataFile() {
172 return this.resetVectorDataFile
;
176 * setResetVectorDataFile
178 * This function is to set class member "resetVectorDataFile"
180 * @param resetVectorDataFile
181 * string of resetVectorData file name.
183 public void setResetVectorDataFile(String resetVectorDataFile
) {
184 this.resetVectorDataFile
= resetVectorDataFile
;
190 * This function is to get class member "outputFile"
192 * @return outputFile string of output file name.
194 public String
getOutputFile() {
201 * This function is to set class member "outputFile"
204 * string of output file name.
206 public void setOutputFile(String outputFile
) {
207 this.outputFile
= outputFile
;
213 * This function is to get class member "outputDir"
215 * @return outputDir name of output directory
217 public String
getOutputDir() {
224 * This function is to set class member "outputDir"
227 * name of output directory
229 public void setOutputDir(String outputDir
) {
230 this.outputDir
= outputDir
;