summaryrefslogtreecommitdiff
path: root/Tools/CCode/Source/PeiRebase
diff options
context:
space:
mode:
authorbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2007-04-11 07:52:41 +0000
committerbxing <bxing@6f19259b-4bc3-4df7-8a09-765794883524>2007-04-11 07:52:41 +0000
commitaaed63a98d57d0004f60ee650b5c942c120eb2fa (patch)
tree8856f87ce03f2ab283db5a62f4ea72c3bbff1958 /Tools/CCode/Source/PeiRebase
parent7990ba7eaa464e41c76d8575065f5c6c0ca7e55c (diff)
downloadedk2-aaed63a98d57d0004f60ee650b5c942c120eb2fa.zip
edk2-aaed63a98d57d0004f60ee650b5c942c120eb2fa.tar.gz
edk2-aaed63a98d57d0004f60ee650b5c942c120eb2fa.tar.bz2
1. Updated LOG file format generated by PeiRebase.
2. Updated PeiRebase to rebase an FV in a single pass. 3. Fixed bugs in GenFvMap to make it compilable by WinDDK and able to generate FV map file for production tip. 4. Update genefi task to copy map files to ${BIN_DIR} as well. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2559 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/CCode/Source/PeiRebase')
-rw-r--r--Tools/CCode/Source/PeiRebase/PeiRebaseExe.c45
1 files changed, 19 insertions, 26 deletions
diff --git a/Tools/CCode/Source/PeiRebase/PeiRebaseExe.c b/Tools/CCode/Source/PeiRebase/PeiRebaseExe.c
index 93acb63..459d8db 100644
--- a/Tools/CCode/Source/PeiRebase/PeiRebaseExe.c
+++ b/Tools/CCode/Source/PeiRebase/PeiRebaseExe.c
@@ -104,27 +104,22 @@ Returns:
// Set utility name for error/warning reporting purposes.
//
SetUtilityName (UTILITY_NAME);
-
- if (argc == 1) {
- Usage();
- return STATUS_ERROR;
- }
-
+
if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
(strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
Usage();
return STATUS_ERROR;
}
-
+
if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
Version();
return STATUS_ERROR;
}
-
+
//
// Verify the correct number of arguments
//
- if (argc != MAX_ARGS) {
+ if (argc < MAX_ARGS) {
Usage ();
return STATUS_ERROR;
}
@@ -147,7 +142,7 @@ Returns:
//
// Parse the command line arguments
//
- for (Index = 1; Index < MAX_ARGS; Index += 2) {
+ for (Index = 1; Index < argc; Index += 2) {
//
// Make sure argument pair begin with - or /
//
@@ -293,7 +288,7 @@ Returns:
// Open the log file
//
strcat (InputFileName, ".log");
- LogFile = fopen (InputFileName, "a");
+ LogFile = fopen (InputFileName, "w");
if (LogFile == NULL) {
Error (NULL, 0, 0, InputFileName, "could not append to log file");
}
@@ -552,7 +547,7 @@ Returns:
--*/
{
Version();
-
+
printf (
"Usage: %s -I InputFileName -O OutputFileName -B BaseAddress [-F InputFvInfName]\n",
UTILITY_NAME
@@ -612,7 +607,7 @@ Returns:
EFI_FFS_FILE_TAIL TailValue;
EFI_PHYSICAL_ADDRESS *BaseToUpdate;
EFI_IMAGE_DEBUG_DIRECTORY_ENTRY *DebugEntry;
-
+
//
// Verify input parameters
@@ -687,14 +682,14 @@ Returns:
PeHdr = (EFI_IMAGE_NT_HEADERS *)((UINTN)ImageContext.ImageAddress + ImageContext.PeCoffHeaderOffset);
if (PeHdr->OptionalHeader.SectionAlignment != PeHdr->OptionalHeader.FileAlignment) {
//
- // Nor XIP module can be ignored.
+ // Nor XIP module can be ignored.
//
if ((Flags & 1) == 0) {
continue;
}
Error (NULL, 0, 0, "Section-Alignment and File-Alignment does not match", FileGuidString);
return EFI_ABORTED;
- }
+ }
//
// Update CodeView and PdbPointer in ImageContext
@@ -703,8 +698,8 @@ Returns:
ImageContext.ImageAddress +
ImageContext.DebugDirectoryEntryRva
);
- ImageContext.CodeView = (VOID *)(UINTN)(
- ImageContext.ImageAddress +
+ ImageContext.CodeView = (VOID *)(UINTN)(
+ ImageContext.ImageAddress +
DebugEntry->RVA
);
switch (*(UINT32 *) ImageContext.CodeView) {
@@ -803,10 +798,9 @@ Returns:
//
fprintf (
LogFile,
- "%s %016I64X %s\n",
+ "%s %016I64X\n",
FileGuidString,
- ImageContext.DestinationAddress,
- ImageContext.PdbPointer == NULL ? "*" : ImageContext.PdbPointer
+ ImageContext.DestinationAddress
);
*BaseToUpdate += EFI_SIZE_TO_PAGES (ImageContext.ImageSize) * EFI_PAGE_SIZE;
@@ -855,7 +849,7 @@ Returns:
//
return EFI_SUCCESS;
}
-
+
//
// Now process TE sections
//
@@ -921,7 +915,7 @@ Returns:
//
// Reloacate TeImage
- //
+ //
ImageContext.DestinationAddress = XipBase + (UINTN) TEImageHeader + sizeof (EFI_TE_IMAGE_HEADER) \
- TEImageHeader->StrippedSize - (UINTN) FfsFile;
Status = PeCoffLoaderRelocateImage (&ImageContext);
@@ -963,13 +957,12 @@ Returns:
fprintf (
LogFile,
- "%s %016I64X %s\n",
+ "%s %016I64X\n",
FileGuidString,
- ImageContext.DestinationAddress,
- ImageContext.PdbPointer == NULL ? "*" : ImageContext.PdbPointer
+ ImageContext.DestinationAddress
);
}
-
+
return EFI_SUCCESS;
}