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