bld_vlv.bat 9.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303
  1. @REM @file
  2. @REM Windows batch file to build BIOS ROM
  3. @REM
  4. @REM Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
  5. @REM SPDX-License-Identifier: BSD-2-Clause-Patent
  6. @REM
  7. @echo off
  8. setlocal EnableDelayedExpansion EnableExtensions
  9. echo.
  10. echo %date% %time%
  11. echo.
  12. ::**********************************************************************
  13. :: Initial Setup
  14. ::**********************************************************************
  15. if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
  16. set /a build_threads=1
  17. set "Build_Flags= "
  18. set exitCode=0
  19. set Arch=X64
  20. set GenLog=FALSE
  21. set GenReport=FALSE
  22. set Clean=FALSE
  23. set PLATFORM_NAME=Vlv2TbltDevicePkg
  24. ::**********************************************************************
  25. :: Detect full path to the edk2 repo
  26. ::**********************************************************************
  27. set CORE_PATH=%WORKSPACE%
  28. if not exist %CORE_PATH%\edksetup.bat (
  29. if defined PACKAGES_PATH (
  30. for %%i IN (%PACKAGES_PATH%) DO (
  31. if exist %%~fi\edksetup.bat (
  32. set CORE_PATH=%%~fi
  33. goto CorePathFound
  34. )
  35. )
  36. ) else (
  37. echo.
  38. echo !!! ERROR !!! Cannot find edksetup.bat !!!
  39. echo.
  40. goto BldFail
  41. )
  42. )
  43. :CorePathFound
  44. ::**********************************************************************
  45. :: Detect full path to the Vlv2TbltDevicePkg
  46. ::**********************************************************************
  47. set PLATFORM_PACKAGE=%WORKSPACE%\%PLATFORM_NAME%
  48. if not exist %PLATFORM_PACKAGE% (
  49. if defined PACKAGES_PATH (
  50. for %%i IN (%PACKAGES_PATH%) DO (
  51. if exist %%~fi\%PLATFORM_NAME% (
  52. set PLATFORM_PACKAGE=%%~fi\%PLATFORM_NAME%
  53. goto PlatformPackageFound
  54. )
  55. )
  56. ) else (
  57. echo.
  58. echo !!! ERROR !!! Cannot find %PLATFORM_NAME% !!!
  59. echo.
  60. goto BldFail
  61. )
  62. )
  63. :PlatformPackageFound
  64. cd %CORE_PATH%
  65. ::**********************************************************************
  66. :: Run edksetup.bat and make sure tools are up to date
  67. ::**********************************************************************
  68. call %CORE_PATH%\edksetup.bat Rebuild
  69. @echo off
  70. ::**********************************************************************
  71. :: Parse command line arguments
  72. ::**********************************************************************
  73. :: Optional arguments
  74. :OptLoop
  75. if /i "%~1"=="/?" goto Usage
  76. if /i "%~1"=="/l" (
  77. set GenLog=TRUE
  78. shift
  79. goto OptLoop
  80. )
  81. if /i "%~1"=="/y" (
  82. set GenReport=TRUE
  83. shift
  84. goto OptLoop
  85. )
  86. if /i "%~1"=="/m" (
  87. if defined NUMBER_OF_PROCESSORS (
  88. set /a build_threads=%NUMBER_OF_PROCESSORS%+1
  89. )
  90. shift
  91. goto OptLoop
  92. )
  93. if /i "%~1" == "/c" (
  94. set Clean=TRUE
  95. shift
  96. goto OptLoop
  97. )
  98. if /i "%~1"=="/x64" (
  99. set Arch=X64
  100. shift
  101. goto OptLoop
  102. )
  103. if /i "%~1"=="/IA32" (
  104. set Arch=IA32
  105. shift
  106. goto OptLoop
  107. )
  108. :: Required argument(s)
  109. if "%~1"=="" goto Usage
  110. if /i "%~2" == "RELEASE" (
  111. set target=RELEASE
  112. ) else (
  113. set target=DEBUG
  114. )
  115. ::**********************************************************************
  116. :: Detect TOOL_CHAIN_TAG
  117. ::**********************************************************************
  118. echo.
  119. echo Setting the Build environment for VS2015/VS2013/VS2012/VS2010/VS2008...
  120. if defined VS140COMNTOOLS (
  121. if not defined VSINSTALLDIR call "%VS140COMNTOOLS%\vsvars32.bat"
  122. if /I "%VS140COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\" (
  123. set TOOL_CHAIN_TAG=VS2015
  124. ) else (
  125. set TOOL_CHAIN_TAG=VS2015x86
  126. )
  127. ) else if defined VS120COMNTOOLS (
  128. if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat"
  129. if /I "%VS120COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" (
  130. set TOOL_CHAIN_TAG=VS2013
  131. ) else (
  132. set TOOL_CHAIN_TAG=VS2013x86
  133. )
  134. ) else if defined VS110COMNTOOLS (
  135. if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"
  136. if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (
  137. set TOOL_CHAIN_TAG=VS2012
  138. ) else (
  139. set TOOL_CHAIN_TAG=VS2012x86
  140. )
  141. ) else if defined VS100COMNTOOLS (
  142. if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"
  143. if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (
  144. set TOOL_CHAIN_TAG=VS2010
  145. ) else (
  146. set TOOL_CHAIN_TAG=VS2010x86
  147. )
  148. ) else if defined VS90COMNTOOLS (
  149. if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
  150. if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
  151. set TOOL_CHAIN_TAG=VS2008
  152. ) else (
  153. set TOOL_CHAIN_TAG=VS2008x86
  154. )
  155. ) else (
  156. echo --ERROR: VS2015/VS2013/VS2012/VS2010/VS2008 not installed correctly. VS140COMNTOOLS/VS120COMNTOOLS/VS110COMNTOOLS/VS100COMNTOOLS/VS90COMNTOOLS not defined ^^!
  157. echo.
  158. goto :BldFail
  159. )
  160. ::**********************************************************************
  161. :: Generate BUILD_PATH and make sure the directory exists
  162. ::**********************************************************************
  163. echo Ensuring correct build directory is present
  164. if not exist %WORKSPACE%\Build mkdir %WORKSPACE%\Build
  165. if not exist %WORKSPACE%\Build\%PLATFORM_NAME%%Arch% mkdir %WORKSPACE%\Build\%PLATFORM_NAME%%Arch%
  166. set BUILD_PATH=%WORKSPACE%\Build\%PLATFORM_NAME%%Arch%\%TARGET%_%TOOL_CHAIN_TAG%
  167. if not exist %BUILD_PATH% mkdir %BUILD_PATH%
  168. ::**********************************************************************
  169. :: Check for clean operation
  170. ::**********************************************************************
  171. if "%Clean%"=="TRUE" (
  172. echo Removing previous build files ...
  173. if exist %BUILD_PATH% (
  174. rmdir /s/q %BUILD_PATH%
  175. )
  176. if exist %WORKSPACE%\Conf\.cache (
  177. rmdir /s/q %WORKSPACE%\Conf\.cache
  178. )
  179. echo.
  180. goto :Exit
  181. )
  182. ::**********************************************************************
  183. :: Generate Build_Flags
  184. ::**********************************************************************
  185. set Build_Flags=%Build_Flags% -b %TARGET%
  186. if "%Arch%"=="IA32" (
  187. set Build_Flags=%Build_Flags% -a IA32
  188. ) else if "%Arch%"=="X64" (
  189. set Build_Flags=%Build_Flags% -a IA32 -a X64
  190. )
  191. set Build_Flags=%Build_Flags% -t %TOOL_CHAIN_TAG%
  192. set Build_Flags=%Build_Flags% -n %build_threads%
  193. set Capsule_Build_Flags=%Build_Flags%
  194. set Build_Flags=%Build_Flags% -p %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc
  195. if "%GenLog%"=="TRUE" (
  196. set Build_Flags=%Build_Flags% -j %BUILD_PATH%\%PLATFORM_NAME%.log
  197. )
  198. if "%GenReport%"=="TRUE" (
  199. set Build_Flags=%Build_Flags% -y %BUILD_PATH%\%PLATFORM_NAME%.report
  200. )
  201. ::**********************************************************************
  202. :: Generate BIOS ID
  203. ::**********************************************************************
  204. echo BOARD_ID = MNW2MAX > %BUILD_PATH%/BiosId.env
  205. echo BOARD_REV = W >> %BUILD_PATH%/BiosId.env
  206. if "%Arch%"=="IA32" (
  207. echo BOARD_EXT = I32 >> %BUILD_PATH%/BiosId.env
  208. )
  209. if "%Arch%"=="X64" (
  210. echo BOARD_EXT = X64 >> %BUILD_PATH%/BiosId.env
  211. )
  212. echo VERSION_MAJOR = 0090 >> %BUILD_PATH%/BiosId.env
  213. if "%TARGET%"=="DEBUG" (
  214. echo BUILD_TYPE = D >> %BUILD_PATH%/BiosId.env
  215. )
  216. if "%TARGET%"=="RELEASE" (
  217. echo BUILD_TYPE = R >> %BUILD_PATH%/BiosId.env
  218. )
  219. echo VERSION_MINOR = 01 >> %BUILD_PATH%/BiosId.env
  220. %WORKSPACE%\edk2-platforms\Platform\Intel\Tools\GenBiosId\GenBiosId.py -i %BUILD_PATH%/BiosId.env -o %BUILD_PATH%/BiosId.bin -ot %BUILD_PATH%/BiosId.txt
  221. ::**********************************************************************
  222. :: Build BIOS
  223. ::**********************************************************************
  224. echo.
  225. echo Invoking EDK2 build...
  226. echo build %Build_Flags%
  227. call build %Build_Flags%
  228. if %ERRORLEVEL% NEQ 0 goto BldFail
  229. copy %BUILD_PATH%\FV\VLV.fd %BUILD_PATH%\FV\Vlv.ROM
  230. ::**********************************************************************
  231. :: Build Capsules
  232. ::**********************************************************************
  233. echo Invoking EDK2 build for capsules...
  234. echo build %Capsule_Build_Flags% -p %PLATFORM_PACKAGE%\PlatformCapsule%Arch%.dsc
  235. call build %Capsule_Build_Flags% -p %PLATFORM_PACKAGE%\PlatformCapsule%Arch%.dsc
  236. goto Exit
  237. :Usage
  238. echo.
  239. echo ***************************************************************************
  240. echo Build BIOS rom for VLV platforms.
  241. echo.
  242. echo Usage: bld_vlv.bat [options] PlatformType [Build Target]
  243. echo.
  244. echo /c CleanAll
  245. echo /l Generate build log file
  246. echo /y Generate build report file
  247. echo /m Enable multi-processor build
  248. echo /IA32 Set Arch to IA32 (default: X64)
  249. echo /X64 Set Arch to X64 (default: X64)
  250. echo.
  251. echo Platform Types: MNW2
  252. echo Build Targets: Debug, Release (default: Debug)
  253. echo.
  254. echo Examples:
  255. echo bld_vlv.bat MNW2 : X64 Debug build for MinnowMax
  256. echo bld_vlv.bat /IA32 MNW2 release : IA32 Release build for MinnowMax
  257. echo.
  258. echo ***************************************************************************
  259. set exitCode=1
  260. goto Exit
  261. :BldFail
  262. set exitCode=1
  263. echo -- Error: EDKII BIOS Build has failed!
  264. echo See EDK2.log for more details
  265. :Exit
  266. echo %date% %time%
  267. exit /b %exitCode%
  268. EndLocal