summaryrefslogtreecommitdiff
path: root/Tools/CCode
diff options
context:
space:
mode:
authorywang <ywang@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-08 22:27:20 +0000
committerywang <ywang@6f19259b-4bc3-4df7-8a09-765794883524>2007-01-08 22:27:20 +0000
commitdb608e6b5b00f54a678d7144170ccb5057782e14 (patch)
treed9633061545281358354db4f3338a69acfe94dd0 /Tools/CCode
parent66d8c20686febc5f7ba580dd79377c93435b75ad (diff)
downloadedk2-db608e6b5b00f54a678d7144170ccb5057782e14.zip
edk2-db608e6b5b00f54a678d7144170ccb5057782e14.tar.gz
edk2-db608e6b5b00f54a678d7144170ccb5057782e14.tar.bz2
Minor changes and bug fixes implemented.
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@2196 6f19259b-4bc3-4df7-8a09-765794883524
Diffstat (limited to 'Tools/CCode')
-rw-r--r--Tools/CCode/Source/EfiCompress/EfiCompressMain.c2
-rw-r--r--Tools/CCode/Source/FwImage/fwimage.c2
-rw-r--r--Tools/CCode/Source/GenBsfFixup/GenBsfFixup.c2
-rw-r--r--Tools/CCode/Source/GenBsfImage/GenBsfImage.c2
-rw-r--r--Tools/CCode/Source/GenCRC32Section/GenCRC32Section.c10
-rw-r--r--Tools/CCode/Source/GenCapsuleHdr/GenCapsuleHdr.c5
-rw-r--r--Tools/CCode/Source/GenDepex/GenDepex.c26
-rw-r--r--Tools/CCode/Source/GenFfsFile/GenFfsFile.c76
-rw-r--r--Tools/CCode/Source/GenFvImage/GenFvImageExe.c65
-rw-r--r--Tools/CCode/Source/GenSection/GenSection.c61
-rw-r--r--Tools/CCode/Source/GenTEImage/GenTEImage.c56
-rwxr-xr-xTools/CCode/Source/ModifyInf/ModifyInf.c2
-rw-r--r--Tools/CCode/Source/Strip/Strip.c2
13 files changed, 236 insertions, 75 deletions
diff --git a/Tools/CCode/Source/EfiCompress/EfiCompressMain.c b/Tools/CCode/Source/EfiCompress/EfiCompressMain.c
index 360b735..b7ff7c7 100644
--- a/Tools/CCode/Source/EfiCompress/EfiCompressMain.c
+++ b/Tools/CCode/Source/EfiCompress/EfiCompressMain.c
@@ -121,7 +121,7 @@ Returns:
SrcBuffer = DstBuffer = NULL;
infile = outfile = NULL;
- if (argc < 1) {
+ if (argc == 1) {
Usage();
goto Done;
}
diff --git a/Tools/CCode/Source/FwImage/fwimage.c b/Tools/CCode/Source/FwImage/fwimage.c
index fb3f1a7..beddd8e 100644
--- a/Tools/CCode/Source/FwImage/fwimage.c
+++ b/Tools/CCode/Source/FwImage/fwimage.c
@@ -762,7 +762,7 @@ Returns:
TimeStamp = 0;
TimeStampPresent = FALSE;
- if (argc < 1) {
+ if (argc == 1) {
Usage();
return STATUS_ERROR;
}
diff --git a/Tools/CCode/Source/GenBsfFixup/GenBsfFixup.c b/Tools/CCode/Source/GenBsfFixup/GenBsfFixup.c
index 1cc1e83..6082b4d 100644
--- a/Tools/CCode/Source/GenBsfFixup/GenBsfFixup.c
+++ b/Tools/CCode/Source/GenBsfFixup/GenBsfFixup.c
@@ -394,7 +394,7 @@ Returns:
Index = 0;
Invert = 0;
- if (argc < 1) {
+ if (argc == 1) {
Usage();
return -1;
}
diff --git a/Tools/CCode/Source/GenBsfImage/GenBsfImage.c b/Tools/CCode/Source/GenBsfImage/GenBsfImage.c
index bc3ae9f..a294a2e 100644
--- a/Tools/CCode/Source/GenBsfImage/GenBsfImage.c
+++ b/Tools/CCode/Source/GenBsfImage/GenBsfImage.c
@@ -2559,7 +2559,7 @@ Returns:
//
// Verify the correct number of arguments
//
- if (argc < 1) {
+ if (argc == 1) {
Usage();
return 1;
}
diff --git a/Tools/CCode/Source/GenCRC32Section/GenCRC32Section.c b/Tools/CCode/Source/GenCRC32Section/GenCRC32Section.c
index 5c9af78..678275a 100644
--- a/Tools/CCode/Source/GenCRC32Section/GenCRC32Section.c
+++ b/Tools/CCode/Source/GenCRC32Section/GenCRC32Section.c
@@ -239,6 +239,11 @@ main (
OutputFileName = NULL;
SetUtilityName (UTILITY_NAME);
+
+ if (argc == 1) {
+ Usage ();
+ return -1;
+ }
if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
(strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
@@ -250,11 +255,6 @@ main (
Version();
return -1;
}
-
- if (argc == 1) {
- Usage ();
- return -1;
- }
BufferSize = 1024 * 1024 * 16;
FileBuffer = (UINT8 *) malloc (BufferSize * sizeof (UINT8));
diff --git a/Tools/CCode/Source/GenCapsuleHdr/GenCapsuleHdr.c b/Tools/CCode/Source/GenCapsuleHdr/GenCapsuleHdr.c
index 97482f2..16b15c3 100644
--- a/Tools/CCode/Source/GenCapsuleHdr/GenCapsuleHdr.c
+++ b/Tools/CCode/Source/GenCapsuleHdr/GenCapsuleHdr.c
@@ -2379,6 +2379,11 @@ Returns:
Version();
return STATUS_ERROR;
}
+
+ if (Argc == 1) {
+ Usage ();
+ return STATUS_ERROR;
+ }
//
// Process until no more options
diff --git a/Tools/CCode/Source/GenDepex/GenDepex.c b/Tools/CCode/Source/GenDepex/GenDepex.c
index e28be72..5c27797 100644
--- a/Tools/CCode/Source/GenDepex/GenDepex.c
+++ b/Tools/CCode/Source/GenDepex/GenDepex.c
@@ -106,7 +106,7 @@ Returns:
--*/
{
printf (
- "%s, Tiano Dependency Expression Generation Utility. Version %d.%d.\n",
+ "%s v%d.%d -Tiano utility to generate dependency expression.\n",
UTILITY_NAME,
UTILITY_MAJOR_VERSION,
UTILITY_MINOR_VERSION
@@ -855,16 +855,22 @@ Returns:
Output_Flag = FALSE;
Pad_Flag = FALSE;
- //
- // Output the calling arguments
- //
- printf ("\n\n");
- for (Index = 0; Index < argc; Index++) {
- printf ("%s ", argv[Index]);
+ if (argc == 1) {
+ Usage();
+ return EFI_INVALID_PARAMETER;
}
-
- printf ("\n\n");
-
+
+ if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0) ||
+ (strcmp(argv[1], "-?") == 0) || (strcmp(argv[1], "/?") == 0)) {
+ Usage();
+ return EFI_INVALID_PARAMETER;
+ }
+
+ if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
+ Version();
+ return EFI_INVALID_PARAMETER;
+ }
+
if (argc < 5) {
printf ("Not enough arguments\n");
Usage();
diff --git a/Tools/CCode/Source/GenFfsFile/GenFfsFile.c b/Tools/CCode/Source/GenFfsFile/GenFfsFile.c
index d4e5468..81708cf 100644
--- a/Tools/CCode/Source/GenFfsFile/GenFfsFile.c
+++ b/Tools/CCode/Source/GenFfsFile/GenFfsFile.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2004, Intel Corporation
+Copyright (c) 2004-2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -46,8 +46,10 @@ Abstract:
#include "EfiUtilityMsgs.h"
#include "SimpleFileParsing.h"
-#define UTILITY_NAME "GenFfsFile"
-#define TOOLVERSION "0.32"
+#define UTILITY_NAME "GenFfsFile"
+#define UTILITY_MAJOR_VERSION 0
+#define UTILITY_MINOR_VERSION 32
+
#define MAX_ARRAY_SIZE 100
static
@@ -83,7 +85,13 @@ ProcessCommandLineArgs (
static
void
-PrintUsage (
+Version (
+ void
+ );
+
+static
+void
+Usage (
void
);
@@ -135,8 +143,33 @@ Returns:
}
static
+void
+Version(
+ void
+ )
+/*++
+
+Routine Description:
+
+ Print out version information for this utility.
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ printf ("%s v%d.%d -EDK utility to generate a Firmware File System files.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
+}
+
+static
void
-PrintUsage (
+Usage (
void
)
/*++
@@ -155,7 +188,9 @@ Returns:
--*/
{
- printf ("Usage:\n");
+ Version();
+
+ printf ("\nUsage:\n");
printf (UTILITY_NAME " -b \"build directory\" -p1 \"package1.inf\" -p2 \"package2.inf\" -v\n");
printf (" -b \"build directory\":\n ");
printf (" specifies the full path to the component build directory.\n");
@@ -2545,14 +2580,27 @@ Returns:
//
// If no args, then print usage instructions and return an error
//
- if (Argc == 1) {
- PrintUsage ();
+ Argc--;
+ Argv++;
+
+ if (Argc < 1) {
+ Usage ();
return STATUS_ERROR;
}
-
+
+ if ((strcmp(Argv[0], "-h") == 0) || (strcmp(Argv[0], "--help") == 0) ||
+ (strcmp(Argv[0], "-?") == 0) || (strcmp(Argv[0], "/?") == 0)) {
+ Usage();
+ return STATUS_ERROR;
+ }
+
+ if ((strcmp(Argv[0], "-V") == 0) || (strcmp(Argv[0], "--version") == 0)) {
+ Version();
+ return STATUS_ERROR;
+ }
+
memset (&mGlobals, 0, sizeof (mGlobals));
- Argc--;
- Argv++;
+
while (Argc > 0) {
if (strcmpi (Argv[0], "-b") == 0) {
//
@@ -2617,17 +2665,17 @@ Returns:
//
// OPTION: -h help
//
- PrintUsage ();
+ Usage ();
return STATUS_ERROR;
} else if (strcmpi (Argv[0], "-?") == 0) {
//
// OPTION: -? help
//
- PrintUsage ();
+ Usage ();
return STATUS_ERROR;
} else {
Error (NULL, 0, 0, Argv[0], "unrecognized option");
- PrintUsage ();
+ Usage ();
return STATUS_ERROR;
}
diff --git a/Tools/CCode/Source/GenFvImage/GenFvImageExe.c b/Tools/CCode/Source/GenFvImage/GenFvImageExe.c
index f5a5179..294c303 100644
--- a/Tools/CCode/Source/GenFvImage/GenFvImageExe.c
+++ b/Tools/CCode/Source/GenFvImage/GenFvImageExe.c
@@ -1,6 +1,6 @@
/*++
-Copyright (c) 2004, Intel Corporation
+Copyright (c) 2004-2007, Intel Corporation
All rights reserved. This program and the accompanying materials
are licensed and made available under the terms and conditions of the BSD License
which accompanies this distribution. The full text of the license may be found at
@@ -29,10 +29,11 @@ Abstract:
#include "CommonLib.h"
#include "EfiUtilityMsgs.h"
-VOID
-PrintUtilityInfo (
- VOID
- )
+static
+void
+Version(
+ void
+)
/*++
Routine Description:
@@ -49,17 +50,15 @@ Returns:
--*/
{
- printf (
- "%s - Tiano Firmware Volume Generation Utility."" Version %i.%i\n\n",
- UTILITY_NAME,
- UTILITY_MAJOR_VERSION,
- UTILITY_MINOR_VERSION
- );
+ printf ("%s v%d.%d -Tiano Firmware Volume Generation Utility.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
}
+
-VOID
-PrintUsage (
- VOID
+static
+void
+Usage(
+ void
)
/*++
@@ -77,9 +76,11 @@ Returns:
--*/
{
- printf ("Usage: %s -I FvInfFileName\n", UTILITY_NAME);
+ Version();
+
+ printf ("\nUsage: %s -I FvInfFileName\n", UTILITY_NAME);
printf (" Where:\n");
- printf ("\tFvInfFileName is the name of the image description file.\n\n");
+ printf (" FvInfFileName is the name of the image description file.\n\n");
}
int
@@ -133,17 +134,29 @@ Returns:
SymFileName = SymFileNameBuffer;
SetUtilityName (UTILITY_NAME);
- //
- // Display utility information
- //
- PrintUtilityInfo ();
-
+
+ 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 GetUtilityStatus ();
+ }
+
+ if ((strcmp(argv[1], "-V") == 0) || (strcmp(argv[1], "--version") == 0)) {
+ Version();
+ return GetUtilityStatus ();
+ }
+
//
// Verify the correct number of arguments
//
if (argc != MAX_ARGS) {
Error (NULL, 0, 0, "invalid number of input parameters specified", NULL);
- PrintUsage ();
+ Usage ();
return GetUtilityStatus ();
}
//
@@ -160,7 +173,7 @@ Returns:
//
if (argv[Index][0] != '-' && argv[Index][0] != '/') {
Error (NULL, 0, 0, argv[Index], "argument pair must begin with \"-\" or \"/\"");
- PrintUsage ();
+ Usage ();
return GetUtilityStatus ();
}
//
@@ -168,7 +181,7 @@ Returns:
//
if (argv[Index][2] != 0) {
Error (NULL, 0, 0, argv[Index], "unrecognized argument");
- PrintUsage ();
+ Usage ();
return GetUtilityStatus ();
}
//
@@ -182,14 +195,14 @@ Returns:
strcpy (InfFileName, argv[Index + 1]);
} else {
Error (NULL, 0, 0, argv[Index + 1], "FvInfFileName may only be specified once");
- PrintUsage ();
+ Usage ();
return GetUtilityStatus ();
}
break;
default:
Error (NULL, 0, 0, argv[Index], "unrecognized argument");
- PrintUsage ();
+ Usage ();
return GetUtilityStatus ();
break;
}
diff --git a/Tools/CCode/Source/GenSection/GenSection.c b/Tools/CCode/Source/GenSection/GenSection.c
index 3209b1e..e3f173f 100644
--- a/Tools/CCode/Source/GenSection/GenSection.c
+++ b/Tools/CCode/Source/GenSection/GenSection.c
@@ -36,6 +36,9 @@ Abstract:
#define UTILITY_NAME "GenSection"
+#define UTILITY_MAJOR_VERSION 0
+#define UTILITY_MINOR_VERSION 1
+
#define PARAMETER_NOT_SPECIFIED "Parameter not specified"
#define MAXIMUM_INPUT_FILE_NUM 10
@@ -76,15 +79,42 @@ char *GUIDedSectionTypeName[] = { "CRC32" };
EFI_GUID gEfiCrc32SectionGuid = EFI_CRC32_GUIDED_SECTION_EXTRACTION_PROTOCOL_GUID;
static
+void
+Version(
+ void
+ )
+/*++
+
+Routine Description:
+
+ Print out version information for this utility.
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ printf ("%s v%d.%d -Utility to create output file with formed section per the FV spec.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
+}
+
+static
VOID
-PrintUsageMessage (
+Usage (
VOID
)
{
UINTN SectionType;
UINTN DisplayCount;
- printf ("Usage: "UTILITY_NAME " -i InputFile -o OutputFile -s SectionType [SectionType params]\n\n");
+ Version();
+
+ printf ("\nUsage: "UTILITY_NAME " -i InputFile -o OutputFile -s SectionType [SectionType params]\n\n");
printf (" Where SectionType is one of the following section types:\n\n");
DisplayCount = 0;
@@ -659,10 +689,23 @@ Returns:
Status = EFI_SUCCESS;
SetUtilityName (UTILITY_NAME);
+
if (argc == 1) {
- PrintUsageMessage ();
+ 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;
+ }
+
//
// Parse command line
//
@@ -758,7 +801,7 @@ Returns:
Index++;
ParamDigitalSignature = argv[Index];
} else if (strcmpi (argv[Index], "-?") == 0) {
- PrintUsageMessage ();
+ Usage ();
return STATUS_ERROR;
} else {
Error (NULL, 0, 0, argv[Index], "unknown option");
@@ -781,7 +824,7 @@ Returns:
SectionSubType = EFI_STANDARD_COMPRESSION;
} else {
Error (NULL, 0, 0, ParamSectionSubType, "unknown compression type");
- PrintUsageMessage ();
+ Usage ();
return GetUtilityStatus ();
}
} else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_GUID_DEFINED]) == 0) {
@@ -791,7 +834,7 @@ Returns:
SectionSubType = EFI_SECTION_CRC32_GUID_DEFINED;
} else {
Error (NULL, 0, 0, ParamSectionSubType, "unknown GUID defined section type", ParamSectionSubType);
- PrintUsageMessage ();
+ Usage ();
return GetUtilityStatus ();
}
} else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_PE32]) == 0) {
@@ -808,7 +851,7 @@ Returns:
Index = sscanf (ParamVersion, "%d", &VersionNumber);
if (Index != 1 || VersionNumber < 0 || VersionNumber > 65565) {
Error (NULL, 0, 0, ParamVersion, "illegal version number");
- PrintUsageMessage ();
+ Usage ();
return GetUtilityStatus ();
}
@@ -820,7 +863,7 @@ Returns:
InputFileRequired = FALSE;
if (strcmp (AuxString, PARAMETER_NOT_SPECIFIED) == 0) {
Error (NULL, 0, 0, "user interface string not specified", NULL);
- PrintUsageMessage ();
+ Usage ();
return GetUtilityStatus ();
}
} else if (stricmp (ParamSectionType, SectionTypeName[EFI_SECTION_COMPATIBILITY16]) == 0) {
@@ -835,7 +878,7 @@ Returns:
SectionType = EFI_SECTION_PEI_DEPEX;
} else {
Error (NULL, 0, 0, ParamSectionType, "unknown section type");
- PrintUsageMessage ();
+ Usage ();
return GetUtilityStatus ();
}
//
diff --git a/Tools/CCode/Source/GenTEImage/GenTEImage.c b/Tools/CCode/Source/GenTEImage/GenTEImage.c
index 90f3b39..39b8332 100644
--- a/Tools/CCode/Source/GenTEImage/GenTEImage.c
+++ b/Tools/CCode/Source/GenTEImage/GenTEImage.c
@@ -34,7 +34,8 @@ Abstract:
// Version of this utility
//
#define UTILITY_NAME "GenTEImage"
-#define UTILITY_VERSION "v0.11"
+#define UTILITY_MAJOR_VERSION 0
+#define UTILITY_MINOR_VERSION 11
//
// Define the max length of a filename
@@ -86,6 +87,12 @@ static STRING_LOOKUP mSubsystemTypes[] = {
//
static
void
+Version (
+ VOID
+ );
+
+static
+void
Usage (
VOID
);
@@ -669,6 +676,18 @@ Returns:
Usage ();
return STATUS_ERROR;
}
+
+ if ((strcmp(Argv[0], "-h") == 0) || (strcmp(Argv[0], "--help") == 0) ||
+ (strcmp(Argv[0], "-?") == 0) || (strcmp(Argv[0], "/?") == 0)) {
+ Usage();
+ return STATUS_ERROR;
+ }
+
+ if ((strcmp(Argv[0], "-V") == 0) || (strcmp(Argv[0], "--version") == 0)) {
+ Version();
+ return STATUS_ERROR;
+ }
+
//
// Process until no more arguments
//
@@ -734,6 +753,31 @@ Returns:
}
static
+void
+Version(
+ void
+)
+/*++
+
+Routine Description:
+
+ Displays the standard utility information to SDTOUT
+
+Arguments:
+
+ None
+
+Returns:
+
+ None
+
+--*/
+{
+ printf ("%s v%d.%d -Utility to generate a TE image from an EFI PE32 image.\n", UTILITY_NAME, UTILITY_MAJOR_VERSION, UTILITY_MINOR_VERSION);
+ printf ("Copyright (c) 1999-2007 Intel Corporation. All rights reserved.\n");
+}
+
+static
void
Usage (
VOID
@@ -756,19 +800,21 @@ Returns:
{
int Index;
static const char *Msg[] = {
- UTILITY_NAME " version "UTILITY_VERSION " - TE image utility",
- " Generate a TE image from an EFI PE32 image",
- " Usage: "UTILITY_NAME " {-v} {-dump} {-h|-?} {-o OutFileName} InFileName",
+ "\nUsage: "UTILITY_NAME " {-v} {-dump} {-h|-?} {-o OutFileName} InFileName",
" [-e|-b] [FileName(s)]",
" where:",
+ " -h,--help,-?,/? to display help messages",
+ " -V,--version to display version information",
" -v - for verbose output",
" -dump - to dump the input file to a text file",
- " -h -? - for this help information",
" -o OutFileName - to write output to OutFileName rather than InFileName"DEFAULT_OUTPUT_EXTENSION,
" InFileName - name of the input PE32 file",
"",
NULL
};
+
+ Version();
+
for (Index = 0; Msg[Index] != NULL; Index++) {
fprintf (stdout, "%s\n", Msg[Index]);
}
diff --git a/Tools/CCode/Source/ModifyInf/ModifyInf.c b/Tools/CCode/Source/ModifyInf/ModifyInf.c
index 2cab6c1..7115c00 100755
--- a/Tools/CCode/Source/ModifyInf/ModifyInf.c
+++ b/Tools/CCode/Source/ModifyInf/ModifyInf.c
@@ -333,7 +333,7 @@ Returns:
FILE *fpin;
FILE *fpout;
- if (argc < 1) {
+ if (argc == 1) {
Usage();
return -1;
}
diff --git a/Tools/CCode/Source/Strip/Strip.c b/Tools/CCode/Source/Strip/Strip.c
index f7820bc..a7efd54 100644
--- a/Tools/CCode/Source/Strip/Strip.c
+++ b/Tools/CCode/Source/Strip/Strip.c
@@ -108,7 +108,7 @@ Returns:
char *Buffer;
char *Ptrx;
- if (argc < 1) {
+ if (argc == 1) {
Usage();
return -1;
}