bld_vlv.sh should probably have "set -e" at the top, like the change to Build_IFWI.sh

See https://bugzilla.tianocore.org/show_bug.cgi?id=1599 ("bld_vlv.sh isn't `set -e` and doesn't check if commands completed successfully").


--
Rebecca Cran


On 7/10/19 1:05 PM, Michael D Kinney wrote:
* Remove cln.sh
* Remove unused PlatformDefintions.h file
* Remove unused defines from DSC files
* Make Windows and Linux script more consistent
* Remove unused options from Windows/Linux scripts
* Remove unused defines from Windows/Linux scripts
* Do not modify Target.txt in Conf directory.  Instead,
  pass all build flags on the command line
* Generate build report in the build output directory
* Generate build logs in the build output directory
* Do not delete files from Conf directory
* Update clean operation to only clean one platform target
* Do not generate AutoPlatformCFG.txt file anymore

Cc: Zailiang Sun <zailiang.sun@intel.com>
Cc: Yi Qian <yi.qian@intel.com>
Cc: Gary Lin <glin@suse.com>
Signed-off-by: Michael D Kinney <michael.d.kinney@intel.com>
---
 Platform/Intel/Vlv2TbltDevicePkg/.gitignore   |   5 -
 .../Intel/Vlv2TbltDevicePkg/Build_IFWI.bat    |  75 ++-------
 .../Intel/Vlv2TbltDevicePkg/Build_IFWI.sh     |  57 +++----
 .../Include/PlatformDefinitions.h             |  43 -----
 .../Vlv2TbltDevicePkg/PlatformPkgConfig.dsc   |   2 -
 .../Vlv2TbltDevicePkg/PlatformPkgGccIA32.dsc  |  55 +-----
 .../Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc   |  53 +-----
 .../Vlv2TbltDevicePkg/PlatformPkgIA32.dsc     |  53 +-----
 .../Vlv2TbltDevicePkg/PlatformPkgX64.dsc      |  55 +-----
 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat  | 120 ++++++-------
 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh   | 159 ++++++++----------
 Platform/Intel/Vlv2TbltDevicePkg/cln.sh       |  62 -------
 12 files changed, 156 insertions(+), 583 deletions(-)
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/.gitignore
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Include/PlatformDefinitions.h
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/cln.sh

diff --git a/Platform/Intel/Vlv2TbltDevicePkg/.gitignore b/Platform/Intel/Vlv2TbltDevicePkg/.gitignore
deleted file mode 100644
index c7698262ad..0000000000
--- a/Platform/Intel/Vlv2TbltDevicePkg/.gitignore
+++ /dev/null
@@ -1,5 +0,0 @@
-AutoPlatformCFG.txt
-Stitch/Stitching.log
-Stitch/MNW*.bin
-Stitch/MNW*.rom
-Stitch/MNW*.rom.orig
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat b/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
index 44759c617f..f65aa61f4a 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
+++ b/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
@@ -9,15 +9,9 @@
 
 SetLocal EnableDelayedExpansion EnableExtensions
 
-@REM Go to work space directory.
-cd ..
-cd ..
-
 :: Assign initial values
 set exitCode=0
 set "Build_Flags= "
-set "Stitch_Flags= "
-set Arch=X64
 set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
 
 set PLATFORM_PATH=%WORKSPACE%
@@ -42,11 +36,6 @@ if not exist %PLATFORM_PATH%\%PLATFORM_PACKAGE% (
 :OptLoop
 if /i "%~1"=="/?" goto Usage
 
-if /i "%~1"=="/q" (
-    set Build_Flags=%Build_Flags% /q
-    shift
-    goto OptLoop
-)
 if /i "%~1"=="/l" (
     set Build_Flags=%Build_Flags% /l
     shift
@@ -67,53 +56,17 @@ if /i "%~1" == "/c" (
     shift
     goto OptLoop
 )
-if /i "%~1" == "/ECP" (
-    set Build_Flags=%Build_Flags% /ecp
-    shift
-    goto OptLoop
-)
-
-if /i "%~1"=="/s" (
-    set Build_Flags=%Build_Flags% /s
-    shift
-    goto OptLoop
-)
-
 if /i "%~1"=="/x64" (
-    set Arch=X64
     set Build_Flags=%Build_Flags% /x64
     shift
     goto OptLoop
 )
-
 if /i "%~1"=="/IA32" (
-    set Arch=IA32
     set Build_Flags=%Build_Flags% /IA32
     shift
     goto OptLoop
 )
 
-if /i "%~1"=="/nG" (
-    set Stitch_Flags=%Stitch_Flags% /nG
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/nM" (
-    set Stitch_Flags=%Stitch_Flags% /nM
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/nB" (
-    set Stitch_Flags=%Stitch_Flags% /nB
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/yL" (
-    set Stitch_Flags=%Stitch_Flags% /yL
-    shift
-    goto OptLoop
-)
-
 :: Require 2 input parameters
 if "%~2"=="" goto Usage
 
@@ -125,7 +78,7 @@ set Build_Target=%~2
 echo ======================================================================
 echo Build_IFWI:  Calling BIOS build Script...
 
-call %PLATFORM_PATH%\%PLATFORM_PACKAGE%\bld_vlv.bat %Build_Flags%  %Platform_Type% %Build_Target%
+call %PLATFORM_PATH%\%PLATFORM_PACKAGE%\bld_vlv.bat %Build_Flags% %Platform_Type% %Build_Target%
 
 if %ERRORLEVEL% NEQ 0 (
     echo echo  -- Error Building BIOS  & echo.
@@ -139,23 +92,21 @@ goto Exit
 :Usage
 echo Script to build BIOS firmware and stitch the entire IFWI.
 echo.
-echo Usage: Build_IFWI.bat [options]  PlatformType  BuildTarget  [IFWI Suffix]
+echo Usage: Build_IFWI.bat [options]  PlatformType  BuildTarget
 echo.
-echo        /c     CleanAll before building
-echo        /x64   Set Arch to X64  (default: X64)
-echo        /IA32  Set Arch to IA32 (default: X64)
-echo        /yL    Enable SPI lock
-echo. 
-echo        Platform Types:   MNW2
-echo        Build Targets:    Release, Debug
-echo        IFWI Suffix:      Suffix to append to end of IFWI filename (default: MM_DD_YYYY)
+echo    /c    CleanAll
+echo    /l    Generate build log file
+echo    /y    Generate build report file
+echo    /m    Enable multi-processor build
+echo    /IA32 Set Arch to IA32 (default: X64)
+echo    /X64  Set Arch to X64 (default: X64)
 echo.
-echo        See  Stitch/Stitch_Config.txt  for additional stitching settings.
+echo        Platform Types:  MNW2
+echo        Build Targets:   Debug, Release  (default: Debug)
 echo.
-echo        If capsule update is needed, please update CAPSULE_ENABLE = TRUE in Config.dsc.
-echo        If recovery is needed, please update RECOVERY_ENABLE = TRUE in Config.dsc.
-echo        If either of above is TRUE, please set OPENSSL_PATH in windows evironment
-echo        and put openssl.exe there, to generate final capsule image.
+echo Examples:
+echo    Build_IFWI.bat MNW2 debug           : X64 Debug build for MinnowMax
+echo    Build_IFWI.bat /IA32 MNW2 release   : IA32 Release build for MinnowMax
 echo.
 set exitCode=1
 
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh b/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
index 349f0c7ba7..153c8c5fae 100755
--- a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
+++ b/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
@@ -6,15 +6,21 @@ function Usage ( ) {
   echo
   echo "Script to build BIOS firmware and stitch the entire IFWI."
   echo
-  echo "Usage: Build_IFWI.sh [options]  PlatformType  BuildTarget  "
+  echo "Usage: Build_IFWI.sh [options]  PlatformType  BuildTarget"
   echo
-  echo 
-  echo "       /yL [option]  :   Enable SPI lock"
-  echo "       Platform Types:   MNW2"
-  echo "       Build Targets:    Release, Debug"
+  echo "   /c    CleanAll"
+  echo "   /l    Generate build log file"
+  echo "   /y    Generate build report file"
+  echo "   /m    Enable multi-processor build"
+  echo "   /IA32 Set Arch to IA32 (default: X64)"
+  echo "   /X64  Set Arch to X64 (default: X64)"
   echo
-  echo "       See  Stitch/Stitch_Config.txt  for additional stitching settings."
+  echo "       Platform Types:  MNW2"
+  echo "       Build Targets:   Debug, Release  (default: Debug)"
   echo
+  echo "Examples:"
+  echo "   Build_IFWI.sh MNW2 debug           : X64 Debug build for MinnowMax"
+  echo "   Build_IFWI.sh /IA32 MNW2 release   : IA32 Release build for MinnowMax"
   echo
   exit 0
 }
@@ -24,9 +30,6 @@ set -e
 ## Assign initial values
 exitCode=0
 Build_Flags=
-Stitch_Flags=
-Arch=X64
-PLATFORM_PACKAGE=Vlv2TbltDevicePkg
 
 ## Check whether WORKSPACE is set or not
 if [[ -z "$WORKSPACE" ]]; then
@@ -47,41 +50,24 @@ fi
 
 for (( i=1; i<=$#; ))
   do
-    if [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/Q" ]; then
-      Build_Flags="$Build_Flags /q"
-      shift
-    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/L" ]; then
+    if [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/L" ]; then
       Build_Flags="$Build_Flags /l"
       shift
+    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/Y" ]; then
+      Build_Flags="$Build_Flags /y"
+      shift
+    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/M" ]; then
+      Build_Flags="$Build_Flags /m"
+      shift
     elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/C" ]; then
       Build_Flags="$Build_Flags /c"
       shift
-    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/ECP" ]; then
-      Build_Flags="$Build_Flags /ecp"
-      shift
     elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/X64" ]; then
-      Arch=X64
       Build_Flags="$Build_Flags /x64"
       shift
     elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/IA32" ]; then
-      Arch=IA32
       Build_Flags="$Build_Flags /IA32"
       shift
-    elif [ "$1" == "/nG" ]; then
-      Stitch_Flags="$Stitch_Flags /nG"
-      shift
-    elif [ "$1" == "/nM" ]; then
-      Stitch_Flags="$Stitch_Flags /nM"
-      shift
-    elif [ "$1" == "/nB" ]; then
-      Stitch_Flags="$Stitch_Flags /nB"
-      shift
-    elif [ "$1" == "/nV" ]; then
-      Stitch_Flags="$Stitch_Flags /nV"
-      shift
-    elif [ "$1" == "/yL" ]; then
-      Build_Flags="$Build_Flags /yL"
-      shift
     else
       break
     fi
@@ -95,11 +81,6 @@ fi
 ## Assign required arguments
 Platform_Type=$1
 Build_Target=$2
-if [ "$3" == "" ]; then
-  IFWI_Suffix=
-else
-  IFWI_Suffix="/S $3"
-fi
 
 ## Build BIOS
 echo "======================================================================"
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Include/PlatformDefinitions.h b/Platform/Intel/Vlv2TbltDevicePkg/Include/PlatformDefinitions.h
deleted file mode 100644
index a64cda0799..0000000000
--- a/Platform/Intel/Vlv2TbltDevicePkg/Include/PlatformDefinitions.h
+++ /dev/null
@@ -1,43 +0,0 @@
-/*++
-
-Copyright (c) 1999  - 2014, Intel Corporation. All rights reserved
-                                                                                   

-  SPDX-License-Identifier: BSD-2-Clause-Patent
-
-                                                                                   

-
-
-Module Name:
-
-  PlatformDefinitions.h
-
-Abstract:
-
-  This header file provides platform specific definitions used by other modules
-  for platform specific initialization.
-
-  THIS FILE SHOULD ONLY CONTAIN #defines BECAUSE IT IS CONSUMED BY NON-C MODULES
-  (ASL and VFR)
-
-  This file should not contain addition or other operations that an ASL compiler or
-  VFR compiler does not understand.
-
---*/
-
-#ifndef _PLATFORM_DEFINITIONS_H_
-#define _PLATFORM_DEFINITIONS_H_
-
-
-//
-// Platform Base Address definitions
-//
-#define PCIEX_BASE_ADDRESS          EDKII_GLUE_PciExpressBaseAddress // Pci Express Configuration Space Base Address
-
-#define PCIEX_LENGTH                PLATFORM_PCIEXPRESS_LENGTH
-
-#define THERMAL_BASE_ADDRESS        0xFED08000
-
-#ifndef MCH_BASE_ADDRESS
-#define MCH_BASE_ADDRESS            0xFED10000  // MCH  Register Base Address
-#endif
-#endif
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
index 7b48d7b44e..43db3e28ab 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
@@ -54,8 +54,6 @@
 DEFINE USB_SERIAL_STATUS_CODE_ENABLE = FALSE
 DEFINE RAM_SERIAL_STATUS_CODE_ENABLE = FALSE
 
-DEFINE ENBDT_S3_SUPPORT = TRUE
-
 DEFINE LZMA_ENABLE = TRUE
 DEFINE S4_ENABLE = TRUE
 
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccIA32.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccIA32.dsc
index eb7ae46505..0f9651cfba 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccIA32.dsc
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccIA32.dsc
@@ -27,20 +27,9 @@ [Defines]
   #
   # Platform On/Off features are defined here
   #
-  #
-  # Platform Support:: Set only one token except Crestview Hills
-  #
-  #   3.BayleyBay
-  #     ENBDT_PF_ENABLE  = TRUE
-  #
-  !include Vlv2TbltDevicePkg/AutoPlatformCFG.txt
   !include Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
 
-!if $(X64_CONFIG) == TRUE
-  DEFINE      DXE_ARCHITECTURE        = X64
-!else
   DEFINE      DXE_ARCHITECTURE        = IA32
-!endif
 
   FLASH_DEFINITION                    = Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
 !if $(LFMA_ENABLE) == TRUE
@@ -761,8 +750,6 @@ [Components.IA32]
 
 !if $(RC_BINARY_RELEASE) == TRUE
   Vlv2TbltDevicePkg/PlatformPei/PlatformPei.inf {
-    <BuildOptions>
-      *_*_IA32_CC_FLAGS      = -DRC_BINARY_RELEASE
   !if $(TARGET) == DEBUG
       <PcdsFixedAtBuild>
         gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2E
@@ -1231,56 +1218,19 @@ [BuildOptions]
 #
 # Define token for different Platform
 #
-  DEFINE MINNOW2_FSP_OPTION =
-
-!if $(ENBDT_PF_BUILD) == TRUE
-  DEFINE ENBDT_PF_ENABLE = -DENBDT_PF_ENABLE=1
-!else
-  DEFINE ENBDT_PF_ENABLE = -DENBDT_PF_ENABLE=0
-!endif
-
-
 !if $(CLKGEN_CONFIG_EXTRA_ENABLE) == TRUE
   DEFINE CLKGEN_CONFIG_EXTRA_BUILD_OPTION = -DCLKGEN_CONFIG_EXTRA=1
 !else
   DEFINE CLKGEN_CONFIG_EXTRA_BUILD_OPTION =
 !endif
 
-
-
 !if $(PCIESC_ENABLE) == TRUE
   DEFINE PCIESC_SUPPORT_BUILD_OPTION = -DPCIESC_SUPPORT=1
 !else
   DEFINE PCIESC_SUPPORT_BUILD_OPTION =
 !endif
-!if $(SATA_ENABLE) == TRUE
-  DEFINE SATA_SUPPORT_BUILD_OPTION = -DSATA_SUPPORT=1
-!else
-  DEFINE SATA_SUPPORT_BUILD_OPTION =
-!endif
-!if $(ENBDT_S3_SUPPORT) == TRUE
-  DEFINE ENBDT_S3_SUPPORT_OPTIONS = -DNOCS_S3_SUPPORT
-!else
-  DEFINE ENBDT_S3_SUPPORT_OPTIONS =
-!endif
 
-!if $(X64_CONFIG) == TRUE
-  DEFINE X64_BUILD_ENABLE = -DX64_BUILD_ENABLE=1
-!else
-  DEFINE X64_BUILD_ENABLE =
-!endif
-
-!if $(TPM_ENABLED) == TRUE
-  DEFINE DSC_TPM_BUILD_OPTIONS = -DTPM_ENABLED
-!else
-  DEFINE DSC_TPM_BUILD_OPTIONS =
-!endif
-
-
-  DEFINE EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS = $(MINNOW2_FSP_OPTION) $(MINNOW2_BUILD_OPTION) $(ENBDT_PF_ENABLE) $(EXTERNAL_VGA_BUILD_OPTION) $(PCIE_ENUM_WA_BUILD_OPTION) $(X0_WA_ENABLE_BUILD_OPTION) $(A0_WA_ENABLE_BUILD_OPTION) $(MICROCODE_FREE_BUILD_OPTIONS) $(SIMICS_BUILD_OPTIONS) $(HYBRID_BUILD_OPTIONS) $(COMPACT_BUILD_OPTIONS) $(VP_BUILD_OPTIONS) $(SYSCTL_ID_BUILD_OPTION) $(CLKGEN_CONFIG_EXTRA_BUILD_OPTION) $(SYSCTL_X0_CONVERT_BOARD_OPTION) $(ENBDT_S3_SUPPORT_OPTIONS) $(SATA_SUPPORT_BUILD_OPTION) $(PCIESC_SUPPORT_BUILD_OPTION) $(DSC_FTPM_ERROR_WR_BUILD_OPTIONS) $(DSC_TPM_BUILD_OPTIONS) $(DSC_BYTI_SECURE_BOOT_BUILD_OPTIONS)
-!if $(PERFORMANCE_ENABLE) == TRUE
-  DEFINE PDB_BUILD_OPTION = /Zi
-!endif
+  DEFINE EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS = $(CLKGEN_CONFIG_EXTRA_BUILD_OPTION) $(PCIESC_SUPPORT_BUILD_OPTION)
 
   GCC:*_*_*_CC_FLAGS = -Wno-missing-braces
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
@@ -1290,7 +1240,6 @@ [BuildOptions]
   DEFINE SOURCE_LEVEL_DEBUG_BUILD_OPTIONS =
 !else
   DEFINE SOURCE_LEVEL_DEBUG_BUILD_OPTIONS =
-
 !endif
 
 #
@@ -1310,8 +1259,6 @@ [BuildOptions.common.EDKII.DXE_SMM_DRIVER, BuildOptions.common.EDKII.SMM_CORE]
   GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
 
 [BuildOptions.Common.EDKII]
-  *_*_IA32_ASM_FLAGS     = $(VP_BUILD_OPTIONS) -D EDKII_GLUE_PciExpressBaseAddress=$(PLATFORM_PCIEXPRESS_BASE)h -DNOCS_S3_SUPPORT
-
   *_*_IA32_CC_FLAGS      = $(EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS)
   *_*_IA32_VFRPP_FLAGS   = $(EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS)
   *_*_IA32_APP_FLAGS     = $(EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS)
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
index 69f2b22aff..257bba7485 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgGccX64.dsc
@@ -27,22 +27,11 @@ [Defines]
   #
   # Platform On/Off features are defined here
   #
-  #
-  # Platform Support:: Set only one token except Crestview Hills
-  #
-  #   3.BayleyBay
-  #     ENBDT_PF_ENABLE  = TRUE
-  #
-  !include Vlv2TbltDevicePkg/AutoPlatformCFG.txt
   !include Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
 
   DEFINE PLATFORMX64_ENABLE = TRUE
 
-!if $(X64_CONFIG) == TRUE
   DEFINE      DXE_ARCHITECTURE        = X64
-!else
-  DEFINE      DXE_ARCHITECTURE        = IA32
-!endif
 
   FLASH_DEFINITION                    = Vlv2TbltDevicePkg/PlatformPkgGcc.fdf
 !if $(LFMA_ENABLE) == TRUE
@@ -763,8 +752,6 @@ [Components.IA32]
 
 !if $(RC_BINARY_RELEASE) == TRUE
   Vlv2TbltDevicePkg/PlatformPei/PlatformPei.inf {
-    <BuildOptions>
-      *_*_IA32_CC_FLAGS      = -DRC_BINARY_RELEASE
   !if $(TARGET) == DEBUG
       <PcdsFixedAtBuild>
         gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2E
@@ -1246,15 +1233,6 @@ [BuildOptions]
 #
 # Define token for different Platform
 #
-  DEFINE MINNOW2_FSP_OPTION =
-
-!if $(ENBDT_PF_BUILD) == TRUE
-  DEFINE ENBDT_PF_ENABLE = -DENBDT_PF_ENABLE=1
-!else
-  DEFINE ENBDT_PF_ENABLE = -DENBDT_PF_ENABLE=0
-!endif
-
-
 !if $(CLKGEN_CONFIG_EXTRA_ENABLE) == TRUE
   DEFINE CLKGEN_CONFIG_EXTRA_BUILD_OPTION = -DCLKGEN_CONFIG_EXTRA=1
 !else
@@ -1268,34 +1246,8 @@ [BuildOptions]
 !else
   DEFINE PCIESC_SUPPORT_BUILD_OPTION =
 !endif
-!if $(SATA_ENABLE) == TRUE
-  DEFINE SATA_SUPPORT_BUILD_OPTION = -DSATA_SUPPORT=1
-!else
-  DEFINE SATA_SUPPORT_BUILD_OPTION =
-!endif
-!if $(ENBDT_S3_SUPPORT) == TRUE
-  DEFINE ENBDT_S3_SUPPORT_OPTIONS = -DNOCS_S3_SUPPORT
-!else
-  DEFINE ENBDT_S3_SUPPORT_OPTIONS =
-!endif
 
-!if $(X64_CONFIG) == TRUE
-  DEFINE X64_BUILD_ENABLE = -DX64_BUILD_ENABLE=1
-!else
-  DEFINE X64_BUILD_ENABLE =
-!endif
-
-!if $(TPM_ENABLED) == TRUE
-  DEFINE DSC_TPM_BUILD_OPTIONS = -DTPM_ENABLED
-!else
-  DEFINE DSC_TPM_BUILD_OPTIONS =
-!endif
-
-
-  DEFINE EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS = $(MINNOW2_FSP_OPTION) $(MINNOW2_BUILD_OPTION) $(ENBDT_PF_ENABLE) $(EXTERNAL_VGA_BUILD_OPTION) $(PCIE_ENUM_WA_BUILD_OPTION) $(X0_WA_ENABLE_BUILD_OPTION) $(A0_WA_ENABLE_BUILD_OPTION) $(MICROCODE_FREE_BUILD_OPTIONS) $(SIMICS_BUILD_OPTIONS) $(HYBRID_BUILD_OPTIONS) $(COMPACT_BUILD_OPTIONS) $(VP_BUILD_OPTIONS) $(SYSCTL_ID_BUILD_OPTION) $(CLKGEN_CONFIG_EXTRA_BUILD_OPTION) $(SYSCTL_X0_CONVERT_BOARD_OPTION) $(ENBDT_S3_SUPPORT_OPTIONS) $(SATA_SUPPORT_BUILD_OPTION) $(PCIESC_SUPPORT_BUILD_OPTION) $(DSC_FTPM_ERROR_WR_BUILD_OPTIONS) $(DSC_TPM_BUILD_OPTIONS) $(DSC_BYTI_SECURE_BOOT_BUILD_OPTIONS)
-!if $(PERFORMANCE_ENABLE) == TRUE
-  DEFINE PDB_BUILD_OPTION = /Zi
-!endif
+  DEFINE EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS = $(CLKGEN_CONFIG_EXTRA_BUILD_OPTION) $(PCIESC_SUPPORT_BUILD_OPTION)
 
   GCC:*_*_*_CC_FLAGS = -Wno-missing-braces
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
@@ -1305,7 +1257,6 @@ [BuildOptions]
   DEFINE SOURCE_LEVEL_DEBUG_BUILD_OPTIONS =
 !else
   DEFINE SOURCE_LEVEL_DEBUG_BUILD_OPTIONS =
-
 !endif
 
 #
@@ -1325,8 +1276,6 @@ [BuildOptions.common.EDKII.DXE_SMM_DRIVER, BuildOptions.common.EDKII.SMM_CORE]
   GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
 
 [BuildOptions.Common.EDKII]
-  *_*_IA32_ASM_FLAGS     = $(VP_BUILD_OPTIONS) -D EDKII_GLUE_PciExpressBaseAddress=$(PLATFORM_PCIEXPRESS_BASE)h -DNOCS_S3_SUPPORT
-
   *_*_IA32_CC_FLAGS      = $(EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS)
   *_*_IA32_VFRPP_FLAGS   = $(EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS)
   *_*_IA32_APP_FLAGS     = $(EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS)
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
index 7092ab6e6b..23e296d432 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
@@ -27,20 +27,9 @@ [Defines]
   #
   # Platform On/Off features are defined here
   #
-  #
-  # Platform Support:: Set only one token except Crestview Hills
-  #
-  #   3.BayleyBay
-  #     ENBDT_PF_ENABLE  = TRUE
-  #
-  !include Vlv2TbltDevicePkg/AutoPlatformCFG.txt
   !include Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
 
-!if $(X64_CONFIG) == TRUE
-  DEFINE      DXE_ARCHITECTURE        = X64
-!else
   DEFINE      DXE_ARCHITECTURE        = IA32
-!endif
 
   FLASH_DEFINITION                    = Vlv2TbltDevicePkg/PlatformPkg.fdf
 !if $(LFMA_ENABLE) == TRUE
@@ -761,8 +750,6 @@ [Components.IA32]
 
 !if $(RC_BINARY_RELEASE) == TRUE
   Vlv2TbltDevicePkg/PlatformPei/PlatformPei.inf {
-    <BuildOptions>
-      *_*_IA32_CC_FLAGS      = /DRC_BINARY_RELEASE
   !if $(TARGET) == DEBUG
       <PcdsFixedAtBuild>
         gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2E
@@ -1231,15 +1218,6 @@ [BuildOptions]
 #
 # Define token for different Platform
 #
-  DEFINE MINNOW2_FSP_OPTION =
-
-!if $(ENBDT_PF_BUILD) == TRUE
-  DEFINE ENBDT_PF_ENABLE = /DENBDT_PF_ENABLE=1
-!else
-  DEFINE ENBDT_PF_ENABLE = /DENBDT_PF_ENABLE=0
-!endif
-
-
 !if $(CLKGEN_CONFIG_EXTRA_ENABLE) == TRUE
   DEFINE CLKGEN_CONFIG_EXTRA_BUILD_OPTION = /DCLKGEN_CONFIG_EXTRA=1
 !else
@@ -1253,34 +1231,8 @@ [BuildOptions]
 !else
   DEFINE PCIESC_SUPPORT_BUILD_OPTION =
 !endif
-!if $(SATA_ENABLE) == TRUE
-  DEFINE SATA_SUPPORT_BUILD_OPTION = /DSATA_SUPPORT=1
-!else
-  DEFINE SATA_SUPPORT_BUILD_OPTION =
-!endif
-!if $(ENBDT_S3_SUPPORT) == TRUE
-  DEFINE ENBDT_S3_SUPPORT_OPTIONS = /DNOCS_S3_SUPPORT
-!else
-  DEFINE ENBDT_S3_SUPPORT_OPTIONS =
-!endif
 
-!if $(X64_CONFIG) == TRUE
-  DEFINE X64_BUILD_ENABLE = /DX64_BUILD_ENABLE=1
-!else
-  DEFINE X64_BUILD_ENABLE =
-!endif
-
-!if $(TPM_ENABLED) == TRUE
-  DEFINE DSC_TPM_BUILD_OPTIONS = /DTPM_ENABLED
-!else
-  DEFINE DSC_TPM_BUILD_OPTIONS =
-!endif
-
-
-  DEFINE EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS = $(MINNOW2_FSP_OPTION) $(MINNOW2_BUILD_OPTION) $(ENBDT_PF_ENABLE) $(EXTERNAL_VGA_BUILD_OPTION) $(PCIE_ENUM_WA_BUILD_OPTION) $(X0_WA_ENABLE_BUILD_OPTION) $(A0_WA_ENABLE_BUILD_OPTION) $(MICROCODE_FREE_BUILD_OPTIONS) $(SIMICS_BUILD_OPTIONS) $(HYBRID_BUILD_OPTIONS) $(COMPACT_BUILD_OPTIONS) $(VP_BUILD_OPTIONS) $(SYSCTL_ID_BUILD_OPTION) $(CLKGEN_CONFIG_EXTRA_BUILD_OPTION) $(SYSCTL_X0_CONVERT_BOARD_OPTION) $(ENBDT_S3_SUPPORT_OPTIONS) $(SATA_SUPPORT_BUILD_OPTION) $(PCIESC_SUPPORT_BUILD_OPTION) $(DSC_FTPM_ERROR_WR_BUILD_OPTIONS) $(DSC_TPM_BUILD_OPTIONS) $(DSC_BYTI_SECURE_BOOT_BUILD_OPTIONS)
-!if $(PERFORMANCE_ENABLE) == TRUE
-  DEFINE PDB_BUILD_OPTION = /Zi
-!endif
+  DEFINE EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS = $(CLKGEN_CONFIG_EXTRA_BUILD_OPTION) $(PCIESC_SUPPORT_BUILD_OPTION)
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   MSFT:*_*_X64_GENFW_FLAGS  = --keepexceptiontable
@@ -1291,7 +1243,6 @@ [BuildOptions]
 !endif
 !else
   DEFINE SOURCE_LEVEL_DEBUG_BUILD_OPTIONS =
-
 !endif
 
 #
@@ -1311,8 +1262,6 @@ [BuildOptions.common.EDKII.DXE_SMM_DRIVER, BuildOptions.common.EDKII.SMM_CORE]
   GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
 
 [BuildOptions.Common.EDKII]
-  *_*_IA32_ASM_FLAGS     = $(VP_BUILD_OPTIONS) /D EDKII_GLUE_PciExpressBaseAddress=$(PLATFORM_PCIEXPRESS_BASE)h /DNOCS_S3_SUPPORT
-
   *_*_IA32_CC_FLAGS      = $(EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS)
   *_*_IA32_VFRPP_FLAGS   = $(EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS)
   *_*_IA32_APP_FLAGS     = $(EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS)
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
index 238561191f..e0fd767dea 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
@@ -27,22 +27,11 @@ [Defines]
   #
   # Platform On/Off features are defined here
   #
-  #
-  # Platform Support:: Set only one token except Crestview Hills
-  #
-  #   3.BayleyBay
-  #     ENBDT_PF_ENABLE  = TRUE
-  #
-  !include Vlv2TbltDevicePkg/AutoPlatformCFG.txt
   !include Vlv2TbltDevicePkg/PlatformPkgConfig.dsc
 
   DEFINE PLATFORMX64_ENABLE = TRUE
 
-!if $(X64_CONFIG) == TRUE
   DEFINE      DXE_ARCHITECTURE        = X64
-!else
-  DEFINE      DXE_ARCHITECTURE        = IA32
-!endif
 
   FLASH_DEFINITION                    = Vlv2TbltDevicePkg/PlatformPkg.fdf
 !if $(LFMA_ENABLE) == TRUE
@@ -763,8 +752,6 @@ [Components.IA32]
 
 !if $(RC_BINARY_RELEASE) == TRUE
   Vlv2TbltDevicePkg/PlatformPei/PlatformPei.inf {
-    <BuildOptions>
-      *_*_IA32_CC_FLAGS      = /DRC_BINARY_RELEASE
   !if $(TARGET) == DEBUG
       <PcdsFixedAtBuild>
         gEfiMdePkgTokenSpaceGuid.PcdDebugPropertyMask|0x2E
@@ -1246,56 +1233,19 @@ [BuildOptions]
 #
 # Define token for different Platform
 #
-  DEFINE MINNOW2_FSP_OPTION =
-
-!if $(ENBDT_PF_BUILD) == TRUE
-  DEFINE ENBDT_PF_ENABLE = /DENBDT_PF_ENABLE=1
-!else
-  DEFINE ENBDT_PF_ENABLE = /DENBDT_PF_ENABLE=0
-!endif
-
-
 !if $(CLKGEN_CONFIG_EXTRA_ENABLE) == TRUE
   DEFINE CLKGEN_CONFIG_EXTRA_BUILD_OPTION = /DCLKGEN_CONFIG_EXTRA=1
 !else
   DEFINE CLKGEN_CONFIG_EXTRA_BUILD_OPTION =
 !endif
 
-
-
 !if $(PCIESC_ENABLE) == TRUE
   DEFINE PCIESC_SUPPORT_BUILD_OPTION = /DPCIESC_SUPPORT=1
 !else
   DEFINE PCIESC_SUPPORT_BUILD_OPTION =
 !endif
-!if $(SATA_ENABLE) == TRUE
-  DEFINE SATA_SUPPORT_BUILD_OPTION = /DSATA_SUPPORT=1
-!else
-  DEFINE SATA_SUPPORT_BUILD_OPTION =
-!endif
-!if $(ENBDT_S3_SUPPORT) == TRUE
-  DEFINE ENBDT_S3_SUPPORT_OPTIONS = /DNOCS_S3_SUPPORT
-!else
-  DEFINE ENBDT_S3_SUPPORT_OPTIONS =
-!endif
 
-!if $(X64_CONFIG) == TRUE
-  DEFINE X64_BUILD_ENABLE = /DX64_BUILD_ENABLE=1
-!else
-  DEFINE X64_BUILD_ENABLE =
-!endif
-
-!if $(TPM_ENABLED) == TRUE
-  DEFINE DSC_TPM_BUILD_OPTIONS = /DTPM_ENABLED
-!else
-  DEFINE DSC_TPM_BUILD_OPTIONS =
-!endif
-
-
-  DEFINE EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS = $(MINNOW2_FSP_OPTION) $(MINNOW2_BUILD_OPTION) $(ENBDT_PF_ENABLE) $(EXTERNAL_VGA_BUILD_OPTION) $(PCIE_ENUM_WA_BUILD_OPTION) $(X0_WA_ENABLE_BUILD_OPTION) $(A0_WA_ENABLE_BUILD_OPTION) $(MICROCODE_FREE_BUILD_OPTIONS) $(SIMICS_BUILD_OPTIONS) $(HYBRID_BUILD_OPTIONS) $(COMPACT_BUILD_OPTIONS) $(VP_BUILD_OPTIONS) $(SYSCTL_ID_BUILD_OPTION) $(CLKGEN_CONFIG_EXTRA_BUILD_OPTION) $(SYSCTL_X0_CONVERT_BOARD_OPTION) $(ENBDT_S3_SUPPORT_OPTIONS) $(SATA_SUPPORT_BUILD_OPTION) $(PCIESC_SUPPORT_BUILD_OPTION) $(DSC_FTPM_ERROR_WR_BUILD_OPTIONS) $(DSC_TPM_BUILD_OPTIONS) $(DSC_BYTI_SECURE_BOOT_BUILD_OPTIONS)
-!if $(PERFORMANCE_ENABLE) == TRUE
-  DEFINE PDB_BUILD_OPTION = /Zi
-!endif
+  DEFINE EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS = $(CLKGEN_CONFIG_EXTRA_BUILD_OPTION) $(PCIESC_SUPPORT_BUILD_OPTION)
 
 !if $(SOURCE_DEBUG_ENABLE) == TRUE
   MSFT:*_*_X64_GENFW_FLAGS  = --keepexceptiontable
@@ -1306,7 +1256,6 @@ [BuildOptions]
 !endif
 !else
   DEFINE SOURCE_LEVEL_DEBUG_BUILD_OPTIONS =
-
 !endif
 
 #
@@ -1326,8 +1275,6 @@ [BuildOptions.common.EDKII.DXE_SMM_DRIVER, BuildOptions.common.EDKII.SMM_CORE]
   GCC:*_*_*_DLINK_FLAGS = -z common-page-size=0x1000
 
 [BuildOptions.Common.EDKII]
-  *_*_IA32_ASM_FLAGS     = $(VP_BUILD_OPTIONS) /D EDKII_GLUE_PciExpressBaseAddress=$(PLATFORM_PCIEXPRESS_BASE)h /DNOCS_S3_SUPPORT
-
   *_*_IA32_CC_FLAGS      = $(EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS)
   *_*_IA32_VFRPP_FLAGS   = $(EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS)
   *_*_IA32_APP_FLAGS     = $(EDK_EDKII_DSC_FEATURE_BUILD_OPTIONS)
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
index ffd6722582..c39b8ccd62 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
+++ b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
@@ -11,7 +11,6 @@ echo.
 echo %date%  %time%
 echo.
 
-
 ::**********************************************************************
 :: Initial Setup
 ::**********************************************************************
@@ -20,9 +19,14 @@ set /a build_threads=1
 set "Build_Flags= "
 set exitCode=0
 set Arch=X64
-set Source=0
+set GenLog=FALSE
+set GenReport=FALSE
+set Clean=FALSE
 set PLATFORM_NAME=Vlv2TbltDevicePkg
 
+::**********************************************************************
+:: Detect full path to the edk2 repo
+::**********************************************************************
 set CORE_PATH=%WORKSPACE%
 if not exist %CORE_PATH%\edksetup.bat (
   if defined PACKAGES_PATH (
@@ -41,6 +45,9 @@ if not exist %CORE_PATH%\edksetup.bat (
 )
 :CorePathFound
 
+::**********************************************************************
+:: Detect full path to the Vlv2TbltDevicePkg
+::**********************************************************************
 set PLATFORM_PACKAGE=%WORKSPACE%\%PLATFORM_NAME%
 if not exist %PLATFORM_PACKAGE% (
   if defined PACKAGES_PATH (
@@ -61,28 +68,13 @@ if not exist %PLATFORM_PACKAGE% (
 
 cd %CORE_PATH%
 
-:: Clean up previous 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\.cache rmdir /q/s %WORKSPACE%\Conf\.cache
+::**********************************************************************
+:: Run edksetup.bat and make sure tools are up to date
+::**********************************************************************
 
-:: 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
 call %CORE_PATH%\edksetup.bat Rebuild
 @echo off
 
-:: Define platform specific environment variables.
-set config_file=%PLATFORM_PACKAGE%\PlatformPkgConfig.dsc
-set auto_config_inc=%PLATFORM_PACKAGE%\AutoPlatformCFG.txt
-
-
-
-::create new AutoPlatformCFG.txt file
-copy /y nul %auto_config_inc% >nul
-
 ::**********************************************************************
 :: Parse command line arguments
 ::**********************************************************************
@@ -92,12 +84,12 @@ copy /y nul %auto_config_inc% >nul
 if /i "%~1"=="/?" goto Usage
 
 if /i "%~1"=="/l" (
-    set Build_Flags=%Build_Flags% -j EDK2.log
+    set GenLog=TRUE
     shift
     goto OptLoop
 )
 if /i "%~1"=="/y" (
-    set Build_Flags=%Build_Flags% -y %PLATFORM_PACKAGE%\EDK2_%PLATFORM_PACKAGE%.report
+    set GenReport=TRUE
     shift
     goto OptLoop
 )
@@ -109,16 +101,7 @@ if /i "%~1"=="/m" (
     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 %WORKSPACE%\Conf\.cache (
-        del /f/s/q %WORKSPACE%\Conf\.cache > nul
-        rmdir /s/q %WORKSPACE%\Conf\.cache
-    )
-    echo.
+    set Clean=TRUE
     shift
     goto OptLoop
 )
@@ -137,23 +120,6 @@ if /i "%~1"=="/IA32" (
 :: Required argument(s)
 if "%~1"=="" goto Usage
 
-if "%Arch%"=="IA32" (
-    echo DEFINE X64_CONFIG = FALSE  >> %auto_config_inc%
-) else if "%Arch%"=="X64" (
-    echo DEFINE X64_CONFIG = TRUE  >> %auto_config_inc%
-)
-
-:: -- Build flags settings for each Platform --
-echo Setting  %1  platform configuration...
-if /i "%~1" == "MNW2" (
-    echo DEFINE ENBDT_PF_BUILD = TRUE   >> %auto_config_inc%
-    
-) else (
-    echo Error - Unsupported PlatformType: %1
-    goto Usage
-)
-set Platform_Type=%~1
-
 if /i "%~2" == "RELEASE" (
     set target=RELEASE
 ) else (
@@ -161,8 +127,9 @@ if /i "%~2" == "RELEASE" (
 )
 
 ::**********************************************************************
-:: Additional EDK Build Setup/Configuration
+:: Detect TOOL_CHAIN_TAG
 ::**********************************************************************
+
 echo.
 echo Setting the Build environment for VS2015/VS2013/VS2012/VS2010/VS2008...
 if defined VS140COMNTOOLS (
@@ -206,6 +173,10 @@ if defined VS140COMNTOOLS (
   goto :BldFail
 )
 
+::**********************************************************************
+:: Generate BUILD_PATH and make sure the directory exists
+::**********************************************************************
+
 echo Ensuring correct build directory is present
 if not exist %WORKSPACE%\Build mkdir %WORKSPACE%\Build
 if "%Arch%"=="IA32" (
@@ -217,26 +188,41 @@ if "%Arch%"=="IA32" (
 )
 if not exist %BUILD_PATH% mkdir %BUILD_PATH%
 
-echo Modifing Conf files for this build...
-:: Remove lines with these tags from target.txt
-findstr /V "TARGET  TARGET_ARCH  TOOL_CHAIN_TAG  BUILD_RULE_CONF  ACTIVE_PLATFORM  MAX_CONCURRENT_THREAD_NUMBER" %WORKSPACE%\Conf\target.txt > %WORKSPACE%\Conf\target.txt.tmp
+::**********************************************************************
+:: Check for clean operation
+::**********************************************************************
 
-echo TARGET          = %TARGET%                                  >> %WORKSPACE%\Conf\target.txt.tmp
+if "%Clean%"=="TRUE" (
+  echo Removing previous build files ...
+  if exist %BUILD_PATH% (
+    rmdir /s/q %BUILD_PATH%
+  )
+  if exist %WORKSPACE%\Conf\.cache (
+    rmdir /s/q %WORKSPACE%\Conf\.cache
+  )
+  echo.
+  goto :Exit
+)
+
+::**********************************************************************
+:: Generate Build_Flags
+::**********************************************************************
+
+set Build_Flags=%Build_Flags% -b %TARGET%
 if "%Arch%"=="IA32" (
-    echo TARGET_ARCH = IA32                                       >> %WORKSPACE%\Conf\target.txt.tmp
+    set Build_Flags=%Build_Flags% -a IA32
 ) else if "%Arch%"=="X64" (
-    echo TARGET_ARCH = IA32 X64                                  >> %WORKSPACE%\Conf\target.txt.tmp
+    set Build_Flags=%Build_Flags% -a IA32 -a X64
 )
-echo TOOL_CHAIN_TAG  = %TOOL_CHAIN_TAG%                                  >> %WORKSPACE%\Conf\target.txt.tmp
-echo BUILD_RULE_CONF = Conf/build_rule.txt                               >> %WORKSPACE%\Conf\target.txt.tmp
-if %Source% == 0 (
-  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc        >> %WORKSPACE%\Conf\target.txt.tmp
-) else (
-  echo ACTIVE_PLATFORM = %PLATFORM_PACKAGE%/PlatformPkg%Arch%Source.dsc  >> %WORKSPACE%\Conf\target.txt.tmp
+set Build_Flags=%Build_Flags% -t %TOOL_CHAIN_TAG%
+set Build_Flags=%Build_Flags% -p %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc
+set Build_Flags=%Build_Flags% -n %build_threads%
+if "%GenLog%"=="TRUE" (
+  set Build_Flags=%Build_Flags% -j %BUILD_PATH%\%PLATFORM_NAME%.log
+)
+if "%GenReport%"=="TRUE" (
+  set Build_Flags=%Build_Flags% -y %BUILD_PATH%\%PLATFORM_NAME%.report
 )
-echo MAX_CONCURRENT_THREAD_NUMBER = %build_threads%                      >> %WORKSPACE%\Conf\target.txt.tmp
-
-move /Y %WORKSPACE%\Conf\target.txt.tmp %WORKSPACE%\Conf\target.txt >nul
 
 ::**********************************************************************
 :: Generate BIOS ID
@@ -267,6 +253,8 @@ echo VERSION_MINOR  = 01      >> %BUILD_PATH%/BiosId.env
 
 echo.
 echo Invoking EDK2 build...
+echo build %Build_Flags%
+
 call build %Build_Flags%
 
 if %ERRORLEVEL% NEQ 0 goto BldFail
@@ -300,7 +288,7 @@ echo Build BIOS rom for VLV platforms.
 echo.
 echo Usage: bld_vlv.bat [options] PlatformType [Build Target]
 echo.
-echo    /c    CleanAll before building
+echo    /c    CleanAll
 echo    /l    Generate build log file
 echo    /y    Generate build report file
 echo    /m    Enable multi-processor build
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
index 1705b1628b..d32beb6a45 100755
--- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
+++ b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
@@ -7,15 +7,22 @@ function Usage() {
   echo "***************************************************************************"
   echo "Build BIOS rom for VLV platforms."
   echo
-  echo "Usage: bld_vlv.sh  PlatformType [Build Target]"
+  echo "Usage: bld_vlv.sh  [options] PlatformType [Build Target]"
   echo
+  echo "   /c    CleanAll"
+  echo "   /l    Generate build log file"
+  echo "   /y    Generate build report file"
+  echo "   /m    Enable multi-processor build"
+  echo "   /IA32 Set Arch to IA32 (default: X64)"
+  echo "   /X64  Set Arch to X64 (default: X64)"
   echo
   echo "       Platform Types:  MNW2"
   echo "       Build Targets:   Debug, Release  (default: Debug)"
   echo
+  echo "Examples:"
+  echo "   bld_vlv.sh MNW2                 : X64 Debug build for MinnowMax"
+  echo "   bld_vlv.sh /IA32 MNW2 release   : IA32 Release build for MinnowMax"
   echo "***************************************************************************"
-  echo "Press any key......"
-  read
   exit 0
 }
 
@@ -29,8 +36,12 @@ echo -e $(date)
 #build_threads=($NUMBER_OF_PROCESSORS)+1
 Build_Flags=
 exitCode=0
+build_threads=1
 Arch=X64
-SpiLock=0
+GenLog=FALSE
+GenReport=FALSE
+Clean=FALSE
+
 
 export CORE_PATH=$WORKSPACE/edk2
 export PLATFORM_PATH=$WORKSPACE/edk2-platforms/Platform/Intel/
@@ -38,27 +49,6 @@ export SILICON_PATH=$WORKSPACE/edk2-platforms/Silicon/Intel/
 export BINARY_PATH=$WORKSPACE/edk2-non-osi/Silicon/Intel/
 export PACKAGES_PATH=$PLATFORM_PATH:$SILICON_PATH:$BINARY_PATH:$CORE_PATH
 
-## Clean up previous build files.
-if [ -e $WORKSPACE/EDK2.log ]; then
-  rm $WORKSPACE/EDK2.log
-fi
-
-if [ -e $WORKSPACE/Unitool.log ]; then
-  rm $WORKSPACE/Unitool.log
-fi
-
-if [ -e $WORKSPACE/Conf/target.txt ]; then
-  rm $WORKSPACE/Conf/target.txt
-fi
-
-if [ -e $WORKSPACE/Conf/tools_def.txt ]; then
-  rm $WORKSPACE/Conf/tools_def.txt
-fi
-
-if [ -e $WORKSPACE/Conf/build_rule.txt ]; then
-  rm $WORKSPACE/Conf/build_rule.txt
-fi
-
 ## 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
 cd $CORE_PATH
@@ -69,17 +59,9 @@ make -C BaseTools
 PLATFORM_NAME=Vlv2TbltDevicePkg
 PLATFORM_PACKAGE=Vlv2TbltDevicePkg
 PLATFORM_PKG_PATH=$PLATFORM_PATH/$PLATFORM_PACKAGE
-config_file=$PLATFORM_PKG_PATH/PlatformPkgConfig.dsc
-auto_config_inc=$PLATFORM_PKG_PATH/AutoPlatformCFG.txt
 
 cd $PLATFORM_PKG_PATH
 
-## create new AutoPlatformCFG.txt file
-if [ -f "$auto_config_inc" ]; then
-  rm $auto_config_inc
-fi
-touch $auto_config_inc
-
 ##**********************************************************************
 ## Parse command line arguments
 ##**********************************************************************
@@ -89,17 +71,17 @@ for (( i=1; i<=$#; ))
   do
     if [ "$1" == "/?" ]; then
       Usage
-    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/Q" ]; then
-      Build_Flags="$Build_Flags --quiet"
-      shift
     elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/L" ]; then
-      Build_Flags="$Build_Flags -j EDK2.log"
+      GenLog=TRUE
+      shift
+    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/Y" ]; then
+      GenReport=TRUE
+      shift
+    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/M" ]; then
+      build_threads=8
       shift
     elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/C" ]; then
-      echo Removing previous build files ...
-      if [ -d "Build" ]; then
-        rm -r Build
-      fi
+      Clean=TRUE
       shift
     elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/X64" ]; then
       Arch=X64
@@ -107,9 +89,6 @@ for (( i=1; i<=$#; ))
     elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/IA32" ]; then
       Arch=IA32
       shift
-    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/YL" ]; then
-      SpiLock=1
-      shift      
     else
       break
     fi
@@ -120,26 +99,7 @@ if [ "$2" == "" ]; then
   Usage
 fi
 
-if [ $Arch == "IA32" ]; then
-  echo DEFINE X64_CONFIG = FALSE >> $auto_config_inc
-else
-  echo DEFINE X64_CONFIG = TRUE  >> $auto_config_inc
-fi
-
-## -- Build flags settings for each Platform --
-##    AlpineValley (ALPV):  SVP_PF_BUILD = TRUE,   ENBDT_PF_BUILD = FALSE,  TABLET_PF_BUILD = FALSE,  BYTI_PF_BUILD = FALSE, IVI_PF_BUILD = FALSE
-##       BayleyBay (BBAY):  SVP_PF_BUILD = FALSE,  ENBDT_PF_BUILD = TRUE,   TABLET_PF_BUILD = FALSE,  BYTI_PF_BUILD = FALSE, IVI_PF_BUILD = FALSE
-##         BayLake (BLAK):  SVP_PF_BUILD = FALSE,  ENBDT_PF_BUILD = FALSE,  TABLET_PF_BUILD = TRUE,   BYTI_PF_BUILD = FALSE, IVI_PF_BUILD = FALSE
-##      Bakersport (BYTI):  SVP_PF_BUILD = FALSE,  ENBDT_PF_BUILD = FALSE,  TABLET_PF_BUILD = FALSE,  BYTI_PF_BUILD = TRUE, IVI_PF_BUILD = FALSE
-## Crestview Hills (CVHS):  SVP_PF_BUILD = FALSE,  ENBDT_PF_BUILD = FALSE,  TABLET_PF_BUILD = FALSE,  BYTI_PF_BUILD = TRUE, IVI_PF_BUILD = TRUE
-##            FFD8 (BLAK):  SVP_PF_BUILD = FALSE,  ENBDT_PF_BUILD = FALSE,  TABLET_PF_BUILD = TRUE,   BYTI_PF_BUILD = FALSE, IVI_PF_BUILD = FALSE
 echo "Setting  $1  platform configuration and BIOS ID..."
-if [ "$(echo $1 | tr 'a-z' 'A-Z')" == "MNW2" ]; then
-  echo DEFINE ENBDT_PF_BUILD = TRUE >> $auto_config_inc
-else
-  echo "Error - Unsupported PlatformType: $1"
-  Usage
-fi
 
 if [ "$(echo $2 | tr 'a-z' 'A-Z')" == "RELEASE" ]; then
   export TARGET=RELEASE
@@ -148,18 +108,8 @@ else
 fi
 
 ##**********************************************************************
-## Additional EDK Build Setup/Configuration
+## Detect TOOL_CHAIN_TAG
 ##**********************************************************************
-echo "Ensuring correct build directory is present for GenBiosId..."
-
-echo Modifying Conf files for this build...
-## Remove lines with these tags from target.txt
-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
-
 gcc_version=$(gcc -v 2>&1 | tail -1 | awk '{print $3}')
 case $gcc_version in
       [1-3].*|4.[0-7].*)
@@ -167,31 +117,19 @@ case $gcc_version in
         exit 1
         ;;
       4.8.*)
-        TARGET_TOOLS=GCC48
+        export TOOL_CHAIN_TAG=GCC48
         ;;
       4.9.*|6.[0-2].*)
-        TARGET_TOOLS=GCC49
+        export TOOL_CHAIN_TAG=GCC49
         ;;
       *)
-        TARGET_TOOLS=GCC5
+        export TOOL_CHAIN_TAG=GCC5
         ;;
 esac
 
-ACTIVE_PLATFORM=$PLATFORM_PKG_PATH/PlatformPkgGcc"$Arch".dsc
-export TOOL_CHAIN_TAG=$TARGET_TOOLS
-MAX_CONCURRENT_THREAD_NUMBER=8
-echo ACTIVE_PLATFORM = $ACTIVE_PLATFORM                           >> $WORKSPACE/Conf/target.txt
-echo TARGET          = $TARGET                                    >> $WORKSPACE/Conf/target.txt
-echo TOOL_CHAIN_TAG  = $TOOL_CHAIN_TAG                            >> $WORKSPACE/Conf/target.txt
-echo MAX_CONCURRENT_THREAD_NUMBER = $MAX_CONCURRENT_THREAD_NUMBER >> $WORKSPACE/Conf/target.txt
-if [ $Arch == "IA32" ]; then
-  echo TARGET_ARCH   = IA32                                       >> $WORKSPACE/Conf/target.txt
-else
-  echo TARGET_ARCH   = IA32 X64                                   >> $WORKSPACE/Conf/target.txt
-fi
-
-
-## Set and Create $BUILD_PATH if necessary
+##**********************************************************************
+## Generate $BUILD_PATH and make sure the directory exists
+##**********************************************************************
 if [ ! -d ${WORKSPACE}/Build ]; then
   mkdir ${WORKSPACE}/Build
 fi
@@ -212,6 +150,40 @@ if [ ! -d $BUILD_PATH ]; then
   mkdir $BUILD_PATH
 fi
 
+##**********************************************************************
+## Check for clean operation
+##**********************************************************************
+if [ $Clean == "TRUE" ]; then
+  echo Removing previous build files ...
+  if [ -d ${BUILD_PATH} ]; then
+    rm -r ${BUILD_PATH}
+  fi
+  if [ -d ${WORKSPACE}/Conf/.cache ]; then
+    rm -r ${WORKSPACE}/Conf/.cache
+  fi
+  exit 0
+fi
+
+##**********************************************************************
+## Generate Build_Flags
+##**********************************************************************
+
+Build_Flags="$Build_Flags -b $TARGET"
+if [ $Arch == "IA32" ]; then
+  Build_Flags="$Build_Flags -a IA32"
+else
+  Build_Flags="$Build_Flags -a IA32 -a X64"
+fi
+Build_Flags="$Build_Flags -t $TOOL_CHAIN_TAG"
+Build_Flags="$Build_Flags -p ${PLATFORM_PKG_PATH}/PlatformPkgGcc${Arch}.dsc"
+Build_Flags="$Build_Flags -n $build_threads"
+if [ $GenLog == "TRUE" ]; then
+  Build_Flags="$Build_Flags -j ${BUILD_PATH}/${PLATFORM_NAME}.log"
+fi
+if [ $GenReport == "TRUE" ]; then
+  Build_Flags="$Build_Flags -y ${BUILD_PATH}/${PLATFORM_NAME}.report"
+fi
+
 ##**********************************************************************
 ## Generate BIOS ID
 ##**********************************************************************
@@ -239,7 +211,8 @@ python $WORKSPACE/edk2-platforms/Platform/Intel/Tools/GenBiosId/GenBiosId.py -i
 ## Build BIOS
 ##**********************************************************************
 echo "Invoking EDK2 build..."
-build
+echo build $Build_Flags
+build $Build_Flags
 
 ##**********************************************************************
 ## Post Build processing and cleanup
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/cln.sh b/Platform/Intel/Vlv2TbltDevicePkg/cln.sh
deleted file mode 100644
index 3511695f6f..0000000000
--- a/Platform/Intel/Vlv2TbltDevicePkg/cln.sh
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/usr/bin/env bash
-echo
-echo Run build cleanall...
-echo
-
-echo
-echo Directories to clean...
-echo
-
-cd ..
-
-if [ -d "Build" ]; then
-  rm -r Build
-fi
-
-if [ -d "Conf/.cache" ]; then
-  rm -r Conf/.cache
-fi
-
-if [ -d "RomImages" ]; then
-  rm -r RomImages
-fi
-
-echo
-echo Files to clean...
-echo
-
-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/tools_def.txt ]; then
-  rm $(pwd)/Conf/tools_def.txt
-fi
-
-if [ -e $(pwd)/Conf/build_rule.txt ]; then
-  rm $(pwd)/Conf/build_rule.txt
-fi
-
-if [ -e $(pwd)/Conf/BuildEnv.sh ]; then
-  rm $(pwd)/Conf/BuildEnv.sh
-fi
-
-if [ -e $(pwd)/Vlv2TbltDevicePkg/AutoPlatformCFG.txt ]; then
-  rm $(pwd)/Vlv2TbltDevicePkg/AutoPlatformCFG.txt
-fi
-
-echo
-echo All done...
-echo