mirror of https://github.com/acidanthera/audk.git
Update so Windows build works like Cygwin buid
git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9940 6f19259b-4bc3-4df7-8a09-765794883524
This commit is contained in:
parent
e18fa16721
commit
3aa4215f72
|
@ -255,7 +255,7 @@ PrepareConfigurationHeader (
|
||||||
// Open data file
|
// Open data file
|
||||||
DataFile = fopen(gDataFile, "rb");
|
DataFile = fopen(gDataFile, "rb");
|
||||||
if (DataFile == NULL) {
|
if (DataFile == NULL) {
|
||||||
fprintf(stderr, "Can't open data file %s.\n", gOutputImageFile);
|
fprintf(stderr, "Can't open data file %s.\n", gDataFile);
|
||||||
exit(1);
|
exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -394,7 +394,6 @@ main (
|
||||||
default:
|
default:
|
||||||
abort ();
|
abort ();
|
||||||
}
|
}
|
||||||
printf ("\n%d(%x) - %s %s", i, TwoArg, argv[i], TwoArg ? argv[i+1] : &argv[i][2]);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -26,6 +26,16 @@ typedef struct {
|
||||||
char *Replace;
|
char *Replace;
|
||||||
} MATCH_PAIR;
|
} MATCH_PAIR;
|
||||||
|
|
||||||
|
void
|
||||||
|
Usage (char *Name)
|
||||||
|
{
|
||||||
|
printf ("\n%s OldFile NewFile MatchString ReplaceString [MatchString2 ReplaceString2]*\n", Name);
|
||||||
|
printf (" OldFile - Must be arg[1] File to search for MatchStrings\n");
|
||||||
|
printf (" NewFile - Must be arg[2] File where MatchString has been replaced with ReplaceString\n");
|
||||||
|
printf (" MatchString & ReplaceString. Required arguments.\n");
|
||||||
|
printf (" More MatchString/ReplaceString pairs are supported.\n");
|
||||||
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// argv[1] - Old File
|
// argv[1] - Old File
|
||||||
// argv[2] - New File
|
// argv[2] - New File
|
||||||
|
@ -44,10 +54,11 @@ main (int argc, char **argv)
|
||||||
int Found;
|
int Found;
|
||||||
|
|
||||||
if (argc < 5) {
|
if (argc < 5) {
|
||||||
// Need at least two files and two strings
|
fprintf (stderr, "Need at least two files and one Match/Replacement string pair\n");
|
||||||
|
Usage (argv[0]);
|
||||||
return -1;
|
return -1;
|
||||||
} else if ((argc % 2) == 0) {
|
} else if ((argc % 2) == 0) {
|
||||||
// Match and Replace string must come in pairs
|
fprintf (stderr, "Match and Replace string must come in pairs\n");
|
||||||
return -4;
|
return -4;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,6 +66,7 @@ main (int argc, char **argv)
|
||||||
fseek (In, 0, SEEK_END);
|
fseek (In, 0, SEEK_END);
|
||||||
InFileSize = ftell (In);
|
InFileSize = ftell (In);
|
||||||
if (InFileSize == 0) {
|
if (InFileSize == 0) {
|
||||||
|
fprintf (stderr, "Could not open %s\n", argv[1]);
|
||||||
return -6;
|
return -6;
|
||||||
}
|
}
|
||||||
fseek (In, 0, SEEK_SET);
|
fseek (In, 0, SEEK_SET);
|
||||||
|
@ -62,11 +74,11 @@ main (int argc, char **argv)
|
||||||
|
|
||||||
Out = fopen (argv[2], "w+");
|
Out = fopen (argv[2], "w+");
|
||||||
if ((In == NULL) || (Out == NULL)) {
|
if ((In == NULL) || (Out == NULL)) {
|
||||||
|
fprintf (stderr, "Could not open %s\n", argv[2]);
|
||||||
return -2;
|
return -2;
|
||||||
}
|
}
|
||||||
|
|
||||||
MaxMatch = (argc - 2)/2;
|
MaxMatch = (argc - 2)/2;
|
||||||
printf ("\nMaxMatch = %d:%d\n", MaxMatch, argc);
|
|
||||||
Match = calloc (MaxMatch, sizeof (MATCH_PAIR));
|
Match = calloc (MaxMatch, sizeof (MATCH_PAIR));
|
||||||
if (Match == NULL) {
|
if (Match == NULL) {
|
||||||
return -7;
|
return -7;
|
||||||
|
@ -76,7 +88,6 @@ main (int argc, char **argv)
|
||||||
Match[n].Match = argv[3 + n*2];
|
Match[n].Match = argv[3 + n*2];
|
||||||
Match[n].MatchSize = strlen (argv[3 + n*2]);
|
Match[n].MatchSize = strlen (argv[3 + n*2]);
|
||||||
Match[n].Replace = argv[3 + n*2 + 1];
|
Match[n].Replace = argv[3 + n*2 + 1];
|
||||||
printf ("%s > %s\n", Match[n].Match, Match[n].Replace);
|
|
||||||
if (Match[n].MatchSize > MaxLenKey) {
|
if (Match[n].MatchSize > MaxLenKey) {
|
||||||
// Max size of match/replace string pair
|
// Max size of match/replace string pair
|
||||||
MaxLenKey = Match[n].MatchSize;
|
MaxLenKey = Match[n].MatchSize;
|
||||||
|
@ -91,6 +102,13 @@ printf ("%s > %s\n", Match[n].Match, Match[n].Replace);
|
||||||
return -5;
|
return -5;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Search for a match by reading every possition of the file
|
||||||
|
// into a buffer that is as big as the maximum search key size.
|
||||||
|
// Then we can search the keys for a match. If no match
|
||||||
|
// copy the old file character to the new file. If it is a match
|
||||||
|
// then copy the replacement string into the output file.
|
||||||
|
// This code assumes the file system is smart and caches the
|
||||||
|
// file in a buffer. So all the reads don't really hit the disk.
|
||||||
InFilePos = 0;
|
InFilePos = 0;
|
||||||
while (InFilePos < (InFileSize - MinLenKey)) {
|
while (InFilePos < (InFileSize - MinLenKey)) {
|
||||||
fseek (In, InFilePos, SEEK_SET);
|
fseek (In, InFilePos, SEEK_SET);
|
||||||
|
@ -98,9 +116,7 @@ printf ("%s > %s\n", Match[n].Match, Match[n].Replace);
|
||||||
for (i = 0, Found = FALSE;i < MaxMatch; i++) {
|
for (i = 0, Found = FALSE;i < MaxMatch; i++) {
|
||||||
if (ReadCount >= Match[i].MatchSize) {
|
if (ReadCount >= Match[i].MatchSize) {
|
||||||
if (!memcmp (Key, Match[i].Match, Match[i].MatchSize)) {
|
if (!memcmp (Key, Match[i].Match, Match[i].MatchSize)) {
|
||||||
printf ("Found [%s] @ %u\n", Match[i].Match, InFilePos);
|
|
||||||
InFilePos += (Match[i].MatchSize - 1);
|
InFilePos += (Match[i].MatchSize - 1);
|
||||||
printf ("InFilePos = %u", InFilePos);
|
|
||||||
fputs (Match[i].Replace, Out);
|
fputs (Match[i].Replace, Out);
|
||||||
Found = TRUE;
|
Found = TRUE;
|
||||||
break;
|
break;
|
||||||
|
@ -114,10 +130,17 @@ printf ("%s > %s\n", Match[n].Match, Match[n].Replace);
|
||||||
InFilePos++;
|
InFilePos++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// We stoped searching when we got to the point that we could no longer match.
|
||||||
|
// So the last few bytes of the file are not copied in the privous loop
|
||||||
|
fseek (In, InFilePos, SEEK_SET);
|
||||||
|
while ((c = fgetc (In)) != EOF) {
|
||||||
|
fputc (c, Out);
|
||||||
|
}
|
||||||
|
|
||||||
fclose (In);
|
fclose (In);
|
||||||
fclose (Out);
|
fclose (Out);
|
||||||
free (Key);
|
free (Key);
|
||||||
|
free (Match);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -15,19 +15,23 @@
|
||||||
@REM b release clean
|
@REM b release clean
|
||||||
@REM b -v -y build.log
|
@REM b -v -y build.log
|
||||||
|
|
||||||
|
ECHO OFF
|
||||||
|
@REM Setup Build environment. Sets WORKSPACE and puts build in path
|
||||||
CALL ..\edksetup.bat
|
CALL ..\edksetup.bat
|
||||||
|
|
||||||
|
@REM Set for tools chain. Currently RVCT31
|
||||||
SET TARGET_TOOLS=RVCT31
|
SET TARGET_TOOLS=RVCT31
|
||||||
SET TARGET=DEBUG
|
SET TARGET=DEBUG
|
||||||
|
|
||||||
@if /I "%1"=="RELEASE" (
|
@if /I "%1"=="RELEASE" (
|
||||||
|
@REM If 1st argument is release set TARGET to RELEASE and shift arguments to remove it
|
||||||
SET TARGET=RELEASE
|
SET TARGET=RELEASE
|
||||||
shift /1
|
shift /1
|
||||||
)
|
)
|
||||||
|
|
||||||
SET BUILD_ROOT=%WORKSPACE%\Build\BeagleBoard\%TARGET%_%TARGET_TOOLS%
|
SET BUILD_ROOT=%WORKSPACE%\Build\BeagleBoard\%TARGET%_%TARGET_TOOLS%
|
||||||
BUILD_ROOT=$WORKSPACE/Build/BeagleBoard/"$TARGET"_"$TARGET_TOOLS"
|
|
||||||
|
|
||||||
|
@REM Build the Beagle Board firmware and creat an FD (FLASH Device) Image.
|
||||||
CALL build -p BeagleBoardPkg\BeagleBoardPkg.dsc -a ARM -t RVCT31 -b %TARGET% %1 %2 %3 %4 %5 %6 %7 %8
|
CALL build -p BeagleBoardPkg\BeagleBoardPkg.dsc -a ARM -t RVCT31 -b %TARGET% %1 %2 %3 %4 %5 %6 %7 %8
|
||||||
|
|
||||||
@if /I "%1"=="CLEAN" goto Clean
|
@if /I "%1"=="CLEAN" goto Clean
|
||||||
|
@ -45,12 +49,12 @@ ECHO Building tools...
|
||||||
CALL nmake
|
CALL nmake
|
||||||
|
|
||||||
ECHO Patching image with ConfigurationHeader.dat
|
ECHO Patching image with ConfigurationHeader.dat
|
||||||
CALL GenerateImage -D ConfigurationHeader.dat -E 0x80008208 -I ../../Build/FV/BEAGLEBOARD_EFI.fd -O ../../Build/FV/BeagleBoard_EFI_flashboot.fd
|
CALL GenerateImage -D ..\ConfigurationHeader.dat -E 0x80008208 -I %BUILD_ROOT%\FV\BEAGLEBOARD_EFI.fd -O %BUILD_ROOT%\FV\BeagleBoard_EFI_flashboot.fd
|
||||||
|
|
||||||
ECHO Patching ..\Debugger_scripts ...
|
ECHO Patching ..\Debugger_scripts ...
|
||||||
SET DEBUGGER_SCRIPT=..\Debugger_scripts
|
SET DEBUGGER_SCRIPT=..\Debugger_scripts
|
||||||
for /f %%a IN ('dir /b %DEBUGGER_SCRIPT%\*.inc %DEBUGGER_SCRIPT%\*.cmm') do (
|
@for /f %%a IN ('dir /b %DEBUGGER_SCRIPT%\*.inc %DEBUGGER_SCRIPT%\*.cmm') do (
|
||||||
CALL replace %DEBUGGER_SCRIPT%\%%a %BUILD_ROOT%\%%a ZZZZZZ %BUILD_ROOT% WWWWWW %WORKSPACE%
|
@CALL replace %DEBUGGER_SCRIPT%\%%a %BUILD_ROOT%\%%a ZZZZZZ %BUILD_ROOT% WWWWWW %WORKSPACE%
|
||||||
)
|
)
|
||||||
|
|
||||||
cd ..
|
cd ..
|
||||||
|
|
Loading…
Reference in New Issue