diff options
author | qouyang <qouyang@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-11 08:19:18 +0000 |
---|---|---|
committer | qouyang <qouyang@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-07-11 08:19:18 +0000 |
commit | 73b4e31adc1000ff7b066445af347424c7f67535 (patch) | |
tree | fca31eb29bab068edba857faf8e9b7c3aed875ba | |
parent | 4748b24d77d65a13dd2bcb0f9fa9ed83f24f9bf4 (diff) | |
download | edk2-platforms-73b4e31adc1000ff7b066445af347424c7f67535.tar.xz |
EDKT96.
Build tools need to auto-generated the FlashMap.h from .fdf file before a module is built, and then included by Autogen.h based on attributes of module in build time, and copy FlashMap.h to Module\DEBUG dir and change "FlashMap.h" to "TianoR8FlashMap.h".
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@874 6f19259b-4bc3-4df7-8a09-765794883524
5 files changed, 106 insertions, 34 deletions
diff --git a/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java b/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java index c01ca93985..665ab89232 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java +++ b/Tools/Source/GenBuild/org/tianocore/build/GenBuildTask.java @@ -542,7 +542,7 @@ public class GenBuildTask extends Ant { // AutoGen
//
- AutoGen autogen = new AutoGen(getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId.getModule(),fpdModuleId.getArch());
+ AutoGen autogen = new AutoGen(getProject().getProperty("FV_DIR"), getProject().getProperty("DEST_DIR_DEBUG"), fpdModuleId.getModule(),fpdModuleId.getArch());
autogen.genAutogen();
diff --git a/Tools/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java b/Tools/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java index 3aff06f956..e36945501b 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java +++ b/Tools/Source/GenBuild/org/tianocore/build/autogen/AutoGen.java @@ -17,22 +17,9 @@ package org.tianocore.build.autogen;
-import org.tianocore.build.global.GlobalData;
-import org.tianocore.build.global.Spd;
-import org.tianocore.build.global.SurfaceAreaQuery;
-import org.tianocore.build.id.ModuleIdentification;
-import org.tianocore.build.id.PackageIdentification;
-import org.tianocore.GuidsDocument;
-import org.tianocore.LibraryClassDocument.LibraryClass;
-import org.tianocore.PPIsDocument;
-import org.tianocore.ProtocolsDocument;
-import org.tianocore.build.pcd.action.PCDAutoGenAction;
-import org.tianocore.build.exception.*;
-import org.tianocore.logger.EdkLog;
-import org.apache.tools.ant.BuildException;
-import org.apache.xmlbeans.XmlObject;
-
import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.ArrayList;
@@ -43,6 +30,21 @@ import java.util.List; import java.util.Map;
import java.util.Set;
+import org.apache.tools.ant.BuildException;
+import org.apache.xmlbeans.XmlObject;
+import org.tianocore.GuidsDocument;
+import org.tianocore.LibraryClassDocument.LibraryClass;
+import org.tianocore.PPIsDocument;
+import org.tianocore.ProtocolsDocument;
+import org.tianocore.build.exception.*;
+import org.tianocore.build.global.GlobalData;
+import org.tianocore.build.global.Spd;
+import org.tianocore.build.global.SurfaceAreaQuery;
+import org.tianocore.build.id.ModuleIdentification;
+import org.tianocore.build.id.PackageIdentification;
+import org.tianocore.build.pcd.action.PCDAutoGenAction;
+import org.tianocore.logger.EdkLog;
+
/**
* This class is to generate Autogen.h and Autogen.c according to module surface
* area or library surface area.
@@ -52,7 +54,10 @@ public class AutoGen { // / The output path of Autogen.h and Autogen.c
// /
private String outputPath;
-
+ ///
+ /// The name of FV directory
+ ///
+ private String fvDir;
// /
// / The base name of module or library.
// /
@@ -104,10 +109,11 @@ public class AutoGen { * @param arch
* Target architecture.
*/
- public AutoGen(String outputPath, ModuleIdentification moduleId, String arch) {
+ public AutoGen(String fvDir, String outputPath, ModuleIdentification moduleId, String arch) {
this.outputPath = outputPath;
this.moduleId = moduleId;
this.arch = arch;
+ this.fvDir = fvDir;
}
@@ -316,7 +322,17 @@ public class AutoGen { }
fileBuffer.append("\r\n");
- //
+ //
+ // If is TianoR8FlashMap, copy {Fv_DIR}/FlashMap.h to
+ // {DEST_DIR_DRBUG}/FlashMap.h
+ //
+ if (SurfaceAreaQuery.isHaveTianoR8FlashMap()) {
+ fileBuffer.append(CommonDefinition.include);
+ fileBuffer.append(" <");
+ fileBuffer.append(CommonDefinition.tianoR8FlashMapH + ">\r\n");
+ copyFlashMapHToDebugDir();
+ }
+
// Write PCD autogen information to AutoGen.h.
//
if (this.myPcdAutogen != null) {
@@ -544,6 +560,17 @@ public class AutoGen { }
fileBuffer.append("\r\n");
+ //
+ // If is TianoR8FlashMap, copy {Fv_DIR}/FlashMap.h to
+ // {DEST_DIR_DRBUG}/FlashMap.h
+ //
+ if (SurfaceAreaQuery.isHaveTianoR8FlashMap()) {
+ fileBuffer.append(CommonDefinition.include);
+ fileBuffer.append(" <");
+ fileBuffer.append(CommonDefinition.tianoR8FlashMapH + ">\r\n");
+ copyFlashMapHToDebugDir();
+ }
+
//
// Write PCD information to library AutoGen.h.
//
@@ -2029,4 +2056,27 @@ public class AutoGen { }
+ private void copyFlashMapHToDebugDir() throws AutoGenException{
+
+ File inFile = new File(fvDir + File.separatorChar + CommonDefinition.flashMapH);
+ int size = (int)inFile.length();
+ byte[] buffer = new byte[size];
+ File outFile = new File (this.outputPath + File.separatorChar + CommonDefinition.tianoR8FlashMapH);
+ try{
+ if (inFile.exists()) {
+ FileInputStream fis = new FileInputStream (inFile);
+ fis.read(buffer);
+ FileOutputStream fos = new FileOutputStream(outFile);
+ fos.write(buffer);
+ fis.close();
+ fos.close();
+ }else {
+ throw new AutoGenException("The flashMap.h file don't exist!!");
+ }
+ } catch (Exception e){
+ throw new AutoGenException(e.getMessage());
+ }
+
+ }
+
}
\ No newline at end of file diff --git a/Tools/Source/GenBuild/org/tianocore/build/autogen/CommonDefinition.java b/Tools/Source/GenBuild/org/tianocore/build/autogen/CommonDefinition.java index ad245edd17..5f83e4d9df 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/autogen/CommonDefinition.java +++ b/Tools/Source/GenBuild/org/tianocore/build/autogen/CommonDefinition.java @@ -54,6 +54,9 @@ public class CommonDefinition { public final static String protocolGuid = "ProtocolGuid";
public final static String ppiGuid = "PpiGuid";
public final static String guidGuid = "Guid";
+
+ public final static String tianoR8FlashMapH = "TianoR8FlashMap.h";
+ public final static String flashMapH = "FlashMap.h";
//
// AutoGen.h and AutoGen.c file's header
diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java index 51f198571a..19725167c5 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java +++ b/Tools/Source/GenBuild/org/tianocore/build/global/GlobalData.java @@ -16,13 +16,23 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. **/
package org.tianocore.build.global;
+import java.io.File;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+import java.util.logging.Logger;
+
import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.Project;
import org.apache.xmlbeans.XmlObject;
import org.tianocore.DbPathAndFilename;
import org.tianocore.FrameworkDatabaseDocument;
import org.tianocore.ModuleSurfaceAreaDocument;
-import org.tianocore.PcdBuildDefinitionDocument;
import org.tianocore.ModuleSurfaceAreaDocument.ModuleSurfaceArea;
+import org.tianocore.PcdBuildDefinitionDocument;
import org.tianocore.build.id.FpdModuleIdentification;
import org.tianocore.build.id.ModuleIdentification;
import org.tianocore.build.id.PackageIdentification;
@@ -37,15 +47,6 @@ import org.tianocore.build.toolchain.ToolChainMap; import org.tianocore.exception.EdkException;
import org.tianocore.logger.EdkLog;
-import java.io.File;
-import java.util.HashMap;
-import java.util.HashSet;
-import java.util.Iterator;
-import java.util.List;
-import java.util.Map;
-import java.util.Set;
-import java.util.logging.Logger;
-
/**
GlobalData provide initializing, instoring, querying and update global data.
It is a bridge to intercommunicate between multiple component, such as AutoGen,
@@ -133,8 +134,6 @@ public class GlobalData { private static final MemoryDatabaseManager pcdDbManager = new MemoryDatabaseManager();
-
-
/**
Parse framework database (DB) and all SPD files listed in DB to initialize
the environment for next build. This method will only be executed only once
@@ -145,7 +144,7 @@ public class GlobalData { @throws BuildException
Framework Dababase or SPD or MSA file is not valid
**/
- public synchronized static void initInfo(String workspaceDatabaseFile, String workspaceDir, String toolsDefFilename) throws BuildException {
+ public synchronized static void initInfo(String workspaceDatabaseFile, String workspaceDir, String toolsDefFilename ) throws BuildException {
//
// ensure this method will be revoked only once
//
@@ -153,8 +152,8 @@ public class GlobalData { return;
}
globalFlag = true;
-
- //
+
+ //
// Backup workspace directory. It will be used by other method
//
GlobalData.workspaceDir = workspaceDir.replaceAll("(\\\\)", "/");
diff --git a/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java b/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java index 37c60643e7..c2918b7b3b 100644 --- a/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java +++ b/Tools/Source/GenBuild/org/tianocore/build/global/SurfaceAreaQuery.java @@ -1916,4 +1916,24 @@ public class SurfaceAreaQuery { return false;
}
+
+ public static boolean isHaveTianoR8FlashMap(){
+ PcdCodedDocument.PcdCoded.PcdEntry[] pcdEntries = null;
+ String[] results;
+ int index;
+ String[] xPath = new String[] {"/"};
+ Object[] returns = get ("Externs", xPath);
+
+ if (returns == null) {
+ return false;
+ }
+
+ ExternsDocument.Externs ext = (ExternsDocument.Externs)returns[0];
+
+ if (ext.getTianoR8FlashMapH()){
+ return true;
+ }else {
+ return false;
+ }
+ }
}
|