X-Git-Url: https://git.proxmox.com/?a=blobdiff_plain;f=DuetPkg%2FPostBuild.bat;h=e7f27788acdfc9ef600980f8e59071a9fbe79bab;hb=37431eb1fedbfbfd3b471d5f599aa90c77d97099;hp=6d71aeb1802950b8dbffed947be6be2164690f0a;hpb=b1f700a8593435e2bdc8f9b3dc21bced4774c80f;p=mirror_edk2.git
diff --git a/DuetPkg/PostBuild.bat b/DuetPkg/PostBuild.bat
index 6d71aeb180..e7f27788ac 100644
--- a/DuetPkg/PostBuild.bat
+++ b/DuetPkg/PostBuild.bat
@@ -1,10 +1,9 @@
+@echo off
@REM ## @file
@REM #
-@REM # Currently, Build system does not provide post build mechanism for module
-@REM # and platform building, so just use a bat file to do post build commands.
-@REM # Originally, following post building command is for EfiLoader module.
+@REM # Post build script that will be automatically run after build.
@REM #
-@REM # Copyright (c) 2010, Intel Corporation. All rights reserved.
+@REM # Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.
@REM #
@REM # This program and the accompanying materials
@REM # are licensed and made available under the terms and conditions of the BSD License
@@ -16,57 +15,69 @@
@REM #
@REM ##
-@set BASETOOLS_DIR=%WORKSPACE_TOOLS_PATH%\Bin\Win32
-@set BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin
-@set PROCESSOR=""
+set BASETOOLS_DIR=%EDK_TOOLS_BIN%
+set BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin
-@if "%1"=="" goto NoArch
-@if "%1"=="IA32" set PROCESSOR=IA32
-@if "%1"=="X64" set PROCESSOR=X64
-@if %PROCESSOR%=="" goto WrongArch
+:SetDefault
+set TARGET_ARCH=
+set TARGET=
+set TOOL_CHAIN_TAG=
-@set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\DEBUG_MYTOOLS
+:ParseParamsLoop
+if "%1"=="" goto EndPParseParamsLoop
+if /I "%1"=="-p" goto ParseParamsLoopNext
+if /I "%1"=="-a" set TARGET_ARCH=%2& goto ParseParamsLoopNext
+if /I "%1"=="-b" set TARGET=%2& goto ParseParamsLoopNext
+if /I "%1"=="-t" set TOOL_CHAIN_TAG=%2& goto ParseParamsLoopNext
+if /I "%1"=="-h" goto Help
+:ParseParamsLoopNext
+shift
+shift
+goto ParseParamsLoop
-@echo Compressing DUETEFIMainFv.FV ...
-@%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DUETEFIMAINFV.z %BUILD_DIR%\FV\DUETEFIMAINFV.Fv
+:EndPParseParamsLoop
+if "%TARGET_ARCH%"=="" goto Help
+if "%TARGET%"=="" goto Help
+if "%TOOL_CHAIN_TAG%"=="" goto Help
-@echo Compressing DxeMain.efi ...
-@%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DxeMain.z %BUILD_DIR%\%PROCESSOR%\DxeCore.efi
+set PROCESSOR=%TARGET_ARCH%
+set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\%TARGET%_%TOOL_CHAIN_TAG%
-@echo Compressing DxeIpl.efi ...
-@%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DxeIpl.z %BUILD_DIR%\%PROCESSOR%\DxeIpl.efi
+@REM Store environment variables used by CreateBootDisk.bat
+echo set TARGET=%TARGET%> %WORKSPACE%\DuetPkg\SetEnv_%PROCESSOR%.bat
+echo set TOOL_CHAIN_TAG=%TOOL_CHAIN_TAG%>> %WORKSPACE%\DuetPkg\SetEnv_%PROCESSOR%.bat
-@echo Generate Loader Image ...
-@if "%PROCESSOR%"=="IA32" goto GENERATE_IMAGE_IA32
-@if "%PROCESSOR%"=="X64" goto GENERATE_IMAGE_X64
+echo Compressing DUETEFIMainFv.FV ...
+%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DUETEFIMAINFV.z %BUILD_DIR%\FV\DUETEFIMAINFV.Fv
-:GENERATE_IMAGE_IA32
-@%BASETOOLS_DIR%\EfiLdrImage.exe -o %BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\%PROCESSOR%\EfiLoader.efi %BUILD_DIR%\FV\DxeIpl.z %BUILD_DIR%\FV\DxeMain.z %BUILD_DIR%\FV\DUETEFIMAINFV.z
-@copy /b %BOOTSECTOR_BIN_DIR%\Start.com+%BOOTSECTOR_BIN_DIR%\Efi32.com2+%BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\FV\Efildr
-@copy /b %BOOTSECTOR_BIN_DIR%\Start16.com+%BOOTSECTOR_BIN_DIR%\Efi32.com2+%BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\FV\Efildr16
-@copy /b %BOOTSECTOR_BIN_DIR%\Start32.com+%BOOTSECTOR_BIN_DIR%\Efi32.com2+%BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\FV\Efildr20
-@goto end
+echo Compressing DxeMain.efi ...
+%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DxeMain.z %BUILD_DIR%\%PROCESSOR%\DxeCore.efi
-:GENERATE_IMAGE_X64
-@%BASETOOLS_DIR%\EfiLdrImage.exe -o %BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\%PROCESSOR%\EfiLoader.efi %BUILD_DIR%\FV\DxeIpl.z %BUILD_DIR%\FV\DxeMain.z %BUILD_DIR%\FV\DUETEFIMAINFV.z
-@copy /b %BOOTSECTOR_BIN_DIR%\Start64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\FV\EfildrPure
-@%BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\EfildrPure -o %BUILD_DIR%\FV\Efildr
-@copy /b %BOOTSECTOR_BIN_DIR%\St16_64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\FV\Efildr16Pure
-@%BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\Efildr16Pure -o %BUILD_DIR%\FV\Efildr16
-@copy /b %BOOTSECTOR_BIN_DIR%\St32_64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\FV\Efildr20Pure
-@%BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\Efildr20Pure -o %BUILD_DIR%\FV\Efildr20
-@goto end
+echo Compressing DxeIpl.efi ...
+%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DxeIpl.z %BUILD_DIR%\%PROCESSOR%\DxeIpl.efi
+echo Generate Loader Image ...
+if "%PROCESSOR%"=="IA32" goto GENERATE_IMAGE_IA32
+if "%PROCESSOR%"=="X64" goto GENERATE_IMAGE_X64
-:NoArch
-@echo Error! Please specific the architecture.
-@goto Help
+:GENERATE_IMAGE_IA32
+%BASETOOLS_DIR%\EfiLdrImage.exe -o %BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\%PROCESSOR%\EfiLoader.efi %BUILD_DIR%\FV\DxeIpl.z %BUILD_DIR%\FV\DxeMain.z %BUILD_DIR%\FV\DUETEFIMAINFV.z
+copy /b %BOOTSECTOR_BIN_DIR%\Start.com+%BOOTSECTOR_BIN_DIR%\Efi32.com2+%BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\FV\Efildr
+copy /b %BOOTSECTOR_BIN_DIR%\Start16.com+%BOOTSECTOR_BIN_DIR%\Efi32.com2+%BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\FV\Efildr16
+copy /b %BOOTSECTOR_BIN_DIR%\Start32.com+%BOOTSECTOR_BIN_DIR%\Efi32.com2+%BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\FV\Efildr20
+goto end
-:WrongArch
-@echo Error! Wrong architecture.
-@goto Help
+:GENERATE_IMAGE_X64
+%BASETOOLS_DIR%\EfiLdrImage.exe -o %BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\%PROCESSOR%\EfiLoader.efi %BUILD_DIR%\FV\DxeIpl.z %BUILD_DIR%\FV\DxeMain.z %BUILD_DIR%\FV\DUETEFIMAINFV.z
+copy /b %BOOTSECTOR_BIN_DIR%\Start64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\FV\EfildrPure
+%BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\EfildrPure -o %BUILD_DIR%\FV\Efildr
+copy /b %BOOTSECTOR_BIN_DIR%\St16_64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\FV\Efildr16Pure
+%BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\Efildr16Pure -o %BUILD_DIR%\FV\Efildr16
+copy /b %BOOTSECTOR_BIN_DIR%\St32_64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\FV\Efildr20Pure
+%BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\Efildr20Pure -o %BUILD_DIR%\FV\Efildr20
+goto end
:Help
-@echo Usage: "PostBuild [IA32|X64]"
-:end
\ No newline at end of file
+echo Usage: This script will be run automatically after build.
+:end