blob: bdcafb864ffccf17c1005b53d1c754974a4457cd [file] [log] [blame]
klu2e4c00742010-03-10 01:23:13 +00001@REM ## @file
2@REM #
3@REM # Currently, Build system does not provide post build mechanism for module
4@REM # and platform building, so just use a bat file to do post build commands.
5@REM # Originally, following post building command is for EfiLoader module.
6@REM #
niruiyu7708d082011-07-01 04:48:45 +00007@REM # Copyright (c) 2010 - 2011, Intel Corporation. All rights reserved.<BR>
klu2e4c00742010-03-10 01:23:13 +00008@REM #
9@REM # This program and the accompanying materials
10@REM # are licensed and made available under the terms and conditions of the BSD License
11@REM # which accompanies this distribution. The full text of the license may be found at
12@REM # http://opensource.org/licenses/bsd-license.php
13@REM # THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
14@REM # WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
15@REM #
16@REM #
17@REM ##
klu252ce3fa2008-04-25 02:59:16 +000018
klu29fe0e262008-10-29 06:49:52 +000019@set BASETOOLS_DIR=%WORKSPACE_TOOLS_PATH%\Bin\Win32
klu2e88f3052009-06-22 03:01:53 +000020@set BOOTSECTOR_BIN_DIR=%WORKSPACE%\DuetPkg\BootSector\bin
klu2c5dfb472008-05-08 06:22:31 +000021@set PROCESSOR=""
niruiyu7708d082011-07-01 04:48:45 +000022@call %WORKSPACE%\DuetPkg\GetVariables.bat
klu252ce3fa2008-04-25 02:59:16 +000023
niruiyu7708d082011-07-01 04:48:45 +000024@if NOT "%1"=="" @set TARGET_ARCH=%1
25@if "%TARGET_ARCH%"=="IA32" set PROCESSOR=IA32
26@if "%TARGET_ARCH%"=="X64" set PROCESSOR=X64
klu2c5dfb472008-05-08 06:22:31 +000027@if %PROCESSOR%=="" goto WrongArch
klu26d3f7722008-05-07 05:11:29 +000028
niruiyu7708d082011-07-01 04:48:45 +000029@set BUILD_DIR=%WORKSPACE%\Build\DuetPkg%PROCESSOR%\%TARGET%_%TOOL_CHAIN_TAG%
klu2ab9cb4b2010-03-18 02:36:52 +000030
31
klu2c5dfb472008-05-08 06:22:31 +000032@echo Compressing DUETEFIMainFv.FV ...
gikidy8b854122009-05-06 03:44:47 +000033@%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DUETEFIMAINFV.z %BUILD_DIR%\FV\DUETEFIMAINFV.Fv
klu2c5dfb472008-05-08 06:22:31 +000034
35@echo Compressing DxeMain.efi ...
gikidy8b854122009-05-06 03:44:47 +000036@%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DxeMain.z %BUILD_DIR%\%PROCESSOR%\DxeCore.efi
klu2c5dfb472008-05-08 06:22:31 +000037
38@echo Compressing DxeIpl.efi ...
gikidy8b854122009-05-06 03:44:47 +000039@%BASETOOLS_DIR%\LzmaCompress -e -o %BUILD_DIR%\FV\DxeIpl.z %BUILD_DIR%\%PROCESSOR%\DxeIpl.efi
klu2c5dfb472008-05-08 06:22:31 +000040
41@echo Generate Loader Image ...
42@if "%PROCESSOR%"=="IA32" goto GENERATE_IMAGE_IA32
43@if "%PROCESSOR%"=="X64" goto GENERATE_IMAGE_X64
44
45:GENERATE_IMAGE_IA32
46@%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
klu2e88f3052009-06-22 03:01:53 +000047@copy /b %BOOTSECTOR_BIN_DIR%\Start.com+%BOOTSECTOR_BIN_DIR%\Efi32.com2+%BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\FV\Efildr
48@copy /b %BOOTSECTOR_BIN_DIR%\Start16.com+%BOOTSECTOR_BIN_DIR%\Efi32.com2+%BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\FV\Efildr16
49@copy /b %BOOTSECTOR_BIN_DIR%\Start32.com+%BOOTSECTOR_BIN_DIR%\Efi32.com2+%BUILD_DIR%\FV\Efildr32 %BUILD_DIR%\FV\Efildr20
klu2c5dfb472008-05-08 06:22:31 +000050@goto end
51
52:GENERATE_IMAGE_X64
53@%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
klu2e88f3052009-06-22 03:01:53 +000054@copy /b %BOOTSECTOR_BIN_DIR%\Start64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\FV\EfildrPure
klu2c5dfb472008-05-08 06:22:31 +000055@%BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\EfildrPure -o %BUILD_DIR%\FV\Efildr
klu2e88f3052009-06-22 03:01:53 +000056@copy /b %BOOTSECTOR_BIN_DIR%\St16_64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\FV\Efildr16Pure
klu2c5dfb472008-05-08 06:22:31 +000057@%BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\Efildr16Pure -o %BUILD_DIR%\FV\Efildr16
klu2e88f3052009-06-22 03:01:53 +000058@copy /b %BOOTSECTOR_BIN_DIR%\St32_64.com+%BOOTSECTOR_BIN_DIR%\Efi64.com2+%BUILD_DIR%\FV\Efildr64 %BUILD_DIR%\FV\Efildr20Pure
klu2c5dfb472008-05-08 06:22:31 +000059@%BASETOOLS_DIR%\GenPage.exe %BUILD_DIR%\FV\Efildr20Pure -o %BUILD_DIR%\FV\Efildr20
60@goto end
61
62
klu2c5dfb472008-05-08 06:22:31 +000063:WrongArch
64@echo Error! Wrong architecture.
65@goto Help
66
67:Help
68@echo Usage: "PostBuild [IA32|X64]"
69:end