]> git.proxmox.com Git - mirror_edk2.git/blob - DuetPkg/PostBuild.bat
28cab6b665ac4e5c426df60cebb5e23aa2574420
[mirror_edk2.git] / DuetPkg / PostBuild.bat
1 @echo off
2 @REM ## @file
3 @REM #
4 @REM # Currently, Build system does not provide post build mechanism for module
5 @REM # and platform building, so just use a bat file to do post build commands.
6 @REM # Originally, following post building command is for EfiLoader module.
7 @REM #
8 @REM # Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
9 @REM #
10 @REM # This program and the accompanying materials
11 @REM # are licensed and made available under the terms and conditions of the BSD License
12 @REM # which accompanies this distribution. The full text of the license may be found at
13 @REM # http://opensource.org/licenses/bsd-license.php
14 @REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
15 @REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
16 @REM #
17 @REM #
18 @REM ##
19
20 set BASETOOLS_DIR=%WORKSPACE_TOOLS_PATH%\Bin\Win32
21 set BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin
22 set PROCESSOR=""
23 call %WORKSPACE%\DuetPkg\GetVariables.bat
24
25 if NOT "%1"=="" @set TARGET_ARCH=%1
26 if "%TARGET_ARCH%"=="IA32" set PROCESSOR=IA32
27 if "%TARGET_ARCH%"=="X64" set PROCESSOR=X64
28 if %PROCESSOR%=="" goto WrongArch
29
30 set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\%TARGET%_%TOOL_CHAIN_TAG%
31
32
33 echo Compressing DUETEFIMainFv.FV ...
34 %BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DUETEFIMAINFV.z %BUILD_DIR%\FV\DUETEFIMAINFV.Fv
35
36 echo Compressing DxeMain.efi ...
37 %BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DxeMain.z %BUILD_DIR%\%PROCESSOR%\DxeCore.efi
38
39 echo Compressing DxeIpl.efi ...
40 %BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DxeIpl.z %BUILD_DIR%\%PROCESSOR%\DxeIpl.efi
41
42 echo Generate Loader Image ...
43 if "%PROCESSOR%"=="IA32" goto GENERATE_IMAGE_IA32
44 if "%PROCESSOR%"=="X64" goto GENERATE_IMAGE_X64
45
46 :GENERATE_IMAGE_IA32
47 %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
48 copy /b %BOOTSECTOR_BIN_DIR%\Start.com+%BOOTSECTOR_BIN_DIR%\Efi32.com2+%BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\FV\Efildr
49 copy /b %BOOTSECTOR_BIN_DIR%\Start16.com+%BOOTSECTOR_BIN_DIR%\Efi32.com2+%BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\FV\Efildr16
50 copy /b %BOOTSECTOR_BIN_DIR%\Start32.com+%BOOTSECTOR_BIN_DIR%\Efi32.com2+%BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\FV\Efildr20
51 goto end
52
53 :GENERATE_IMAGE_X64
54 %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
55 copy /b %BOOTSECTOR_BIN_DIR%\Start64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\FV\EfildrPure
56 %BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\EfildrPure -o %BUILD_DIR%\FV\Efildr
57 copy /b %BOOTSECTOR_BIN_DIR%\St16_64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\FV\Efildr16Pure
58 %BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\Efildr16Pure -o %BUILD_DIR%\FV\Efildr16
59 copy /b %BOOTSECTOR_BIN_DIR%\St32_64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\FV\Efildr20Pure
60 %BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\Efildr20Pure -o %BUILD_DIR%\FV\Efildr20
61 goto end
62
63
64 :WrongArch
65 echo Error! Wrong architecture.
66 goto Help
67
68 :Help
69 echo Usage: "PostBuild [IA32|X64]"
70 :end