+++ /dev/null
-@REM @file\r
-@REM Windows batch file to build BIOS ROM\r
-@REM\r
-@REM Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>\r
-@REM \r
-@REM SPDX-License-Identifier: BSD-2-Clause-Patent\r
-@REM\r
-\r
-@echo off\r
-SetLocal EnableDelayedExpansion EnableExtensions\r
-\r
-set PLATFORM_BIN_PACKAGE=%WORKSPACE%\Vlv2SocBinPkg\r
-if not exist %PLATFORM_BIN_PACKAGE% (\r
- if defined PACKAGES_PATH (\r
- for %%i IN (%PACKAGES_PATH%) DO (\r
- if exist %%~fi\Vlv2SocBinPkg (\r
- set PLATFORM_BIN_PACKAGE=%%~fi\Vlv2SocBinPkg\r
- goto PlatformBinPackageFound\r
- )\r
- )\r
- ) else (\r
- echo.\r
- echo !!! ERROR !!! Cannot find %PLATFORM_NAME% !!!\r
- echo.\r
- goto BldFail\r
- )\r
-)\r
-:PlatformBinPackageFound\r
-\r
-\r
-:: Set script defaults\r
-set exitCode=0\r
-set BackupRom=1\r
-set UpdateVBios=1\r
-set SpiLock=0\r
-set Stitch_Config=Stitch_Config.txt\r
-copy /y nul Stitching.log >nul\r
-\r
-:: Set default Suffix as: YYYY_MM_DD_HHMM\r
-set hour=%time: =0%\r
-reg copy "HKCU\Control Panel\International" "HKCU\Control Panel\International_Temp" /f >nul\r
-reg add "HKCU\Control Panel\International" /v sShortDate /d "yyyy_MM_dd" /f >nul\r
-for /f "tokens=1" %%i in ("%date%") do set today=%%i\r
-reg copy "HKCU\Control Panel\International_Temp" "HKCU\Control Panel\International" /f >nul\r
-reg delete "HKCU\Control Panel\International_Temp" /f >nul\r
-set IFWI_Suffix=%today%_%hour:~0,2%%time:~3,2%\r
-\r
-:: Process input arguments\r
-if "%~1"=="?" goto Usage\r
-if "%~1"=="/?" goto Usage\r
-if /i "%~1"=="Help" goto Usage\r
-\r
-:OptLoop\r
-if /i "%~1"=="/nV" (\r
- set UpdateVBios=0\r
- shift\r
- goto OptLoop\r
-)\r
-if /i "%~1"=="/nB" (\r
- set BackupRom=0\r
- shift\r
- goto OptLoop\r
-)\r
-if /i "%~1"=="/yL" (\r
- set SpiLock=1\r
- shift\r
- goto OptLoop\r
-)\r
-\r
-if /i "%~1"=="/B" (\r
- if "%~2"=="" goto Usage\r
- if not exist %~2 echo BIOS not found. & goto Usage\r
- set BIOS_Names=%~2\r
- set BIOS_File_Name=%~n2\r
- shift & shift\r
- goto OptLoop\r
-)\r
-if /i "%~1"=="/C" (\r
- if "%~2"=="" goto Usage\r
- if not exist %~2 echo ConfigFile not found. & goto Usage\r
- set Stitch_Config=%~2\r
- shift & shift\r
- goto OptLoop\r
-)\r
-if /i "%~1"=="/S" (\r
- if "%~2"=="" goto Usage\r
- set IFWI_Suffix=%~2\r
- shift & shift\r
- goto OptLoop\r
-)\r
-\r
-if "%BIOS_File_Name:~0,4%"=="MNW2" (\r
- set Stitch_Config= MNW2_Stitch_Config.txt\r
-)\r
-if "%BIOS_File_Name:~3,4%"=="MNW2" (\r
- set Stitch_Config= MNW2_Stitch_Config.txt\r
-)\r
-\r
-:: if no rom specified by user, search in ./ for ROM files\r
-if "%BIOS_Names%"=="" (\r
- set "BIOS_Names= "\r
- for /f "tokens=*" %%i in ('dir /b *.rom') do set BIOS_Names=!BIOS_Names! %%i\r
- if "!BIOS_Names!"==" " (\r
- echo NO .ROM files found !!!\r
- goto Usage\r
- )\r
-)\r
-\r
-:: Parse the Stitch_Config File\r
-if not exist %Stitch_Config% (\r
- echo Stitch Configuration File %Stitch_Config% not found.\r
- goto ScriptFail\r
-)\r
-for /f "delims== tokens=1,2" %%i in (%Stitch_Config%) do (\r
- if /i "%%i"=="HEADER" set IFWI_HEADER=%%j\r
- if /i "%%i"=="SEC_VERSION" set SEC_VERSION=%%j\r
- if /i "%%i"=="Source" (\r
- if /i "%%j"=="ALPHA" set Source_Prefix=A_\r
- if /i "%%j"=="BF" set Source_Prefix=BF_\r
- if /i "%%j"=="BE" set Source_Prefix=BE_\r
- if /i "%%j"=="PV" set Source_Prefix=PV_\r
- if /i "%%j"=="PR1" set Source_Prefix=PR1_\r
- )\r
-)\r
-\r
-if %SpiLock% EQU 1 (\r
- set IFWI_HEADER_FILE=IFWIHeader\!IFWI_HEADER!_SPILOCK.bin\r
-) else (\r
- set IFWI_HEADER_FILE=IFWIHeader\!IFWI_HEADER!.bin\r
-)\r
-\r
-:: **********************************************************************\r
-:: The Main Stitching Loop\r
-:: **********************************************************************\r
-echo %date% %time% >>Stitching.log 2>&1\r
-echo %date% %time%\r
-echo.\r
-for %%i in (%BIOS_Names%) do (\r
-\r
- REM ----- Do NOT use :: for comments Inside of code blocks() -------\r
- set BIOS_Rom=%%i\r
- set BIOS_Name=%%~ni\r
- set BIOS_Version=!BIOS_Name:~-7,7!\r
-\r
- REM extract PlatformType from BIOS filename\r
- set Platform_Type=!BIOS_Name:~0,4!\r
-\r
- REM Special treat for BayLake FFD8\r
- set Temp_Name=!BIOS_Name:~0,7!\r
-\r
-\r
- REM Capitalize and validate the Platform_Type\r
- if /i "!Platform_Type!"=="MNW2" (\r
- set Platform_Type=MNW2\r
- ) else (\r
- echo Error - Unsupported PlatformType: !Platform_Type!\r
- goto Usage\r
- )\r
-\r
-\r
- REM search BIOS_Name for Arch substring: either IA32 or X64\r
- if not "!BIOS_Name!"=="!BIOS_Name:_IA32_=!" (\r
- set Arch=IA32\r
- ) else if not "!BIOS_Name!"=="!BIOS_Name:_X64_=!" (\r
- set Arch=X64\r
- ) else (\r
- echo Error: Could not determine Architecture for !BIOS_Rom!\r
- goto Usage\r
- )\r
- set IFWI_Prefix=!Platform_Type!_IFWI_%Source_Prefix%!Arch!_!!BIOS_Version!\r
-\r
- REM search BIOS_Name for Build_Target substring: either R or D\r
- if not "!BIOS_Name!"=="!BIOS_Name:_R_=!" (\r
- set Build_Target=Release\r
- set IFWI_Prefix=!IFWI_Prefix!_R\r
- ) else if not "!BIOS_Name!"=="!BIOS_Name:_D_=!" (\r
- set Build_Target=Debug\r
- set IFWI_Prefix=!IFWI_Prefix!_D\r
- ) else (\r
- echo Error: Could not determine Build Target for !BIOS_Rom!\r
- goto Usage\r
- )\r
-\r
- REM Create a BIOS backup before Stitching\r
- if %BackupRom% EQU 1 (\r
- echo Creating backup of original BIOS rom.\r
- copy /y !BIOS_Rom! !BIOS_Rom!.orig >nul\r
- )\r
-\r
- echo. >>Stitching.log\r
- echo ********** Stitching !BIOS_Rom! ********** >>Stitching.log\r
- echo. >>Stitching.log\r
- echo.\r
- echo Stitching IFWI for !BIOS_Rom! ...\r
- echo ---------------------------------------------------------------------------\r
- echo IFWI Header: !IFWI_HEADER_FILE!, SEC version: !SEC_VERSION!, \r
- echo BIOS Version: !BIOS_Version!\r
-\r
- echo Platform Type: !Platform_Type!, IFWI Prefix: %BIOS_ID%\r
- echo ---------------------------------------------------------------------------\r
-\r
- echo -----------------------------\r
- echo.\r
- echo Generating IFWI... %BIOS_ID%.bin\r
- echo.\r
-\r
- copy /b/y !IFWI_HEADER_FILE! + %PLATFORM_BIN_PACKAGE%\SEC\!SEC_VERSION!\VLV_SEC_REGION.bin + %PLATFORM_BIN_PACKAGE%\SEC\!SEC_VERSION!\Vacant.bin + !BIOS_Rom! %BIOS_ID%.bin\r
- echo.\r
- echo ===========================================================================\r
-)\r
-@echo off\r
-\r
-::**********************************************************************\r
-:: end of main loop\r
-::**********************************************************************\r
-\r
-echo.\r
-echo -- All specified ROM files Stitched. --\r
-echo.\r
-goto Exit\r
-\r
-:Usage\r
-echo.\r
-echo **************************************************************************************************\r
-echo This Script is used to Stitch together BIOS, GOP Driver, Microcode Patch and TXE FW\r
-echo into a single Integrated Firmware Image (IFWI).\r
-echo.\r
-echo Usage: IFWIStitch.bat [flags] [/B BIOS.ROM] [/C Stitch_Config] [/S IFWI_Suffix]\r
-echo.\r
-echo This script has NO Required arguments, so that the user can just double click from the GUI.\r
-echo However, this requires that the BIOS.ROM file name is formatted correctly.\r
-echo.\r
-echo /nG Do NOT update the GOP driver. (applies to all ROM files for this run)\r
-echo /nV Do NOT update the VBIOS. (applies to all ROM files for this run)\r
-echo /nM Do NOT update the Microcode. (applies to all ROM files for this run)\r
-echo /nB Do NOT backup BIOS.ROMs. (Default will backup to BIOS.ROM.Orig)\r
-echo.\r
-echo BIOS.ROM: A single BIOS ROM file to use for stitching\r
-echo (DEFAULT: ALL .ROM files inside the current directory)\r
-echo Stitch_Config: Text file containing version info of each FW component\r
-echo (DEFAULT: Stitch_Config.txt)\r
-echo IFWI_Suffix: Suffix to append to the end of the IFWI filename\r
-echo (DEFAULT: YYYY_MM_DD_HHMM)\r
-echo.\r
-echo Examples:\r
-echo IFIWStitch.bat : Stitch all ROMs with defaults\r
-echo IFIWStitch.bat /B C:/MyRoms/testBIOS.rom : Stitch single ROM with defaults\r
-echo IFIWStitch.bat /B ../testBIOS.rom /S test123 : Stitch single ROM and add custom suffix\r
-echo IFIWStitch.bat /nM /nB /B testBIOS.rom /S test456 : Stitch single ROM, keep uCode from .rom,\r
-echo don't create backup, and add custom suffix.\r
-echo ****************************************************************************************************\r
-pause\r
-exit /b 1\r
-\r
-:ScriptFail\r
-set exitCode=1\r
-\r
-:Exit\r
-echo -- See Stitching.log for more info. --\r
-echo.\r
-echo %date% %time%\r
-echo.\r
-if "%Platform_Type%"=="MNW2" (\r
- echo .\r
-) else (\r
- echo only support MNW2 for this project!\r
-pause\r
-)\r
-exit /b %exitCode%\r
-EndLocal\r