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
;
27 import org
.tianocore
.logger
.EdkLog
;
32 * SecFixupTask is used to call SecFixup.exe to fix up sec image.
34 public class SecFixupTask
extends Task
implements EfiDefine
{
38 private String toolName
= "SecFixup";
43 private String secExeFile
= "";
48 private String resetVectorDataFile
= "";
51 // / output directory, this variable is added by jave wrap
53 private String outputFile
= "";
58 private String outputDir
= "";
63 * SecFixupTask execute function is to assemble tool command line & execute
66 * @throws BuidException
68 public void execute() throws BuildException
{
70 Project project
= this.getOwningTarget().getProject();
74 FrameworkLogger logger
= new FrameworkLogger(project
, toolName
76 EdkLog
.setLogLevel(project
.getProperty("env.LOGLEVEL"));
77 EdkLog
.setLogger(logger
);
79 // absolute path of efi tools
81 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
87 command
= path
+ File
.separatorChar
+ toolName
;
92 if (!this.outputDir
.equalsIgnoreCase("")) {
93 argument
= this.secExeFile
+ " " + this.resetVectorDataFile
+ " "
94 + this.outputDir
+ File
.separatorChar
+ this.outputFile
;
96 argument
= this.secExeFile
+ " " + this.resetVectorDataFile
+ " "
101 // return value of fwimage execution
106 Commandline cmdline
= new Commandline();
107 cmdline
.setExecutable(command
);
108 cmdline
.createArgument().setLine(argument
);
110 LogStreamHandler streamHandler
= new LogStreamHandler(this,
111 Project
.MSG_INFO
, Project
.MSG_WARN
);
112 Execute runner
= new Execute(streamHandler
, null);
114 runner
.setAntRun(project
);
115 runner
.setCommandline(cmdline
.getCommandline());
117 // Set debug log information.
119 EdkLog
.log(EdkLog
.EDK_INFO
, Commandline
.toString(cmdline
122 revl
= runner
.execute();
124 if (EFI_SUCCESS
== revl
) {
126 // command execution success
128 EdkLog
.log(EdkLog
.EDK_INFO
, "SecFixup succeeded!");
131 // command execution fail
133 EdkLog
.log(EdkLog
.EDK_ERROR
, "SecFixup failed. (error="
134 + Integer
.toHexString(revl
) + ")");
135 throw new BuildException("SecFixup failed. (error="
136 + Integer
.toHexString(revl
) + ")");
139 } catch (Exception e
) {
140 throw new BuildException(e
.getMessage());
147 * This function is to get class member "secExeFile".
149 * @return string of sectExe file name.
151 public String
getSecExeFile() {
152 return this.secExeFile
;
158 * This function is to set class member "secExeFile".
161 * string of secExe file name.
163 public void setSecExeFile(String secExeFile
) {
164 this.secExeFile
= secExeFile
;
168 * getResetVectorDataFile
170 * This function is to get class member "resetVectorDataFile"
172 * @return resetVectorDataFile string of resetVectorData file name.
174 public String
getResetVectorDataFile() {
175 return this.resetVectorDataFile
;
179 * setResetVectorDataFile
181 * This function is to set class member "resetVectorDataFile"
183 * @param resetVectorDataFile
184 * string of resetVectorData file name.
186 public void setResetVectorDataFile(String resetVectorDataFile
) {
187 this.resetVectorDataFile
= resetVectorDataFile
;
193 * This function is to get class member "outputFile"
195 * @return outputFile string of output file name.
197 public String
getOutputFile() {
204 * This function is to set class member "outputFile"
207 * string of output file name.
209 public void setOutputFile(String outputFile
) {
210 this.outputFile
= outputFile
;
216 * This function is to get class member "outputDir"
218 * @return outputDir name of output directory
220 public String
getOutputDir() {
227 * This function is to set class member "outputDir"
230 * name of output directory
232 public void setOutputDir(String outputDir
) {
233 this.outputDir
= outputDir
;