- Fixed PVCS tracker 484 by merging the GenDll and GenEfi macro in BuildMacro.xml to GenEfi, moving out GenDll and GenEfi macro calling inside macro EFI_SECTION_TE and EFI_SECTION_PE32, and generating the calling of GenEfi macro according to the module type (binary or library).

- Cleaned the coding style of AutoGen.java


git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2429 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
jwang36 2007-03-08 01:44:17 +00:00
parent 64b41a0710
commit a30ae9faea
3 changed files with 147 additions and 190 deletions

View File

@ -974,16 +974,13 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
</sequential>
</macrodef>
<!--############################################################################
Build Sections
#############################################################################-->
<!--
DLL
Generate efi file
-->
<macrodef name="GenDll">
<macrodef name="GenEfi">
<attribute name="FILEPATH"/>
<attribute name="FILENAME"/>
<attribute name="FILEEXT"/>
<attribute name="FILEEXT" default="efi"/>
<element name="LIB.ARG" optional="yes"/>
<element name="LINK.ARG" optional="yes"/>
@ -997,102 +994,152 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
<fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}" />
</sourcefiles>
<targetfiles>
<file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll"/>
<file name="${DEST_DIR_DEBUG}/@{FILENAME}.efi"/>
</targetfiles>
<sequential>
<!-- Generate a temporary lib file for object files -->
<cc userdefine="on">
<command type="SLINK" cmd="${SLINK}" family="${SLINK_FAMILY}" dpath="${SLINK_DPATH}"
outputFile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib"
outputFile="${DEST_DIR_OUTPUT}/@{FILENAME}Local.lib"
libpath="${SLINKLIBPATH}" include="${SLINK_INCLUDEPATH}">
<argument value="${SLINK_FLAGS}"/>
<fileset dir="${DEST_DIR_OUTPUT}" includes="${OBJECTS}"/>
</command>
</cc>
<!-- Link the temporary lib file with dependent libraries -->
<cc userdefine="on">
<command type="DLINK" cmd="${DLINK}" family="${DLINK_FAMILY}"
outputFile="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.dll" dpath="${DLINK_DPATH}"
outputFile="${DEST_DIR_DEBUG}/@{FILENAME}.dll" dpath="${DLINK_DPATH}"
libpath="${DLINK_LIBPATH}" include="${DLINK_INCLUDEPATH}">
<argument value="${DLINK_FLAGS}"/>
<libset libs="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}Local.lib ${LIBS} ${DLINK_SPATH}"/>
<libset libs="${DEST_DIR_OUTPUT}/@{FILENAME}Local.lib ${LIBS} ${DLINK_SPATH}"/>
<LINK.ARG/>
</command>
</cc>
<!-- Convert the dll file to efi file -->
<fwimage componentType="${MODULE_TYPE}" outImage="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
peImage="${DEST_DIR_DEBUG}/@{FILENAME}.dll" time="0"/>
<!-- Copy the efi file to BIN and OUTPUT directory -->
<copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
<copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
</sequential>
</OnDependency>
</sequential>
</macrodef>
<!--
EFI
Binary
-->
<macrodef name="GenEfi">
<macrodef name="Build_Binary">
<attribute name="FILEPATH"/>
<attribute name="FILENAME"/>
<attribute name="FILEEXT" default="dll"/>
<attribute name="FILEEXT" default="bin"/>
<element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
<sequential>
<OnDependency>
<sourcefiles>
<file name="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"/>
</sourcefiles>
<targetfiles>
<file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
</targetfiles>
<copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
</sequential>
</macrodef>
<!--
Microcode
-->
<macrodef name="Build_MICROCODE">
<attribute name="FILEPATH"/>
<attribute name="FILENAME"/>
<attribute name="FILEEXT" default="TXT"/>
<sequential>
<fwimage componentType="${MODULE_TYPE}" outImage="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
peImage="${DEST_DIR_DEBUG}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" time="0"/>
</sequential>
</OnDependency>
<element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
<sequential>
<mkdir dir="${TARGET_DIR}/Microcode"/>
<flashmap MCIFile="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" MCOFILE="${TARGET_DIR}/Microcode/@{FILENAME}.bin"/>
</sequential>
</macrodef>
<!--
Graphics (bmp, ...)
-->
<macrodef name="Build_BMP">
<attribute name="FILEPATH"/>
<attribute name="FILENAME"/>
<attribute name="FILEEXT" default="bmp"/>
<element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
<sequential>
<copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
</sequential>
</macrodef>
<!--
build EFI file
-->
<macrodef name="Build_EFI">
<attribute name="FILEPATH"/>
<attribute name="FILENAME"/>
<attribute name="FILEEXT" default="efi"/>
<element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
<sequential>
<mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
<copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
tofile="${DEST_DIR_OUTPUT}/${BASE_NAME}.efi"/>
</sequential>
</macrodef>
<!--
Build macro for Apriori
-->
<macrodef name="Build_Apriori">
<attribute name="FILEPATH" default="."/>
<attribute name="FILENAME"/>
<attribute name="FILEEXT" default="apr"/>
<attribute name="GUID"/>
<sequential>
<mkdir dir="${FV_DIR}/Apriori" />
<gensection inputfile="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
outputfile="${FV_DIR}/Apriori/@{FILENAME}.sec"
sectiontype="EFI_SECTION_RAW"/>
<genffsfile BaseName="@{FILENAME}" ffsATTRIBCHECKSUM="TRUE" ffsFILETYPE="EFI_FV_FILETYPE_FREEFORM"
fileGuid="@{GUID}" moduleType="BASE" outputDir="${FV_DIR}">
<sectFile fileName="${FV_DIR}/Apriori/@{FILENAME}.sec"/>
</genffsfile>
</sequential>
</macrodef>
<!--
EFI_SECTION_FREEFORM_SUBTYPE_GUID
EFI_SECTION_VERSION
EFI_SECTION_USER_INTERFACE
EFI_SECTION_DXE_DEPEX
EFI_SECTION_PEI_DEPEX
EFI_SECTION_PE32
EFI_SECTION_PIC
EFI_SECTION_TE
EFI_SECTION_RAW
EFI_SECTION_COMPRESSION
EFI_SECTION_GUID_DEFINED
EFI_SECTION_COMPATIBILITY16
EFI_SECTION_FIRMWARE_VOLUME_IMAGE
-->
<!--############################################################################
Build Sections
#############################################################################-->
<!--
EFI_SECTION_PE32
EFI_SECTION_TE
-->
<macrodef name="EFI_SECTION_TE">
<attribute name="FILEPATH"/>
<attribute name="FILENAME"/>
<attribute name="FILEEXT" default="" />
<attribute name="FILEEXT" default="efi" />
<element name="PRE.PROCESS" optional="yes"/>
<element name="POST.PROCESS" optional="yes"/>
<sequential>
<PRE.PROCESS/>
<if>
<not>
<equals arg1="${LIBS}" arg2=""/>
</not>
<then>
<GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">
<LIB.ARG></LIB.ARG>
<LINK.ARG></LINK.ARG>
</GenDll>
<GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>
</then>
</if>
<OnDependency>
<sourcefiles>
<file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
@ -1102,44 +1149,31 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
</targetfiles>
<sequential>
<copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
<copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
<PRE.PROCESS/>
<genteimage Dump="false" Verbose="false" OutputDir="" OutputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.te" InputFile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
<gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.te"
outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.tes"
sectiontype="EFI_SECTION_TE"/>
<POST.PROCESS/>
</sequential>
</OnDependency>
</sequential>
</macrodef>
<!--
EFI_SECTION_PE32
-->
<macrodef name="EFI_SECTION_PE32">
<attribute name="FILEPATH"/>
<attribute name="FILENAME"/>
<attribute name="FILEEXT" default="" />
<attribute name="FILEEXT" default="efi"/>
<element name="PRE.PROCESS" optional="yes"/>
<element name="POST.PROCESS" optional="yes"/>
<sequential>
<PRE.PROCESS/>
<if>
<not>
<!-- TBD ${OBJECTS} -->
<equals arg1="${LIBS}" arg2=""/>
</not>
<then>
<GenDll FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="">
<LIB.ARG></LIB.ARG>
<LINK.ARG></LINK.ARG>
</GenDll>
<GenEfi FILEPATH="." FILENAME="@{FILENAME}" FILEEXT="dll"/>
</then>
</if>
<OnDependency>
<sourcefiles>
<file name="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"/>
@ -1149,8 +1183,8 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
</targetfiles>
<sequential>
<copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${BIN_DIR}/@{FILENAME}.efi" />
<copy file="${DEST_DIR_OUTPUT}/@{FILENAME}.efi" tofile="${DEST_DIR_DEBUG}/@{FILENAME}.efi" />
<PRE.PROCESS/>
<gensection inputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.efi"
outputfile="${DEST_DIR_OUTPUT}/@{FILENAME}.pe32"
sectiontype="EFI_SECTION_PE32"/>
@ -1415,95 +1449,4 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
</sequential>
</macrodef>
<!--
Binary
-->
<macrodef name="Build_Binary">
<attribute name="FILEPATH"/>
<attribute name="FILENAME"/>
<attribute name="FILEEXT" default="bin"/>
<element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
<sequential>
<copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
</sequential>
</macrodef>
<!--
Microcode
-->
<macrodef name="Build_MICROCODE">
<attribute name="FILEPATH"/>
<attribute name="FILENAME"/>
<attribute name="FILEEXT" default="TXT"/>
<element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
<sequential>
<mkdir dir="${TARGET_DIR}/Microcode"/>
<flashmap MCIFile="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}" MCOFILE="${TARGET_DIR}/Microcode/@{FILENAME}.bin"/>
</sequential>
</macrodef>
<!--
Graphics (bmp, ...)
-->
<macrodef name="Build_BMP">
<attribute name="FILEPATH"/>
<attribute name="FILENAME"/>
<attribute name="FILEEXT" default="bmp"/>
<element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
<sequential>
<copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
tofile="${DEST_DIR_OUTPUT}/@{FILEPATH}/@{FILENAME}.bin"/>
</sequential>
</macrodef>
<!--
build EFI file
-->
<macrodef name="Build_EFI">
<attribute name="FILEPATH"/>
<attribute name="FILENAME"/>
<attribute name="FILEEXT" default="efi"/>
<element name="EXTRA.INC" optional="yes"/>
<element name="EXTRA.ARG" optional="yes"/>
<sequential>
<mkdir dir="${MODULE_DIR}/@{FILEPATH}" />
<copy file="${MODULE_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
tofile="${DEST_DIR_OUTPUT}/${BASE_NAME}.efi"/>
</sequential>
</macrodef>
<!--
Build macro for Apriori
-->
<macrodef name="Build_Apriori">
<attribute name="FILEPATH" default="."/>
<attribute name="FILENAME"/>
<attribute name="FILEEXT" default="apr"/>
<attribute name="GUID"/>
<sequential>
<mkdir dir="${FV_DIR}/Apriori" />
<gensection inputfile="${FV_DIR}/@{FILEPATH}/@{FILENAME}.@{FILEEXT}"
outputfile="${FV_DIR}/Apriori/@{FILENAME}.sec"
sectiontype="EFI_SECTION_RAW"/>
<genffsfile BaseName="@{FILENAME}" ffsATTRIBCHECKSUM="TRUE" ffsFILETYPE="EFI_FV_FILETYPE_FREEFORM"
fileGuid="@{GUID}" moduleType="BASE" outputDir="${FV_DIR}">
<sectFile fileName="${FV_DIR}/Apriori/@{FILENAME}.sec"/>
</genffsfile>
</sequential>
</macrodef>
</project>

View File

@ -371,19 +371,24 @@ public class ModuleBuildFileGenerator {
FileProcess fileProcess = new FileProcess();
fileProcess.init(project, includes, document);
//
// Initialize some properties by user
//
Element initEle = document.createElement("Build_Init");
Element initIncEle = document.createElement("EXTRA.INC");
for (int i = 0; i < includes.length; i++) {
Element includeEle = document.createElement("includepath");
includeEle.setAttribute("path", includes[i]);
initIncEle.appendChild(includeEle);
boolean isBinaryModule = fpdModuleId.getModule().isBinary();
boolean isLibraryModule = fpdModuleId.getModule().isLibrary();
if (!isBinaryModule) {
//
// Initialize some properties by user
//
Element initEle = document.createElement("Build_Init");
Element initIncEle = document.createElement("EXTRA.INC");
for (int i = 0; i < includes.length; i++) {
Element includeEle = document.createElement("includepath");
includeEle.setAttribute("path", includes[i]);
initIncEle.appendChild(includeEle);
}
initEle.appendChild(initIncEle);
root.appendChild(initEle);
}
initEle.appendChild(initIncEle);
root.appendChild(initEle);
String moduleDir = project.getProperty("MODULE_DIR");
//
@ -421,10 +426,9 @@ public class ModuleBuildFileGenerator {
}
//
// Parse AutoGen.c & AutoGen.h
// Don't build AutoGen.c for library and binary module
//
if (!fpdModuleId.getModule().isLibrary()
&& !fpdModuleId.getModule().isBinary()) {
if (!isLibraryModule && !isBinaryModule) {
fileProcess.parseFile(project.getProperty("DEST_DIR_DEBUG") + File.separatorChar + "AutoGen.c", null, root, false);
}
@ -470,6 +474,18 @@ public class ModuleBuildFileGenerator {
if (sectiontype.equalsIgnoreCase("EFI_SECTION_RAW") && project.getProperty("MODULE_TYPE").equalsIgnoreCase("SEC")) {
sectiontype += "_SEC";
}
if ((sectiontype.equalsIgnoreCase("EFI_SECTION_PE32") ||
sectiontype.equalsIgnoreCase("EFI_SECTION_TE"))
&& !fpdModuleId.getModule().isLibrary()
&& !fpdModuleId.getModule().isBinary()) {
//
// Generate code to generate efi file
//
Element ele = document.createElement("GenEfi");
ele.setAttribute("FILEPATH", ".");
ele.setAttribute("FILENAME", "${BASE_NAME}");
root.appendChild(ele);
}
Element ele = document.createElement(sectiontype);
ele.setAttribute("FILEPATH", ".");
ele.setAttribute("FILENAME", "${BASE_NAME}");

View File

@ -1107,8 +1107,7 @@ public class AutoGen {
fileBuffer.append(" if (EFI_ERROR (Status)) {\r\n");
fileBuffer.append(" ProcessLibraryDestructorList (gImageHandle, gST);\r\n");
fileBuffer.append(" }\r\n");
fileBuffer
.append(" gBS->Exit (gImageHandle, Status, 0, NULL);\r\n");
fileBuffer.append(" gBS->Exit (gImageHandle, Status, 0, NULL);\r\n");
} else {
fileBuffer.append(" if (!EFI_ERROR (Status) || EFI_ERROR (mDriverEntryPointStatus)) {\r\n");
fileBuffer.append(" mDriverEntryPointStatus = Status;\r\n");
@ -1591,8 +1590,7 @@ public class AutoGen {
case CommonDefinition.ModuleTypePeiCore:
case CommonDefinition.ModuleTypePeim:
fileBuffer.append(" IN EFI_FFS_FILE_HEADER *FfsHeader,\r\n");
fileBuffer
.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
fileBuffer.append(" IN EFI_PEI_SERVICES **PeiServices\r\n");
break;
case CommonDefinition.ModuleTypeDxeCore: