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 FileArg secExeFile
= new FileArg();
49 private FileArg resetVectorDataFile
= new FileArg();
54 private FileArg outputFile
= new FileArg();
57 // output directory, this variable is added by jave wrap
59 private String outputDir
= ".";
64 SecFixupTask execute function is to assemble tool command line & execute
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 argument
= "" + secExeFile
+ resetVectorDataFile
+ outputFile
;
90 // return value of fwimage execution
95 Commandline cmdline
= new Commandline();
96 cmdline
.setExecutable(command
);
97 cmdline
.createArgument().setLine(argument
);
99 LogStreamHandler streamHandler
= new LogStreamHandler(this,
100 Project
.MSG_INFO
, Project
.MSG_WARN
);
101 Execute runner
= new Execute(streamHandler
, null);
103 runner
.setAntRun(project
);
104 runner
.setCommandline(cmdline
.getCommandline());
105 runner
.setWorkingDirectory(new File(outputDir
));
108 // Set debug log information.
110 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, Commandline
.toString(cmdline
.getCommandline()));
111 EdkLog
.log(this, EdkLog
.EDK_INFO
, secExeFile
.toFileList()
112 + resetVectorDataFile
.toFileList() + " => " + outputFile
.toFileList());
114 revl
= runner
.execute();
116 if (EFI_SUCCESS
== revl
) {
118 // command execution success
120 EdkLog
.log(this, EdkLog
.EDK_VERBOSE
, toolName
+ " succeeded!");
123 // command execution fail
125 EdkLog
.log(this, EdkLog
.EDK_INFO
, "ERROR = "+ Integer
.toHexString(revl
));
126 throw new BuildException(toolName
+ " failed!");
128 } catch (Exception e
) {
129 throw new BuildException(e
.getMessage());
136 This function is to get class member "secExeFile".
138 @return string of sectExe file name.
140 public String
getSecExeFile() {
141 return this.secExeFile
.getValue();
147 This function is to set class member "secExeFile".
150 string of secExe file name.
152 public void setSecExeFile(String secExeFile
) {
153 this.secExeFile
.setArg(" ", secExeFile
);
157 getResetVectorDataFile
159 This function is to get class member "resetVectorDataFile"
161 @return resetVectorDataFile string of resetVectorData file name.
163 public String
getResetVectorDataFile() {
164 return this.resetVectorDataFile
.getValue();
168 setResetVectorDataFile
170 This function is to set class member "resetVectorDataFile"
172 @param resetVectorDataFile
173 string of resetVectorData file name.
175 public void setResetVectorDataFile(String resetVectorDataFile
) {
176 this.resetVectorDataFile
.setArg(" ", resetVectorDataFile
);
182 This function is to get class member "outputFile"
184 @return outputFile string of output file name.
186 public String
getOutputFile() {
187 return this.outputFile
.getValue();
193 This function is to set class member "outputFile"
196 string of output file name.
198 public void setOutputFile(String outputFile
) {
199 this.outputFile
.setArg(" ", outputFile
);
205 This function is to get class member "outputDir"
207 @return outputDir name of output directory
209 public String
getOutputDir() {
216 This function is to set class member "outputDir"
219 name of output directory
221 public void setOutputDir(String outputDir
) {
222 this.outputDir
= outputDir
;