public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: lushifex <shifeix.a.lu@intel.com>
To: edk2-devel@lists.01.org
Cc: david.wei@intel.com;
Subject: [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Build script.
Date: Mon, 30 Oct 2017 09:58:51 +0800	[thread overview]
Message-ID: <ec57d042-ac96-4271-9fca-6272992570e9@SHWDEOPENPSI011.local> (raw)

Enhance build script.

Contributed-under: TianoCore Contribution Agreement 1.0
Signed-off-by: Jarlstrom, Laurie <laurie.jarlstrom@intel.com>
Signed-off-by: lushifex <shifeix.a.lu@intel.com>
---
 BuildBIOS.bat                                | 104 +----
 BuildBIOS.sh                                 |  28 +-
 Platform/BroxtonPlatformPkg/BuildBios.bat    | 613 ---------------------------
 Platform/BroxtonPlatformPkg/BuildBios.sh     | 333 ---------------
 Platform/BroxtonPlatformPkg/BuildBxtBios.bat | 612 ++++++++++++++++++++++++++
 Platform/BroxtonPlatformPkg/BuildBxtBios.sh  | 333 +++++++++++++++
 Platform/BroxtonPlatformPkg/BuildIFWI.bat    |  12 +-
 Platform/BroxtonPlatformPkg/BuildIFWI.sh     |  16 +-
 8 files changed, 1003 insertions(+), 1048 deletions(-)
 delete mode 100644 Platform/BroxtonPlatformPkg/BuildBios.bat
 delete mode 100644 Platform/BroxtonPlatformPkg/BuildBios.sh
 create mode 100644 Platform/BroxtonPlatformPkg/BuildBxtBios.bat
 create mode 100644 Platform/BroxtonPlatformPkg/BuildBxtBios.sh

diff --git a/BuildBIOS.bat b/BuildBIOS.bat
index baf7cdd..7b2394f 100644
--- a/BuildBIOS.bat
+++ b/BuildBIOS.bat
@@ -1,18 +1,12 @@
 @echo off
 echo %date%  %time%
 echo.
+setlocal EnableDelayedExpansion EnableExtensions
 
 set exitCode=0
-set WORKSPACE=%CD%
-set CORE_PATH=%CD%
 set BuildFlags=
-set PlatformName=
-set BuildTarget=Debug
-set Compiler=/vs13
-set Arch=/x64
-set FabId=/B
-set BoardId=/MN
-set buildthread=
+
+set thisscript=%0
 
 :: Optional arguments
 :OptLoop
@@ -20,82 +14,15 @@ set buildthread=
 if /i "%~1"=="" goto Usage
 if /i "%~1"=="/?" goto Usage
 
-if /i "%~1"=="/IA32" (
-    set Arch=/IA32
-    shift
-    goto OptLoop
-)
-
-if /i "%~1"=="/x64" (
-    set Arch=/x64
-    shift
-    goto OptLoop
-)
-
-if /i "%~1"=="/vs08" (
-    set Compiler=/vs08
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/vs10" (
-    set Compiler=/vs10
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/vs12" (
-    set Compiler=/vs12
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/vs13" (
-    set Compiler=/vs13
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/vs15" (
-    set Compiler=/vs15
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/A" (
-    set FabId=/A
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/B" (
-    set FabId=/B
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/MN" (
-    set BoardId=/MN
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/BG" (
-    set BoardId=/BG
-    echo.
-    shift
-    goto OptLoop
-)
-
-if /i "%~1"=="/m" (
-    set buildthread=/m
-    echo.
+set BuildOption=%~1
+if "!BuildOption:~0,1!"=="/" (
+    set BuildFlags=%BuildFlags% %BuildOption%
     shift
     goto OptLoop
 )
 
 :: Required argument(s)
-:: Require 2 input parameters
+:: Require 2 input parameters , first parameter without a "/" is Platform Name
 if "%~2"=="" goto Usage
 
 :: Assign required arguments
@@ -104,17 +31,26 @@ set BuildTarget=%~2
 
 :OptLoopEnd
 echo ---- Call Build Script of Broxton ----
-echo calling : Platform\%PlatformName%PlatformPkg\BuildIFWI.bat %buildthread% %Compiler% %Arch% %BoardId% %FabId% /fspw %BuildFlags% MINN %BuildTarget% 
-call Platform\%PlatformName%PlatformPkg\BuildIFWI.bat %buildthread% %Compiler% %Arch% %BoardId% %FabId% /fspw %BuildFlags% MINN %BuildTarget% 
+
+if not exist Platform\%PlatformName%PlatformPkg\BuildIFWI.bat (
+  echo Platform %PlatformName%PlatformPkg does not exist
+  echo. & echo Error - Unsupported Platform name: %1 
+  echo.
+  goto Usage
+)
+
+echo calling : Platform\%PlatformName%PlatformPkg\BuildIFWI.bat  %BuildFlags%  /fspw MINN %BuildTarget% 
+call Platform\%PlatformName%PlatformPkg\BuildIFWI.bat  %BuildFlags%  /fspw MINN %BuildTarget% 
 
 goto Exit
 
 :Usage
-echo Usage: BuildBIOS.bat [options] ^<PlatformName^> ^<BuildTarget^>
+echo Usage: %thisscript% [options] ^<PlatformName^> ^<BuildTarget^>
 echo.
 echo Options:
 echo.       /?    Display this help text
 echo.
+echo        /m     Set the build thread count to number of processors
 echo        /vs13  Set Compiler to vs2013 build (default: vs2013)
 echo        /x64   Set Arch to X64  (default: X64)
 echo        /IA32  Set Arch to IA32 (default: X64)
@@ -126,7 +62,7 @@ echo        PlatformName:  Broxton
 echo        BuildTargets:  Release, Debug
 
 echo Examples:
-echo    BuildBIOS.bat /vs13 /B /x64 Broxton Debug
+echo    %thisscript% /vs13 /B /x64 Broxton Debug
 
 set exitCode=1
 
diff --git a/BuildBIOS.sh b/BuildBIOS.sh
index aea8daa..5ea0dd8 100755
--- a/BuildBIOS.sh
+++ b/BuildBIOS.sh
@@ -16,7 +16,7 @@ function Usage () {
   echo
   echo "Script to build BIOS firmware and stitch the entire IFWI."
   echo
-  echo "Usage: BuildBIOS.sh Build_Flags [PlatformName]  Target_Flag"
+  echo "Usage: BuildBios.sh Build_Flags [PlatformName]  Target_Flag"
   echo
   echo "       Build_Flags:                 /MN    Minnow3 Board (default: MN)"
   echo "       Build_Flags:                 /BG    Benson Glacier Board"
@@ -51,7 +51,11 @@ fi
 ## Build Flags
 for (( i=1; i<=$#; ))
   do
-    if [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/BG" ]; then
+    if [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/MN" ]; then
+      BoardId=MN
+      Build_Flags="$Build_Flags /MN"
+      shift
+    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/BG" ]; then
       BoardId=BG
       Build_Flags="$Build_Flags /BG"
       shift
@@ -68,14 +72,22 @@ for (( i=1; i<=$#; ))
     fi
   done
 
-Target_Flag=Release
+if [ "$1" == "Broxton" ]; then
+       shift
+ else
+   echo "No parameter for board : assume Broxton"  
+fi
+
+Target_Flag=Debug
+
 if [ "$1" == "Debug" ]; then
   Target_Flag=Debug
-  shift
-fi
-if [ "$1" == "Release" ]; then
+elif [ "$1" == "Release" ]; then
   Target_Flag=Release
-  shift
+else
+  echo "Error - Invalid Target"
+  echo "  Please review the Help screen"
+  Usage
 fi
 
 echo $Build_Flags
@@ -84,7 +96,7 @@ echo $Target_Flag
 export WORKSPACE=`pwd`
 export PACKAGES_PATH=$WORKSPACE:$WORKSPACE/Core:$WORKSPACE/Silicon/:$WORKSPACE/Platform:$WORKSPACE/Platform/BroxtonPlatformPkg:$WORKSPACE/Silicon/BroxtonSoC:$WORKSPACE/Platform/BroxtonPlatformPkg/Common
 
-. edksetup.sh
+. edksetup.sh BaseTools
 
 make -C BaseTools
 
diff --git a/Platform/BroxtonPlatformPkg/BuildBios.bat b/Platform/BroxtonPlatformPkg/BuildBios.bat
deleted file mode 100644
index 04fe6cc..0000000
--- a/Platform/BroxtonPlatformPkg/BuildBios.bat
+++ /dev/null
@@ -1,613 +0,0 @@
-@echo off
-::echo on
-setlocal EnableDelayedExpansion EnableExtensions
-echo.
-echo %date%  %time%
-echo.
-
-::**********************************************************************
-:: Initial Setup
-::**********************************************************************
-set WORKSPACE=%CD%
-if %WORKSPACE:~-1%==\ (
-  set WORKSPACE=%WORKSPACE:~0,-1%
-)
-set CORE_PATH=%WORKSPACE%\Core
-set PLATFORM_PATH=Platform\BroxtonPlatformPkg
-set SILICON_PATH=Silicon\BroxtonSoC
-set AslPath=%WORKSPACE%\%PLATFORM_PATH%\Common\Tools\Iasl\iasl.exe
-set PACKAGES_PATH=%CORE_PATH%;%WORKSPACE%\Silicon\;%WORKSPACE%\Platform;%WORKSPACE%\%PLATFORM_PATH%;%WORKSPACE%\%SILICON_PATH%;%WORKSPACE%\%PLATFORM_PATH%\Common ;
-set EDK_TOOLS_BIN=%WORKSPACE%\BaseTools\Bin\Win32
-set /a build_threads=1
-set "Nasm_Flags=-D ARCH_IA32 -D DEBUG_PORT80"
-set "Build_Flags= "
-set exitCode=0
-set Arch=X64
-set Compiler=VS2013
-set FabId=B
-set BoardId=MN
-if not defined BiosVersion set BiosVersion=DEV
-
-
-:: Clean up previous build files.
-echo Clean up old build files...
-if exist %WORKSPACE%\edk2.log                  del %WORKSPACE%\edk2.log
-if exist %WORKSPACE%\unitool.log               del %WORKSPACE%\unitool.log
-if exist %WORKSPACE%\Conf\target.txt           del %WORKSPACE%\Conf\target.txt
-if exist %WORKSPACE%\Conf\tools_def.txt        del %WORKSPACE%\Conf\tools_def.txt
-if exist %WORKSPACE%\Conf\build_rule.txt       del %WORKSPACE%\Conf\build_rule.txt
-if exist %WORKSPACE%\Conf\FrameworkDatabase.db del %WORKSPACE%\Conf\FrameworkDatabase.db
-if exist %WORKSPACE%\Stitch\*.bin              del %WORKSPACE%\Stitch\*.bin
-if exist conf\.cache rmdir /q/s conf\.cache
-
-
-:: Override tools_def.txt
-echo Creating Conf folder and build config files...
-if not exist %WORKSPACE%\Conf md %WORKSPACE%\Conf
-copy /y %CORE_PATH%\BaseTools\Conf\*.template %WORKSPACE%\Conf\*.txt
-copy /y %WORKSPACE%\%PLATFORM_PATH%\DeviceCommonPkg\Override\BaseTools\Conf\tools_def.template %WORKSPACE%\Conf\tools_def.txt
-
-:: Setup EDK environment. Edksetup puts new copies of target.txt, tools_def.txt, build_rule.txt in WorkSpace\Conf
-:: Also run edksetup as soon as possible to avoid it from changing environment variables we're overriding
-set "VCINSTALLDIR="
-set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
-call edksetup.bat
-@echo off
-
-set Minnow_RVP=MINN
-
-:: Initialize all the build flags to FALSE
-:: Then based on the cmd line input, some will be set to TRUE prior to building.
-:: Note: These variable names match the actual Build Macro names in DSC for clarity.
-set ENBDT_PF_BUILD=FALSE
-set SrcDebug=FALSE
-set APLK_SETUP_ENABLE_BUILD=FALSE
-set FSP_BUILD=FALSE
-set FSP_WRAPPER=FALSE
-
-:: Set Defaults of platform specific environment variables.
-set EFI_SOURCE=%CD%
-set EDK_SOURCE=%CD%
-set PLATFORM_NAME=BxtPlatformPkg
-set PLATFORM_PACKAGE=%PLATFORM_PATH%\BxtPlatformPkg
-set PLATFORM_RC_PACKAGE=Silicon\BroxtonSoC\BroxtonSiPkg
-set COMMON_PLATFORM_PACKAGE=%PLATFORM_PATH%\BxtPlatformPkg
-set FSP_BIN_PKG_NAME=BroxtonFspBinPkg
-set STITCH_PATH=%WORKSPACE%\%PLATFORM_PATH%\Common\Tools\Stitch
-
-PATH=%PATH%;%WORKSPACE%\%PLATFORM_PATH%\Common\Tools\GenBiosId;%WORKSPACE%\%PLATFORM_PATH%\Common\Tools\nasm\Win32
-PATH=%PATH%;%WORKSPACE%\%PLATFORM_PATH%\Common\Tools\FCE;%WORKSPACE%\%PLATFORM_PATH%\Common\Tools\nasm\Win32
-
-::**********************************************************************
-:: Parse command line arguments
-::**********************************************************************
-
-:: Optional arguments
-:OptLoop
-if /i "%~1"=="" goto Usage
-if /i "%~1"=="/?" goto Usage
-
-if /i "%~1"=="/l" (
-    set Build_Flags=%Build_Flags% -j EDK2.log
-    shift
-    goto OptLoop
-)
-if /i "%~1" == "/c" (
-    echo Removing previous Build files...
-    if exist build (
-        del /f/s/q build > nul
-        rmdir /s/q build
-    )
-    if exist Conf\.cache (
-        del /f/s/q Conf\.cache > nul
-        rmdir /s/q Conf\.cache
-    )
-    echo.
-    shift
-    goto OptLoop
-)
-
-if /i "%~1"=="/ia32" (
-    set Arch=IA32
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/x64" (
-    set Arch=X64
-    shift
-    goto OptLoop
-)
-
-if /i "%~1"=="/vs08" (
-    set Compiler=VS2008
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/vs10" (
-    set Compiler=VS2010
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/vs12" (
-    set Compiler=VS2012
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/vs13" (
-    set Compiler=VS2013
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/vs15" (
-    set Compiler=VS2015
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/FspW" (
-    set FSP_WRAPPER=TRUE
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/A" (
-    set FabId=A
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/B" (
-    set FabId=B
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/MN" (
-    set BoardId=MN
-    echo.
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/BG" (
-    set BoardId=BG
-    echo.
-    shift
-    goto OptLoop
-)
-
-if /i "%~1"=="/m" (
-    if defined NUMBER_OF_PROCESSORS (
-        set /a build_threads=%NUMBER_OF_PROCESSORS%
-    )
-    shift
-    goto OptLoop
-)
-
-:: Required argument(s)
-if "%~2"=="" (
-   echo. & echo -- ERROR: Not Enough Arguments Provided
-   echo -- Please review the Help screen "/?" -- & echo.
-   goto ExitFail
-)
-
-echo. & echo -- Setting compiler to %Compiler% -- & echo.
-
-:: BOARD_ID needs to be exactly 7 characters (GenBiosId.exe limitation)
-echo Setting  %1  platform configuration and BIOS ID...
-if /i "%~1" == "%Minnow_RVP%" (
-  if %BoardId%==MN (
-    set BOARD_ID=MINNOW3
-  ) else if %BoardId%==BG (
-    set BOARD_ID=BENSONV
-  )
-    set ENBDT_PF_BUILD=TRUE
-    set PLATFORM_NAME=BroxtonPlatformPkg
-    set PLATFORM_PACKAGE=%PLATFORM_PATH%
-    set APLK_SETUP_ENABLE_BUILD=TRUE
-) else (
-    echo. & echo Error - Unsupported PlatformType: %1
-    echo Please review the Help screen "/?" & echo.
-    goto ExitFail
-)
-set Platform_Type=%~1
-
-::
-:: Tack on BIOS Version
-::
-
-::**********************************************************************
-:: Additional EDK Build Setup/Configuration
-::**********************************************************************
-
-::Setup DefineAtBuildMacros config file
-set Build_Macros=.\%PLATFORM_PACKAGE%\DefineAtBuildMacros.dsc
-copy /y nul %Build_Macros% >nul
-
-::output platform specific build macros to DefineAtBuildMacros.dsc
-echo DEFINE ENBDT_PF_BUILD          = %ENBDT_PF_BUILD%          >> %Build_Macros%
-
-echo DEFINE APLK_SETUP_ENABLE_BUILD = %APLK_SETUP_ENABLE_BUILD% >> %Build_Macros%
-
-if "%Arch%"=="IA32" (
-    echo DEFINE X64_CONFIG              = FALSE                     >> %Build_Macros%
-) else if "%Arch%"=="X64" (
-    echo DEFINE X64_CONFIG              = TRUE                      >> %Build_Macros%
-)
-
-::Stage of copy of BiosId.env in Conf/ with Platform_Type and Build_Target values removed
-
-if "%Arch%"=="X64" (
-    findstr /b /v "BOARD_ID BUILD_TYPE BOARD_REV" %PLATFORM_PACKAGE%\BiosId.env > Conf\BiosId.env
-) else if "%Arch%"=="IA32" (
-    findstr /b /v "BOARD_ID BUILD_TYPE BOARD_REV BOARD_EXT" %PLATFORM_PACKAGE%\BiosId.env > Conf\BiosId.env
-    echo BOARD_EXT = I32 >> Conf\BiosId.env
-)
-
-if /i "%~2" == "RELEASE" (
-    set target=RELEASE
-    echo BUILD_TYPE = R >> Conf\BiosId.env
-) else (
-    set target=DEBUG
-    echo BUILD_TYPE = D >> Conf\BiosId.env
-)
-
-if %BoardId%==BG (
-  echo BOARD_REV = A >> Conf\BiosId.env
-)
-
-if %BoardId%==MN (
-  if %FabId%==B (
-    echo BOARD_REV = B >> Conf\BiosId.env
-  ) else (
-    echo BOARD_REV = A >> Conf\BiosId.env
-  )
-)
-
-:: Set the Build_Type, Version_Major, and Version_Minor environment variables
-find /v "#" Conf\BiosId.env > ver_strings
-for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
-del /f/q ver_strings >nul
-:: Do this after parsing "ver_strings"
-echo BOARD_ID = %BOARD_ID% >> Conf\BiosId.env
-
-echo.
-echo Setting the Build environment for Visual Studio...
-if "%Compiler%"=="VS2008" (
-  if defined VS90COMNTOOLS (
-     call "%VS90COMNTOOLS%\vsvars32.bat" >nul
-     if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
-      set TOOL_CHAIN_TAG=VS2008
-     ) else  set TOOL_CHAIN_TAG=VS2008x86
-  ) else (
-    echo  --ERROR: VS2008 not installed correctly. VS90COMNTOOLS not defined ^^!
-    goto BldFail
-  )
-) else if "%Compiler%"=="VS2010" (
-  if defined VS100COMNTOOLS (
-     call "%VS100COMNTOOLS%\vsvars32.bat" >nul
-     if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (
-        set TOOL_CHAIN_TAG=VS2010
-     ) else  set TOOL_CHAIN_TAG=VS2010x86
-  ) else (
-     echo  --ERROR: VS2010 not installed correctly. VS100COMNTOOLS not defined ^^!
-     goto BldFail
-  )
-) else if "%Compiler%"=="VS2012" (
-  if defined VS110COMNTOOLS (
-     call "%VS110COMNTOOLS%\vsvars32.bat" >nul
-     if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (
-        set TOOL_CHAIN_TAG=VS2012
-     ) else  set TOOL_CHAIN_TAG=VS2012x86
-  ) else (
-     echo  --ERROR: VS2012 not installed correctly. VS110COMNTOOLS not defined ^^!
-     goto BldFail
-  )
-) else if "%Compiler%"=="VS2013" (
-  if defined VS120COMNTOOLS (
-     call "%VS120COMNTOOLS%\vsvars32.bat" >nul
-     if /I "%VS120COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" (
-        set TOOL_CHAIN_TAG=VS2013
-     ) else  set TOOL_CHAIN_TAG=VS2013x86
-  ) else (
-     echo  --ERROR: VS2013 not installed correctly. VS120COMNTOOLS not defined ^^!
-     echo           See help ^(/?^) for how specify a different VS version.
-     goto BldFail
-  )
-) else if "%Compiler%"=="VS2015" (
-  if defined VS140COMNTOOLS (
-     call "%VS140COMNTOOLS%\vsvars32.bat" >nul
-     if /I "%VS140COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\" (
-        set TOOL_CHAIN_TAG=VS2015
-     ) else  set TOOL_CHAIN_TAG=VS2015x86
-
-  ) else (
-     echo  --ERROR: VS2015 not installed correctly. VS140COMNTOOLS not defined ^^!
-     echo           See help ^(/?^) for how specify a different VS version.
-     goto BldFail
-  )
-)
-
-::**********************************************************************
-:: Build BIOS
-::**********************************************************************
-
-echo Setup build directory for GenBiosId...
-set BUILD_PATH=Build\%PLATFORM_NAME%\%TARGET%_%TOOL_CHAIN_TAG%
-if not exist %BUILD_PATH%\IA32  mkdir %BUILD_PATH%\IA32
-
-echo Creating BiosId...
-GenBiosId.exe -i Conf\BiosId.env -o %BUILD_PATH%\IA32\BiosId.bin -ob Conf\BiosId.bat
-if "%Arch%"=="X64" (
-   if not exist %BUILD_PATH%\X64  mkdir %BUILD_PATH%\X64
-   GenBiosId.exe -i Conf\BiosId.env -o %BUILD_PATH%\X64\BiosId.bin -ob Conf\BiosId.bat
-) else if "%Arch%"=="IA32" (
-   if not exist %BUILD_PATH%\IA32  mkdir %BUILD_PATH%\IA32
-   GenBiosId.exe -i Conf\BiosId.env -o %BUILD_PATH%\IA32\BiosId.bin -ob Conf\BiosId.bat
-)
-
-if ErrorLevel 1 goto BldFail
-
-echo Building ResetVector...
-
-set ResetVectorPath=%WORKSPACE%\%PLATFORM_RC_PACKAGE%\Cpu\ResetVector
-
-pushd %ResetVectorPath%\Vtf0
-  nasm.exe %Nasm_Flags% -o Bin\ResetVector.ia32.port80.raw ResetVectorCode.asm
-  python %CORE_PATH%\UefiCpuPkg\ResetVector\Vtf0\Tools\FixupForRawSection.py Bin\ResetVector.ia32.port80.raw
-popd
-
-pushd %ResetVectorPath%\Vtf1
-  nasm.exe %Nasm_Flags% -o Bin\ResetVector.ia32.port80.raw ResetVectorCode.asm
-  python %CORE_PATH%\UefiCpuPkg\ResetVector\Vtf0\Tools\FixupForRawSection.py Bin\ResetVector.ia32.port80.raw
-popd
-
-:: SaveWorkSpace w/a is needed when using subst for Workspace builds (eg. R:/)
-set SaveWorkSpace=%WORKSPACE%
-set WORKSPACE=%CD%
-if "%Arch%"=="X64" (
-set ActivePlatform=%PLATFORM_PACKAGE%\PlatformPkgX64.dsc
-) else if "%Arch%"=="IA32" (
-set ActivePlatform=%PLATFORM_PACKAGE%\PlatformPkgIA32.dsc
-)
-
-echo Modifying Conf files for this build...
-:: Remove lines with these tags from target.txt
-findstr /V "TARGET  TARGET_ARCH  TOOL_CHAIN_TAG  ACTIVE_PLATFORM  MAX_CONCURRENT_THREAD_NUMBER" Conf\target.txt > Conf\target.txt.tmp
-
-if "%Arch%"=="IA32" (
-    echo TARGET_ARCH = IA32                                  >> Conf\target.txt.tmp
-) else if "%Arch%"=="X64" (
-    echo TARGET_ARCH = IA32 X64                              >> Conf\target.txt.tmp
-)
-echo TARGET          = %TARGET%                              >> Conf\target.txt.tmp
-echo TOOL_CHAIN_TAG  = %TOOL_CHAIN_TAG%                      >> Conf\target.txt.tmp
-echo ACTIVE_PLATFORM = %ActivePlatform%                      >> Conf\target.txt.tmp
-echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads%          >> Conf\target.txt.tmp
-
-move /Y Conf\target.txt.tmp Conf\target.txt >nul
-echo *_VS2008x86_*_ASL_PATH = %AslPath% >> Conf\tools_def.txt
-echo *_VS2010x86_*_ASL_PATH = %AslPath% >> Conf\tools_def.txt
-echo *_VS2012x86_*_ASL_PATH = %AslPath% >> Conf\tools_def.txt
-echo *_VS2013x86_*_ASL_PATH = %AslPath% >> Conf\tools_def.txt
-echo *_VS2015x86_*_ASL_PATH = %AslPath% >> Conf\tools_def.txt
-
-echo.
-echo Invoking normal EDK2 build...
-build %Build_Flags%
-if ErrorLevel 1 goto BldFail
-
-set WORKSPACE=%SaveWorkSpace%
-
-::**********************************************************************
-:: Post Build processing and cleanup
-::**********************************************************************
-echo Create FlashMap.h...
-
-set PLAT_INIT_PRE_MEM=PlatformPreMemPei
-
-set AutoGenPath=%BUILD_PATH%\IA32\BroxtonPlatformPkg\Common\PlatformSettings\PlatformPreMemPei\%PLAT_INIT_PRE_MEM%\DEBUG\AutoGen.h
-
-if not exist "%AutoGenPath%" (
-  echo ERROR: Couldn't find %AutoGenPath% so we can generate FlashMap.h
-  goto BldFail
-)
-findstr /L "_PCD_VALUE_" %AutoGenPath% > %STITCH_PATH%\FlashMap.h
-
-echo Running FCE...
-copy /b %BUILD_PATH%\FV\FvIBBM.fv + /b %BUILD_PATH%\FV\Soc.fd /b %BUILD_PATH%\FV\Temp.fd
-:: Extract Hii data from build and store a copy in HiiDefaultData.txt
-:: UQI 0006 005C 0078 0030 0031 0030 0031 is for question prompt(STR_IPU_ENABLED)
-:: First 0006 is the length of string; Next six byte values are mapped to STR_IPU_ENABLED string value defined in Platform\BroxtonPlatformPkg\Common\PlatformSettings\PlatformSetupDxe\VfrStrings.uni.
-fce.exe read -i %BUILD_PATH%\FV\Temp.fd 0006 005C 0078 0030 0031 0030 0031 > %BUILD_PATH%\FV\HiiDefaultData.txt 2>>EDK2.log
-:: Generate the Setup variable and save changes to BxtXXX.fd
-:: B73FE497-B92E-416e-8326-45AD0D270091 is the GUID of IBBM FV
-fce.exe update -i %BUILD_PATH%\FV\Temp.fd -s %BUILD_PATH%\FV\HiiDefaultData.txt -o %BUILD_PATH%\FV\Bxt%Arch%.fd  -g B73FE497-B92E-416e-8326-45AD0D270091 -a 1>>EDK2.log 2>&1
-split -f %BUILD_PATH%\FV\Bxt%Arch%.fd -s 0x35000 -o %BUILD_PATH%\FV\FvIBBM.fv
-
-if ErrorLevel 1 goto BldFail
-
-@echo off
-
-:: Translate Release Build Type
-if "%BUILD_TYPE%"=="R" set BUILD_TYPE=R
-
-echo Copy BIOS...
-set BIOS_Name=%BOARD_ID%%BOARD_REV%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%
-copy /y/b %BUILD_PATH%\FV\Soc.fd          %STITCH_PATH%\%BIOS_Name%.ROM >nul
-copy /y   %STITCH_PATH%\FlashMap.h        %STITCH_PATH%\%BIOS_Name%.map >nul
-
-set Storage_Folder=%STITCH_PATH%\%BIOS_Name%
-if not exist %Storage_Folder%  mkdir %Storage_Folder%
-
-copy /y/b %BUILD_PATH%\FV\FvIBBL.fv  %Storage_Folder% >nul
-copy /y/b %BUILD_PATH%\FV\FvIBBM.fv  %Storage_Folder% >nul
-copy /y/b %BUILD_PATH%\FV\FvIBBR.fv  %Storage_Folder% >nul
-copy /y/b %BUILD_PATH%\FV\FvOBB.fv   %Storage_Folder% >nul
-copy /y/b %BUILD_PATH%\FV\FvOBBX.fv  %Storage_Folder% >nul
-copy /y/b %BUILD_PATH%\FV\FvOBBY.fv  %Storage_Folder% >nul
-
-if /i "%FSP_WRAPPER%" == "TRUE" (
-::  0xFEF7A000 = gIntelFsp2WrapperTokenSpaceGuid.PcdFlashFvFspBase = $(CAR_BASE_ADDRESS) + $(BLD_RAM_DATA_SIZE) + $(FSP_RAM_DATA_SIZE) + $(FSP_EMP_DATA_SIZE) + $(BLD_IBBM_SIZE)
-    pushd  %WORKSPACE%\Silicon\BroxtonSoC\BroxtonFspPkg\ApolloLakeFspBinPkg\FspBin
-    python %WORKSPACE%\Core\IntelFsp2Pkg\Tools\SplitFspBin.py rebase -f Fsp.fd -c m -b 0xFEF7A000 -o .\ -n ApolloLakeFsp.fd
-    python %WORKSPACE%\Core\IntelFsp2Pkg\Tools\SplitFspBin.py split -f ApolloLakeFsp.fd -o .\ -n FSP.Fv
-    popd
-    copy /y/b %WORKSPACE%\Silicon\BroxtonSoC\BroxtonFspPkg\ApolloLakeFspBinPkg\FspBin\FSP_T.Fv %Storage_Folder%\FSP_T.Fv
-    copy /y/b %WORKSPACE%\Silicon\BroxtonSoC\BroxtonFspPkg\ApolloLakeFspBinPkg\FspBin\FSP_M.Fv %Storage_Folder%\FSP_M.Fv
-    copy /y/b %WORKSPACE%\Silicon\BroxtonSoC\BroxtonFspPkg\ApolloLakeFspBinPkg\FspBin\FSP_S.Fv %Storage_Folder%\FSP_S.Fv
-)
-
-echo Get NvStorage Base and Size...
-if not exist "%STITCH_PATH%\FlashMap.h" (
-  echo ERROR: Couldn't find %STITCH_PATH%\FlashMap.h
-  goto BldFail
-)
-
-::generate NvStorage.Fv
-::      %STITCH_PATH%\FlashMap.h has the information for the magic numbers below. Parse it.
-::        You'll need to account for both hex (0x000000) and int (1234567U) value types
-::        FLASH_REGION_VPD_OFFSET
-::          _PCD_VALUE_PcdFlashNvStorageBase - _PCD_VALUE_PcdFlashBaseAddress
-::        FLASH_REGION_VPD_SIZE + FLASH_REGION_NVSTORAGE_SUBREGION_NV_FTW_WORKING_SIZE + FLASH_REGION_NVSTORAGE_SUBREGION_NV_FTW_SPARE_SIZE
-::          _PCD_VALUE_PcdFlashNvStorageSize
-::
-::                     PCD to find                      Variable      File to search
-::===========================================================================================
-  call :FindPcdInFile _PCD_VALUE_PcdFlashNvStorageBase NvStorageBase "%STITCH_PATH%\FlashMap.h"
-  call :FindPcdInFile _PCD_VALUE_PcdFlashBaseAddress   BaseAddress   "%STITCH_PATH%\FlashMap.h"
-  call :FindPcdInFile _PCD_VALUE_PcdFlashNvStorageSize NvStorageSize "%STITCH_PATH%\FlashMap.h"
-:: Find image offset as opposed to memory offset
-  PowerShell ($env:NvStorageBase - $env:BaseAddress) > temp.pcd
-  set /p VpdOffset=<temp.pcd
-  del /f /q temp.pcd
-:: Force the variables we care about into DEC string format
-  set VpdSize=%NvStorageSize%
-  call :ForceToDec VpdOffset
-  call :ForceToDec VpdSize
-:: Dump what we found
-  echo - NvStorageBase = %NvStorageBase%
-  echo - BaseAddress   = %BaseAddress%
-  echo - NvStorageSize = %NvStorageSize%
-  echo - VpdOffset     = %VpdOffset%
-  echo - VpdSize       = %VpdSize%
-
-:: Create NvStorage.fv
-  echo Create NvStorage.fv...
-  pushd %STITCH_PATH%
-    REM This -s offset must equal the decimal value of  FLASH_REGION_VPD_OFFSET  in the Platform.fdf
-    Split.exe -f %STITCH_PATH%\%BIOS_Name%.ROM -s %VpdOffset% -o temp1.bin -t temp2.bin
-    REM This -s offset must equal the decimal value of
-    REM  FLASH_REGION_VPD_SIZE + FLASH_REGION_NVSTORAGE_SUBREGION_NV_FTW_WORKING_SIZE + FLASH_REGION_NVSTORAGE_SUBREGION_NV_FTW_SPARE_SIZE
-    Split.exe -f temp2.bin -s %VpdSize% -o %Storage_Folder%\NvStorage.Fv -t temp3.bin
-    del /F/Q temp1.bin temp2.bin temp3.bin
-  popd
-
-echo.
-echo Build location:     %BUILD_PATH%
-echo BIOS ROM Created:   %BIOS_Name%
-echo.
-echo --------------- The EDKII BIOS build has successfully completed. ---------------
-echo.
-goto Exit
-
-::
-:: Find PCD value (%~1) in a file (%~3) and return it in a variable (%~2) as a HEX string
-::
-:: USAGE: call :FindPcdInFile PCD Variable File
-:FindPcdInFile
-  call :GetPcd "%~1" "%~2" "%~3"
-  call :ForceToHex "%~2"
-goto :EOF
-
-::
-:: Find PCD value (%~1) in a file (%~3) and return it in a variable (%~2)
-::
-:: USAGE: call :GetPcd PCD Variable File
-:GetPcd
-  set _TargetFile=%~3
-  if not exist "%_TargetFile%" (
-    echo ERROR: Couldn't find %_TargetFile%^!
-    set ExitCode=1
-  ) else (
-    for /f "tokens=3" %%a in ('findstr /C:"%~1" "%_TargetFile%"') do (
-      set _TestValue=%%~a
-      set _PcdValue=!_TestValue:~0,-1!
-    )
-    set %~2=!_PcdValue!
-	echo %2 %_PcdValue%
-  )
-  set _TargetFile=
-  set _TestValue=
-  set _PcdValue=
-goto :EOF
-
-::
-:: Force value of %1 into hex format 0x1234
-::
-:: USAGE: call :ForceToHex Variable
-:ForceToHex
-  call set _Temp=%%%~1%%
-  if "%_Temp:~0,2%" == "0x" goto :ForceToHexExit
-  PowerShell ('0x' + [convert]::tostring($env:_Temp, 16).ToUpper()) > temp.pcd
-  set /p %~1=<temp.pcd
-  del /f /q temp.pcd
-:ForceToHexExit
-  set _Temp=
-goto :EOF
-
-::
-:: Force value of %1 into decimal format
-::
-:: USAGE: call :ForceToDec Variable
-:ForceToDec
-  call set _Temp=%%%~1%%
-  if not "%_Temp:~0,2%" == "0x" goto :ForceToDecExit
-  PowerShell ([convert]::toInt64((Get-Item env:_Temp).value, 16)) > temp.pcd
-  set /p %~1=<temp.pcd
-  del /f /q temp.pcd
-:ForceToDecExit
-  set _Temp=
-goto :EOF
-
-:Usage
-echo.
-echo ***************************************************************************
-echo Build BIOS Rom for BXT platforms.
-echo.
-echo Usage: BuildBios.bat [options] ^<PlatformType^> ^<BuildTarget^>
-echo.
-echo.   /?       Display this help text
-echo    /l       Log a copy of the build output to EDK2.log
-echo    /c       CleanAll before building
-echo    /x64     Set Arch to X64  (default)
-echo    /ia32    Set Arch to IA32
-echo    /vs08    Set compiler to VisualStudio 2008
-echo    /vs10    Set compiler to VisualStudio 2010
-echo    /vs12    Set compiler to VisualStudio 2012
-echo    /vs13    Set compiler to VisualStudio 2013  (default)
-echo    /vs15    Set compiler to VisualStudio 2015
-echo    Platform Types:  %Minnow_RVP%
-echo    Build Targets:   Debug, Release
-echo.
-echo ***************************************************************************
-:ExitFail
-echo.
-set exitCode=1
-goto Exit
-
-:BldFail
-set exitCode=1
-echo  -- Error:  EDKII BIOS Build has failed!
-echo See EDK2.log for more details
-
-:Exit
-echo %date%  %time%
-(
-  EndLocal
-  set BiosVersion=%BiosVersion%
-  exit /b %ExitCode%
-)
diff --git a/Platform/BroxtonPlatformPkg/BuildBios.sh b/Platform/BroxtonPlatformPkg/BuildBios.sh
deleted file mode 100644
index b6127e2..0000000
--- a/Platform/BroxtonPlatformPkg/BuildBios.sh
+++ /dev/null
@@ -1,333 +0,0 @@
-#
-# Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
-# This program and the accompanying materials
-# are licensed and made available under the terms and conditions of the BSD License
-# which accompanies this distribution.  The full text of the license may be found at
-# http://opensource.org/licenses/bsd-license.php
-# 
-# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
-# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
-#
-
-##**********************************************************************
-## Function define
-##**********************************************************************
-function ErrorExit() {
-  echo
-  echo "Press any key......"
-  read
-  exit 0
-}
-
-echo -e $(date)
-##**********************************************************************
-## Initial Setup
-##**********************************************************************
-
-Build_Flags=
-SV_String=_
-exitCode=0
-Arch=X64
-FabId=B
-BoardId=MN
-
-## Initialize all the build flags to FALSE
-## depending on the cmd line input, some will be set to TRUE prior to building
-ENBDT_PF_BUILD=FALSE
-TABLET_PF_BUILD=FALSE
-BYTI_PF_BUILD=FALSE
-CSLE_ENABLE=FALSE
-VP_BIOS_ENABLE=FALSE
-SV_BIOS_ENABLE=FALSE
-PPV_BIOS_ENABLE=FALSE
-RVVP_BIOS_ENABLE=FALSE
-RVV_BIOS_ENABLE=FALSE
-SrcDebug=FALSE
-
-## Clean up previous build files.
-if [ -e $(pwd)/EDK2.log ]; then
-  rm $(pwd)/EDK2.log
-fi
-
-if [ -e $(pwd)/Unitool.log ]; then
-  rm $(pwd)/Unitool.log
-fi
-
-if [ -e $(pwd)/Conf/target.txt ]; then
-  rm $(pwd)/Conf/target.txt
-fi
-
-if [ -e $(pwd)/Conf/BiosId.env ]; then
-  rm $(pwd)/Conf/BiosId.env
-fi
-
-if [ -e $(pwd)/Conf/build_rule.txt ]; then
-  rm $(pwd)/Conf/build_rule.txt
-fi
-
-if [ -e $(pwd)/FlashMap.h ]; then
-  rm $(pwd)/FlashMap.h
-fi
-
-## Override tools_def.txt
-#cp $WORKSPACE\BaseTools\Conf\tools_def.template $WORKSPACE\Conf\tools_def.txt
-#:: Override tools_def.txt
-echo Creating Conf folder and build config files...
-cp $WORKSPACE/BaseTools/Conf/target.template $WORKSPACE/Conf/target.txt
-cp $WORKSPACE/BaseTools/Conf/tools_def.template $WORKSPACE/Conf/tools_def.txt
-cp $WORKSPACE/BaseTools/Conf/build_rule.template $WORKSPACE/Conf/build_rule.txt
-
-
-
-
-TOOL_CHAIN_TAG=GCC5
-
-## Define platform specific environment variables.
-PLATFORM_NAME=BroxtonPlatformPkg
-PLATFORM_PACKAGE=Platform/BroxtonPlatformPkg
-EFI_SOURCE=$WORKSPACE
-EDK_SOURCE=$WORKSPACE
-
-##**********************************************************************
-## Parse command line arguments
-##**********************************************************************
-
-## Optional arguments
-for (( i=1; i<=$#; ))
-  do
-    if [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/X64" ]; then
-      Arch=X64
-      shift
-    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/BG" ]; then
-      BoardId=BG
-      shift
-    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/B" ]; then
-      FabId=B
-      shift
-    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/A" ]; then
-      FabId=A
-      shift
-    else
-      break
-    fi
-  done
-
-## Required argument(s)
-if [ "$2" == "" ]; then
-  echo 
-  echo "Not Enough Arguments Provided"
-  echo "Please review the Help screen"
-  ErrorExit
-fi
-
-## Remove the values for Platform_Type and Build_Target from BiosId.env and stage in Conf/
-cp $WORKSPACE/$PLATFORM_PACKAGE/BiosId.env       $WORKSPACE/Conf/BiosId.env
-sed -i '/^BOARD_ID/d' $WORKSPACE/Conf/BiosId.env
-sed -i '/^BOARD_REV/d' $WORKSPACE/Conf/BiosId.env
-sed -i '/^BUILD_TYPE/d' $WORKSPACE/Conf/BiosId.env
-
-if [ $BoardId == "MN" ]; then
-  BOARD_ID=MNW3
-  echo BOARD_ID = MINNOW3 >> $WORKSPACE/Conf/BiosId.env
-else
-  BOARD_ID=BEN1
-  echo BOARD_ID = BENSONV >> $WORKSPACE/Conf/BiosId.env
-fi
-ENBDT_PF_BUILD=TRUE
-PLATFORM_NAME=BroxtonPlatformPkg
-PLATFORM_PACKAGE=Platform/BroxtonPlatformPkg  
-Platform_Type=$1
-
-## Create new DefineAtBuildMacros.dsc file
-Build_Macros=$WORKSPACE/$PLATFORM_PACKAGE/DefineAtBuildMacros.dsc
-if [ -f "$Build_Macros" ]; then
-  rm $Build_Macros
-fi
-touch $Build_Macros
-
-## Output platform specific build macros to DefineAtBuildMacros.dsc
-echo DEFINE ENBDT_PF_BUILD      = $ENBDT_PF_BUILD   >> $Build_Macros
-echo DEFINE TABLET_PF_BUILD     = $TABLET_PF_BUILD  >> $Build_Macros
-echo DEFINE BYTI_PF_BUILD       = $BYTI_PF_BUILD    >> $Build_Macros
-echo DEFINE CSLE_ENABLE         = $CSLE_ENABLE      >> $Build_Macros
-echo DEFINE VP_BIOS_ENABLE      = $VP_BIOS_ENABLE   >> $Build_Macros
-echo DEFINE SV_BIOS_ENABLE      = $SV_BIOS_ENABLE   >> $Build_Macros
-echo DEFINE PPV_BIOS_ENABLE     = $PPV_BIOS_ENABLE  >> $Build_Macros
-echo DEFINE RVVP_BIOS_ENABLE    = $RVVP_BIOS_ENABLE >> $Build_Macros
-echo DEFINE RVV_BIOS_ENABLE     = $RVV_BIOS_ENABLE  >> $Build_Macros
-
-if [ $Arch == "IA32" ]; then
-  echo DEFINE X64_CONFIG = FALSE      >> $Build_Macros
-else
-  echo DEFINE X64_CONFIG = TRUE       >> $Build_Macros
-fi
-
-if [ "$(echo $2 | tr 'a-z' 'A-Z')" == "RELEASE" ]; then
-  TARGET=RELEASE
-  BUILD_TYPE=R
-  echo BUILD_TYPE = R >> $WORKSPACE/Conf/BiosId.env
-else
-  TARGET=DEBUG
-  BUILD_TYPE=D
-  echo BUILD_TYPE = D >> $WORKSPACE/Conf/BiosId.env
-fi
-
-if [ $BoardId == "BG" ]; then
-  BOARD_REV=A
-  echo BOARD_REV = A >> $WORKSPACE/Conf/BiosId.env
-fi
-
-if [ $BoardId == "MN" ]; then
-  if [ $FabId == "B" ]; then
-    BOARD_REV=B
-    echo BOARD_REV = B >> $WORKSPACE/Conf/BiosId.env
-  else
-    BOARD_REV=A
-    echo BOARD_REV = A >> $WORKSPACE/Conf/BiosId.env
-  fi
-fi
-
-
-##**********************************************************************
-## Additional EDK Build Setup/Configuration
-##**********************************************************************
-echo "Ensuring correct build directory is present for GenBiosId..."
-ACTIVE_PLATFORM=$PLATFORM_PACKAGE/PlatformPkgX64Gcc.dsc
-#TOOL_CHAIN_TAG=GCC47
-MAX_CONCURRENT_THREAD_NUMBER=1
-sed -i '/^ACTIVE_PLATFORM/d' $WORKSPACE/Conf/target.txt
-sed -i '/^TARGET /d' $WORKSPACE/Conf/target.txt
-sed -i '/^TARGET_ARCH/d' $WORKSPACE/Conf/target.txt
-sed -i '/^TOOL_CHAIN_TAG/d' $WORKSPACE/Conf/target.txt
-sed -i '/^MAX_CONCURRENT_THREAD_NUMBER/d' $WORKSPACE/Conf/target.txt
-echo ACTIVE_PLATFORM = $ACTIVE_PLATFORM                           >> Conf/target.txt
-echo TARGET          = $TARGET                                    >> Conf/target.txt
-echo TOOL_CHAIN_TAG  = $TOOL_CHAIN_TAG                            >> Conf/target.txt
-echo MAX_CONCURRENT_THREAD_NUMBER = $MAX_CONCURRENT_THREAD_NUMBER >> Conf/target.txt
-if [ $Arch == "IA32" ]; then
-  echo TARGET_ARCH   = IA32                                       >> Conf/target.txt
-else
-  echo TARGET_ARCH   = IA32 X64                                   >> Conf/target.txt
-fi
-
-###
-### Update ASL path for GCC47 & 46
-###
-
-## Fix error due to '\' in OBJCOPY_ADDDEBUGFLAG GCC Common rule
-  echo DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG     = --add-gnu-debuglink=\$\(DEBUG_DIR\)/\$\(MODULE_NAME\).debug >> $WORKSPACE/Conf/tools_def.txt
-### 
-
-##**********************************************************************
-## Build BIOS
-##**********************************************************************
-echo "Creating BiosId..."
-BUILD_PATH=Build/$PLATFORM_NAME/"$TARGET"_"$TOOL_CHAIN_TAG"
-if [ ! -d "$BUILD_PATH/$Arch" ]; then
-  mkdir -p $BUILD_PATH/$Arch
-fi
-if [ -e "$BUILD_PATH/$Arch/BiosId.bin" ]; then
-  rm -f $BUILD_PATH/$Arch/BiosId.bin
-fi
-./Platform/BroxtonPlatformPkg/Common/Tools/GenBiosId/GenBiosId -i Conf/BiosId.env -o $BUILD_PATH/$Arch/BiosId.bin
-
-
-
-echo
-echo "**** Replace DebugLib.h to save space.... ****"
-cp PlatformTools/GCC/DebugLib.h Core/MdePkg/Include/Library/
-
-echo
-echo "**** Copy ResetVector to original folder ****"
-echo "**** Due to nasm can't execute in Ubuntu ****"
-
-
-echo "Invoking EDK2 build..."
-
-build $Build_Flags
-
-##**********************************************************************
-## Post Build processing and cleanup
-##**********************************************************************
-
-#
-# FSP Rebase and Split
-#
-#   0xFEF7A000 = gIntelFsp2WrapperTokenSpaceGuid.PcdFlashFvFspBase = $(CAR_BASE_ADDRESS) + $(BLD_RAM_DATA_SIZE) + $(FSP_RAM_DATA_SIZE) + $(FSP_EMP_DATA_SIZE) + $(BLD_IBBM_SIZE)
-pushd  $WORKSPACE/Silicon/BroxtonSoC/BroxtonFspPkg/ApolloLakeFspBinPkg/FspBin
-python $WORKSPACE/Core/IntelFsp2Pkg/Tools/SplitFspBin.py rebase -f Fsp.fd -c m -b 0xFEF7A000 -o ./ -n ApolloLakeFsp.fd
-python $WORKSPACE/Core/IntelFsp2Pkg/Tools/SplitFspBin.py split -f ApolloLakeFsp.fd -o ./ -n FSP.Fv
-popd
-cp -f $WORKSPACE/Silicon/BroxtonSoC/BroxtonFspPkg/ApolloLakeFspBinPkg/FspBin/FSP_T.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-cp -f $WORKSPACE/Silicon/BroxtonSoC/BroxtonFspPkg/ApolloLakeFspBinPkg/FspBin/FSP_M.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-cp -f $WORKSPACE/Silicon/BroxtonSoC/BroxtonFspPkg/ApolloLakeFspBinPkg/FspBin/FSP_S.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-
-echo "Running fce..."
-cat $BUILD_PATH/FV/FVIBBM.Fv $BUILD_PATH/FV/SOC.fd > $BUILD_PATH/FV/Temp.fd
-# Extract Hii data from build and store a copy in HiiDefaultData.txt
-# UQI 0006 005C 0078 0030 0031 0030 0031 is for question prompt(STR_IPU_ENABLED)
-# First 0006 is the length of string; Next six byte values are mapped to STR_IPU_ENABLED string value defined in Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/VfrStrings.uni.
-./$PLATFORM_PACKAGE/Common/Tools/FCE/FCE read -i $BUILD_PATH/FV/Temp.fd 0006 005C 0078 0030 0031 0030 0031 > $BUILD_PATH/FV/HiiDefaultData.txt
-
-## copy the Setup variable to the SetupDefault variable and save changes to BxtXXX.fd
-./$PLATFORM_PACKAGE/Common/Tools/FCE/FCE update -i $BUILD_PATH/FV/Temp.fd -s $BUILD_PATH/FV/HiiDefaultData.txt -o $BUILD_PATH/FV/Bxt"$Arch".fd -g B73FE497-B92E-416e-8326-45AD0D270091 -a 1>>EDK2.log 2>&1
-#echo "Skip FCE tool..."
-Split -f $BUILD_PATH/FV/Bxt"$Arch".fd -s 0x35000 -o $BUILD_PATH/FV/FVIBBM.Fv
-#cp $BUILD_PATH/FV/SOC.fd $BUILD_PATH/FV/Bxt"$Arch".fd
-
-## Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables
-##find /v "#" Conf\BiosId.env > ver_strings
-##for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
-##del /f/q ver_strings >nul
-##
-VERSION_MAJOR=$(grep '^VERSION_MAJOR' Conf/BiosId.env | cut -d ' ' -f 3 | cut -c 1-4)
-VERSION_MINOR=$(grep '^VERSION_MINOR' Conf/BiosId.env | cut -d ' ' -f 3 | cut -c 1-2)
-BIOS_Name="$BOARD_ID""$BOARD_REV""$SV_String""$Arch"_"$BUILD_TYPE"_"$VERSION_MAJOR"_"$VERSION_MINOR"
-
-cp -f $BUILD_PATH/FV/FVOBB.Fv  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-cp -f $BUILD_PATH/FV/FVOBBX.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-cp -f $BUILD_PATH/FV/FVIBBR.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-cp -f $BUILD_PATH/FV/FVIBBM.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-cp -f $BUILD_PATH/FV/FVIBBL.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-
-if [ $BoardId == "BG" ]; then
-  cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/BensonGlacier/FAB_A/SpiChunk1.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-  cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/BensonGlacier/FAB_A/SpiChunk2.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-  cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/BensonGlacier/FAB_A/SpiChunk3.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-  cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/BensonGlacier/FAB_A/GCC/NvStorage.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-fi
-
-if [ $BoardId == "MN" ]; then
-  if [ $FabId == "B" ]; then
-    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_B/SpiChunk1.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_B/SpiChunk2.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_B/SpiChunk3.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_B/GCC/NvStorage.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-  else
-    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_A/SpiChunk1.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_A/SpiChunk2.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_A/SpiChunk3.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_A/GCC/NvStorage.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-  fi
-fi
-
-#
-# Assmeble components
-#
-pushd $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
-
-cat FVIBBL.Fv > IBBL.Fv
-
-cat FVIBBM.Fv FSP_M.Fv > IBB.Fv
-
-cat FSP_S.Fv FVIBBR.Fv FVOBB.Fv FVOBBX.Fv > OBB.Fv
-
-cat SpiChunk1.bin IBBL.Fv IBB.Fv SpiChunk2.bin OBB.Fv NvStorage.Fv SpiChunk3.bin > $BIOS_Name"_GCC".bin
-
-popd
-
-echo
-echo Check if SPI IFWI image is generated at below location:
-echo $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch/$BIOS_Name"_GCC".bin
-echo
-echo
diff --git a/Platform/BroxtonPlatformPkg/BuildBxtBios.bat b/Platform/BroxtonPlatformPkg/BuildBxtBios.bat
new file mode 100644
index 0000000..7804dc5
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/BuildBxtBios.bat
@@ -0,0 +1,612 @@
+@echo off
+::echo on
+setlocal EnableDelayedExpansion EnableExtensions
+echo.
+echo %date%  %time%
+echo.
+
+::**********************************************************************
+:: Initial Setup
+::**********************************************************************
+set WORKSPACE=%CD%
+if %WORKSPACE:~-1%==\ (
+  set WORKSPACE=%WORKSPACE:~0,-1%
+)
+set CORE_PATH=%WORKSPACE%\Core
+set PLATFORM_PATH=Platform\BroxtonPlatformPkg
+set SILICON_PATH=Silicon\BroxtonSoC
+set AslPath=%WORKSPACE%\%PLATFORM_PATH%\Common\Tools\Iasl\iasl.exe
+set PACKAGES_PATH=%CORE_PATH%;%WORKSPACE%\Silicon\;%WORKSPACE%\Platform;%WORKSPACE%\%PLATFORM_PATH%;%WORKSPACE%\%SILICON_PATH%;%WORKSPACE%\%PLATFORM_PATH%\Common ;
+set EDK_TOOLS_BIN=%WORKSPACE%\BaseTools\Bin\Win32
+set /a build_threads=1
+set "Nasm_Flags=-D ARCH_IA32 -D DEBUG_PORT80"
+set "Build_Flags= "
+set exitCode=0
+set Arch=X64
+set Compiler=VS2013
+set FabId=B
+set BoardId=MN
+if not defined BiosVersion set BiosVersion=DEV
+
+
+:: Clean up previous build files.
+echo Clean up old build files...
+if exist %WORKSPACE%\edk2.log                  del %WORKSPACE%\edk2.log
+if exist %WORKSPACE%\unitool.log               del %WORKSPACE%\unitool.log
+if exist %WORKSPACE%\Conf\target.txt           del %WORKSPACE%\Conf\target.txt
+if exist %WORKSPACE%\Conf\tools_def.txt        del %WORKSPACE%\Conf\tools_def.txt
+if exist %WORKSPACE%\Conf\build_rule.txt       del %WORKSPACE%\Conf\build_rule.txt
+if exist %WORKSPACE%\Conf\FrameworkDatabase.db del %WORKSPACE%\Conf\FrameworkDatabase.db
+if exist %WORKSPACE%\Stitch\*.bin              del %WORKSPACE%\Stitch\*.bin
+if exist conf\.cache rmdir /q/s conf\.cache
+
+
+:: Override tools_def.txt
+echo Creating Conf folder and build config files...
+if not exist %WORKSPACE%\Conf md %WORKSPACE%\Conf
+copy /y %WORKSPACE%\BaseTools\Conf\*.template %WORKSPACE%\Conf\*.txt
+
+:: Setup EDK environment. Edksetup puts new copies of target.txt, tools_def.txt, build_rule.txt in WorkSpace\Conf
+:: Also run edksetup as soon as possible to avoid it from changing environment variables we're overriding
+set "VCINSTALLDIR="
+set EDK_TOOLS_PATH=%WORKSPACE%\BaseTools
+call edksetup.bat
+@echo off
+
+set Minnow_RVP=MINN
+
+:: Initialize all the build flags to FALSE
+:: Then based on the cmd line input, some will be set to TRUE prior to building.
+:: Note: These variable names match the actual Build Macro names in DSC for clarity.
+set ENBDT_PF_BUILD=FALSE
+set SrcDebug=FALSE
+set APLK_SETUP_ENABLE_BUILD=FALSE
+set FSP_BUILD=FALSE
+set FSP_WRAPPER=FALSE
+
+:: Set Defaults of platform specific environment variables.
+set EFI_SOURCE=%CD%
+set EDK_SOURCE=%CD%
+set PLATFORM_NAME=BxtPlatformPkg
+set PLATFORM_PACKAGE=%PLATFORM_PATH%\BxtPlatformPkg
+set PLATFORM_RC_PACKAGE=Silicon\BroxtonSoC\BroxtonSiPkg
+set COMMON_PLATFORM_PACKAGE=%PLATFORM_PATH%\BxtPlatformPkg
+set FSP_BIN_PKG_NAME=BroxtonFspBinPkg
+set STITCH_PATH=%WORKSPACE%\%PLATFORM_PATH%\Common\Tools\Stitch
+
+PATH=%PATH%;%WORKSPACE%\%PLATFORM_PATH%\Common\Tools\GenBiosId;%WORKSPACE%\%PLATFORM_PATH%\Common\Tools\nasm\Win32
+PATH=%PATH%;%WORKSPACE%\%PLATFORM_PATH%\Common\Tools\FCE;%WORKSPACE%\%PLATFORM_PATH%\Common\Tools\nasm\Win32
+
+::**********************************************************************
+:: Parse command line arguments
+::**********************************************************************
+
+:: Optional arguments
+:OptLoop
+if /i "%~1"=="" goto Usage
+if /i "%~1"=="/?" goto Usage
+
+if /i "%~1"=="/l" (
+    set Build_Flags=%Build_Flags% -j EDK2.log
+    shift
+    goto OptLoop
+)
+if /i "%~1" == "/c" (
+    echo Removing previous Build files...
+    if exist build (
+        del /f/s/q build > nul
+        rmdir /s/q build
+    )
+    if exist Conf\.cache (
+        del /f/s/q Conf\.cache > nul
+        rmdir /s/q Conf\.cache
+    )
+    echo.
+    shift
+    goto OptLoop
+)
+
+if /i "%~1"=="/ia32" (
+    set Arch=IA32
+    shift
+    goto OptLoop
+)
+if /i "%~1"=="/x64" (
+    set Arch=X64
+    shift
+    goto OptLoop
+)
+
+if /i "%~1"=="/vs08" (
+    set Compiler=VS2008
+    echo.
+    shift
+    goto OptLoop
+)
+if /i "%~1"=="/vs10" (
+    set Compiler=VS2010
+    echo.
+    shift
+    goto OptLoop
+)
+if /i "%~1"=="/vs12" (
+    set Compiler=VS2012
+    echo.
+    shift
+    goto OptLoop
+)
+if /i "%~1"=="/vs13" (
+    set Compiler=VS2013
+    echo.
+    shift
+    goto OptLoop
+)
+if /i "%~1"=="/vs15" (
+    set Compiler=VS2015
+    echo.
+    shift
+    goto OptLoop
+)
+if /i "%~1"=="/FspW" (
+    set FSP_WRAPPER=TRUE
+    echo.
+    shift
+    goto OptLoop
+)
+if /i "%~1"=="/A" (
+    set FabId=A
+    echo.
+    shift
+    goto OptLoop
+)
+if /i "%~1"=="/B" (
+    set FabId=B
+    echo.
+    shift
+    goto OptLoop
+)
+if /i "%~1"=="/MN" (
+    set BoardId=MN
+    echo.
+    shift
+    goto OptLoop
+)
+if /i "%~1"=="/BG" (
+    set BoardId=BG
+    echo.
+    shift
+    goto OptLoop
+)
+
+if /i "%~1"=="/m" (
+    if defined NUMBER_OF_PROCESSORS (
+        set /a build_threads=%NUMBER_OF_PROCESSORS%
+    )
+    shift
+    goto OptLoop
+)
+
+:: Required argument(s)
+if "%~2"=="" (
+   echo. & echo -- ERROR: Not Enough Arguments Provided
+   echo -- Please review the Help screen "/?" -- & echo.
+   goto ExitFail
+)
+
+echo. & echo -- Setting compiler to %Compiler% -- & echo.
+
+:: BOARD_ID needs to be exactly 7 characters (GenBiosId.exe limitation)
+echo Setting  %1  platform configuration and BIOS ID...
+if /i "%~1" == "%Minnow_RVP%" (
+  if %BoardId%==MN (
+    set BOARD_ID=MINNOW3
+  ) else if %BoardId%==BG (
+    set BOARD_ID=BENSONV
+  )
+    set ENBDT_PF_BUILD=TRUE
+    set PLATFORM_NAME=BroxtonPlatformPkg
+    set PLATFORM_PACKAGE=%PLATFORM_PATH%
+    set APLK_SETUP_ENABLE_BUILD=TRUE
+) else (
+    echo. & echo Error - Unsupported PlatformType: %1
+    echo Please review the Help screen "/?" & echo.
+    goto ExitFail
+)
+set Platform_Type=%~1
+
+::
+:: Tack on BIOS Version
+::
+
+::**********************************************************************
+:: Additional EDK Build Setup/Configuration
+::**********************************************************************
+
+::Setup DefineAtBuildMacros config file
+set Build_Macros=.\%PLATFORM_PACKAGE%\DefineAtBuildMacros.dsc
+copy /y nul %Build_Macros% >nul
+
+::output platform specific build macros to DefineAtBuildMacros.dsc
+echo DEFINE ENBDT_PF_BUILD          = %ENBDT_PF_BUILD%          >> %Build_Macros%
+
+echo DEFINE APLK_SETUP_ENABLE_BUILD = %APLK_SETUP_ENABLE_BUILD% >> %Build_Macros%
+
+if "%Arch%"=="IA32" (
+    echo DEFINE X64_CONFIG              = FALSE                     >> %Build_Macros%
+) else if "%Arch%"=="X64" (
+    echo DEFINE X64_CONFIG              = TRUE                      >> %Build_Macros%
+)
+
+::Stage of copy of BiosId.env in Conf/ with Platform_Type and Build_Target values removed
+
+if "%Arch%"=="X64" (
+    findstr /b /v "BOARD_ID BUILD_TYPE BOARD_REV" %PLATFORM_PACKAGE%\BiosId.env > Conf\BiosId.env
+) else if "%Arch%"=="IA32" (
+    findstr /b /v "BOARD_ID BUILD_TYPE BOARD_REV BOARD_EXT" %PLATFORM_PACKAGE%\BiosId.env > Conf\BiosId.env
+    echo BOARD_EXT = I32 >> Conf\BiosId.env
+)
+
+if /i "%~2" == "RELEASE" (
+    set target=RELEASE
+    echo BUILD_TYPE = R >> Conf\BiosId.env
+) else (
+    set target=DEBUG
+    echo BUILD_TYPE = D >> Conf\BiosId.env
+)
+
+if %BoardId%==BG (
+  echo BOARD_REV = A >> Conf\BiosId.env
+)
+
+if %BoardId%==MN (
+  if %FabId%==B (
+    echo BOARD_REV = B >> Conf\BiosId.env
+  ) else (
+    echo BOARD_REV = A >> Conf\BiosId.env
+  )
+)
+
+:: Set the Build_Type, Version_Major, and Version_Minor environment variables
+find /v "#" Conf\BiosId.env > ver_strings
+for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
+del /f/q ver_strings >nul
+:: Do this after parsing "ver_strings"
+echo BOARD_ID = %BOARD_ID% >> Conf\BiosId.env
+
+echo.
+echo Setting the Build environment for Visual Studio...
+if "%Compiler%"=="VS2008" (
+  if defined VS90COMNTOOLS (
+     call "%VS90COMNTOOLS%\vsvars32.bat" >nul
+     if /I "%VS90COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 9.0\Common7\Tools\" (
+      set TOOL_CHAIN_TAG=VS2008
+     ) else  set TOOL_CHAIN_TAG=VS2008x86
+  ) else (
+    echo  --ERROR: VS2008 not installed correctly. VS90COMNTOOLS not defined ^^!
+    goto BldFail
+  )
+) else if "%Compiler%"=="VS2010" (
+  if defined VS100COMNTOOLS (
+     call "%VS100COMNTOOLS%\vsvars32.bat" >nul
+     if /I "%VS100COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 10.0\Common7\Tools\" (
+        set TOOL_CHAIN_TAG=VS2010
+     ) else  set TOOL_CHAIN_TAG=VS2010x86
+  ) else (
+     echo  --ERROR: VS2010 not installed correctly. VS100COMNTOOLS not defined ^^!
+     goto BldFail
+  )
+) else if "%Compiler%"=="VS2012" (
+  if defined VS110COMNTOOLS (
+     call "%VS110COMNTOOLS%\vsvars32.bat" >nul
+     if /I "%VS110COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 11.0\Common7\Tools\" (
+        set TOOL_CHAIN_TAG=VS2012
+     ) else  set TOOL_CHAIN_TAG=VS2012x86
+  ) else (
+     echo  --ERROR: VS2012 not installed correctly. VS110COMNTOOLS not defined ^^!
+     goto BldFail
+  )
+) else if "%Compiler%"=="VS2013" (
+  if defined VS120COMNTOOLS (
+     call "%VS120COMNTOOLS%\vsvars32.bat" >nul
+     if /I "%VS120COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 12.0\Common7\Tools\" (
+        set TOOL_CHAIN_TAG=VS2013
+     ) else  set TOOL_CHAIN_TAG=VS2013x86
+  ) else (
+     echo  --ERROR: VS2013 not installed correctly. VS120COMNTOOLS not defined ^^!
+     echo           See help ^(/?^) for how specify a different VS version.
+     goto BldFail
+  )
+) else if "%Compiler%"=="VS2015" (
+  if defined VS140COMNTOOLS (
+     call "%VS140COMNTOOLS%\vsvars32.bat" >nul
+     if /I "%VS140COMNTOOLS%" == "C:\Program Files\Microsoft Visual Studio 14.0\Common7\Tools\" (
+        set TOOL_CHAIN_TAG=VS2015
+     ) else  set TOOL_CHAIN_TAG=VS2015x86
+
+  ) else (
+     echo  --ERROR: VS2015 not installed correctly. VS140COMNTOOLS not defined ^^!
+     echo           See help ^(/?^) for how specify a different VS version.
+     goto BldFail
+  )
+)
+
+::**********************************************************************
+:: Build BIOS
+::**********************************************************************
+
+echo Setup build directory for GenBiosId...
+set BUILD_PATH=Build\%PLATFORM_NAME%\%TARGET%_%TOOL_CHAIN_TAG%
+if not exist %BUILD_PATH%\IA32  mkdir %BUILD_PATH%\IA32
+
+echo Creating BiosId...
+GenBiosId.exe -i Conf\BiosId.env -o %BUILD_PATH%\IA32\BiosId.bin -ob Conf\BiosId.bat
+if "%Arch%"=="X64" (
+   if not exist %BUILD_PATH%\X64  mkdir %BUILD_PATH%\X64
+   GenBiosId.exe -i Conf\BiosId.env -o %BUILD_PATH%\X64\BiosId.bin -ob Conf\BiosId.bat
+) else if "%Arch%"=="IA32" (
+   if not exist %BUILD_PATH%\IA32  mkdir %BUILD_PATH%\IA32
+   GenBiosId.exe -i Conf\BiosId.env -o %BUILD_PATH%\IA32\BiosId.bin -ob Conf\BiosId.bat
+)
+
+if ErrorLevel 1 goto BldFail
+
+echo Building ResetVector...
+
+set ResetVectorPath=%WORKSPACE%\%PLATFORM_RC_PACKAGE%\Cpu\ResetVector
+
+pushd %ResetVectorPath%\Vtf0
+  nasm.exe %Nasm_Flags% -o Bin\ResetVector.ia32.port80.raw ResetVectorCode.asm
+  python %CORE_PATH%\UefiCpuPkg\ResetVector\Vtf0\Tools\FixupForRawSection.py Bin\ResetVector.ia32.port80.raw
+popd
+
+pushd %ResetVectorPath%\Vtf1
+  nasm.exe %Nasm_Flags% -o Bin\ResetVector.ia32.port80.raw ResetVectorCode.asm
+  python %CORE_PATH%\UefiCpuPkg\ResetVector\Vtf0\Tools\FixupForRawSection.py Bin\ResetVector.ia32.port80.raw
+popd
+
+:: SaveWorkSpace w/a is needed when using subst for Workspace builds (eg. R:/)
+set SaveWorkSpace=%WORKSPACE%
+set WORKSPACE=%CD%
+if "%Arch%"=="X64" (
+set ActivePlatform=%PLATFORM_PACKAGE%\PlatformPkgX64.dsc
+) else if "%Arch%"=="IA32" (
+set ActivePlatform=%PLATFORM_PACKAGE%\PlatformPkgIA32.dsc
+)
+
+echo Modifying Conf files for this build...
+:: Remove lines with these tags from target.txt
+findstr /V "TARGET  TARGET_ARCH  TOOL_CHAIN_TAG  ACTIVE_PLATFORM  MAX_CONCURRENT_THREAD_NUMBER" Conf\target.txt > Conf\target.txt.tmp
+
+if "%Arch%"=="IA32" (
+    echo TARGET_ARCH = IA32                                  >> Conf\target.txt.tmp
+) else if "%Arch%"=="X64" (
+    echo TARGET_ARCH = IA32 X64                              >> Conf\target.txt.tmp
+)
+echo TARGET          = %TARGET%                              >> Conf\target.txt.tmp
+echo TOOL_CHAIN_TAG  = %TOOL_CHAIN_TAG%                      >> Conf\target.txt.tmp
+echo ACTIVE_PLATFORM = %ActivePlatform%                      >> Conf\target.txt.tmp
+echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads%          >> Conf\target.txt.tmp
+
+move /Y Conf\target.txt.tmp Conf\target.txt >nul
+echo *_VS2008x86_*_ASL_PATH = %AslPath% >> Conf\tools_def.txt
+echo *_VS2010x86_*_ASL_PATH = %AslPath% >> Conf\tools_def.txt
+echo *_VS2012x86_*_ASL_PATH = %AslPath% >> Conf\tools_def.txt
+echo *_VS2013x86_*_ASL_PATH = %AslPath% >> Conf\tools_def.txt
+echo *_VS2015x86_*_ASL_PATH = %AslPath% >> Conf\tools_def.txt
+
+echo.
+echo Invoking normal EDK2 build...
+build %Build_Flags%
+if ErrorLevel 1 goto BldFail
+
+set WORKSPACE=%SaveWorkSpace%
+
+::**********************************************************************
+:: Post Build processing and cleanup
+::**********************************************************************
+echo Create FlashMap.h...
+
+set PLAT_INIT_PRE_MEM=PlatformPreMemPei
+
+set AutoGenPath=%BUILD_PATH%\IA32\BroxtonPlatformPkg\Common\PlatformSettings\PlatformPreMemPei\%PLAT_INIT_PRE_MEM%\DEBUG\AutoGen.h
+
+if not exist "%AutoGenPath%" (
+  echo ERROR: Couldn't find %AutoGenPath% so we can generate FlashMap.h
+  goto BldFail
+)
+findstr /L "_PCD_VALUE_" %AutoGenPath% > %STITCH_PATH%\FlashMap.h
+
+echo Running FCE...
+copy /b %BUILD_PATH%\FV\FvIBBM.fv + /b %BUILD_PATH%\FV\Soc.fd /b %BUILD_PATH%\FV\Temp.fd
+:: Extract Hii data from build and store a copy in HiiDefaultData.txt
+:: UQI 0006 005C 0078 0030 0031 0030 0031 is for question prompt(STR_IPU_ENABLED)
+:: First 0006 is the length of string; Next six byte values are mapped to STR_IPU_ENABLED string value defined in Platform\BroxtonPlatformPkg\Common\PlatformSettings\PlatformSetupDxe\VfrStrings.uni.
+fce.exe read -i %BUILD_PATH%\FV\Temp.fd 0006 005C 0078 0030 0031 0030 0031 > %BUILD_PATH%\FV\HiiDefaultData.txt 2>>EDK2.log
+:: Generate the Setup variable and save changes to BxtXXX.fd
+:: B73FE497-B92E-416e-8326-45AD0D270091 is the GUID of IBBM FV
+fce.exe update -i %BUILD_PATH%\FV\Temp.fd -s %BUILD_PATH%\FV\HiiDefaultData.txt -o %BUILD_PATH%\FV\Bxt%Arch%.fd  -g B73FE497-B92E-416e-8326-45AD0D270091 -a 1>>EDK2.log 2>&1
+split -f %BUILD_PATH%\FV\Bxt%Arch%.fd -s 0x35000 -o %BUILD_PATH%\FV\FvIBBM.fv
+
+if ErrorLevel 1 goto BldFail
+
+@echo off
+
+:: Translate Release Build Type
+if "%BUILD_TYPE%"=="R" set BUILD_TYPE=R
+
+echo Copy BIOS...
+set BIOS_Name=%BOARD_ID%%BOARD_REV%_%Arch%_%BUILD_TYPE%_%VERSION_MAJOR%_%VERSION_MINOR%
+copy /y/b %BUILD_PATH%\FV\Soc.fd          %STITCH_PATH%\%BIOS_Name%.ROM >nul
+copy /y   %STITCH_PATH%\FlashMap.h        %STITCH_PATH%\%BIOS_Name%.map >nul
+
+set Storage_Folder=%STITCH_PATH%\%BIOS_Name%
+if not exist %Storage_Folder%  mkdir %Storage_Folder%
+
+copy /y/b %BUILD_PATH%\FV\FvIBBL.fv  %Storage_Folder% >nul
+copy /y/b %BUILD_PATH%\FV\FvIBBM.fv  %Storage_Folder% >nul
+copy /y/b %BUILD_PATH%\FV\FvIBBR.fv  %Storage_Folder% >nul
+copy /y/b %BUILD_PATH%\FV\FvOBB.fv   %Storage_Folder% >nul
+copy /y/b %BUILD_PATH%\FV\FvOBBX.fv  %Storage_Folder% >nul
+copy /y/b %BUILD_PATH%\FV\FvOBBY.fv  %Storage_Folder% >nul
+
+if /i "%FSP_WRAPPER%" == "TRUE" (
+::  0xFEF7A000 = gIntelFsp2WrapperTokenSpaceGuid.PcdFlashFvFspBase = $(CAR_BASE_ADDRESS) + $(BLD_RAM_DATA_SIZE) + $(FSP_RAM_DATA_SIZE) + $(FSP_EMP_DATA_SIZE) + $(BLD_IBBM_SIZE)
+    pushd  %WORKSPACE%\Silicon\BroxtonSoC\BroxtonFspPkg\ApolloLakeFspBinPkg\FspBin
+    python %WORKSPACE%\Core\IntelFsp2Pkg\Tools\SplitFspBin.py rebase -f Fsp.fd -c m -b 0xFEF7A000 -o .\ -n ApolloLakeFsp.fd
+    python %WORKSPACE%\Core\IntelFsp2Pkg\Tools\SplitFspBin.py split -f ApolloLakeFsp.fd -o .\ -n FSP.Fv
+    popd
+    copy /y/b %WORKSPACE%\Silicon\BroxtonSoC\BroxtonFspPkg\ApolloLakeFspBinPkg\FspBin\FSP_T.Fv %Storage_Folder%\FSP_T.Fv
+    copy /y/b %WORKSPACE%\Silicon\BroxtonSoC\BroxtonFspPkg\ApolloLakeFspBinPkg\FspBin\FSP_M.Fv %Storage_Folder%\FSP_M.Fv
+    copy /y/b %WORKSPACE%\Silicon\BroxtonSoC\BroxtonFspPkg\ApolloLakeFspBinPkg\FspBin\FSP_S.Fv %Storage_Folder%\FSP_S.Fv
+)
+
+echo Get NvStorage Base and Size...
+if not exist "%STITCH_PATH%\FlashMap.h" (
+  echo ERROR: Couldn't find %STITCH_PATH%\FlashMap.h
+  goto BldFail
+)
+
+::generate NvStorage.Fv
+::      %STITCH_PATH%\FlashMap.h has the information for the magic numbers below. Parse it.
+::        You'll need to account for both hex (0x000000) and int (1234567U) value types
+::        FLASH_REGION_VPD_OFFSET
+::          _PCD_VALUE_PcdFlashNvStorageBase - _PCD_VALUE_PcdFlashBaseAddress
+::        FLASH_REGION_VPD_SIZE + FLASH_REGION_NVSTORAGE_SUBREGION_NV_FTW_WORKING_SIZE + FLASH_REGION_NVSTORAGE_SUBREGION_NV_FTW_SPARE_SIZE
+::          _PCD_VALUE_PcdFlashNvStorageSize
+::
+::                     PCD to find                      Variable      File to search
+::===========================================================================================
+  call :FindPcdInFile _PCD_VALUE_PcdFlashNvStorageBase NvStorageBase "%STITCH_PATH%\FlashMap.h"
+  call :FindPcdInFile _PCD_VALUE_PcdFlashBaseAddress   BaseAddress   "%STITCH_PATH%\FlashMap.h"
+  call :FindPcdInFile _PCD_VALUE_PcdFlashNvStorageSize NvStorageSize "%STITCH_PATH%\FlashMap.h"
+:: Find image offset as opposed to memory offset
+  PowerShell ($env:NvStorageBase - $env:BaseAddress) > temp.pcd
+  set /p VpdOffset=<temp.pcd
+  del /f /q temp.pcd
+:: Force the variables we care about into DEC string format
+  set VpdSize=%NvStorageSize%
+  call :ForceToDec VpdOffset
+  call :ForceToDec VpdSize
+:: Dump what we found
+  echo - NvStorageBase = %NvStorageBase%
+  echo - BaseAddress   = %BaseAddress%
+  echo - NvStorageSize = %NvStorageSize%
+  echo - VpdOffset     = %VpdOffset%
+  echo - VpdSize       = %VpdSize%
+
+:: Create NvStorage.fv
+  echo Create NvStorage.fv...
+  pushd %STITCH_PATH%
+    REM This -s offset must equal the decimal value of  FLASH_REGION_VPD_OFFSET  in the Platform.fdf
+    Split.exe -f %STITCH_PATH%\%BIOS_Name%.ROM -s %VpdOffset% -o temp1.bin -t temp2.bin
+    REM This -s offset must equal the decimal value of
+    REM  FLASH_REGION_VPD_SIZE + FLASH_REGION_NVSTORAGE_SUBREGION_NV_FTW_WORKING_SIZE + FLASH_REGION_NVSTORAGE_SUBREGION_NV_FTW_SPARE_SIZE
+    Split.exe -f temp2.bin -s %VpdSize% -o %Storage_Folder%\NvStorage.Fv -t temp3.bin
+    del /F/Q temp1.bin temp2.bin temp3.bin
+  popd
+
+echo.
+echo Build location:     %BUILD_PATH%
+echo BIOS ROM Created:   %BIOS_Name%
+echo.
+echo --------------- The EDKII BIOS build has successfully completed. ---------------
+echo.
+goto Exit
+
+::
+:: Find PCD value (%~1) in a file (%~3) and return it in a variable (%~2) as a HEX string
+::
+:: USAGE: call :FindPcdInFile PCD Variable File
+:FindPcdInFile
+  call :GetPcd "%~1" "%~2" "%~3"
+  call :ForceToHex "%~2"
+goto :EOF
+
+::
+:: Find PCD value (%~1) in a file (%~3) and return it in a variable (%~2)
+::
+:: USAGE: call :GetPcd PCD Variable File
+:GetPcd
+  set _TargetFile=%~3
+  if not exist "%_TargetFile%" (
+    echo ERROR: Couldn't find %_TargetFile%^!
+    set ExitCode=1
+  ) else (
+    for /f "tokens=3" %%a in ('findstr /C:"%~1" "%_TargetFile%"') do (
+      set _TestValue=%%~a
+      set _PcdValue=!_TestValue:~0,-1!
+    )
+    set %~2=!_PcdValue!
+	echo %2 %_PcdValue%
+  )
+  set _TargetFile=
+  set _TestValue=
+  set _PcdValue=
+goto :EOF
+
+::
+:: Force value of %1 into hex format 0x1234
+::
+:: USAGE: call :ForceToHex Variable
+:ForceToHex
+  call set _Temp=%%%~1%%
+  if "%_Temp:~0,2%" == "0x" goto :ForceToHexExit
+  PowerShell ('0x' + [convert]::tostring($env:_Temp, 16).ToUpper()) > temp.pcd
+  set /p %~1=<temp.pcd
+  del /f /q temp.pcd
+:ForceToHexExit
+  set _Temp=
+goto :EOF
+
+::
+:: Force value of %1 into decimal format
+::
+:: USAGE: call :ForceToDec Variable
+:ForceToDec
+  call set _Temp=%%%~1%%
+  if not "%_Temp:~0,2%" == "0x" goto :ForceToDecExit
+  PowerShell ([convert]::toInt64((Get-Item env:_Temp).value, 16)) > temp.pcd
+  set /p %~1=<temp.pcd
+  del /f /q temp.pcd
+:ForceToDecExit
+  set _Temp=
+goto :EOF
+
+:Usage
+echo.
+echo ***************************************************************************
+echo Build Edk II BIOS Rom for BXT platforms.
+echo.
+echo Usage: %0 [options] ^<PlatformType^> ^<BuildTarget^>
+echo.
+echo.   /?       Display this help text
+echo    /l       Log a copy of the build output to EDK2.log
+echo    /c       CleanAll before building
+echo    /x64     Set Arch to X64  (default)
+echo    /ia32    Set Arch to IA32
+echo    /vs08    Set compiler to VisualStudio 2008
+echo    /vs10    Set compiler to VisualStudio 2010
+echo    /vs12    Set compiler to VisualStudio 2012
+echo    /vs13    Set compiler to VisualStudio 2013  (default)
+echo    /vs15    Set compiler to VisualStudio 2015
+echo    Platform Types:  %Minnow_RVP%
+echo    Build Targets:   Debug, Release
+echo.
+echo ***************************************************************************
+:ExitFail
+echo.
+set exitCode=1
+goto Exit
+
+:BldFail
+set exitCode=1
+echo  -- Error:  EDKII BIOS Build has failed!
+echo See EDK2.log for more details
+
+:Exit
+echo %date%  %time%
+(
+  EndLocal
+  set BiosVersion=%BiosVersion%
+  exit /b %ExitCode%
+)
diff --git a/Platform/BroxtonPlatformPkg/BuildBxtBios.sh b/Platform/BroxtonPlatformPkg/BuildBxtBios.sh
new file mode 100644
index 0000000..d0b677f
--- /dev/null
+++ b/Platform/BroxtonPlatformPkg/BuildBxtBios.sh
@@ -0,0 +1,333 @@
+#
+# Copyright (c) 2006 - 2017, Intel Corporation. All rights reserved.<BR>
+# This program and the accompanying materials
+# are licensed and made available under the terms and conditions of the BSD License
+# which accompanies this distribution.  The full text of the license may be found at
+# http://opensource.org/licenses/bsd-license.php
+# 
+# THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+# WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+#
+
+##**********************************************************************
+## Function define
+##**********************************************************************
+function ErrorExit() {
+  echo
+  echo "Press any key......"
+  read
+  exit 0
+}
+
+echo -e $(date)
+##**********************************************************************
+## Initial Setup
+##**********************************************************************
+
+Build_Flags=
+SV_String=_
+exitCode=0
+Arch=X64
+FabId=B
+BoardId=MN
+
+## Initialize all the build flags to FALSE
+## depending on the cmd line input, some will be set to TRUE prior to building
+ENBDT_PF_BUILD=FALSE
+TABLET_PF_BUILD=FALSE
+BYTI_PF_BUILD=FALSE
+CSLE_ENABLE=FALSE
+VP_BIOS_ENABLE=FALSE
+SV_BIOS_ENABLE=FALSE
+PPV_BIOS_ENABLE=FALSE
+RVVP_BIOS_ENABLE=FALSE
+RVV_BIOS_ENABLE=FALSE
+SrcDebug=FALSE
+
+## Clean up previous build files.
+if [ -e $(pwd)/EDK2.log ]; then
+  rm $(pwd)/EDK2.log
+fi
+
+if [ -e $(pwd)/Unitool.log ]; then
+  rm $(pwd)/Unitool.log
+fi
+
+if [ -e $(pwd)/Conf/target.txt ]; then
+  rm $(pwd)/Conf/target.txt
+fi
+
+if [ -e $(pwd)/Conf/BiosId.env ]; then
+  rm $(pwd)/Conf/BiosId.env
+fi
+
+if [ -e $(pwd)/Conf/build_rule.txt ]; then
+  rm $(pwd)/Conf/build_rule.txt
+fi
+
+if [ -e $(pwd)/FlashMap.h ]; then
+  rm $(pwd)/FlashMap.h
+fi
+
+## Override tools_def.txt
+#cp $WORKSPACE\BaseTools\Conf\tools_def.template $WORKSPACE\Conf\tools_def.txt
+#:: Override tools_def.txt
+echo Creating Conf folder and build config files...
+cp $WORKSPACE/BaseTools/Conf/target.template $WORKSPACE/Conf/target.txt
+cp $WORKSPACE/BaseTools/Conf/tools_def.template $WORKSPACE/Conf/tools_def.txt
+cp $WORKSPACE/BaseTools/Conf/build_rule.template $WORKSPACE/Conf/build_rule.txt
+
+
+
+
+TOOL_CHAIN_TAG=GCC5
+
+## Define platform specific environment variables.
+PLATFORM_NAME=BroxtonPlatformPkg
+PLATFORM_PACKAGE=Platform/BroxtonPlatformPkg
+EFI_SOURCE=$WORKSPACE
+EDK_SOURCE=$WORKSPACE
+
+##**********************************************************************
+## Parse command line arguments
+##**********************************************************************
+
+## Optional arguments
+for (( i=1; i<=$#; ))
+  do
+    if [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/X64" ]; then
+      Arch=X64
+      shift
+    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/MN" ]; then
+      BoardId=MN
+      shift
+    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/BG" ]; then
+      BoardId=BG
+      shift
+    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/B" ]; then
+      FabId=B
+      shift
+    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/A" ]; then
+      FabId=A
+      shift
+    else
+      break
+    fi
+  done
+
+## Required argument(s)
+if [ "$2" == "" ]; then
+  echo 
+  echo "Not Enough Arguments Provided"
+  echo "Please review the Help screen"
+  ErrorExit
+fi
+
+## Remove the values for Platform_Type and Build_Target from BiosId.env and stage in Conf/
+cp $WORKSPACE/$PLATFORM_PACKAGE/BiosId.env       $WORKSPACE/Conf/BiosId.env
+sed -i '/^BOARD_ID/d' $WORKSPACE/Conf/BiosId.env
+sed -i '/^BOARD_REV/d' $WORKSPACE/Conf/BiosId.env
+sed -i '/^BUILD_TYPE/d' $WORKSPACE/Conf/BiosId.env
+
+if [ $BoardId == "MN" ]; then
+  BOARD_ID=MNW3
+  echo BOARD_ID = MINNOW3 >> $WORKSPACE/Conf/BiosId.env
+else
+  BOARD_ID=BEN1
+  echo BOARD_ID = BENSONV >> $WORKSPACE/Conf/BiosId.env
+fi
+ENBDT_PF_BUILD=TRUE
+PLATFORM_NAME=BroxtonPlatformPkg
+PLATFORM_PACKAGE=Platform/BroxtonPlatformPkg  
+Platform_Type=$1
+
+## Create new DefineAtBuildMacros.dsc file
+Build_Macros=$WORKSPACE/$PLATFORM_PACKAGE/DefineAtBuildMacros.dsc
+if [ -f "$Build_Macros" ]; then
+  rm $Build_Macros
+fi
+touch $Build_Macros
+
+## Output platform specific build macros to DefineAtBuildMacros.dsc
+echo DEFINE ENBDT_PF_BUILD      = $ENBDT_PF_BUILD   >> $Build_Macros
+echo DEFINE TABLET_PF_BUILD     = $TABLET_PF_BUILD  >> $Build_Macros
+echo DEFINE BYTI_PF_BUILD       = $BYTI_PF_BUILD    >> $Build_Macros
+echo DEFINE CSLE_ENABLE         = $CSLE_ENABLE      >> $Build_Macros
+echo DEFINE VP_BIOS_ENABLE      = $VP_BIOS_ENABLE   >> $Build_Macros
+echo DEFINE SV_BIOS_ENABLE      = $SV_BIOS_ENABLE   >> $Build_Macros
+echo DEFINE PPV_BIOS_ENABLE     = $PPV_BIOS_ENABLE  >> $Build_Macros
+echo DEFINE RVVP_BIOS_ENABLE    = $RVVP_BIOS_ENABLE >> $Build_Macros
+echo DEFINE RVV_BIOS_ENABLE     = $RVV_BIOS_ENABLE  >> $Build_Macros
+
+if [ $Arch == "IA32" ]; then
+  echo DEFINE X64_CONFIG = FALSE      >> $Build_Macros
+else
+  echo DEFINE X64_CONFIG = TRUE       >> $Build_Macros
+fi
+
+if [ "$(echo $2 | tr 'a-z' 'A-Z')" == "RELEASE" ]; then
+  TARGET=RELEASE
+  BUILD_TYPE=R
+  echo BUILD_TYPE = R >> $WORKSPACE/Conf/BiosId.env
+else
+  TARGET=DEBUG
+  BUILD_TYPE=D
+  echo BUILD_TYPE = D >> $WORKSPACE/Conf/BiosId.env
+fi
+
+if [ $BoardId == "BG" ]; then
+  BOARD_REV=A
+  echo BOARD_REV = A >> $WORKSPACE/Conf/BiosId.env
+fi
+
+if [ $BoardId == "MN" ]; then
+  if [ $FabId == "B" ]; then
+    BOARD_REV=B
+    echo BOARD_REV = B >> $WORKSPACE/Conf/BiosId.env
+  else
+    BOARD_REV=A
+    echo BOARD_REV = A >> $WORKSPACE/Conf/BiosId.env
+  fi
+fi
+
+
+##**********************************************************************
+## Additional EDK Build Setup/Configuration
+##**********************************************************************
+echo "Ensuring correct build directory is present for GenBiosId..."
+ACTIVE_PLATFORM=$PLATFORM_PACKAGE/PlatformPkgX64Gcc.dsc
+#TOOL_CHAIN_TAG=GCC47
+MAX_CONCURRENT_THREAD_NUMBER=1
+sed -i '/^ACTIVE_PLATFORM/d' $WORKSPACE/Conf/target.txt
+sed -i '/^TARGET /d' $WORKSPACE/Conf/target.txt
+sed -i '/^TARGET_ARCH/d' $WORKSPACE/Conf/target.txt
+sed -i '/^TOOL_CHAIN_TAG/d' $WORKSPACE/Conf/target.txt
+sed -i '/^MAX_CONCURRENT_THREAD_NUMBER/d' $WORKSPACE/Conf/target.txt
+echo ACTIVE_PLATFORM = $ACTIVE_PLATFORM                           >> Conf/target.txt
+echo TARGET          = $TARGET                                    >> Conf/target.txt
+echo TOOL_CHAIN_TAG  = $TOOL_CHAIN_TAG                            >> Conf/target.txt
+echo MAX_CONCURRENT_THREAD_NUMBER = $MAX_CONCURRENT_THREAD_NUMBER >> Conf/target.txt
+if [ $Arch == "IA32" ]; then
+  echo TARGET_ARCH   = IA32                                       >> Conf/target.txt
+else
+  echo TARGET_ARCH   = IA32 X64                                   >> Conf/target.txt
+fi
+
+###
+### Update ASL path for GCC47 & 46
+###
+
+## Fix error due to '\' in OBJCOPY_ADDDEBUGFLAG GCC Common rule
+  echo DEBUG_*_*_OBJCOPY_ADDDEBUGFLAG     = --add-gnu-debuglink=\$\(DEBUG_DIR\)/\$\(MODULE_NAME\).debug >> $WORKSPACE/Conf/tools_def.txt
+### 
+
+##**********************************************************************
+## Build BIOS
+##**********************************************************************
+echo "Creating BiosId..."
+BUILD_PATH=Build/$PLATFORM_NAME/"$TARGET"_"$TOOL_CHAIN_TAG"
+if [ ! -d "$BUILD_PATH/$Arch" ]; then
+  mkdir -p $BUILD_PATH/$Arch
+fi
+if [ -e "$BUILD_PATH/$Arch/BiosId.bin" ]; then
+  rm -f $BUILD_PATH/$Arch/BiosId.bin
+fi
+./Platform/BroxtonPlatformPkg/Common/Tools/GenBiosId/GenBiosId -i Conf/BiosId.env -o $BUILD_PATH/$Arch/BiosId.bin
+
+
+echo
+echo "**** Copy ResetVector to original folder ****"
+echo "**** Due to nasm can't execute in Ubuntu ****"
+
+
+echo "Invoking EDK2 build..."
+
+build $Build_Flags
+
+echo "check if Build was successful"
+
+##**********************************************************************
+## Post Build processing and cleanup
+##**********************************************************************
+
+#
+# FSP Rebase and Split
+#
+#   0xFEF7A000 = gIntelFsp2WrapperTokenSpaceGuid.PcdFlashFvFspBase = $(CAR_BASE_ADDRESS) + $(BLD_RAM_DATA_SIZE) + $(FSP_RAM_DATA_SIZE) + $(FSP_EMP_DATA_SIZE) + $(BLD_IBBM_SIZE)
+pushd  $WORKSPACE/Silicon/BroxtonSoC/BroxtonFspPkg/ApolloLakeFspBinPkg/FspBin
+python $WORKSPACE/Core/IntelFsp2Pkg/Tools/SplitFspBin.py rebase -f Fsp.fd -c m -b 0xFEF7A000 -o ./ -n ApolloLakeFsp.fd
+python $WORKSPACE/Core/IntelFsp2Pkg/Tools/SplitFspBin.py split -f ApolloLakeFsp.fd -o ./ -n FSP.Fv
+popd
+cp -f $WORKSPACE/Silicon/BroxtonSoC/BroxtonFspPkg/ApolloLakeFspBinPkg/FspBin/FSP_T.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+cp -f $WORKSPACE/Silicon/BroxtonSoC/BroxtonFspPkg/ApolloLakeFspBinPkg/FspBin/FSP_M.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+cp -f $WORKSPACE/Silicon/BroxtonSoC/BroxtonFspPkg/ApolloLakeFspBinPkg/FspBin/FSP_S.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+
+echo "Running fce..."
+cat $BUILD_PATH/FV/FVIBBM.Fv $BUILD_PATH/FV/SOC.fd > $BUILD_PATH/FV/Temp.fd
+# Extract Hii data from build and store a copy in HiiDefaultData.txt
+# UQI 0006 005C 0078 0030 0031 0030 0031 is for question prompt(STR_IPU_ENABLED)
+# First 0006 is the length of string; Next six byte values are mapped to STR_IPU_ENABLED string value defined in Platform/BroxtonPlatformPkg/Common/PlatformSettings/PlatformSetupDxe/VfrStrings.uni.
+./$PLATFORM_PACKAGE/Common/Tools/FCE/FCE read -i $BUILD_PATH/FV/Temp.fd 0006 005C 0078 0030 0031 0030 0031 > $BUILD_PATH/FV/HiiDefaultData.txt
+
+## copy the Setup variable to the SetupDefault variable and save changes to BxtXXX.fd
+./$PLATFORM_PACKAGE/Common/Tools/FCE/FCE update -i $BUILD_PATH/FV/Temp.fd -s $BUILD_PATH/FV/HiiDefaultData.txt -o $BUILD_PATH/FV/Bxt"$Arch".fd -g B73FE497-B92E-416e-8326-45AD0D270091 -a 1>>EDK2.log 2>&1
+#echo "Skip FCE tool..."
+Split -f $BUILD_PATH/FV/Bxt"$Arch".fd -s 0x35000 -o $BUILD_PATH/FV/FVIBBM.Fv
+#cp $BUILD_PATH/FV/SOC.fd $BUILD_PATH/FV/Bxt"$Arch".fd
+
+## Set the Board_Id, Build_Type, Version_Major, and Version_Minor environment variables
+##find /v "#" Conf\BiosId.env > ver_strings
+##for /f "tokens=1,3" %%i in (ver_strings) do set %%i=%%j
+##del /f/q ver_strings >nul
+##
+VERSION_MAJOR=$(grep '^VERSION_MAJOR' Conf/BiosId.env | cut -d ' ' -f 3 | cut -c 1-4)
+VERSION_MINOR=$(grep '^VERSION_MINOR' Conf/BiosId.env | cut -d ' ' -f 3 | cut -c 1-2)
+BIOS_Name="$BOARD_ID""$BOARD_REV""$SV_String""$Arch"_"$BUILD_TYPE"_"$VERSION_MAJOR"_"$VERSION_MINOR"
+
+cp -f $BUILD_PATH/FV/FVOBB.Fv  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+cp -f $BUILD_PATH/FV/FVOBBX.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+cp -f $BUILD_PATH/FV/FVIBBR.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+cp -f $BUILD_PATH/FV/FVIBBM.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+cp -f $BUILD_PATH/FV/FVIBBL.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+
+if [ $BoardId == "BG" ]; then
+  cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/BensonGlacier/FAB_A/SpiChunk1.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+  cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/BensonGlacier/FAB_A/SpiChunk2.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+  cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/BensonGlacier/FAB_A/SpiChunk3.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+  cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/BensonGlacier/FAB_A/GCC/NvStorage.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+fi
+
+if [ $BoardId == "MN" ]; then
+  if [ $FabId == "B" ]; then
+    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_B/SpiChunk1.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_B/SpiChunk2.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_B/SpiChunk3.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_B/GCC/NvStorage.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+  else
+    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_A/SpiChunk1.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_A/SpiChunk2.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_A/SpiChunk3.bin  $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+    cp -f $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Binaries/IFWI/MinnowBoard3/FAB_A/GCC/NvStorage.Fv $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+  fi
+fi
+
+#
+# Assmeble components
+#
+pushd $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch
+
+cat FVIBBL.Fv > IBBL.Fv
+
+cat FVIBBM.Fv FSP_M.Fv > IBB.Fv
+
+cat FSP_S.Fv FVIBBR.Fv FVOBB.Fv FVOBBX.Fv > OBB.Fv
+
+cat SpiChunk1.bin IBBL.Fv IBB.Fv SpiChunk2.bin OBB.Fv NvStorage.Fv SpiChunk3.bin > $BIOS_Name"_GCC".bin
+
+popd
+
+echo
+echo Check if SPI IFWI image is generated at below location:
+echo $WORKSPACE/Platform/BroxtonPlatformPkg/Common/Tools/Stitch/$BIOS_Name"_GCC".bin
+echo
+echo
diff --git a/Platform/BroxtonPlatformPkg/BuildIFWI.bat b/Platform/BroxtonPlatformPkg/BuildIFWI.bat
index 5042580..04d338d 100644
--- a/Platform/BroxtonPlatformPkg/BuildIFWI.bat
+++ b/Platform/BroxtonPlatformPkg/BuildIFWI.bat
@@ -2,6 +2,7 @@
 SetLocal EnableDelayedExpansion EnableExtensions
 
 :: Assign initial values
+set thisscript=%0
 set exitCode=0
 set "Build_Flags= "
 set Arch=X64
@@ -116,7 +117,7 @@ if /i "%~1"=="/m" (
 :: Require 2 input parameters
 if "%~2"=="" (
    echo. & echo -- ERROR: Not Enough Arguments Provided
-   echo -- Please review the Help screen "/?" -- & echo.
+   echo -- Please review the Help screen %thisscript% "/?" -- & echo.
    goto exit
 )
 
@@ -129,8 +130,8 @@ echo ===========================================================================
 echo Build_IFWI:  Calling BIOS build Script...
 echo.
 
-echo - call BuildBios.bat %buildthread% %Build_Flags% %Platform_Type% %Build_Target%
-call %WORKSPACE%\%PLATFORM_PATH%\BuildBios.bat %buildthread% %Build_Flags% %Platform_Type% %Build_Target%
+echo - call BuildBxtBios.bat %buildthread% %Build_Flags% %Platform_Type% %Build_Target%
+call %WORKSPACE%\%PLATFORM_PATH%\BuildBxtBios.bat %buildthread% %Build_Flags% %Platform_Type% %Build_Target%
 if ErrorLevel 1 (
     echo echo  -- Error Building BIOS  & echo.
     set exitCode=1
@@ -170,7 +171,7 @@ if ErrorLevel 1 (
 )
 echo.
 echo Build_IFWI is finished.
-echo The final IFWI file is located in Stitch\
+echo The final IFWI file is located in %WORKSPACE%\%PLATFORM_PATH%\Common\Tools\Stitch\
 echo ======================================================================
 
 
@@ -180,11 +181,12 @@ goto Exit
 if /i "%SkipUsageFlag%" == "TRUE" goto Exit
 echo Script to build BIOS firmware and stitch the entire IFWI.
 echo.
-echo Usage: BuildIFWI.bat [options] ^<PlatformType^> ^<BuildTarget^>
+echo Usage: %thisscript% [options] ^<PlatformType^> ^<BuildTarget^>
 echo.
 echo.    /?       Display this help text
 echo     /l       Log a copy of the build output to EDK2.log
 echo     /c       CleanAll before building
+echo     /m 	  Set the build thread count to number of processors
 echo     /FspW    Build FSP and FSP Wrapper
 echo     /x64     Set Arch to X64 (default)
 echo     /vs08    Set compiler to VisualStudio 2008
diff --git a/Platform/BroxtonPlatformPkg/BuildIFWI.sh b/Platform/BroxtonPlatformPkg/BuildIFWI.sh
index 73766cc..f5fb4b4 100755
--- a/Platform/BroxtonPlatformPkg/BuildIFWI.sh
+++ b/Platform/BroxtonPlatformPkg/BuildIFWI.sh
@@ -19,10 +19,12 @@ function Usage () {
   echo
   echo "Usage: BuildIFWI.sh Build_Flags Platform_Type Build_Target"
   echo
-  echo "       Build_Flags:                 /A     Set FabId to A (default:  FAB_B)"
-  echo "       Build_Flags:                 /B     Set FabId to B (default:  FAB_B)"
-  echo "       Platform_Type [optional]:    Broxton  "                   
-  echo "       Build_Target:                Release, Debug       "
+  echo "       Build_Flags:                 /MN    Minnow3 Board (default: MN) "
+  echo "       Build_Flags:                 /BG    Benson Glacier Board "
+  echo "       Build_Flags:                 /A     Set FabId to A (default:  FAB_B) "
+  echo "       Build_Flags:                 /B     Set FabId to B (default:  FAB_B) "
+  echo "       Platform_Type [optional]:    Broxton "                   
+  echo "       Build_Target:                Release, Debug "
   echo
   echo "Press any key......"
   read
@@ -56,6 +58,10 @@ for (( i=1; i<=$#; ))
       Arch=X64
       Build_Flags="$Build_Flags /x64"
       shift
+    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/MN" ]; then
+      BoardId=MN
+      Build_Flags="$Build_Flags /MN"
+      shift
     elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/BG" ]; then
       BoardId=BG
       Build_Flags="$Build_Flags /BG"
@@ -94,7 +100,7 @@ fi
 ## Build BIOS
 echo "======================================================================"
 echo "Build_IFWI:  Calling BIOS build Script..."
-bash Platform/BroxtonPlatformPkg/BuildBios.sh $Build_Flags $Platform_Type $Build_Target
+bash Platform/BroxtonPlatformPkg/BuildBxtBios.sh $Build_Flags $Platform_Type $Build_Target
 
 echo
 echo Finished Building Process.
-- 
2.7.0.windows.1




             reply	other threads:[~2017-10-30  1:55 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-10-30  1:58 lushifex [this message]
2017-10-30  2:15 ` [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Build script Wei, David
  -- strict thread matches above, loose matches on Subject: below --
2017-12-19 16:40 [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Build Script lushifex
2017-12-20  6:04 ` Wei, David
2017-09-14  5:59 lushifex
2017-09-14  6:24 ` Wei, David
2017-07-11 22:20 lushifex
2017-07-11 22:20 lushifex
2017-06-16  2:48 [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Build script lushifex
2017-06-16  2:50 ` Wei, David
2017-06-08  7:58 lushifex
2017-06-08  8:01 ` Wei, David

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ec57d042-ac96-4271-9fca-6272992570e9@SHWDEOPENPSI011.local \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox