From e843cdd7d9ed9e72e0df61f46e5a073a0797615e Mon Sep 17 00:00:00 2001 From: eric_tian Date: Tue, 19 Jan 2010 08:28:28 +0000 Subject: [PATCH] 1. update bat file to generate right bootia32.efi/bootx64.efi file according to command line parameters. 2. fix a print error in which a %x in format string exists but the corresponding variable argument is not present! 3. fix CONSUME_MEMORY too small issue. In X64 arch, cpu may cause the paging table is too big and beyond the pei memory scope between EfiMemoryTop and EfimemoryBottom. for example, a cpu support 44bits addressing memory space may occupied ~64M paging table. git-svn-id: https://edk2.svn.sourceforge.net/svnroot/edk2/trunk/edk2@9794 6f19259b-4bc3-4df7-8a09-765794883524 --- DuetPkg/CreateBootDisk.bat | 39 ++++++++++++++++++++++------ DuetPkg/CreateBootDisk.sh | 46 +++++++++++++++++++++++++++------- DuetPkg/DxeIpl/HobGeneration.h | 2 +- DuetPkg/EfiLdr/EfiLoader.c | 2 +- DuetPkg/ReadMe.txt | 20 +++++++++------ 5 files changed, 83 insertions(+), 26 deletions(-) diff --git a/DuetPkg/CreateBootDisk.bat b/DuetPkg/CreateBootDisk.bat index 2272a11dca..e4e1369cd4 100644 --- a/DuetPkg/CreateBootDisk.bat +++ b/DuetPkg/CreateBootDisk.bat @@ -6,17 +6,23 @@ @set BUILD_DIR=%WORKSPACE%\Build\DuetPkg\DEBUG_MYTOOLS @set BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin @set DISK_LABEL=DUET -@echo on +@set PROCESSOR="" +@echo on @if "%1"=="" goto Help @if "%2"=="" goto Help @if "%3"=="" goto Help +@if "%4"=="" goto NoArch @set EFI_BOOT_DISK=%2 +@if "%4"=="IA32" set PROCESSOR=IA32 +@if "%4"=="X64" set PROCESSOR=X64 +@if %PROCESSOR%=="" goto WrongArch @if "%1"=="floppy" goto CreateFloppy @if "%1"=="file" goto CreateFile @if "%1"=="usb" goto CreateUsb @if "%1"=="ide" goto CreateIde + goto Help :CreateFloppy @@ -35,7 +41,8 @@ goto Help @echo Done. copy %BUILD_DIR%\FV\EfiLdr %EFI_BOOT_DISK% mkdir %EFI_BOOT_DISK%\efi\boot -copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\ia32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y +@if "%PROCESSOR%"=="IA32" goto CreateBootFileForIA32 +@if "%PROCESSOR%"=="X64" goto CreateBootFileForX64 @goto end :CreateFile @@ -56,7 +63,7 @@ copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\ia32\Shell.efi %EFI_BOOT_DISK%\efi\ @if "%3"=="FAT12" goto WrongFATType :CreateUsb_FAT16 -@if "%4"=="step2" goto CreateUsb_FAT16_step2 +@if "%5"=="step2" goto CreateUsb_FAT16_step2 @echo Format %EFI_BOOT_DISK% ... @echo.> FormatCommandInput.txt @format /FS:FAT /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL @@ -73,11 +80,12 @@ copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\ia32\Shell.efi %EFI_BOOT_DISK%\efi\ :CreateUsb_FAT16_step2 @copy %BUILD_DIR%\FV\EfiLdr16 %EFI_BOOT_DISK% @mkdir %EFI_BOOT_DISK%\efi\boot -copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\Ia32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y +@if "%PROCESSOR%"=="IA32" goto CreateBootFileForIA32 +@if "%PROCESSOR%"=="X64" goto CreateBootFileForX64 @goto end :CreateUsb_FAT32 -@if "%4"=="step2" goto CreateUsb_FAT32_step2 +@if "%5"=="step2" goto CreateUsb_FAT32_step2 @echo Format %EFI_BOOT_DISK% ... @echo.> FormatCommandInput.txt @format /FS:FAT32 /v:%DISK_LABEL% /q %EFI_BOOT_DISK% < FormatCommandInput.txt > NUL @@ -95,17 +103,34 @@ copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\Ia32\Shell.efi %EFI_BOOT_DISK%\efi\ :CreateUsb_FAT32_step2 @copy %BUILD_DIR%\FV\EfiLdr20 %EFI_BOOT_DISK% @mkdir %EFI_BOOT_DISK%\efi\boot -@copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\ia32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y +@if "%PROCESSOR%"=="IA32" goto CreateBootFileForIA32 +@if "%PROCESSOR%"=="X64" goto CreateBootFileForX64 @goto end :CreateIde @goto end +:CreateBootFileForIA32 +copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\IA32\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootia32.efi /y +@goto end + +:CreateBootFileForX64 +copy %WORKSPACE%\EdkShellBinPkg\MinimumShell\X64\Shell.efi %EFI_BOOT_DISK%\efi\boot\bootx64.efi /y +@goto end + :WrongFATType @echo Wrong FAT type %3 for %1 @goto end +:NoArch +@echo Error! Please specific the architecture. +@goto Help + +:WrongArch +@echo Error! Wrong architecture. +@goto Help + :Help -@echo "Usage: CreateBootDisk [usb|floppy|ide] DiskNumber [FAT12|FAT16|FAT32]" +@echo "Usage: CreateBootDisk [usb|floppy|ide] DiskNumber [FAT12|FAT16|FAT32] [IA32|X64]" :end @echo on \ No newline at end of file diff --git a/DuetPkg/CreateBootDisk.sh b/DuetPkg/CreateBootDisk.sh index fb54a31b0d..bfe1abd83e 100755 --- a/DuetPkg/CreateBootDisk.sh +++ b/DuetPkg/CreateBootDisk.sh @@ -14,8 +14,8 @@ if [ \ "$*" = "--help" \ ] then - echo "Usage: CreateBootDisk [usb|floppy|ide] MediaPath DevicePath [FAT12|FAT16|FAT32]" - echo "e.g. : CreateBootDisk floppy /media/floppy0 /dev/fd0 FAT12 " + echo "Usage: CreateBootDisk [usb|floppy|ide] MediaPath DevicePath [FAT12|FAT16|FAT32] [IA32|X64]" + echo "e.g. : CreateBootDisk floppy /media/floppy0 /dev/fd0 FAT12 IA32" PROCESS_MARK=FALSE fi @@ -44,9 +44,17 @@ then mkdir -p $EFI_BOOT_MEDIA/efi mkdir -p $EFI_BOOT_MEDIA/efi/boot - - cp $WORKSPACE/EdkShellBinPkg/MinimumShell/Ia32/Shell.efi $EFI_BOOT_MEDIA/efi/boot/bootia32.efi - + if [ "$5" = IA32 ] + then + cp $WORKSPACE/EdkShellBinPkg/MinimumShell/Ia32/Shell.efi $EFI_BOOT_MEDIA/efi/boot/bootia32.efi + else + if [ "$5" = X64 ] + then + cp $WORKSPACE/EdkShellBinPkg/MinimumShell/X64/Shell.efi $EFI_BOOT_MEDIA/efi/boot/bootx64.efi + else + echo Wrong Arch! + fi + fi echo Done. else echo "Wrong FAT type $4 for floppy!" @@ -73,11 +81,21 @@ then if [ "$4" = FAT16 ] then - if [ "$5" = step2 ] + if [ "$6" = step2 ] then cp $BUILD_DIR/FV/Efildr16 $EFI_BOOT_MEDIA mkdir $EFI_BOOT_MEDIA/efi/boot - cp $WORKSPACE/EdkShellBinPkg/MinimumShell/ia32/Shell.efi $EFI_BOOT_MEDIA/efi/boot/bootia32.efi + if [ "$5" = IA32 ] + then + cp $WORKSPACE/EdkShellBinPkg/MinimumShell/Ia32/Shell.efi $EFI_BOOT_MEDIA/efi/boot/bootia32.efi + else + if [ "$5" = X64 ] + then + cp $WORKSPACE/EdkShellBinPkg/MinimumShell/X64/Shell.efi $EFI_BOOT_MEDIA/efi/boot/bootx64.efi + else + echo Wrong Arch! + fi + fi echo "step2 Done!" else echo Format $EFI_BOOT_DEVICE ... @@ -93,11 +111,21 @@ then fi elif [ "$4" = FAT32 ] then - if [ "$5" = step2 ] + if [ "$6" = step2 ] then cp $BUILD_DIR/FV/Efildr20 $EFI_BOOT_MEDIA mkdir $EFI_BOOT_MEDIA/efi/boot - cp $WORKSPACE/EdkShellBinPkg/MinimumShell/ia32/Shell.efi $EFI_BOOT_MEDIA/efi/boot/bootia32.efi + if [ "$5" = IA32 ] + then + cp $WORKSPACE/EdkShellBinPkg/MinimumShell/Ia32/Shell.efi $EFI_BOOT_MEDIA/efi/boot/bootia32.efi + else + if [ "$5" = X64 ] + then + cp $WORKSPACE/EdkShellBinPkg/MinimumShell/X64/Shell.efi $EFI_BOOT_MEDIA/efi/boot/bootx64.efi + else + echo Wrong Arch! + fi + fi echo "step2 Done!" else echo Format $EFI_BOOT_DEVICE ... diff --git a/DuetPkg/DxeIpl/HobGeneration.h b/DuetPkg/DxeIpl/HobGeneration.h index 021b3ed501..9123089b73 100644 --- a/DuetPkg/DxeIpl/HobGeneration.h +++ b/DuetPkg/DxeIpl/HobGeneration.h @@ -26,7 +26,7 @@ Revision History: #define EFI_MEMORY_BELOW_1MB_START 0x86000 #define EFI_MEMORY_BELOW_1MB_END 0x9F800 #define EFI_MEMORY_STACK_PAGE_NUM 0x20 -#define CONSUMED_MEMORY 0x2000000 +#define CONSUMED_MEMORY 0x100000 * 80 #define NV_STORAGE_START 0x15000 #define NV_STORAGE_STATE 0x19000 diff --git a/DuetPkg/EfiLdr/EfiLoader.c b/DuetPkg/EfiLdr/EfiLoader.c index c69a97f01f..c036e3f72c 100644 --- a/DuetPkg/EfiLdr/EfiLoader.c +++ b/DuetPkg/EfiLdr/EfiLoader.c @@ -56,7 +56,7 @@ EfiLoader ( PrintHeader ('A'); - AsciiSPrint (PrintBuffer, 256, "Enter DUET Loader ...\n", BiosMemoryMapBaseAddress); + AsciiSPrint (PrintBuffer, 256, "Enter DUET Loader...\n"); PrintString (PrintBuffer); AsciiSPrint (PrintBuffer, 256, "BiosMemoryMapBaseAddress = 0x%x\n", BiosMemoryMapBaseAddress); diff --git a/DuetPkg/ReadMe.txt b/DuetPkg/ReadMe.txt index 173851b5a1..caaa4fbbf1 100644 --- a/DuetPkg/ReadMe.txt +++ b/DuetPkg/ReadMe.txt @@ -36,17 +36,21 @@ Create bootable disk 3.1 Create floppy boot disk 1). enter \DuetPkg directory. 2). Insert a floppy disk to drive - 3). run "CreateBootDisk.bat floppy a: FAT12" if floppy drive is a: disk. - + 3). run "CreateBootDisk.bat floppy a: FAT12 IA32" if floppy drive is a: disk and Arch to boot is IA32. + or + run "CreateBootDisk.bat floppy a: FAT12 X64" if floppy drive is a: disk and Arch to boot is X64. 3.2 Create usb boot disk 1). enter \DuetPkg directory. 2). Plugin usb disk - 3). run "CreateBootDisk.bat usb e: FAT16" if usb drive is e: and FAT format is FAT16 or - "CreateBootDisk.bat usb e: FAT32" if usb drive is e: and FAT format is FAT32 + 3). run "CreateBootDisk.bat usb e: FAT16 IA32" if usb drive is e: and FAT format is FAT16 and Arch to boot is IA32. + or "CreateBootDisk.bat usb e: FAT16 X64" if usb drive is e: and FAT format is FAT16 and Arch to boot is X64. + or "CreateBootDisk.bat usb e: FAT32 IA32" if usb drive is e: and FAT format is FAT32 and Arch to boot is IA32. + or "CreateBootDisk.bat usb e: FAT32 X64" if usb drive is e: and FAT format is FAT32 and Arch to boot is X64. 4). UnPlug usb disk and plugin it again. - 5). run "CreateBootDisk.bat usb e: FAT16 step2" if usb drive is e: and FAT format is FAT16 or - "CreateBootDisk.bat usb e: FAT32 step2" if usb drive is e: and FAT format is FAT32. - + 5). run "CreateBootDisk.bat usb e: FAT16 IA32 step2" if usb drive is e: and FAT format is FAT16 and Arch to boot is IA32. + or "CreateBootDisk.bat usb e: FAT16 X64 step2" if usb drive is e: and FAT format is FAT16 and Arch to boot is X64. + or "CreateBootDisk.bat usb e: FAT32 IA32 step2" if usb drive is e: and FAT format is FAT32 and Arch to boot is IA32. + or "CreateBootDisk.bat usb e: FAT32 X64 step2" if usb drive is e: and FAT format is FAT32 and Arch to boot is X64. B. Build DUET image on Linux Platform ====================================== @@ -98,4 +102,4 @@ B. Build DUET image on Linux Platform 1). enter /R9_tree/DuetPkg directory. 2). Insert a floppy disk to drive 3). run "CreateBootDisk.sh" to build floppy drive - such as "./CreateBootDisk.sh floppy /media/floppy0 /dev/fd0 FAT12" \ No newline at end of file + such as "./CreateBootDisk.sh floppy /media/floppy0 /dev/fd0 FAT12 IA32" \ No newline at end of file -- 2.39.2