DuetPkg: Add POSTBUILD in DSC files to run post-build automatically
[mirror_edk2.git] / DuetPkg / PostBuild.bat
CommitLineData
ea4511d1 1@echo off\r
e4c0074b 2@REM ## @file\r
3@REM #\r
bab82372 4@REM # Post build script that will be automatically run after build.\r
e4c0074b 5@REM #\r
bab82372 6@REM # Copyright (c) 2010 - 2016, Intel Corporation. All rights reserved.<BR>\r
e4c0074b 7@REM #\r
8@REM # This program and the accompanying materials\r
9@REM # are licensed and made available under the terms and conditions of the BSD License\r
10@REM # which accompanies this distribution. The full text of the license may be found at\r
11@REM # http://opensource.org/licenses/bsd-license.php\r
12@REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
13@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
14@REM #\r
15@REM #\r
16@REM ##\r
6d3f7723 17\r
bab82372 18set BASETOOLS_DIR=%EDK_TOOLS_BIN%\r
ea4511d1 19set BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin\r
c5dfb477 20\r
bab82372
HW
21:SetDefault\r
22set TARGET_ARCH=\r
23set TARGET=\r
24set TOOL_CHAIN_TAG=\r
c5dfb477 25\r
bab82372
HW
26:ParseParamsLoop\r
27if "%1"=="" goto EndPParseParamsLoop\r
28if /I "%1"=="-p" goto ParseParamsLoopNext\r
29if /I "%1"=="-a" set TARGET_ARCH=%2& goto ParseParamsLoopNext\r
30if /I "%1"=="-b" set TARGET=%2& goto ParseParamsLoopNext\r
31if /I "%1"=="-t" set TOOL_CHAIN_TAG=%2& goto ParseParamsLoopNext\r
32if /I "%1"=="-h" goto Help\r
33\r
34:ParseParamsLoopNext\r
35shift\r
36shift\r
37goto ParseParamsLoop\r
38\r
39:EndPParseParamsLoop\r
40if "%TARGET_ARCH%"=="" goto Help\r
41if "%TARGET%"=="" goto Help\r
42if "%TOOL_CHAIN_TAG%"=="" goto Help\r
43\r
44set PROCESSOR=%TARGET_ARCH%\r
ea4511d1 45set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\%TARGET%_%TOOL_CHAIN_TAG%\r
ab9cb4b1 46\r
bab82372
HW
47@REM Store environment variables used by CreateBootDisk.bat\r
48echo set TARGET=%TARGET%> %WORKSPACE%\DuetPkg\SetEnv_%PROCESSOR%.bat\r
49echo set TOOL_CHAIN_TAG=%TOOL_CHAIN_TAG%>> %WORKSPACE%\DuetPkg\SetEnv_%PROCESSOR%.bat\r
ab9cb4b1 50\r
ea4511d1
HW
51echo Compressing DUETEFIMainFv.FV ...\r
52%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DUETEFIMAINFV.z %BUILD_DIR%\FV\DUETEFIMAINFV.Fv\r
c5dfb477 53\r
ea4511d1
HW
54echo Compressing DxeMain.efi ...\r
55%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DxeMain.z %BUILD_DIR%\%PROCESSOR%\DxeCore.efi\r
c5dfb477 56\r
ea4511d1
HW
57echo Compressing DxeIpl.efi ...\r
58%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DxeIpl.z %BUILD_DIR%\%PROCESSOR%\DxeIpl.efi\r
c5dfb477 59\r
ea4511d1
HW
60echo Generate Loader Image ...\r
61if "%PROCESSOR%"=="IA32" goto GENERATE_IMAGE_IA32\r
62if "%PROCESSOR%"=="X64" goto GENERATE_IMAGE_X64\r
c5dfb477 63\r
64:GENERATE_IMAGE_IA32\r
ea4511d1
HW
65%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\r
66copy /b %BOOTSECTOR_BIN_DIR%\Start.com+%BOOTSECTOR_BIN_DIR%\Efi32.com2+%BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\FV\Efildr\r
67copy /b %BOOTSECTOR_BIN_DIR%\Start16.com+%BOOTSECTOR_BIN_DIR%\Efi32.com2+%BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\FV\Efildr16\r
68copy /b %BOOTSECTOR_BIN_DIR%\Start32.com+%BOOTSECTOR_BIN_DIR%\Efi32.com2+%BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\FV\Efildr20\r
69goto end\r
c5dfb477 70\r
71:GENERATE_IMAGE_X64\r
ea4511d1
HW
72%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\r
73copy /b %BOOTSECTOR_BIN_DIR%\Start64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\FV\EfildrPure\r
74%BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\EfildrPure -o %BUILD_DIR%\FV\Efildr\r
75copy /b %BOOTSECTOR_BIN_DIR%\St16_64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\FV\Efildr16Pure\r
76%BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\Efildr16Pure -o %BUILD_DIR%\FV\Efildr16\r
77copy /b %BOOTSECTOR_BIN_DIR%\St32_64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\FV\Efildr20Pure\r
78%BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\Efildr20Pure -o %BUILD_DIR%\FV\Efildr20\r
79goto end\r
c5dfb477 80\r
c5dfb477 81:Help\r
bab82372
HW
82echo Usage: This script will be run automatically after build.\r
83:end\r