summaryrefslogtreecommitdiff
path: root/Tools/Source/GenBuild/org/tianocore/build/fpd
diff options
context:
space:
mode:
authorwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>2006-08-18 05:37:49 +0000
committerwuyizhong <wuyizhong@6f19259b-4bc3-4df7-8a09-765794883524>2006-08-18 05:37:49 +0000
commit4b5f554990ac8aa2a2a15ab19fbc7202be2073af (patch)
tree1e8581c47cf9659f7b76a56013a90ec3767809d6 /Tools/Source/GenBuild/org/tianocore/build/fpd
parent45649fb7004bf40388ab92a3e612b883bb99f9ac (diff)
downloadedk2-4b5f554990ac8aa2a2a15ab19fbc7202be2073af.zip
edk2-4b5f554990ac8aa2a2a15ab19fbc7202be2073af.tar.gz
edk2-4b5f554990ac8aa2a2a15ab19fbc7202be2073af.tar.bz2
Change module build sequence. 1. Get FvImageName list according to their declaration order in the fpd file. 2. First build all modules in the first fvimage, then build all modules in the second fvimage, and so on. These modules sequence is still from their layout in the fpd file. 3. At last, build the remaining modules whose FVBinding = NULL. And also clean some unused code, and add and update some comments.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@1320 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/Source/GenBuild/org/tianocore/build/fpd')
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java9
-rw-r--r--Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java167
2 files changed, 115 insertions, 61 deletions
diff --git a/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java b/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java
index edaab68..9a7581d 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/fpd/FpdParserTask.java
@@ -55,8 +55,7 @@ import org.tianocore.build.toolchain.ToolChainMap;
and BUILD_DIR. </p>
<p>The task generates ${PLATFORM}_build.xml file which will be called by top level
- build.xml. The task also generate Fv.inf files (File is for Tool GenFvImage)
- and flash definition file (File is for Tool FlashMap) if necessary. </p>
+ build.xml. The task also generate Fv.inf files (File is for Tool GenFvImage). </p>
<p>FpdParserTask task stores all FPD information to GlobalData. And parse
tools definition file to set up compiler options for different Target and
@@ -70,9 +69,6 @@ import org.tianocore.build.toolchain.ToolChainMap;
&lt;FPDParser platformName="Nt32" /&gt;
</pre>
- <p>The task will initialize all information through parsing Framework Database,
- SPD, Tool chain configuration files. </p>
-
@since GenBuild 1.0
**/
public class FpdParserTask extends Task {
@@ -102,7 +98,6 @@ public class FpdParserTask extends Task {
private boolean isUnified = true;
-
/**
Public construct method. It is necessary for ANT task.
**/
@@ -174,7 +169,7 @@ public class FpdParserTask extends Task {
//
// Gen build.xml
//
- PlatformBuildFileGenerator fileGenerator = new PlatformBuildFileGenerator(getProject(), outfiles, isUnified);
+ PlatformBuildFileGenerator fileGenerator = new PlatformBuildFileGenerator(getProject(), outfiles, fvs, isUnified);
fileGenerator.genBuildFile();
//
diff --git a/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java b/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java
index a20f17b..ef6dc72 100644
--- a/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java
+++ b/Tools/Source/GenBuild/org/tianocore/build/fpd/PlatformBuildFileGenerator.java
@@ -12,6 +12,7 @@
package org.tianocore.build.fpd;
import java.io.File;
+import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import java.util.Set;
@@ -52,6 +53,12 @@ public class PlatformBuildFileGenerator {
/// Mapping from modules identification to out put file name
///
private Map<FpdModuleIdentification, String> outfiles;
+
+ ///
+ /// Mapping from FV name to its modules
+ ///
+ private Map<String, Set<FpdModuleIdentification>> fvs = new HashMap<String, Set<FpdModuleIdentification>>();
+
private boolean isUnified = true;
@@ -63,10 +70,11 @@ public class PlatformBuildFileGenerator {
+ "Abstract:\n"
+ "Auto-generated ANT build file for building EFI Modules and Platforms\n";
- public PlatformBuildFileGenerator(Project project, Map<FpdModuleIdentification, String> outfiles, boolean isUnified){
+ public PlatformBuildFileGenerator(Project project, Map<FpdModuleIdentification, String> outfiles, Map<String, Set<FpdModuleIdentification>> fvs, boolean isUnified){
this.project = project;
this.outfiles = outfiles;
this.isUnified = isUnified;
+ this.fvs = fvs;
this.platformName = project.getProperty("PLATFORM");
}
@@ -173,68 +181,119 @@ public class PlatformBuildFileGenerator {
}
}
+ /**
+ 1. Get All valid Fv Image Names in sequence
+ 2. For each FV, get modules by sequences
+ 3. Get other modules
+
+ @param document XML document
+ @param root Node
+ **/
private void applyModules(Document document, Node root) {
root.appendChild(document.createComment("Modules target"));
Element ele = document.createElement("target");
ele.setAttribute("name", "modules");
- Set<FpdModuleIdentification> set = outfiles.keySet();
- Iterator iter = set.iterator();
- while (iter.hasNext()) {
- FpdModuleIdentification fpdModuleId = (FpdModuleIdentification) iter.next();
- ModuleIdentification moduleId = fpdModuleId.getModule();
- Element moduleEle = document.createElement("GenBuild");
- moduleEle.setAttribute("type", "build");
- //
- // Inherit Properties.
- //{"ARCH", "PACKAGE", "PACKAGE_GUID", "PACKAGE_VERSION", "MODULE_DIR"}
- //
-
- //
- // ARCH
- //
- Element property = document.createElement("property");
- property.setAttribute("name", "ARCH");
- property.setAttribute("value", fpdModuleId.getArch());
- moduleEle.appendChild(property);
-
- //
- // MODULE_GUID
- //
- property = document.createElement("property");
- property.setAttribute("name", "MODULE_GUID");
- property.setAttribute("value", moduleId.getGuid());
- moduleEle.appendChild(property);
-
- //
- // MODULE_VERSION
- //
- property = document.createElement("property");
- property.setAttribute("name", "MODULE_VERSION");
- property.setAttribute("value", moduleId.getVersion());
- moduleEle.appendChild(property);
-
- //
- // PACKAGE_GUID
- //
- property = document.createElement("property");
- property.setAttribute("name", "PACKAGE_GUID");
- property.setAttribute("value", moduleId.getPackage().getGuid());
- moduleEle.appendChild(property);
-
- //
- // PACKAGE_VERSION
- //
- property = document.createElement("property");
- property.setAttribute("name", "PACKAGE_VERSION");
- property.setAttribute("value", moduleId.getPackage().getVersion());
- moduleEle.appendChild(property);
-
- ele.appendChild(moduleEle);
+ //
+ // Get all valid FV name
+ //
+ String[] validFv = SurfaceAreaQuery.getFpdValidImageNames();
+
+ //
+ // For each valid FV, get all modules in sequence
+ //
+ for (int i = 0; i < validFv.length; i++) {
+ if (fvs.containsKey(validFv[i])) {
+ Set<FpdModuleIdentification> set = fvs.get(validFv[i]);
+ Iterator<FpdModuleIdentification> iter = set.iterator();
+ while (iter.hasNext()) {
+ FpdModuleIdentification fpdModuleId = iter.next();
+ applySingleModule(document, ele, fpdModuleId);
+ }
+ }
}
+
+ //
+ // Get all other modules
+ //
+ Iterator<String> fvsNameIter = fvs.keySet().iterator();
+
+ while (fvsNameIter.hasNext()) {
+ String fvName = fvsNameIter.next();
+ if (!isContain(validFv, fvName)) {
+ Set<FpdModuleIdentification> set = fvs.get(fvName);
+ Iterator iter = set.iterator();
+ while (iter.hasNext()) {
+ FpdModuleIdentification fpdModuleId = (FpdModuleIdentification) iter.next();
+ applySingleModule(document, ele, fpdModuleId);
+ }
+ }
+ }
+
root.appendChild(ele);
}
+ private void applySingleModule(Document document, Node root, FpdModuleIdentification fpdModuleId) {
+ ModuleIdentification moduleId = fpdModuleId.getModule();
+ Element moduleEle = document.createElement("GenBuild");
+ moduleEle.setAttribute("type", "build");
+ //
+ // Inherit Properties.
+ //{"ARCH", "PACKAGE", "PACKAGE_GUID", "PACKAGE_VERSION", "MODULE_DIR"}
+ //
+
+ //
+ // ARCH
+ //
+ Element property = document.createElement("property");
+ property.setAttribute("name", "ARCH");
+ property.setAttribute("value", fpdModuleId.getArch());
+ moduleEle.appendChild(property);
+
+ //
+ // MODULE_GUID
+ //
+ property = document.createElement("property");
+ property.setAttribute("name", "MODULE_GUID");
+ property.setAttribute("value", moduleId.getGuid());
+ moduleEle.appendChild(property);
+
+ //
+ // MODULE_VERSION
+ //
+ property = document.createElement("property");
+ property.setAttribute("name", "MODULE_VERSION");
+ property.setAttribute("value", moduleId.getVersion());
+ moduleEle.appendChild(property);
+
+ //
+ // PACKAGE_GUID
+ //
+ property = document.createElement("property");
+ property.setAttribute("name", "PACKAGE_GUID");
+ property.setAttribute("value", moduleId.getPackage().getGuid());
+ moduleEle.appendChild(property);
+
+ //
+ // PACKAGE_VERSION
+ //
+ property = document.createElement("property");
+ property.setAttribute("name", "PACKAGE_VERSION");
+ property.setAttribute("value", moduleId.getPackage().getVersion());
+ moduleEle.appendChild(property);
+
+ root.appendChild(moduleEle);
+ }
+
+ private boolean isContain(String[] list, String item) {
+ for (int i = 0; i < list.length; i++) {
+ if (list[i].equalsIgnoreCase(item)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
private void applyFvs(Document document, Node root) {
//
// FVS Target