4 GenFvImageTask is to call GenFvImage.exe to generate FvImage.
6 Copyright (c) 2006, Intel Corporation
7 All rights reserved. This program and the accompanying materials
8 are licensed and made available under the terms and conditions of the BSD License
9 which accompanies this distribution. The full text of the license may be found at
10 http://opensource.org/licenses/bsd-license.php
12 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
13 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 package org
.tianocore
.framework
.tasks
;
19 import org
.apache
.tools
.ant
.BuildException
;
20 import org
.apache
.tools
.ant
.Project
;
21 import org
.apache
.tools
.ant
.Task
;
22 import org
.apache
.tools
.ant
.taskdefs
.Execute
;
23 import org
.apache
.tools
.ant
.taskdefs
.LogStreamHandler
;
24 import org
.apache
.tools
.ant
.types
.Commandline
;
29 GenFvImageTask is to call GenFvImage.exe to generate the FvImage.
32 public class GenFvImageTask
extends Task
implements EfiDefine
{
34 /// The name of input inf file
36 private String infFile
="";
41 GenFvImageTask execute is to assemble tool command line & execute tool
44 public void execute() throws BuildException
{
45 Project project
= this.getOwningTarget().getProject();
46 String path
= project
.getProperty("env.FRAMEWORK_TOOLS_PATH");
52 path
= path
+ File
.separatorChar
;
55 command
= path
+ "GenFvImage";
57 String argument
= infFile
;
61 Commandline commandLine
= new Commandline();
62 commandLine
.setExecutable(command
);
63 commandLine
.createArgument().setLine(argument
);
65 LogStreamHandler streamHandler
= new LogStreamHandler(this,
69 // create a execute object and set it's commandline
71 Execute runner
= new Execute(streamHandler
,null);
72 runner
.setAntRun(project
);
73 runner
.setCommandline(commandLine
.getCommandline());
74 System
.out
.println(Commandline
.toString(commandLine
.getCommandline()));
78 // user execute class call external programs - GenFvImage
80 revl
= runner
.execute();
82 // execute command line success!
84 if (EFI_SUCCESS
== revl
){
85 System
.out
.println("GenFvImage succeeded!");
89 // execute command line failed!
91 throw new BuildException("GenFvImage failed !(error =" +
92 Integer
.toHexString(revl
) + ")");
95 } catch (Exception e
) {
96 System
.out
.println(e
.getMessage());
102 This function is to get class member of infFile
103 @return String name of infFile
105 public String
getInfFile() {
112 This function is to set class member of infFile.
114 @param infFile name of infFile
116 public void setInfFile(String infFile
) {
117 this.infFile
= "-I " + infFile
;