diff options
author | bbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-06-09 21:14:37 +0000 |
---|---|---|
committer | bbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524> | 2006-06-09 21:14:37 +0000 |
commit | 1507f64ec4bd382969bc98f16f0249b4e9b4e3c0 (patch) | |
tree | 6d7a93e5e79eb85d4ce2900a92389dee77f9deba | |
parent | 6de5f959d627648b33a2a7275c35bb9fd6856a26 (diff) | |
download | edk2-platforms-1507f64ec4bd382969bc98f16f0249b4e9b4e3c0.tar.xz |
One GenFvImage can handle all archs now.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@459 6f19259b-4bc3-4df7-8a09-765794883524
3 files changed, 7 insertions, 304 deletions
diff --git a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFvImageTask.java b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFvImageTask.java index f9340758b3..ae47ec7ff4 100644 --- a/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFvImageTask.java +++ b/Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFvImageTask.java @@ -34,10 +34,6 @@ public class GenFvImageTask extends Task implements EfiDefine{ /// The name of input inf file
///
private String infFile="";
- ///
- /// The target architecture.
- ///
- private String arch="";
/**
execute
@@ -56,25 +52,8 @@ public class GenFvImageTask extends Task implements EfiDefine{ path = path + File.separatorChar;
}
- // FIXME arch should be passed via schema attributes.
- arch=System.getenv("ARCH");
- if (arch == null) {
- arch = "";
- }
- // FIXME end
+ command = path + "GenFvImage";
- if (arch.equalsIgnoreCase("IA32")){
- command = path + "GenFvImage_Ia32";
- }
- else if (arch.equalsIgnoreCase("X64")){
- command = path + "GenFvImage_X64";
- }
- else if (arch.equalsIgnoreCase("IPF")){
- command = path + "GenFvImage_Ipf";
- }
- else {
- command = path + "GenFvImage";
- }
String argument = infFile;
try {
@@ -138,24 +117,4 @@ public class GenFvImageTask extends Task implements EfiDefine{ this.infFile = "-I " + infFile;
}
- /**
- getArch
-
- This function is to get class member of arch.
- @return The target architecture.
- **/
- public String getArch() {
- return arch;
- }
-
- /**
- setArch
-
- This function is to set class member of arch.
-
- @param arch The target architecture.
- **/
- public void setArch(String arch) {
- this.arch = arch;
- }
}
diff --git a/Tools/Source/TianoTools/GenFvImage/GenFvImageLib.c b/Tools/Source/TianoTools/GenFvImage/GenFvImageLib.c index c4515001d8..6cc5a0d56f 100644 --- a/Tools/Source/TianoTools/GenFvImage/GenFvImageLib.c +++ b/Tools/Source/TianoTools/GenFvImage/GenFvImageLib.c @@ -1306,168 +1306,6 @@ Returns: return EFI_SUCCESS;
}
-EFI_STATUS
-RebaseFfsFile (
- IN OUT EFI_FFS_FILE_HEADER *FfsFile,
- IN EFI_PHYSICAL_ADDRESS BaseAddress
- )
-/*++
-
-Routine Description:
-
- This function determines if a file is XIP and should be rebased. It will
- rebase any PE32 sections found in the file using the base address.
-
-Arguments:
-
- FfsFile A pointer to Ffs file image.
- BaseAddress The base address to use for rebasing the file image.
-
-Returns:
-
- EFI_SUCCESS The image was properly rebased.
- EFI_INVALID_PARAMETER An input parameter is invalid.
- EFI_ABORTED An error occurred while rebasing the input file image.
- EFI_OUT_OF_RESOURCES Could not allocate a required resource.
-
---*/
-{
- EFI_STATUS Status;
- PE_COFF_LOADER_IMAGE_CONTEXT ImageContext;
- UINTN MemoryImagePointer;
- UINTN MemoryImagePointerAligned;
-
- EFI_PHYSICAL_ADDRESS ImageAddress;
- UINT64 ImageSize;
- EFI_PHYSICAL_ADDRESS EntryPoint;
-
- UINT32 Pe32FileSize;
- UINT32 NewPe32BaseAddress;
-
- UINTN Index;
- EFI_FILE_SECTION_POINTER CurrentPe32Section;
- UINT8 FileGuidString[80];
-
- //
- // Verify input parameters
- //
- if (FfsFile == NULL) {
- return EFI_INVALID_PARAMETER;
- }
- //
- // Convert the GUID to a string so we can at least report which file
- // if we find an error.
- //
- PrintGuidToBuffer (&FfsFile->Name, FileGuidString, sizeof (FileGuidString), TRUE);
-
- //
- // Do some nominal checks on the file, then check for XIP.
- //
- Status = VerifyFfsFile (FfsFile);
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "invalid FFS file", FileGuidString);
- return EFI_INVALID_PARAMETER;
- }
-
- if (FfsFile->Type != EFI_FV_FILETYPE_SECURITY_CORE &&
- FfsFile->Type != EFI_FV_FILETYPE_PEI_CORE &&
- FfsFile->Type != EFI_FV_FILETYPE_PEIM
- ) {
- //
- // File is not XIP, so don't rebase
- //
- return EFI_SUCCESS;
- }
- //
- // Rebase each PE32 section
- //
- for (Index = 1;; Index++) {
- Status = GetSectionByType (FfsFile, EFI_SECTION_PE32, Index, &CurrentPe32Section);
- if (EFI_ERROR (Status)) {
- break;
- }
- //
- // Calculate the PE32 base address, the FFS file base plus the offset of the PE32 section
- //
- NewPe32BaseAddress = ((UINT32) BaseAddress) + ((UINTN) CurrentPe32Section.Pe32Section - (UINTN) FfsFile);
-
- //
- // Initialize context
- //
- memset (&ImageContext, 0, sizeof (ImageContext));
- ImageContext.Handle = (VOID *) ((UINTN) CurrentPe32Section.Pe32Section + sizeof (EFI_PE32_SECTION));
- ImageContext.ImageRead = (PE_COFF_LOADER_READ_FILE) FfsRebaseImageRead;
-
- Status = PeCoffLoaderGetImageInfo (&ImageContext);
-
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "GetImageInfo() failed", FileGuidString);
- return Status;
- }
- //
- // Allocate a buffer for the image to be loaded into.
- //
- Pe32FileSize = GetLength (CurrentPe32Section.Pe32Section->CommonHeader.Size);
- MemoryImagePointer = (UINTN) (malloc (Pe32FileSize + 0x1000));
- MemoryImagePointerAligned = (MemoryImagePointer + 0x0FFF) & (-1 << 12);
- if (MemoryImagePointerAligned == 0) {
- Error (NULL, 0, 0, "memory allocation failure", NULL);
- return EFI_OUT_OF_RESOURCES;
- }
-
- //
- // bugbug
- //
- ImageContext.ImageAddress = MemoryImagePointerAligned;
- Status = PeCoffLoaderLoadImage (&ImageContext);
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "LoadImage() failure", FileGuidString);
- free ((VOID *) MemoryImagePointer);
- return Status;
- }
-
- Status = PeCoffLoaderRelocateImage (&ImageContext);
- if (EFI_ERROR (Status)) {
- Error (NULL, 0, 0, "RelocateImage() failure", FileGuidString);
- free ((VOID *) MemoryImagePointer);
- return Status;
- }
-
- ImageAddress = ImageContext.ImageAddress;
- ImageSize = ImageContext.ImageSize;
- EntryPoint = ImageContext.EntryPoint;
-
- if (ImageSize > Pe32FileSize) {
- Error (
- NULL,
- 0,
- 0,
- "rebased PE32 is larger than original PE32 image",
- "0x%X > 0x%X on file %s",
- ImageSize,
- Pe32FileSize,
- FileGuidString
- );
- free ((VOID *) MemoryImagePointer);
- return EFI_ABORTED;
- }
-
- memcpy (CurrentPe32Section.Pe32Section, (VOID *) MemoryImagePointerAligned, Pe32FileSize);
-
- free ((VOID *) MemoryImagePointer);
- }
- //
- // the above for loop will always exit with EFI_NOT_FOUND if it completes
- // normally. If Index == 1 at exit, then no PE32 sections were found. If it
- // exits with any other error code, then something broke...
- //
- if (Status != EFI_NOT_FOUND) {
- Error (NULL, 0, 0, "failed to parse PE32 section", FileGuidString);
- return Status;
- }
-
- return EFI_SUCCESS;
-}
EFI_STATUS
AddSymFile (
diff --git a/Tools/Source/TianoTools/GenFvImage/build.xml b/Tools/Source/TianoTools/GenFvImage/build.xml index d29a2eca97..c57ec2968e 100644 --- a/Tools/Source/TianoTools/GenFvImage/build.xml +++ b/Tools/Source/TianoTools/GenFvImage/build.xml @@ -24,9 +24,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <property environment="env"/>
<property name="LINK_OUTPUT_TYPE" value="static"/>
- <property name="BUILD_DIR_IA32" value="${PACKAGE_DIR}/${ToolName}/tmp/Ia32"/>
- <property name="BUILD_DIR_X64" value="${PACKAGE_DIR}/${ToolName}/tmp/X64"/>
- <property name="BUILD_DIR_IPF" value="${PACKAGE_DIR}/${ToolName}/tmp/Ipf"/>
+ <property name="BUILD_DIR" value="${PACKAGE_DIR}/${ToolName}/tmp"/>
<target name="GenTool" depends="init, Tool">
<echo message="Building the EDK Tool: ${ToolName}"/>
@@ -34,9 +32,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <target name="init">
<echo message="The EDK Tool: ${ToolName}"/>
- <mkdir dir="${BUILD_DIR_IA32}"/>
- <mkdir dir="${BUILD_DIR_X64}"/>
- <mkdir dir="${BUILD_DIR_IPF}"/>
+ <mkdir dir="${BUILD_DIR}"/>
<if>
<equals arg1="${GCC}" arg2="cygwin"/>
<then>
@@ -109,10 +105,10 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. </target>
- <target name="Tool" depends="init, GenFvImage, GenFvImage_Ia32, GenFvImage_X64, GenFvImage_Ipf"/>
+ <target name="Tool" depends="init, GenFvImage"/>
<target name="GenFvImage" >
- <cc name="${ToolChain}" objdir="${BUILD_DIR_IA32}"
+ <cc name="${ToolChain}" objdir="${BUILD_DIR}"
outfile="${BIN_DIR}/${ToolName}"
outtype="executable"
optimize="speed">
@@ -134,95 +130,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <includepath path="${env.WORKSPACE}/MdePkg/Include/Library"/>
<includepath path="${env.WORKSPACE}/MdePkg/Include/ToBeRemoved"/>
<includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools CustomizedCompress PeCoffLoader_Ia32"/>
- <linkerarg value="/nodefaultlib:libc.lib" unless="gcc"/>
- <syslibset dir="${syslibdirs}" libs="${syslibs}" if="gcc"/>
- <syslibset libs="RpcRT4" unless="gcc"/>
- </cc>
- </target>
-
- <target name="GenFvImage_Ia32">
- <cc name="${ToolChain}" objdir="${BUILD_DIR_IA32}"
- outfile="${BIN_DIR}/${ToolName}_Ia32"
- outtype="executable"
- optimize="speed">
-
- <defineset>
- <define name="BUILDING_TOOLS"/>
- <define name="TOOL_BUILD_IA32_TARGET"/>
- </defineset>
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"/>
-
- <includepath path="${PACKAGE_DIR}/${ToolName}"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include/Ia32"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include/Common"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include/Protocol"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include/Library"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include/ToBeRemoved"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools CustomizedCompress PeCoffLoader_Ia32"/>
- <linkerarg value="/nodefaultlib:libc.lib" unless="gcc"/>
- <syslibset dir="${syslibdirs}" libs="${syslibs}" if="gcc"/>
- <syslibset libs="RpcRT4" unless="gcc"/>
- </cc>
- </target>
-
- <target name="GenFvImage_X64">
- <cc name="${ToolChain}" objdir="${BUILD_DIR_X64}"
- outfile="${BIN_DIR}/${ToolName}_X64"
- outtype="executable"
- optimize="speed">
-
- <defineset>
- <define name="BUILDING_TOOLS"/>
- <define name="TOOL_BUILD_X64_TARGET"/>
- </defineset>
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"/>
-
- <includepath path="${PACKAGE_DIR}/${ToolName}"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include/Ia32"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include/Common"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include/Protocol"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include/Library"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include/ToBeRemoved"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools CustomizedCompress PeCoffLoader_X64"/>
- <linkerarg value="/nodefaultlib:libc.lib" unless="gcc"/>
- <syslibset dir="${syslibdirs}" libs="${syslibs}" if="gcc"/>
- <syslibset libs="RpcRT4" unless="gcc"/>
- </cc>
- </target>
-
- <target name="GenFvImage_Ipf">
- <cc name="${ToolChain}" objdir="${BUILD_DIR_IPF}"
- outfile="${BIN_DIR}/${ToolName}_Ipf"
- outtype="executable"
- optimize="speed">
-
- <defineset>
- <define name="BUILDING_TOOLS"/>
- <define name="TOOL_BUILD_IPF_TARGET"/>
- </defineset>
-
- <fileset dir="${basedir}/${ToolName}"
- includes="${FileSet}"/>
-
- <includepath path="${PACKAGE_DIR}/${ToolName}"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include/Ia32"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include/Common"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include/Protocol"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include/Library"/>
- <includepath path="${env.WORKSPACE}/MdePkg/Include/ToBeRemoved"/>
- <includepath path="${PACKAGE_DIR}/Common"/>
- <libset dir="${LIB_DIR}" libs="CommonTools CustomizedCompress PeCoffLoader_Ipf"/>
+ <libset dir="${LIB_DIR}" libs="CommonTools CustomizedCompress"/>
<linkerarg value="/nodefaultlib:libc.lib" unless="gcc"/>
<syslibset dir="${syslibdirs}" libs="${syslibs}" if="gcc"/>
<syslibset libs="RpcRT4" unless="gcc"/>
@@ -232,9 +140,7 @@ WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED. <target name="clean" depends="init">
<echo message="Removing Intermediate Files Only"/>
<delete>
- <fileset dir="${BUILD_DIR_IA32}" includes="*.obj"/>
- <fileset dir="${BUILD_DIR_X64}" includes="*.obj"/>
- <fileset dir="${BUILD_DIR_IPF}" includes="*.obj"/>
+ <fileset dir="${BUILD_DIR}" includes="*.obj"/>
</delete>
</target>
|