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();
74 // absolute path of efi tools
76 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
82 command
= path
+ File
.separatorChar
+ toolName
;
87 if (!this.outputDir
.equalsIgnoreCase("")) {
88 argument
= this.secExeFile
+ " " + this.resetVectorDataFile
+ " "
89 + this.outputDir
+ File
.separatorChar
+ this.outputFile
;
91 argument
= this.secExeFile
+ " " + this.resetVectorDataFile
+ " "
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(this, EdkLog
.EDK_VERBOSE
, Commandline
.toString(cmdline
.getCommandline()));
116 revl
= runner
.execute();
118 if (EFI_SUCCESS
== revl
) {
120 // command execution success
122 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, "SecFixup succeeded!");
125 // command execution fail
127 EdkLog
.log(this, EdkLog
.EDK_INFO
, "ERROR = "+ Integer
.toHexString(revl
));
128 throw new BuildException("SecFixup failed!");
130 } catch (Exception e
) {
131 throw new BuildException(e
.getMessage());
138 * This function is to get class member "secExeFile".
140 * @return string of sectExe file name.
142 public String
getSecExeFile() {
143 return this.secExeFile
;
149 * This function is to set class member "secExeFile".
152 * string of secExe file name.
154 public void setSecExeFile(String secExeFile
) {
155 this.secExeFile
= secExeFile
;
159 * getResetVectorDataFile
161 * This function is to get class member "resetVectorDataFile"
163 * @return resetVectorDataFile string of resetVectorData file name.
165 public String
getResetVectorDataFile() {
166 return this.resetVectorDataFile
;
170 * setResetVectorDataFile
172 * This function is to set class member "resetVectorDataFile"
174 * @param resetVectorDataFile
175 * string of resetVectorData file name.
177 public void setResetVectorDataFile(String resetVectorDataFile
) {
178 this.resetVectorDataFile
= resetVectorDataFile
;
184 * This function is to get class member "outputFile"
186 * @return outputFile string of output file name.
188 public String
getOutputFile() {
195 * This function is to set class member "outputFile"
198 * string of output file name.
200 public void setOutputFile(String outputFile
) {
201 this.outputFile
= outputFile
;
207 * This function is to get class member "outputDir"
209 * @return outputDir name of output directory
211 public String
getOutputDir() {
218 * This function is to set class member "outputDir"
221 * name of output directory
223 public void setOutputDir(String outputDir
) {
224 this.outputDir
= outputDir
;