Skip to content

Commit

Permalink
Enhance GenFv tool always collect all module Map files into the singl…
Browse files Browse the repository at this point in the history
…e FvMap file for user easy reference.

git-svn-id: https://buildtools.tianocore.org/svn/buildtools/trunk/BaseTools@1245 7335b38e-4728-0410-8992-fb3ffe349368
  • Loading branch information
lgao4 committed May 27, 2008
1 parent 18035ad commit cf60856
Showing 1 changed file with 28 additions and 19 deletions.
47 changes: 28 additions & 19 deletions Source/C/GenFv/GenFvInternalLib.c
Expand Up @@ -1997,12 +1997,12 @@ Routine Description:
if (FvInfo->RuntimeBaseAddress != 0) {
Flags |= REBASE_RUNTIME_FILE;
}

//
// Don't Rebase this FFS.
// Don't Rebase this FFS.
// Only copy the original map file into the FvMap file
// for the image that is not required to be relocated.
//
if (Flags == 0) {
return EFI_SUCCESS;
}

//
// We only process files potentially containing PE32 sections.
Expand Down Expand Up @@ -2058,7 +2058,7 @@ Routine Description:
//
// We aren't relocating XIP code, so skip it.
//
return EFI_SUCCESS;
goto WritePeMap;
}

//
Expand Down Expand Up @@ -2137,7 +2137,7 @@ Routine Description:
//
// RT drivers aren't supposed to be relocated
//
continue;
goto WritePeMap;
}
//
// make sure image base address at the section alignment
Expand All @@ -2156,7 +2156,7 @@ Routine Description:
//
// Skip all BS_DRIVER's
//
continue;
goto WritePeMap;
}
//
// make sure image base address at the Section and Page alignment
Expand All @@ -2174,7 +2174,7 @@ Routine Description:
//
// Skip DXE core, DxeCore only contain one PE image.
//
return EFI_SUCCESS;
goto WritePeMap;
}
//
// make sure image base address at the Section and Page alignment
Expand Down Expand Up @@ -2286,18 +2286,17 @@ Routine Description:
//
// Get this module function address from ModulePeMapFile and add them into FvMap file
//
WritePeMap:
WriteMapFile (FvMapFile, FileName, ImageContext.DestinationAddress, PeHdr->OptionalHeader.AddressOfEntryPoint, 0);
}

if ((Flags & 1) == 0 || (
FfsFile->Type != EFI_FV_FILETYPE_SECURITY_CORE &&
if (FfsFile->Type != EFI_FV_FILETYPE_SECURITY_CORE &&
FfsFile->Type != EFI_FV_FILETYPE_PEI_CORE &&

FfsFile->Type != EFI_FV_FILETYPE_PEIM &&
FfsFile->Type != EFI_FV_FILETYPE_COMBINED_PEIM_DRIVER
)) {
) {
//
// Only XIP code may have a TE section
// Only Peim code may have a TE section
//
return EFI_SUCCESS;
}
Expand Down Expand Up @@ -2330,6 +2329,13 @@ Routine Description:
Error (NULL, 0, 3000, "Invalid", "GetImageInfo() call failed on rebase of TE image %s", FileName);
return Status;
}

if ((Flags & REBASE_XIP_FILE) == 0) {
//
// For none XIP PEIM module, their map info also are collected.
//
goto WriteTeMap;
}
//
// if reloc is stripped, try to get the original efi image to get reloc info.
//
Expand Down Expand Up @@ -2466,6 +2472,7 @@ Routine Description:
//
// Get this module function address from ModulePeMapFile and add them into FvMap file
//
WriteTeMap:
WriteMapFile (
FvMapFile,
FileName,
Expand Down Expand Up @@ -2645,16 +2652,18 @@ Routine Description:
//
// module information output
//
if (FileGuidName != NULL) {
fprintf (FvMapFile, "%s (", KeyWord);
fprintf (FvMapFile, "BaseAddress=%08lx, ", ImageBaseAddress + Offset);
fprintf (FvMapFile, "EntryPoint=%08lx, ", ImageBaseAddress + AddressOfEntryPoint);
fprintf (FvMapFile, "GUID=%s)\n\n", FileGuidName);
if (ImageBaseAddress == 0) {
fprintf (FvMapFile, "%s (dummy) (", KeyWord);
fprintf (FvMapFile, "BaseAddress=%08lx, ", ImageBaseAddress);
} else {
fprintf (FvMapFile, "%s (", KeyWord);
fprintf (FvMapFile, "BaseAddress=%08lx, ", ImageBaseAddress + Offset);
fprintf (FvMapFile, "EntryPoint=%08lx)", ImageBaseAddress + AddressOfEntryPoint);
}
fprintf (FvMapFile, "EntryPoint=%08lx, ", ImageBaseAddress + AddressOfEntryPoint);
if (FileGuidName != NULL) {
fprintf (FvMapFile, "GUID=%s", FileGuidName);
}
fprintf (FvMapFile, ")\n\n");

while (fgets (Line, MAX_LINE_LEN, PeMapFile) != NULL) {
//
Expand Down

0 comments on commit cf60856

Please sign in to comment.