One GenFvImage can handle all archs now.
authorbbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 9 Jun 2006 21:14:37 +0000 (21:14 +0000)
committerbbahnsen <bbahnsen@6f19259b-4bc3-4df7-8a09-765794883524>
Fri, 9 Jun 2006 21:14:37 +0000 (21:14 +0000)
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@459 6f19259b-4bc3-4df7-8a09-765794883524

Tools/Source/FrameworkTasks/org/tianocore/framework/tasks/GenFvImageTask.java
Tools/Source/TianoTools/GenFvImage/GenFvImageLib.c
Tools/Source/TianoTools/GenFvImage/build.xml

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