[edk2-devel] [edk2-platforms Patch V2 5/5] Vlv2Tbl2DevicePkg: Convert BAT/sh Build scripts to Python

Michael D Kinney posted 5 patches 6 years, 6 months ago
There is a newer version of this series
[edk2-devel] [edk2-platforms Patch V2 5/5] Vlv2Tbl2DevicePkg: Convert BAT/sh Build scripts to Python
Posted by Michael D Kinney 6 years, 6 months ago
Convert Build_IFWI and bld_vlv BAT/sh scripts to OS
independent python script PeBuild.py.  This script
generates the BiosId file.  Standard EDK II build
commands are used to build FW images and capsules.

* Sample VS2015x86 commands for IA32/X64 and DEBUG/RELEASE
  build -a IA32 -a X64 -t VS2015x86 -p Vlv2TbltDevicePkg\PlatformPkgX64.dsc
  build -a IA32 -a X64 -t VS2015x86 -p Vlv2TbltDevicePkg\PlatformPkgX64.dsc
  build -a IA32        -t VS2015x86 -p Vlv2TbltDevicePkg\PlatformPkgIA32.dsc
  build -a IA32        -t VS2015x86 -p Vlv2TbltDevicePkg\PlatformPkgIA32.dsc

* Sample GCC5 commands for IA32/X64 and DEBUG/RELEASE
  build -a IA32 -a X64 -n 5 -t GCC5 -p Vlv2TbltDevicePkg/PlatformPkgX64.dsc
  build -a IA32 -a X64 -n 5 -t GCC5 -p Vlv2TbltDevicePkg/PlatformPkgX64.dsc
  build -a IA32        -n 5 -t GCC5 -p Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
  build -a IA32        -n 5 -t GCC5 -p Vlv2TbltDevicePkg/PlatformPkgIA32.dsc

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>
---
 .../Intel/Vlv2TbltDevicePkg/Build_IFWI.bat    | 118 ------
 .../Intel/Vlv2TbltDevicePkg/Build_IFWI.sh     | 100 -----
 .../Vlv2TbltDevicePkg/PlatformCapsule.fdf     |  48 ---
 .../Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc |  39 --
 .../Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc  |  39 --
 .../Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf   |  30 +-
 .../Vlv2TbltDevicePkg/PlatformPkgIA32.dsc     |  13 +-
 .../Vlv2TbltDevicePkg/PlatformPkgX64.dsc      |  13 +-
 Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py  | 348 ++++++++++++++++++
 Platform/Intel/Vlv2TbltDevicePkg/Readme.md    |  62 ++--
 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat  | 303 ---------------
 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh   | 222 -----------
 12 files changed, 432 insertions(+), 903 deletions(-)
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
 delete mode 100755 Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsule.fdf
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc
 create mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py
 delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
 delete mode 100755 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh

diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat b/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
deleted file mode 100644
index f65aa61f4a..0000000000
--- a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
+++ /dev/null
@@ -1,118 +0,0 @@
-@REM @file
-@REM   Windows batch file to build BIOS ROM
-@REM
-@REM Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
-@REM SPDX-License-Identifier: BSD-2-Clause-Patent
-@REM
-
-@echo off
-
-SetLocal EnableDelayedExpansion EnableExtensions
-
-:: Assign initial values
-set exitCode=0
-set "Build_Flags= "
-set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
-
-set PLATFORM_PATH=%WORKSPACE%
-if not exist %PLATFORM_PATH%\%PLATFORM_PACKAGE% (
-  if defined PACKAGES_PATH (
-    for %%i IN (%PACKAGES_PATH%) DO (
-      if exist %%~fi\%PLATFORM_PACKAGE% (
-        set PLATFORM_PATH=%%~fi
-        goto PlatformPackageFound
-      )
-    )
-  ) else (
-    echo.
-    echo !!! ERROR !!! Cannot find %PLATFORM_PACKAGE% !!!
-    echo.
-    goto Exit
-  )
-)
-:PlatformPackageFound
-
-:: Parse Optional arguments
-:OptLoop
-if /i "%~1"=="/?" goto Usage
-
-if /i "%~1"=="/l" (
-    set Build_Flags=%Build_Flags% /l
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/y" (
-    set Build_Flags=%Build_Flags% /y
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/m" (
-    set Build_Flags=%Build_Flags% /m
-    shift
-    goto OptLoop
-)
-if /i "%~1" == "/c" (
-    set Build_Flags=%Build_Flags% /c
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/x64" (
-    set Build_Flags=%Build_Flags% /x64
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/IA32" (
-    set Build_Flags=%Build_Flags% /IA32
-    shift
-    goto OptLoop
-)
-
-:: Require 2 input parameters
-if "%~2"=="" goto Usage
-
-:: Assign required arguments
-set Platform_Type=%~1
-set Build_Target=%~2
-
-:: Build BIOS
-echo ======================================================================
-echo Build_IFWI:  Calling BIOS build Script...
-
-call %PLATFORM_PATH%\%PLATFORM_PACKAGE%\bld_vlv.bat %Build_Flags% %Platform_Type% %Build_Target%
-
-if %ERRORLEVEL% NEQ 0 (
-    echo echo  -- Error Building BIOS  & echo.
-    set exitCode=1
-    goto exit
-)
-echo.
-echo Finished Building BIOS.
-goto Exit
-
-:Usage
-echo Script to build BIOS firmware and stitch the entire IFWI.
-echo.
-echo Usage: Build_IFWI.bat [options]  PlatformType  BuildTarget
-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    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
-
-:Exit
-@REM  CD to platform package.
-cd %PLATFORM_PATH%
-exit /b %exitCode%
-
-EndLocal
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh b/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
deleted file mode 100755
index 153c8c5fae..0000000000
--- a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
+++ /dev/null
@@ -1,100 +0,0 @@
-#!/usr/bin/env bash
-##**********************************************************************
-## Function define
-##**********************************************************************
-function Usage ( ) {
-  echo
-  echo "Script to build BIOS firmware and stitch the entire IFWI."
-  echo
-  echo "Usage: Build_IFWI.sh [options]  PlatformType  BuildTarget"
-  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 "   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
-}
-
-set -e
-
-## Assign initial values
-exitCode=0
-Build_Flags=
-
-## Check whether WORKSPACE is set or not
-if [[ -z "$WORKSPACE" ]]; then
-  echo "Please export WORKSPACE before running Build_IFWI.sh"
-  echo "See the details in Readme.md"
-  exit 1
-fi
-
-## Create $WORKSPACE/Conf if necessary
-if [ ! -d $WORKSPACE/Conf ]; then
-  mkdir $WORKSPACE/Conf
-fi
-
-## Parse Optional arguments
-if [ "$1" == "/?" ]; then
-  Usage
-fi
-
-for (( i=1; i<=$#; ))
-  do
-    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')" == "/X64" ]; then
-      Build_Flags="$Build_Flags /x64"
-      shift
-    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/IA32" ]; then
-      Build_Flags="$Build_Flags /IA32"
-      shift
-    else
-      break
-    fi
-  done
-
-## Require 2 input parameters
-if [ "$2" == "" ]; then
-  Usage
-fi
-
-## Assign required arguments
-Platform_Type=$1
-Build_Target=$2
-
-## Build BIOS
-echo "======================================================================"
-echo "Build_IFWI:  Calling BIOS build Script..."
-. bld_vlv.sh $Build_Flags $Platform_Type $Build_Target
-
-echo
-echo Finished Building BIOS.
-
-## Start Integration process
-echo ======================================================================
-echo Skip "Build_IFWI:  Calling IFWI Stitching Script..."
-
-echo
-echo Build_IFWI is finished.
-echo The final IFWI file is located in Stitch
-echo ======================================================================
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsule.fdf b/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsule.fdf
deleted file mode 100644
index d8b0074d6a..0000000000
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsule.fdf
+++ /dev/null
@@ -1,48 +0,0 @@
-## @file
-# FDF file of Platform capsule.
-#
-# Copyright (c) 2016 - 2019, Intel Corporation.
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-##
-
-[FV.SystemFirmwareUpdateCargo]
-FvAlignment        = 16
-ERASE_POLARITY     = 1
-MEMORY_MAPPED      = TRUE
-STICKY_WRITE       = TRUE
-LOCK_CAP           = TRUE
-LOCK_STATUS        = TRUE
-WRITE_DISABLED_CAP = TRUE
-WRITE_ENABLED_CAP  = TRUE
-WRITE_STATUS       = TRUE
-WRITE_LOCK_CAP     = TRUE
-WRITE_LOCK_STATUS  = TRUE
-READ_DISABLED_CAP  = TRUE
-READ_ENABLED_CAP   = TRUE
-READ_STATUS        = TRUE
-READ_LOCK_CAP      = TRUE
-READ_LOCK_STATUS   = TRUE
-
-FILE RAW = AF9C9EB2-12AD-4D3E-A4D4-96F6C9966215 { # PcdEdkiiSystemFirmwareFileGuid
-    $(WORKSPACE)/$(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/FV/Vlv.ROM
-  }
-
-[FmpPayload.FmpPayloadSystemFirmwareRsa2048]
-IMAGE_HEADER_INIT_VERSION = 0x02
-IMAGE_TYPE_ID             = 4096267b-da0a-42eb-b5eb-fef31d207cb4 # PcdSystemFmpCapsuleImageTypeIdGuid
-IMAGE_INDEX               = 0x1
-HARDWARE_INSTANCE         = 0x0
-MONOTONIC_COUNT           = 0x2
-CERTIFICATE_GUID          = A7717414-C616-4977-9420-844712A735BF # RSA2048SHA256
-
-FILE DATA = $(WORKSPACE)/$(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/FV/SYSTEMFIRMWAREUPDATECARGO.Fv
-
-[Capsule.Vlv2Rec]
-CAPSULE_GUID                = 6dcbd5ed-e82d-4c44-bda1-7194199ad92a # gEfiFmpCapsuleGuid
-CAPSULE_FLAGS               = PersistAcrossReset,InitiateReset
-CAPSULE_HEADER_SIZE         = 0x20
-CAPSULE_HEADER_INIT_VERSION = 0x1
-
-FMP_PAYLOAD = FmpPayloadSystemFirmwareRsa2048
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc
deleted file mode 100644
index 246347b8fa..0000000000
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc
+++ /dev/null
@@ -1,39 +0,0 @@
-#/** @file
-# Platform capsule description.
-#
-# Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#
-#**/
-
-[Defines]
-  PLATFORM_NAME                  = Vlv2TbltDevicePkg
-  PLATFORM_GUID                  = EE87F258-6ECC-4415-B1D8-23771BEE26E7
-  PLATFORM_VERSION               = 0.1
-  FLASH_DEFINITION               = Vlv2TbltDevicePkg/PlatformCapsule.fdf
-  OUTPUT_DIRECTORY               = Build/Vlv2TbltDevicePkgIA32
-  SUPPORTED_ARCHITECTURES        = IA32|X64
-  BUILD_TARGETS                  = DEBUG|RELEASE
-  SKUID_IDENTIFIER               = DEFAULT
-  POSTBUILD                      = python Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.py
-
-###################################################################################################
-#
-# Components Section - list of the modules and components that will be processed by compilation
-#                      tools and the EDK II tools to generate PE32/PE32+/Coff image files.
-#
-# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
-#       into firmware volume images. This section is just a list of modules to compile from
-#       source into UEFI-compliant binaries.
-#       It is the FDF file that contains information on combining binary files into firmware
-#       volume images, whose concept is beyond UEFI and is described in PI specification.
-#       Binary modules do not need to be listed in this section, as they should be
-#       specified in the FDF file. For example: Shell binary, FAT binary (Fat.efi),
-#       Logo (Logo.bmp), and etc.
-#       There may also be modules listed in this section that are not required in the FDF file,
-#       When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
-#       generated for it, but the binary will not be put into any firmware volume.
-#
-###################################################################################################
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc
deleted file mode 100644
index 68bde30f83..0000000000
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc
+++ /dev/null
@@ -1,39 +0,0 @@
-#/** @file
-# Platform capsule description.
-#
-# Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
-#
-# SPDX-License-Identifier: BSD-2-Clause-Patent
-#
-#
-#**/
-
-[Defines]
-  PLATFORM_NAME                  = Vlv2TbltDevicePkg
-  PLATFORM_GUID                  = EE87F258-6ECC-4415-B1D8-23771BEE26E7
-  PLATFORM_VERSION               = 0.1
-  FLASH_DEFINITION               = Vlv2TbltDevicePkg/PlatformCapsule.fdf
-  OUTPUT_DIRECTORY               = Build/Vlv2TbltDevicePkgX64
-  SUPPORTED_ARCHITECTURES        = IA32|X64
-  BUILD_TARGETS                  = DEBUG|RELEASE
-  SKUID_IDENTIFIER               = DEFAULT
-  POSTBUILD                      = python Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.py
-
-###################################################################################################
-#
-# Components Section - list of the modules and components that will be processed by compilation
-#                      tools and the EDK II tools to generate PE32/PE32+/Coff image files.
-#
-# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
-#       into firmware volume images. This section is just a list of modules to compile from
-#       source into UEFI-compliant binaries.
-#       It is the FDF file that contains information on combining binary files into firmware
-#       volume images, whose concept is beyond UEFI and is described in PI specification.
-#       Binary modules do not need to be listed in this section, as they should be
-#       specified in the FDF file. For example: Shell binary, FAT binary (Fat.efi),
-#       Logo (Logo.bmp), and etc.
-#       There may also be modules listed in this section that are not required in the FDF file,
-#       When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
-#       generated for it, but the binary will not be put into any firmware volume.
-#
-###################################################################################################
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
index e958c1ebf2..48058b663a 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
@@ -711,9 +711,8 @@ [FV.FVMAIN_COMPACT]
 !endif
      }
 
-[FV.SETUP_DATA]
-BlockSize          = $(FLASH_BLOCK_SIZE)
-#NumBlocks         = 0x10
+!if $(RECOVERY_ENABLE)
+[FV.SystemFirmwareUpdateCargo]
 FvAlignment        = 16
 ERASE_POLARITY     = 1
 MEMORY_MAPPED      = TRUE
@@ -731,6 +730,31 @@ [FV.SETUP_DATA]
 READ_LOCK_CAP      = TRUE
 READ_LOCK_STATUS   = TRUE
 
+FILE RAW = AF9C9EB2-12AD-4D3E-A4D4-96F6C9966215 { # PcdEdkiiSystemFirmwareFileGuid
+    FD = Vlv
+#    $(WORKSPACE)/$(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/FV/Vlv.fd
+  }
+
+[FmpPayload.FmpPayloadSystemFirmwareRsa2048]
+IMAGE_HEADER_INIT_VERSION = 0x02
+IMAGE_TYPE_ID             = 4096267b-da0a-42eb-b5eb-fef31d207cb4 # PcdSystemFmpCapsuleImageTypeIdGuid
+IMAGE_INDEX               = 0x1
+HARDWARE_INSTANCE         = 0x0
+MONOTONIC_COUNT           = 0x2
+CERTIFICATE_GUID          = A7717414-C616-4977-9420-844712A735BF # RSA2048SHA256
+
+FV = SystemFirmwareUpdateCargo
+#FILE DATA = $(WORKSPACE)/$(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/FV/SYSTEMFIRMWAREUPDATECARGO.Fv
+
+[Capsule.Vlv2Rec]
+CAPSULE_GUID                = 6dcbd5ed-e82d-4c44-bda1-7194199ad92a # gEfiFmpCapsuleGuid
+CAPSULE_FLAGS               = PersistAcrossReset,InitiateReset
+CAPSULE_HEADER_SIZE         = 0x20
+CAPSULE_HEADER_INIT_VERSION = 0x1
+
+FMP_PAYLOAD = FmpPayloadSystemFirmwareRsa2048
+!endif
+
 ################################################################################
 #
 # Rules are use with the [FV] section's module INF type to define
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
index 121ebc9eee..5149dd5aa4 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
@@ -23,6 +23,8 @@ [Defines]
   BUILD_TARGETS                       = DEBUG|RELEASE
   SKUID_IDENTIFIER                    = DEFAULT
   VPD_TOOL_GUID                       = 8C3D856A-9BE6-468E-850A-24F7A8D38E08
+  PREBUILD                            = python Vlv2TbltDevicePkg/PreBuild.py
+  POSTBUILD                           = python Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.py
 
   DEFINE RC_BINARY_RELEASE        = TRUE
   #
@@ -213,7 +215,7 @@ [LibraryClasses.common]
   TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
 !endif
 
- BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.inf
+  BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.inf
 
   StallSmmLib|Vlv2TbltDevicePkg/Library/StallSmmLib/StallSmmLib.inf
 
@@ -242,6 +244,10 @@ [LibraryClasses.common]
 
   BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
 
+!if $(RECOVERY_ENABLE)
+  EdkiiSystemCapsuleLib|SignedCapsulePkg/Library/EdkiiSystemCapsuleLib/EdkiiSystemCapsuleLib.inf
+!endif
+
 [LibraryClasses.IA32.SEC]
 !if $(PERFORMANCE_ENABLE) == TRUE
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
@@ -718,11 +724,10 @@ [PcdsDynamicExDefault.common.DEFAULT]
   gEfiVLVTokenSpaceGuid.PcdCpuSmramCpuDataAddress|0
   gEfiVLVTokenSpaceGuid.PcdCpuLockBoxSize|0
   gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|TRUE
-
-[PcdsDynamicExDefault.X64.DEFAULT]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{GUID("$(FMP_MINNOW_MAX_SYSTEM)")}|VOID*|0x10
 !if $(RECOVERY_ENABLE)
+  gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescriptor|{0x0}|VOID*|0x100
   gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareFileGuid|{GUID("AF9C9EB2-12AD-4D3E-A4D4-96F6C9966215")}|VOID*|0x10
-  gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{GUID("4096267b-da0a-42eb-b5eb-fef31d207cb4")}|VOID*|0x10
 !endif
 
 [PcdsDynamicExVpd.common.DEFAULT]
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
index 3e4087f919..466512242c 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
@@ -23,6 +23,8 @@ [Defines]
   BUILD_TARGETS                       = DEBUG|RELEASE
   SKUID_IDENTIFIER                    = DEFAULT
   VPD_TOOL_GUID                       = 8C3D856A-9BE6-468E-850A-24F7A8D38E08
+  PREBUILD                            = python Vlv2TbltDevicePkg/PreBuild.py
+  POSTBUILD                           = python Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.py
 
   DEFINE RC_BINARY_RELEASE        = TRUE
   #
@@ -215,7 +217,7 @@ [LibraryClasses.common]
   TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
 !endif
 
- BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.inf
+  BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.inf
 
   StallSmmLib|Vlv2TbltDevicePkg/Library/StallSmmLib/StallSmmLib.inf
 
@@ -244,6 +246,10 @@ [LibraryClasses.common]
 
   BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
 
+!if $(RECOVERY_ENABLE)
+  EdkiiSystemCapsuleLib|SignedCapsulePkg/Library/EdkiiSystemCapsuleLib/EdkiiSystemCapsuleLib.inf
+!endif
+
 [LibraryClasses.IA32.SEC]
 !if $(PERFORMANCE_ENABLE) == TRUE
   PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
@@ -720,11 +726,10 @@ [PcdsDynamicExDefault.common.DEFAULT]
   gEfiVLVTokenSpaceGuid.PcdCpuSmramCpuDataAddress|0
   gEfiVLVTokenSpaceGuid.PcdCpuLockBoxSize|0
   gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|TRUE
-
-[PcdsDynamicExDefault.X64.DEFAULT]
+  gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{GUID("$(FMP_MINNOW_MAX_SYSTEM)")}|VOID*|0x10
 !if $(RECOVERY_ENABLE)
+  gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescriptor|{0x0}|VOID*|0x100
   gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareFileGuid|{GUID("AF9C9EB2-12AD-4D3E-A4D4-96F6C9966215")}|VOID*|0x10
-  gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{GUID("4096267b-da0a-42eb-b5eb-fef31d207cb4")}|VOID*|0x10
 !endif
 
 [PcdsDynamicExVpd.common.DEFAULT]
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py b/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py
new file mode 100644
index 0000000000..220515c809
--- /dev/null
+++ b/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py
@@ -0,0 +1,348 @@
+## @file
+# PreBuild operations for Vlv2TbltDevicePkg
+#
+# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
+#
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+
+'''
+PreBuild
+'''
+
+import os
+import sys
+import argparse
+import subprocess
+import glob
+import shutil
+import struct
+import datetime
+
+#
+# Globals for help information
+#
+__prog__        = 'PreBuild'
+__copyright__   = 'Copyright (c) 2019, Intel Corporation. All rights reserved.'
+__description__ = 'Vlv2Tbl2DevicePkg pre-build operations.\n'
+
+#
+# Globals
+#
+gWorkspace = ''
+gBaseToolsPath = ''
+gArgs      = None
+
+def LogAlways(Message):
+    sys.stdout.write (__prog__ + ': ' + Message + '\n')
+    sys.stdout.flush()
+
+def Log(Message):
+    global gArgs
+    if not gArgs.Verbose:
+        return
+    sys.stdout.write (__prog__ + ': ' + Message + '\n')
+    sys.stdout.flush()
+
+def Error(Message, ExitValue=1):
+    sys.stderr.write (__prog__ + ': ERROR: ' + Message + '\n')
+    sys.exit (ExitValue)
+
+def RelativePath(target):
+    global gWorkspace
+    Log('RelativePath' + target)
+    return os.path.relpath (target, gWorkspace)
+
+def NormalizePath(target):
+    if isinstance(target, tuple):
+        return os.path.normpath (os.path.join (*target))
+    else:
+        return os.path.normpath (target)
+
+def RemoveFile(target):
+    target = NormalizePath(target)
+    if not target or target == os.pathsep:
+        Error ('RemoveFile() invalid target')
+    if os.path.exists(target):
+        os.remove (target)
+        Log ('remove %s' % (RelativePath (target)))
+
+def RemoveDirectory(target):
+    target = NormalizePath(target)
+    if not target or target == os.pathsep:
+        Error ('RemoveDirectory() invalid target')
+    if os.path.exists(target):
+        Log ('rmdir %s' % (RelativePath (target)))
+        shutil.rmtree(target)
+
+def CreateDirectory(target):
+    target = NormalizePath(target)
+    if not os.path.exists(target):
+        Log ('mkdir %s' % (RelativePath (target)))
+        os.makedirs (target)
+
+def Copy(src, dst):
+    src = NormalizePath(src)
+    dst = NormalizePath(dst)
+    for File in glob.glob(src):
+        Log ('copy %s -> %s' % (RelativePath (File), RelativePath (dst)))
+        shutil.copy (File, dst)
+
+def GenCapsuleDevice (BaseName, PayloadFileName, Guid, Version, Lsv, CapsulesPath, CapsulesSubDir):
+    global gBaseToolsPath
+    LogAlways ('Generate Capsule: {0} {1:08x} {2:08x} {3}'.format (Guid, Version, Lsv, PayloadFileName))
+
+    VersionString = '.'.join([str(ord(x)) for x in struct.pack('>I', Version).decode()])
+
+    FmpCapsuleFile = NormalizePath ((CapsulesPath, CapsulesSubDir, BaseName + '.' + VersionString + '.cap'))
+    Command = GenerateCapsuleCommand.format (
+                FMP_CAPSULE_GUID    = Guid,
+                FMP_CAPSULE_VERSION = Version,
+                FMP_CAPSULE_LSV     = Lsv,
+                BASE_TOOLS_PATH     = gBaseToolsPath,
+                FMP_CAPSULE_FILE    = FmpCapsuleFile,
+                FMP_CAPSULE_PAYLOAD = PayloadFileName
+                )
+    Command = ' '.join(Command.splitlines()).strip()
+    if gArgs.Verbose:
+        Command = Command + ' -v'
+
+    Log (Command)
+
+    Process = subprocess.Popen(Command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+    ProcessOutput = Process.communicate()
+
+    if Process.returncode == 0:
+        Log (ProcessOutput[0].decode())
+    else:
+        LogAlways (Command)
+        LogAlways (ProcessOutput[0].decode())
+        Error ('GenerateCapsule returned an error')
+
+    Copy (PayloadFileName, (CapsulesPath, 'firmware.bin'))
+    MetaInfoXml = MetaInfoXmlTemplate
+    MetaInfoXml = MetaInfoXml.replace ('FMP_CAPSULE_GUID', Guid)
+    MetaInfoXml = MetaInfoXml.replace ('FMP_CAPSULE_BASE_NAME', BaseName)
+    MetaInfoXml = MetaInfoXml.replace ('FMP_CAPSULE_VERSION_DECIMAL', str(Version))
+    MetaInfoXml = MetaInfoXml.replace ('FMP_CAPSULE_STRING', VersionString)
+    MetaInfoXml = MetaInfoXml.replace ('FMP_CAPSULE_DATE', str(datetime.date.today()))
+    f = open (NormalizePath ((CapsulesPath, 'firmware.metainfo.xml')), 'w')
+    f.write(MetaInfoXml)
+    f.close()
+
+    f = open (NormalizePath ((CapsulesPath, 'Lvfs.ddf')), 'w')
+    f.write(LvfsDdfTemplate)
+    f.close()
+
+    if sys.platform == "win32":
+        Command = 'makecab /f ' + NormalizePath ((CapsulesPath, 'Lvfs.ddf'))
+    else:
+        Command = 'gcab --create firmware.cab firmware.bin firmware.metainfo.xml'
+    Log (Command)
+
+    Process = subprocess.Popen(Command, cwd=CapsulesPath, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+    ProcessOutput = Process.communicate()
+
+    if Process.returncode == 0:
+        Log (ProcessOutput[0].decode())
+    else:
+        LogAlways (Command)
+        LogAlways (ProcessOutput[0].decode())
+        Error ('GenerateCapsule returned an error')
+
+    FmpCabinetFile = NormalizePath ((CapsulesPath, CapsulesSubDir, BaseName + '.' + VersionString + '.cab'))
+
+    Copy ((CapsulesPath, 'firmware.cab'), FmpCabinetFile)
+
+    RemoveFile ((CapsulesPath, 'firmware.cab'))
+    RemoveFile ((CapsulesPath, 'setup.inf'))
+    RemoveFile ((CapsulesPath, 'setup.rpt'))
+    RemoveFile ((CapsulesPath, 'Lvfs.ddf'))
+    RemoveFile ((CapsulesPath, 'firmware.metainfo.xml'))
+    RemoveFile ((CapsulesPath, 'firmware.bin'))
+
+BiosIdTemplate = '''
+BOARD_ID       = MNW2MAX
+BOARD_REV      = $BOARD_REV
+BOARD_EXT      = $ARCH
+VERSION_MAJOR  = 0090
+BUILD_TYPE     = $BUILD_TYPE
+VERSION_MINOR  = 01
+'''
+
+
+if __name__ == '__main__':
+    #
+    # Create command line argument parser object
+    #
+    parser = argparse.ArgumentParser (
+                        prog = __prog__,
+                        description = __description__ + __copyright__,
+                        conflict_handler = 'resolve'
+                        )
+    parser.add_argument (
+             '-a', '--arch', dest = 'Arch', nargs = '+', action = 'append',
+             required = True,
+             help = '''ARCHS is one of list: IA32, X64, IPF, ARM, AARCH64 or EBC,
+                       which overrides target.txt's TARGET_ARCH definition. To
+                       specify more archs, please repeat this option.'''
+             )
+    parser.add_argument (
+             '-t', '--tagname', dest = 'ToolChain', required = True,
+             help = '''Using the Tool Chain Tagname to build the platform,
+                       overriding target.txt's TOOL_CHAIN_TAG definition.'''
+             )
+    parser.add_argument (
+             '-p', '--platform', dest = 'PlatformFile', required = True,
+             help = '''Build the platform specified by the DSC file name argument,
+                       overriding target.txt's ACTIVE_PLATFORM definition.'''
+             )
+    parser.add_argument (
+             '-b', '--buildtarget', dest = 'BuildTarget', required = True,
+             help = '''Using the TARGET to build the platform, overriding
+                       target.txt's TARGET definition.'''
+             )
+    parser.add_argument (
+             '--conf=', dest = 'ConfDirectory', required = True,
+             help = '''Specify the customized Conf directory.'''
+             )
+    parser.add_argument (
+             '-D', '--define', dest = 'Define', nargs='*', action = 'append',
+             help = '''Macro: "Name [= Value]".'''
+             )
+    parser.add_argument (
+             '-v', '--verbose', dest = 'Verbose', action = 'store_true',
+             help = '''Turn on verbose output with informational messages printed'''
+             )
+    parser.add_argument (
+             '--package', dest = 'Package', nargs = '*', action = 'append',
+             help = '''The directory name of a package of tests to copy'''
+             )
+
+    #
+    # Parse command line arguments
+    #
+    gArgs, remaining = parser.parse_known_args()
+    gArgs.BuildType = 'all'
+    for BuildType in ['all', 'fds', 'genc', 'genmake', 'clean', 'cleanall', 'modules', 'libraries', 'run']:
+        if BuildType in remaining:
+            gArgs.BuildType = BuildType
+            remaining.remove(BuildType)
+            break
+    gArgs.Remaining = ' '.join(remaining)
+
+    #
+    # Get WORKSPACE environment variable
+    #
+    try:
+        gWorkspace = os.environ['WORKSPACE']
+    except:
+        Error ('WORKSPACE environment variable not set')
+
+    #
+    # Get PACKAGES_PATH and generate prioritized list of paths
+    #
+    PathList = [gWorkspace]
+    try:
+        PathList += os.environ['PACKAGES_PATH'].split(os.pathsep)
+    except:
+        pass
+
+    #
+    # Determine full path to BaseTools
+    #
+    Vlv2Tbl2DevicePkgPath = ''
+    for Path in PathList:
+        if gBaseToolsPath == '':
+            if os.path.exists (os.path.join (Path, 'BaseTools')):
+                gBaseToolsPath = os.path.join (Path, 'BaseTools')
+        if Vlv2Tbl2DevicePkgPath == '':
+            if os.path.exists (os.path.join (Path, 'Vlv2TbltDevicePkg')):
+                Vlv2Tbl2DevicePkgPath = os.path.join (Path, 'Vlv2TbltDevicePkg')
+    if gBaseToolsPath == '':
+        Error ('Can not find BaseTools in WORKSPACE or PACKAGES_PATH')
+    if Vlv2Tbl2DevicePkgPath == '':
+        Error ('Can not find Vlv2Tbl2DevicePkg in WORKSPACE or PACKAGES_PATH')
+
+    #
+    # Parse OUTPUT_DIRECTORY from DSC file
+    #
+    for Path in PathList:
+        if os.path.exists (os.path.join (Path, gArgs.PlatformFile)):
+            Dsc = open (os.path.join (Path, gArgs.PlatformFile), 'r').readlines()
+            break
+    for Line in Dsc:
+        if Line.strip().startswith('OUTPUT_DIRECTORY'):
+            OutputDirectory = Line.strip().split('=')[1].strip()
+            break
+
+    #
+    # Determine full paths to EDK II build directory, EDK II build output
+    # directory and the CPU arch of the UEFI phase.
+    #
+    CommandDir = os.path.dirname(sys.argv[0])
+    EdkiiBuildDir = os.path.join (gWorkspace, OutputDirectory)
+    EdkiiBuildOutput = os.path.join (EdkiiBuildDir, gArgs.BuildTarget + '_' + gArgs.ToolChain)
+    UefiArch = gArgs.Arch[0][0]
+    if len (gArgs.Arch) > 1:
+        if ['X64'] in gArgs.Arch:
+            UefiArch = 'X64'
+
+    if gArgs.BuildType == 'run':
+        Error ("'run' target not supported")
+    if gArgs.BuildType == 'clean':
+        sys.exit (0)
+
+    #
+    # Create output directories to put BiosId files
+    #
+    try:
+        CreateDirectory ((gWorkspace, 'Build'))
+    except:
+        pass
+    try:
+        CreateDirectory ((EdkiiBuildDir))
+    except:
+        pass
+    try:
+        CreateDirectory ((EdkiiBuildOutput))
+    except:
+        pass
+
+    #
+    # Generate BiosId files
+    #
+    BiosId = BiosIdTemplate
+    if sys.platform == "win32":
+        # Built from a Windows Host OS
+        BiosId = BiosId.replace ('$BOARD_REV', 'W')
+    else:
+        # Built from a Linux/Unix/Mac Host OS
+        BiosId = BiosId.replace ('$BOARD_REV', 'L')
+    if UefiArch == 'X64':
+      BiosId = BiosId.replace ('$ARCH', 'X64')
+    else:
+      BiosId = BiosId.replace ('$ARCH', 'I32')
+    BiosId = BiosId.replace ('$BUILD_TYPE', gArgs.BuildTarget[0])
+
+    BiosIdFileName = NormalizePath ((EdkiiBuildOutput, 'BiosId.env'))
+    f = open (BiosIdFileName, 'w')
+    f.write(BiosId)
+    f.close()
+
+    Command = 'python ' + NormalizePath ((Vlv2Tbl2DevicePkgPath, '../Tools/GenBiosId/GenBiosId.py'))
+    Command = Command + ' -i '  + BiosIdFileName
+    Command = Command + ' -o '  + NormalizePath ((EdkiiBuildOutput, 'BiosId.bin'))
+    Command = Command + ' -ot ' + NormalizePath ((EdkiiBuildOutput, 'BiosId.txt'))
+
+    LogAlways (Command)
+
+    Process = subprocess.Popen(Command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
+    ProcessOutput = Process.communicate()
+
+    if Process.returncode == 0:
+        Log (ProcessOutput[0].decode())
+    else:
+        LogAlways (Command)
+        LogAlways (ProcessOutput[0].decode())
+        Error ('GenBiosId returned an error')
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Readme.md b/Platform/Intel/Vlv2TbltDevicePkg/Readme.md
index 97180ef7af..b52c23fdec 100644
--- a/Platform/Intel/Vlv2TbltDevicePkg/Readme.md
+++ b/Platform/Intel/Vlv2TbltDevicePkg/Readme.md
@@ -57,12 +57,15 @@ powershell Expand-Archive nasm-2.13.03-win64.zip .
 
 set WORKSPACE=%CD%
 set PACKAGES_PATH=%WORKSPACE%\edk2;%WORKSPACE%\edk2-platforms\Silicon\Intel;%WORKSPACE%\edk2-platforms\Platform\Intel;%WORKSPACE%\edk2-non-osi\Silicon\Intel
+set EDK_TOOLS_PATH=%WORKSPACE%\edk2\BaseTools
 path=%path%;%WORKSPACE%\openssl-1.0.2r-x64_86-win64
 set NASM_PREFIX=%WORKSPACE%\nasm-2.13.03\
 
-cd edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg
+cd %WORKSPACE%\edk2
 
-Build_IFWI.bat /m MNW2 Debug
+edksetup.bat Rebuild
+
+build -a IA32 -a X64 -n 5 -t VS2015x86 -b DEBUG -p Vlv2TbltDevicePkg\PlatformPkgX64.dsc
 ```
 
 Once all the code and tools are downloaded and installed, only the following
@@ -72,8 +75,14 @@ directory used to install the source and binaries.
 ```
 set WORKSPACE=%CD%
 set PACKAGES_PATH=%WORKSPACE%\edk2;%WORKSPACE%\edk2-platforms\Silicon\Intel;%WORKSPACE%\edk2-platforms\Platform\Intel;%WORKSPACE%\edk2-non-osi\Silicon\Intel
+set EDK_TOOLS_PATH=%WORKSPACE%\edk2\BaseTools
 path=%path%;%WORKSPACE%\openssl-1.0.2r-x64_86-win64
 set NASM_PREFIX=%WORKSPACE%\nasm-2.13.03\
+
+cd %WORKSPACE%\edk2
+
+edksetup.bat Rebuild
+
 ```
 
 Once the environment is setup, the MinnowBoard MAX firmware and capsules can be
@@ -82,39 +91,43 @@ rebuilt using the following commands.
 * Build X64 Debug Image with report file
 
 ```
-cd edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg
-Build_IFWI.bat /m /y MNW2 Debug
+build -a IA32 -a X64 -n 5 -t VS2015x86 -b DEBUG -p Vlv2TbltDevicePkg\PlatformPkgX64.dsc -y Vlv.report
 ```
 
 * Build X64 Release Image with build log
 
 ```
-cd edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg
-Build_IFWI.bat /m /l MNW2 Release
+build -a IA32 -a X64 -n 5 -t VS2015x86 -b RELEASE Vlv2TbltDevicePkg\PlatformPkgX64.dsc -j Vlv.log
 ```
 
 * Build IA32 Debug Image
 
 ```
-cd edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg
-Build_IFWI.bat /m /IA32 MNW2 Debug
+build -a IA32 -n 5 -t VS2015x86 -b DEBUG -p Vlv2TbltDevicePkg\PlatformPkgIA32.dsc
 ```
 
 The generated firmware image is the build output directory below WORKSPACE.  For
 exampple, the X64 Debug Image is at:
 
-`Build\Vlv2TbltDevicePkg\DEBUG_VS2015x86\FV\Vlv.ROM`
+`Build\Vlv2TbltDevicePkgX64\DEBUG_VS2015x86\FV\Vlv.fd`
 
 And the IA32 Release image is at:
 
-`Build\Vlv2TbltDevicePkgIA32\RELEASE_VS2015x86\FV\Vlv.ROM`
+`Build\Vlv2TbltDevicePkgIA32\RELEASE_VS2015x86\FV\Vlv.fd`
 
 The X64 CapsuleApp and generated UEFI Capsules are in the directory
 
-`Build\Vlv2TbltDevicePkg\Capsules`
+`Build\Vlv2TbltDevicePkgX64\Capsules`
 
 # Linux Pre-requisites
 
+* git
+* python
+* iasl
+* nasm
+* openssl
+* gcab
+
 # Download and Build MinnowMax using Linux/GCC
 
 Run the script below from an empty directory.  The script clones the EDK II
@@ -132,10 +145,12 @@ git clone https://github.com/tianocore/edk2-platforms.git
 git clone https://github.com/tianocore/edk2-non-osi.git
 
 export WORKSPACE=$PWD
+export PACKAGES_PATH=$WORKSPACE/edk2;$WORKSPACE/edk2-platforms/Silicon/Intel;$WORKSPACE/edk2-platforms/Platform/Intel;$WORKSPACE/edk2-non-osi/Silicon/Intel
+cd $WORKSPACE/edk2
 
-cd edk2-platforms/Platform/Intel/Vlv2TbltDevicePkg
+. edksetup.sh BaseTools Rebuild
 
-./Build_IFWI.sh /m MNW2 Debug
+build -a IA32 -a X64 -n 5 -t GCC5 -b DEBUG -p Vlv2TbltDevicePkg/PlatformPkgX64.dsc
 ```
 
 Once all the code is downloaded and installed, only the following commands are
@@ -144,6 +159,10 @@ install the source and binaries.
 
 ```
 export WORKSPACE=$PWD/edk2
+export PACKAGES_PATH=$WORKSPACE/edk2;$WORKSPACE/edk2-platforms/Silicon/Intel;$WORKSPACE/edk2-platforms/Platform/Intel;$WORKSPACE/edk2-non-osi/Silicon/Intel
+cd $WORKSPACE/edk2
+
+. edksetup.sh BaseTools Rebuild
 ```
 
 Once the environment is setup, the MinnowBoard MAX firmware and capsules can be
@@ -152,36 +171,33 @@ rebuilt using the following commands.
 * Build X64 Debug Image with report file
 
 ```
-cd edk2-platforms/Platform/Intel/Vlv2TbltDevicePkg
-./Build_IFWI.sh /m /y MNW2 Debug
+build -a IA32 -a X64 -n 5 -t GCC5 -b DEBUG -p Vlv2TbltDevicePkg/PlatformPkgX64.dsc -y Vlv.report
 ```
 
 * Build X64 Release Image with build log
 
 ```
-cd edk2-platforms/Platform/Intel/Vlv2TbltDevicePkg
-./Build_IFWI.sh /m /l MNW2 Release
+build -a IA32 -a X64 -n 5 -t GCC5 -b RELEASE -p Vlv2TbltDevicePkg/PlatformPkgX64.dsc -j Vlv.log
 ```
 
 * Build IA32 Debug Image
 
 ```
-cd edk2-platforms/Platform/Intel/Vlv2TbltDevicePkg
-./Build_IFWI.sh /m /IA32 MNW2 Debug
+build -a IA32 -n 5 -t GCC5 -b DEBUG -p Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
 ```
 
 The generated firmware image is the build output directory below WORKSPACE.  For
 exampple, the X64 Debug Image is at:
 
-`Build/Vlv2TbltDevicePkg/DEBUG_GCC5/FV/Vlv.ROM`
+`Build/Vlv2TbltDevicePkgX64/DEBUG_GCC5/FV/Vlv.fd`
 
 And the IA32 Release image is at:
 
-`Build/Vlv2TbltDevicePkgIA32/RELEASE_GCC5/FV/Vlv.ROM`
+`Build/Vlv2TbltDevicePkgIA32/RELEASE_GCC5/FV/Vlv.fd`
 
 The X64 CapsuleApp and generated UEFI Capsules are in the directory
 
-`Build/Vlv2TbltDevicePkg/Capsules`
+`Build/Vlv2TbltDevicePkgX64/Capsules`
 
 # Use DediProg to update FLASH image on a MinnowBoard MAX Target
 
@@ -192,7 +208,7 @@ The X64 CapsuleApp and generated UEFI Capsules are in the directory
 * Boot MinnowBoard MAX to the Boot Manager
 * Boot the `EFI Internal Shell` boot option
 * Mount the USB FLASH Drive (usually `FS1`)
-* Use `cd` command to go to `Capsules/TestCert` directory
+* Use `cd` command to go to `Capsules/TestCert_*` directory
 * Run the following command to apply all four capsules
 
 ```
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
deleted file mode 100644
index fb634c490c..0000000000
--- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
+++ /dev/null
@@ -1,303 +0,0 @@
-@REM @file
-@REM   Windows batch file to build BIOS ROM
-@REM
-@REM Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
-@REM SPDX-License-Identifier: BSD-2-Clause-Patent
-@REM
-
-@echo off
-setlocal EnableDelayedExpansion EnableExtensions
-echo.
-echo %date%  %time%
-echo.
-
-::**********************************************************************
-:: Initial Setup
-::**********************************************************************
-if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
-set /a build_threads=1
-set "Build_Flags= "
-set exitCode=0
-set Arch=X64
-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 (
-    for %%i IN (%PACKAGES_PATH%) DO (
-      if exist %%~fi\edksetup.bat (
-        set CORE_PATH=%%~fi
-        goto CorePathFound
-      )
-    )
-  ) else (
-    echo.
-    echo !!! ERROR !!! Cannot find edksetup.bat !!!
-    echo.
-    goto BldFail
-  )
-)
-:CorePathFound
-
-::**********************************************************************
-:: Detect full path to the Vlv2TbltDevicePkg
-::**********************************************************************
-set PLATFORM_PACKAGE=%WORKSPACE%\%PLATFORM_NAME%
-if not exist %PLATFORM_PACKAGE% (
-  if defined PACKAGES_PATH (
-    for %%i IN (%PACKAGES_PATH%) DO (
-      if exist %%~fi\%PLATFORM_NAME% (
-        set PLATFORM_PACKAGE=%%~fi\%PLATFORM_NAME%
-        goto PlatformPackageFound
-      )
-    )
-  ) else (
-    echo.
-    echo !!! ERROR !!! Cannot find %PLATFORM_NAME% !!!
-    echo.
-    goto BldFail
-  )
-)
-:PlatformPackageFound
-
-cd %CORE_PATH%
-
-::**********************************************************************
-:: Run edksetup.bat and make sure tools are up to date
-::**********************************************************************
-
-call %CORE_PATH%\edksetup.bat Rebuild
-@echo off
-
-::**********************************************************************
-:: Parse command line arguments
-::**********************************************************************
-
-:: Optional arguments
-:OptLoop
-if /i "%~1"=="/?" goto Usage
-
-if /i "%~1"=="/l" (
-    set GenLog=TRUE
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/y" (
-    set GenReport=TRUE
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/m" (
-    if defined NUMBER_OF_PROCESSORS (
-        set /a build_threads=%NUMBER_OF_PROCESSORS%+1
-    )
-    shift
-    goto OptLoop
-)
-if /i "%~1" == "/c" (
-    set Clean=TRUE
-    shift
-    goto OptLoop
-)
-
-if /i "%~1"=="/x64" (
-    set Arch=X64
-    shift
-    goto OptLoop
-)
-if /i "%~1"=="/IA32" (
-    set Arch=IA32
-    shift
-    goto OptLoop
-)
-
-:: Required argument(s)
-if "%~1"=="" goto Usage
-
-if /i "%~2" == "RELEASE" (
-    set target=RELEASE
-) else (
-    set target=DEBUG
-)
-
-::**********************************************************************
-:: Detect TOOL_CHAIN_TAG
-::**********************************************************************
-
-echo.
-echo Setting the Build environment for VS2015/VS2013/VS2012/VS2010/VS2008...
-if defined VS140COMNTOOLS (
-  if not defined VSINSTALLDIR call "%VS140COMNTOOLS%\vsvars32.bat"
-  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 if defined VS120COMNTOOLS (
-  if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat"
-  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 if defined VS110COMNTOOLS (
-  if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"
-  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 if defined VS100COMNTOOLS (
-  if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"
-  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 if defined VS90COMNTOOLS (
-  if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
-  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: VS2015/VS2013/VS2012/VS2010/VS2008 not installed correctly. VS140COMNTOOLS/VS120COMNTOOLS/VS110COMNTOOLS/VS100COMNTOOLS/VS90COMNTOOLS not defined ^^!
-  echo.
-  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 not exist %WORKSPACE%\Build\%PLATFORM_NAME%%Arch% mkdir %WORKSPACE%\Build\%PLATFORM_NAME%%Arch%
-set BUILD_PATH=%WORKSPACE%\Build\%PLATFORM_NAME%%Arch%\%TARGET%_%TOOL_CHAIN_TAG%
-if not exist %BUILD_PATH% mkdir %BUILD_PATH%
-
-::**********************************************************************
-:: Check for clean operation
-::**********************************************************************
-
-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" (
-    set Build_Flags=%Build_Flags% -a IA32
-) else if "%Arch%"=="X64" (
-    set Build_Flags=%Build_Flags% -a IA32 -a X64
-)
-set Build_Flags=%Build_Flags% -t %TOOL_CHAIN_TAG%
-set Build_Flags=%Build_Flags% -n %build_threads%
-set Capsule_Build_Flags=%Build_Flags%
-set Build_Flags=%Build_Flags% -p %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc
-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
-)
-
-::**********************************************************************
-:: Generate BIOS ID
-::**********************************************************************
-
-echo BOARD_ID       = MNW2MAX >  %BUILD_PATH%/BiosId.env
-echo BOARD_REV      = W       >> %BUILD_PATH%/BiosId.env
-if "%Arch%"=="IA32" (
-  echo BOARD_EXT      = I32   >> %BUILD_PATH%/BiosId.env
-)
-if "%Arch%"=="X64" (
-  echo BOARD_EXT      = X64   >> %BUILD_PATH%/BiosId.env
-)
-echo VERSION_MAJOR  = 0090    >> %BUILD_PATH%/BiosId.env
-if "%TARGET%"=="DEBUG" (
-  echo BUILD_TYPE     = D     >> %BUILD_PATH%/BiosId.env
-)
-if "%TARGET%"=="RELEASE" (
-  echo BUILD_TYPE     = R     >> %BUILD_PATH%/BiosId.env
-)
-echo VERSION_MINOR  = 01      >> %BUILD_PATH%/BiosId.env
-
-%WORKSPACE%\edk2-platforms\Platform\Intel\Tools\GenBiosId\GenBiosId.py -i %BUILD_PATH%/BiosId.env -o %BUILD_PATH%/BiosId.bin -ot %BUILD_PATH%/BiosId.txt
-
-::**********************************************************************
-:: Build BIOS
-::**********************************************************************
-
-echo.
-echo Invoking EDK2 build...
-echo build %Build_Flags%
-
-call build %Build_Flags%
-
-if %ERRORLEVEL% NEQ 0 goto BldFail
-
-copy %BUILD_PATH%\FV\VLV.fd %BUILD_PATH%\FV\Vlv.ROM
-
-::**********************************************************************
-:: Build Capsules
-::**********************************************************************
-echo Invoking EDK2 build for capsules...
-echo build %Capsule_Build_Flags% -p %PLATFORM_PACKAGE%\PlatformCapsule%Arch%.dsc
-call build %Capsule_Build_Flags% -p %PLATFORM_PACKAGE%\PlatformCapsule%Arch%.dsc
-
-goto Exit
-
-:Usage
-echo.
-echo ***************************************************************************
-echo Build BIOS rom for VLV platforms.
-echo.
-echo Usage: bld_vlv.bat [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.bat MNW2                 : X64 Debug build for MinnowMax
-echo    bld_vlv.bat /IA32 MNW2 release   : IA32 Release build for MinnowMax
-echo.
-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%
-exit /b %exitCode%
-
-EndLocal
diff --git a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
deleted file mode 100755
index c8db91c6dc..0000000000
--- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
+++ /dev/null
@@ -1,222 +0,0 @@
-#!/usr/bin/env bash
-##**********************************************************************
-## Function define
-##**********************************************************************
-function Usage() {
-  echo
-  echo "***************************************************************************"
-  echo "Build BIOS rom for VLV platforms."
-  echo
-  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 "***************************************************************************"
-  exit 0
-}
-
-set -e
-
-cd ..
-echo -e $(date)
-##**********************************************************************
-## Initial Setup
-##**********************************************************************
-#build_threads=($NUMBER_OF_PROCESSORS)+1
-Build_Flags=
-exitCode=0
-build_threads=1
-Arch=X64
-GenLog=FALSE
-GenReport=FALSE
-Clean=FALSE
-
-
-export CORE_PATH=$WORKSPACE/edk2
-export PLATFORM_PATH=$WORKSPACE/edk2-platforms/Platform/Intel/
-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
-
-## 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
-. edksetup.sh BaseTools
-make -C BaseTools
-
-## Define platform specific environment variables.
-PLATFORM_NAME=Vlv2TbltDevicePkg
-PLATFORM_PACKAGE=Vlv2TbltDevicePkg
-PLATFORM_PKG_PATH=$PLATFORM_PATH/$PLATFORM_PACKAGE
-
-cd $PLATFORM_PKG_PATH
-
-##**********************************************************************
-## Parse command line arguments
-##**********************************************************************
-
-## Optional arguments
-for (( i=1; i<=$#; ))
-  do
-    if [ "$1" == "/?" ]; then
-      Usage
-    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/L" ]; then
-      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
-      Clean=TRUE
-      shift
-    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/X64" ]; then
-      Arch=X64
-      shift
-    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/IA32" ]; then
-      Arch=IA32
-      shift
-    else
-      break
-    fi
-  done
-
-## Required argument(s)
-if [ "$2" == "" ]; then
-  Usage
-fi
-
-echo "Setting  $1  platform configuration and BIOS ID..."
-
-if [ "$(echo $2 | tr 'a-z' 'A-Z')" == "RELEASE" ]; then
-  export TARGET=RELEASE
-else
-  export TARGET=DEBUG
-fi
-
-##**********************************************************************
-## Detect TOOL_CHAIN_TAG
-##**********************************************************************
-gcc_version=$(gcc -v 2>&1 | tail -1 | awk '{print $3}')
-case $gcc_version in
-      [1-3].*|4.[0-7].*)
-        echo MNW2 requires GCC4.8 or later
-        exit 1
-        ;;
-      4.8.*)
-        export TOOL_CHAIN_TAG=GCC48
-        ;;
-      4.9.*|6.[0-2].*)
-        export TOOL_CHAIN_TAG=GCC49
-        ;;
-      *)
-        export TOOL_CHAIN_TAG=GCC5
-        ;;
-esac
-
-##**********************************************************************
-## Generate $BUILD_PATH and make sure the directory exists
-##**********************************************************************
-if [ ! -d ${WORKSPACE}/Build ]; then
-  mkdir ${WORKSPACE}/Build
-fi
-
-if [ ! -d ${WORKSPACE}/Build/${PLATFORM_NAME}${Arch} ]; then
-  mkdir ${WORKSPACE}/Build/${PLATFORM_NAME}${Arch}
-fi
-BUILD_PATH=${WORKSPACE}/Build/${PLATFORM_NAME}${Arch}/${TARGET}_${TOOL_CHAIN_TAG}
-
-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 -n $build_threads"
-Capsule_Build_Flags="$Build_Flags"
-Build_Flags="$Build_Flags -p ${PLATFORM_PKG_PATH}/PlatformPkg${Arch}.dsc"
-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
-##**********************************************************************
-
-echo BOARD_ID       = MNW2MAX >  $BUILD_PATH/BiosId.env
-echo BOARD_REV      = L       >> $BUILD_PATH/BiosId.env
-if [ $Arch == "IA32" ]; then
-  echo BOARD_EXT      = I32   >> $BUILD_PATH/BiosId.env
-fi
-if [ $Arch == "X64" ]; then
-  echo BOARD_EXT      = X64   >> $BUILD_PATH/BiosId.env
-fi
-echo VERSION_MAJOR  = 0090    >> $BUILD_PATH/BiosId.env
-if [ $TARGET == "DEBUG" ]; then
-  echo BUILD_TYPE     = D     >> $BUILD_PATH/BiosId.env
-fi
-if [ $TARGET == "RELEASE" ]; then
-  echo BUILD_TYPE     = R     >> $BUILD_PATH/BiosId.env
-fi
-echo VERSION_MINOR  = 01      >> $BUILD_PATH/BiosId.env
-
-python $WORKSPACE/edk2-platforms/Platform/Intel/Tools/GenBiosId/GenBiosId.py -i $BUILD_PATH/BiosId.env -o $BUILD_PATH/BiosId.bin -ot $BUILD_PATH/BiosId.txt
-
-##**********************************************************************
-## Build BIOS
-##**********************************************************************
-echo "Invoking EDK2 build..."
-echo build $Build_Flags
-build $Build_Flags
-
-cp -f $BUILD_PATH/FV/VLV.fd $BUILD_PATH/FV/Vlv.ROM
-
-##**********************************************************************
-## Build Capsules
-##**********************************************************************
-echo "Invoking EDK2 build for capsules..."
-echo build $Capsule_Build_Flags -p $PLATFORM_PKG_PATH/PlatformCapsule${Arch}.dsc
-build      $Capsule_Build_Flags -p $PLATFORM_PKG_PATH/PlatformCapsule${Arch}.dsc
-
-echo
-echo -------------------- The EDKII BIOS build has successfully completed. --------------------
-echo
-- 
2.21.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#44010): https://edk2.groups.io/g/devel/message/44010
Mute This Topic: https://groups.io/mt/32523935/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [edk2-platforms Patch V2 5/5] Vlv2Tbl2DevicePkg: Convert BAT/sh Build scripts to Python
Posted by Gary Lin 6 years, 6 months ago
On Thu, Jul 18, 2019 at 11:02:47PM -0700,  Michael D Kinney  wrote:
> Convert Build_IFWI and bld_vlv BAT/sh scripts to OS
> independent python script PeBuild.py.  This script
> generates the BiosId file.  Standard EDK II build
> commands are used to build FW images and capsules.
> 
> * Sample VS2015x86 commands for IA32/X64 and DEBUG/RELEASE
>   build -a IA32 -a X64 -t VS2015x86 -p Vlv2TbltDevicePkg\PlatformPkgX64.dsc
>   build -a IA32 -a X64 -t VS2015x86 -p Vlv2TbltDevicePkg\PlatformPkgX64.dsc
>   build -a IA32        -t VS2015x86 -p Vlv2TbltDevicePkg\PlatformPkgIA32.dsc
>   build -a IA32        -t VS2015x86 -p Vlv2TbltDevicePkg\PlatformPkgIA32.dsc
> 
> * Sample GCC5 commands for IA32/X64 and DEBUG/RELEASE
>   build -a IA32 -a X64 -n 5 -t GCC5 -p Vlv2TbltDevicePkg/PlatformPkgX64.dsc
>   build -a IA32 -a X64 -n 5 -t GCC5 -p Vlv2TbltDevicePkg/PlatformPkgX64.dsc
>   build -a IA32        -n 5 -t GCC5 -p Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
>   build -a IA32        -n 5 -t GCC5 -p Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> 
Hi Mike,

I found some errors in Readme.md

> 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>
> ---
>  .../Intel/Vlv2TbltDevicePkg/Build_IFWI.bat    | 118 ------
>  .../Intel/Vlv2TbltDevicePkg/Build_IFWI.sh     | 100 -----
>  .../Vlv2TbltDevicePkg/PlatformCapsule.fdf     |  48 ---
>  .../Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc |  39 --
>  .../Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc  |  39 --
>  .../Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf   |  30 +-
>  .../Vlv2TbltDevicePkg/PlatformPkgIA32.dsc     |  13 +-
>  .../Vlv2TbltDevicePkg/PlatformPkgX64.dsc      |  13 +-
>  Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py  | 348 ++++++++++++++++++
>  Platform/Intel/Vlv2TbltDevicePkg/Readme.md    |  62 ++--
>  Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat  | 303 ---------------
>  Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh   | 222 -----------
>  12 files changed, 432 insertions(+), 903 deletions(-)
>  delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
>  delete mode 100755 Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
>  delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsule.fdf
>  delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc
>  delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc
>  create mode 100644 Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py
>  delete mode 100644 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
>  delete mode 100755 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
> 
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat b/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
> deleted file mode 100644
> index f65aa61f4a..0000000000
> --- a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
> +++ /dev/null
> @@ -1,118 +0,0 @@
> -@REM @file
> -@REM   Windows batch file to build BIOS ROM
> -@REM
> -@REM Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
> -@REM SPDX-License-Identifier: BSD-2-Clause-Patent
> -@REM
> -
> -@echo off
> -
> -SetLocal EnableDelayedExpansion EnableExtensions
> -
> -:: Assign initial values
> -set exitCode=0
> -set "Build_Flags= "
> -set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
> -
> -set PLATFORM_PATH=%WORKSPACE%
> -if not exist %PLATFORM_PATH%\%PLATFORM_PACKAGE% (
> -  if defined PACKAGES_PATH (
> -    for %%i IN (%PACKAGES_PATH%) DO (
> -      if exist %%~fi\%PLATFORM_PACKAGE% (
> -        set PLATFORM_PATH=%%~fi
> -        goto PlatformPackageFound
> -      )
> -    )
> -  ) else (
> -    echo.
> -    echo !!! ERROR !!! Cannot find %PLATFORM_PACKAGE% !!!
> -    echo.
> -    goto Exit
> -  )
> -)
> -:PlatformPackageFound
> -
> -:: Parse Optional arguments
> -:OptLoop
> -if /i "%~1"=="/?" goto Usage
> -
> -if /i "%~1"=="/l" (
> -    set Build_Flags=%Build_Flags% /l
> -    shift
> -    goto OptLoop
> -)
> -if /i "%~1"=="/y" (
> -    set Build_Flags=%Build_Flags% /y
> -    shift
> -    goto OptLoop
> -)
> -if /i "%~1"=="/m" (
> -    set Build_Flags=%Build_Flags% /m
> -    shift
> -    goto OptLoop
> -)
> -if /i "%~1" == "/c" (
> -    set Build_Flags=%Build_Flags% /c
> -    shift
> -    goto OptLoop
> -)
> -if /i "%~1"=="/x64" (
> -    set Build_Flags=%Build_Flags% /x64
> -    shift
> -    goto OptLoop
> -)
> -if /i "%~1"=="/IA32" (
> -    set Build_Flags=%Build_Flags% /IA32
> -    shift
> -    goto OptLoop
> -)
> -
> -:: Require 2 input parameters
> -if "%~2"=="" goto Usage
> -
> -:: Assign required arguments
> -set Platform_Type=%~1
> -set Build_Target=%~2
> -
> -:: Build BIOS
> -echo ======================================================================
> -echo Build_IFWI:  Calling BIOS build Script...
> -
> -call %PLATFORM_PATH%\%PLATFORM_PACKAGE%\bld_vlv.bat %Build_Flags% %Platform_Type% %Build_Target%
> -
> -if %ERRORLEVEL% NEQ 0 (
> -    echo echo  -- Error Building BIOS  & echo.
> -    set exitCode=1
> -    goto exit
> -)
> -echo.
> -echo Finished Building BIOS.
> -goto Exit
> -
> -:Usage
> -echo Script to build BIOS firmware and stitch the entire IFWI.
> -echo.
> -echo Usage: Build_IFWI.bat [options]  PlatformType  BuildTarget
> -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    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
> -
> -:Exit
> -@REM  CD to platform package.
> -cd %PLATFORM_PATH%
> -exit /b %exitCode%
> -
> -EndLocal
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh b/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
> deleted file mode 100755
> index 153c8c5fae..0000000000
> --- a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
> +++ /dev/null
> @@ -1,100 +0,0 @@
> -#!/usr/bin/env bash
> -##**********************************************************************
> -## Function define
> -##**********************************************************************
> -function Usage ( ) {
> -  echo
> -  echo "Script to build BIOS firmware and stitch the entire IFWI."
> -  echo
> -  echo "Usage: Build_IFWI.sh [options]  PlatformType  BuildTarget"
> -  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 "   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
> -}
> -
> -set -e
> -
> -## Assign initial values
> -exitCode=0
> -Build_Flags=
> -
> -## Check whether WORKSPACE is set or not
> -if [[ -z "$WORKSPACE" ]]; then
> -  echo "Please export WORKSPACE before running Build_IFWI.sh"
> -  echo "See the details in Readme.md"
> -  exit 1
> -fi
> -
> -## Create $WORKSPACE/Conf if necessary
> -if [ ! -d $WORKSPACE/Conf ]; then
> -  mkdir $WORKSPACE/Conf
> -fi
> -
> -## Parse Optional arguments
> -if [ "$1" == "/?" ]; then
> -  Usage
> -fi
> -
> -for (( i=1; i<=$#; ))
> -  do
> -    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')" == "/X64" ]; then
> -      Build_Flags="$Build_Flags /x64"
> -      shift
> -    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/IA32" ]; then
> -      Build_Flags="$Build_Flags /IA32"
> -      shift
> -    else
> -      break
> -    fi
> -  done
> -
> -## Require 2 input parameters
> -if [ "$2" == "" ]; then
> -  Usage
> -fi
> -
> -## Assign required arguments
> -Platform_Type=$1
> -Build_Target=$2
> -
> -## Build BIOS
> -echo "======================================================================"
> -echo "Build_IFWI:  Calling BIOS build Script..."
> -. bld_vlv.sh $Build_Flags $Platform_Type $Build_Target
> -
> -echo
> -echo Finished Building BIOS.
> -
> -## Start Integration process
> -echo ======================================================================
> -echo Skip "Build_IFWI:  Calling IFWI Stitching Script..."
> -
> -echo
> -echo Build_IFWI is finished.
> -echo The final IFWI file is located in Stitch
> -echo ======================================================================
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsule.fdf b/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsule.fdf
> deleted file mode 100644
> index d8b0074d6a..0000000000
> --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsule.fdf
> +++ /dev/null
> @@ -1,48 +0,0 @@
> -## @file
> -# FDF file of Platform capsule.
> -#
> -# Copyright (c) 2016 - 2019, Intel Corporation.
> -#
> -# SPDX-License-Identifier: BSD-2-Clause-Patent
> -#
> -##
> -
> -[FV.SystemFirmwareUpdateCargo]
> -FvAlignment        = 16
> -ERASE_POLARITY     = 1
> -MEMORY_MAPPED      = TRUE
> -STICKY_WRITE       = TRUE
> -LOCK_CAP           = TRUE
> -LOCK_STATUS        = TRUE
> -WRITE_DISABLED_CAP = TRUE
> -WRITE_ENABLED_CAP  = TRUE
> -WRITE_STATUS       = TRUE
> -WRITE_LOCK_CAP     = TRUE
> -WRITE_LOCK_STATUS  = TRUE
> -READ_DISABLED_CAP  = TRUE
> -READ_ENABLED_CAP   = TRUE
> -READ_STATUS        = TRUE
> -READ_LOCK_CAP      = TRUE
> -READ_LOCK_STATUS   = TRUE
> -
> -FILE RAW = AF9C9EB2-12AD-4D3E-A4D4-96F6C9966215 { # PcdEdkiiSystemFirmwareFileGuid
> -    $(WORKSPACE)/$(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/FV/Vlv.ROM
> -  }
> -
> -[FmpPayload.FmpPayloadSystemFirmwareRsa2048]
> -IMAGE_HEADER_INIT_VERSION = 0x02
> -IMAGE_TYPE_ID             = 4096267b-da0a-42eb-b5eb-fef31d207cb4 # PcdSystemFmpCapsuleImageTypeIdGuid
> -IMAGE_INDEX               = 0x1
> -HARDWARE_INSTANCE         = 0x0
> -MONOTONIC_COUNT           = 0x2
> -CERTIFICATE_GUID          = A7717414-C616-4977-9420-844712A735BF # RSA2048SHA256
> -
> -FILE DATA = $(WORKSPACE)/$(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/FV/SYSTEMFIRMWAREUPDATECARGO.Fv
> -
> -[Capsule.Vlv2Rec]
> -CAPSULE_GUID                = 6dcbd5ed-e82d-4c44-bda1-7194199ad92a # gEfiFmpCapsuleGuid
> -CAPSULE_FLAGS               = PersistAcrossReset,InitiateReset
> -CAPSULE_HEADER_SIZE         = 0x20
> -CAPSULE_HEADER_INIT_VERSION = 0x1
> -
> -FMP_PAYLOAD = FmpPayloadSystemFirmwareRsa2048
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc
> deleted file mode 100644
> index 246347b8fa..0000000000
> --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -#/** @file
> -# Platform capsule description.
> -#
> -# Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
> -#
> -# SPDX-License-Identifier: BSD-2-Clause-Patent
> -#
> -#
> -#**/
> -
> -[Defines]
> -  PLATFORM_NAME                  = Vlv2TbltDevicePkg
> -  PLATFORM_GUID                  = EE87F258-6ECC-4415-B1D8-23771BEE26E7
> -  PLATFORM_VERSION               = 0.1
> -  FLASH_DEFINITION               = Vlv2TbltDevicePkg/PlatformCapsule.fdf
> -  OUTPUT_DIRECTORY               = Build/Vlv2TbltDevicePkgIA32
> -  SUPPORTED_ARCHITECTURES        = IA32|X64
> -  BUILD_TARGETS                  = DEBUG|RELEASE
> -  SKUID_IDENTIFIER               = DEFAULT
> -  POSTBUILD                      = python Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.py
> -
> -###################################################################################################
> -#
> -# Components Section - list of the modules and components that will be processed by compilation
> -#                      tools and the EDK II tools to generate PE32/PE32+/Coff image files.
> -#
> -# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
> -#       into firmware volume images. This section is just a list of modules to compile from
> -#       source into UEFI-compliant binaries.
> -#       It is the FDF file that contains information on combining binary files into firmware
> -#       volume images, whose concept is beyond UEFI and is described in PI specification.
> -#       Binary modules do not need to be listed in this section, as they should be
> -#       specified in the FDF file. For example: Shell binary, FAT binary (Fat.efi),
> -#       Logo (Logo.bmp), and etc.
> -#       There may also be modules listed in this section that are not required in the FDF file,
> -#       When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
> -#       generated for it, but the binary will not be put into any firmware volume.
> -#
> -###################################################################################################
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc
> deleted file mode 100644
> index 68bde30f83..0000000000
> --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc
> +++ /dev/null
> @@ -1,39 +0,0 @@
> -#/** @file
> -# Platform capsule description.
> -#
> -# Copyright (c) 2016 - 2019, Intel Corporation. All rights reserved.<BR>
> -#
> -# SPDX-License-Identifier: BSD-2-Clause-Patent
> -#
> -#
> -#**/
> -
> -[Defines]
> -  PLATFORM_NAME                  = Vlv2TbltDevicePkg
> -  PLATFORM_GUID                  = EE87F258-6ECC-4415-B1D8-23771BEE26E7
> -  PLATFORM_VERSION               = 0.1
> -  FLASH_DEFINITION               = Vlv2TbltDevicePkg/PlatformCapsule.fdf
> -  OUTPUT_DIRECTORY               = Build/Vlv2TbltDevicePkgX64
> -  SUPPORTED_ARCHITECTURES        = IA32|X64
> -  BUILD_TARGETS                  = DEBUG|RELEASE
> -  SKUID_IDENTIFIER               = DEFAULT
> -  POSTBUILD                      = python Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.py
> -
> -###################################################################################################
> -#
> -# Components Section - list of the modules and components that will be processed by compilation
> -#                      tools and the EDK II tools to generate PE32/PE32+/Coff image files.
> -#
> -# Note: The EDK II DSC file is not used to specify how compiled binary images get placed
> -#       into firmware volume images. This section is just a list of modules to compile from
> -#       source into UEFI-compliant binaries.
> -#       It is the FDF file that contains information on combining binary files into firmware
> -#       volume images, whose concept is beyond UEFI and is described in PI specification.
> -#       Binary modules do not need to be listed in this section, as they should be
> -#       specified in the FDF file. For example: Shell binary, FAT binary (Fat.efi),
> -#       Logo (Logo.bmp), and etc.
> -#       There may also be modules listed in this section that are not required in the FDF file,
> -#       When a module listed here is excluded from FDF file, then UEFI-compliant binary will be
> -#       generated for it, but the binary will not be put into any firmware volume.
> -#
> -###################################################################################################
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
> index e958c1ebf2..48058b663a 100644
> --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
> @@ -711,9 +711,8 @@ [FV.FVMAIN_COMPACT]
>  !endif
>       }
>
> -[FV.SETUP_DATA]
> -BlockSize          = $(FLASH_BLOCK_SIZE)
> -#NumBlocks         = 0x10
> +!if $(RECOVERY_ENABLE)
> +[FV.SystemFirmwareUpdateCargo]
>  FvAlignment        = 16
>  ERASE_POLARITY     = 1
>  MEMORY_MAPPED      = TRUE
> @@ -731,6 +730,31 @@ [FV.SETUP_DATA]
>  READ_LOCK_CAP      = TRUE
>  READ_LOCK_STATUS   = TRUE
>
> +FILE RAW = AF9C9EB2-12AD-4D3E-A4D4-96F6C9966215 { # PcdEdkiiSystemFirmwareFileGuid
> +    FD = Vlv
> +#    $(WORKSPACE)/$(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/FV/Vlv.fd
> +  }
> +
> +[FmpPayload.FmpPayloadSystemFirmwareRsa2048]
> +IMAGE_HEADER_INIT_VERSION = 0x02
> +IMAGE_TYPE_ID             = 4096267b-da0a-42eb-b5eb-fef31d207cb4 # PcdSystemFmpCapsuleImageTypeIdGuid
> +IMAGE_INDEX               = 0x1
> +HARDWARE_INSTANCE         = 0x0
> +MONOTONIC_COUNT           = 0x2
> +CERTIFICATE_GUID          = A7717414-C616-4977-9420-844712A735BF # RSA2048SHA256
> +
> +FV = SystemFirmwareUpdateCargo
> +#FILE DATA = $(WORKSPACE)/$(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_TAG)/FV/SYSTEMFIRMWAREUPDATECARGO.Fv
> +
> +[Capsule.Vlv2Rec]
> +CAPSULE_GUID                = 6dcbd5ed-e82d-4c44-bda1-7194199ad92a # gEfiFmpCapsuleGuid
> +CAPSULE_FLAGS               = PersistAcrossReset,InitiateReset
> +CAPSULE_HEADER_SIZE         = 0x20
> +CAPSULE_HEADER_INIT_VERSION = 0x1
> +
> +FMP_PAYLOAD = FmpPayloadSystemFirmwareRsa2048
> +!endif
> +
>  ################################################################################
>  #
>  # Rules are use with the [FV] section's module INF type to define
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> index 121ebc9eee..5149dd5aa4 100644
> --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> @@ -23,6 +23,8 @@ [Defines]
>    BUILD_TARGETS                       = DEBUG|RELEASE
>    SKUID_IDENTIFIER                    = DEFAULT
>    VPD_TOOL_GUID                       = 8C3D856A-9BE6-468E-850A-24F7A8D38E08
> +  PREBUILD                            = python Vlv2TbltDevicePkg/PreBuild.py
> +  POSTBUILD                           = python Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.py
>
>    DEFINE RC_BINARY_RELEASE        = TRUE
>    #
> @@ -213,7 +215,7 @@ [LibraryClasses.common]
>    TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
>  !endif
>
> - BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.inf
> +  BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.inf
>
>    StallSmmLib|Vlv2TbltDevicePkg/Library/StallSmmLib/StallSmmLib.inf
>
> @@ -242,6 +244,10 @@ [LibraryClasses.common]
>
>    BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
>
> +!if $(RECOVERY_ENABLE)
> +  EdkiiSystemCapsuleLib|SignedCapsulePkg/Library/EdkiiSystemCapsuleLib/EdkiiSystemCapsuleLib.inf
> +!endif
> +
>  [LibraryClasses.IA32.SEC]
>  !if $(PERFORMANCE_ENABLE) == TRUE
>    PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
> @@ -718,11 +724,10 @@ [PcdsDynamicExDefault.common.DEFAULT]
>    gEfiVLVTokenSpaceGuid.PcdCpuSmramCpuDataAddress|0
>    gEfiVLVTokenSpaceGuid.PcdCpuLockBoxSize|0
>    gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|TRUE
> -
> -[PcdsDynamicExDefault.X64.DEFAULT]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{GUID("$(FMP_MINNOW_MAX_SYSTEM)")}|VOID*|0x10
>  !if $(RECOVERY_ENABLE)
> +  gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescriptor|{0x0}|VOID*|0x100
>    gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareFileGuid|{GUID("AF9C9EB2-12AD-4D3E-A4D4-96F6C9966215")}|VOID*|0x10
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{GUID("4096267b-da0a-42eb-b5eb-fef31d207cb4")}|VOID*|0x10
>  !endif
>
>  [PcdsDynamicExVpd.common.DEFAULT]
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> index 3e4087f919..466512242c 100644
> --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> @@ -23,6 +23,8 @@ [Defines]
>    BUILD_TARGETS                       = DEBUG|RELEASE
>    SKUID_IDENTIFIER                    = DEFAULT
>    VPD_TOOL_GUID                       = 8C3D856A-9BE6-468E-850A-24F7A8D38E08
> +  PREBUILD                            = python Vlv2TbltDevicePkg/PreBuild.py
> +  POSTBUILD                           = python Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCapsuleAll.py
>
>    DEFINE RC_BINARY_RELEASE        = TRUE
>    #
> @@ -215,7 +217,7 @@ [LibraryClasses.common]
>    TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibNull/TpmMeasurementLibNull.inf
>  !endif
>
> - BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.inf
> +  BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.inf
>
>    StallSmmLib|Vlv2TbltDevicePkg/Library/StallSmmLib/StallSmmLib.inf
>
> @@ -244,6 +246,10 @@ [LibraryClasses.common]
>
>    BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.inf
>
> +!if $(RECOVERY_ENABLE)
> +  EdkiiSystemCapsuleLib|SignedCapsulePkg/Library/EdkiiSystemCapsuleLib/EdkiiSystemCapsuleLib.inf
> +!endif
> +
>  [LibraryClasses.IA32.SEC]
>  !if $(PERFORMANCE_ENABLE) == TRUE
>    PerformanceLib|MdePkg/Library/BasePerformanceLibNull/BasePerformanceLibNull.inf
> @@ -720,11 +726,10 @@ [PcdsDynamicExDefault.common.DEFAULT]
>    gEfiVLVTokenSpaceGuid.PcdCpuSmramCpuDataAddress|0
>    gEfiVLVTokenSpaceGuid.PcdCpuLockBoxSize|0
>    gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|TRUE
> -
> -[PcdsDynamicExDefault.X64.DEFAULT]
> +  gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{GUID("$(FMP_MINNOW_MAX_SYSTEM)")}|VOID*|0x10
>  !if $(RECOVERY_ENABLE)
> +  gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareImageDescriptor|{0x0}|VOID*|0x100
>    gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmwareFileGuid|{GUID("AF9C9EB2-12AD-4D3E-A4D4-96F6C9966215")}|VOID*|0x10
> -  gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTypeIdGuid|{GUID("4096267b-da0a-42eb-b5eb-fef31d207cb4")}|VOID*|0x10
>  !endif
>
>  [PcdsDynamicExVpd.common.DEFAULT]
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py b/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py
> new file mode 100644
> index 0000000000..220515c809
> --- /dev/null
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py
> @@ -0,0 +1,348 @@
> +## @file
> +# PreBuild operations for Vlv2TbltDevicePkg
> +#
> +# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
> +#
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +#
> +
> +'''
> +PreBuild
> +'''
> +
> +import os
> +import sys
> +import argparse
> +import subprocess
> +import glob
> +import shutil
> +import struct
> +import datetime
> +
> +#
> +# Globals for help information
> +#
> +__prog__        = 'PreBuild'
> +__copyright__   = 'Copyright (c) 2019, Intel Corporation. All rights reserved.'
> +__description__ = 'Vlv2Tbl2DevicePkg pre-build operations.\n'
> +
> +#
> +# Globals
> +#
> +gWorkspace = ''
> +gBaseToolsPath = ''
> +gArgs      = None
> +
> +def LogAlways(Message):
> +    sys.stdout.write (__prog__ + ': ' + Message + '\n')
> +    sys.stdout.flush()
> +
> +def Log(Message):
> +    global gArgs
> +    if not gArgs.Verbose:
> +        return
> +    sys.stdout.write (__prog__ + ': ' + Message + '\n')
> +    sys.stdout.flush()
> +
> +def Error(Message, ExitValue=1):
> +    sys.stderr.write (__prog__ + ': ERROR: ' + Message + '\n')
> +    sys.exit (ExitValue)
> +
> +def RelativePath(target):
> +    global gWorkspace
> +    Log('RelativePath' + target)
> +    return os.path.relpath (target, gWorkspace)
> +
> +def NormalizePath(target):
> +    if isinstance(target, tuple):
> +        return os.path.normpath (os.path.join (*target))
> +    else:
> +        return os.path.normpath (target)
> +
> +def RemoveFile(target):
> +    target = NormalizePath(target)
> +    if not target or target == os.pathsep:
> +        Error ('RemoveFile() invalid target')
> +    if os.path.exists(target):
> +        os.remove (target)
> +        Log ('remove %s' % (RelativePath (target)))
> +
> +def RemoveDirectory(target):
> +    target = NormalizePath(target)
> +    if not target or target == os.pathsep:
> +        Error ('RemoveDirectory() invalid target')
> +    if os.path.exists(target):
> +        Log ('rmdir %s' % (RelativePath (target)))
> +        shutil.rmtree(target)
> +
> +def CreateDirectory(target):
> +    target = NormalizePath(target)
> +    if not os.path.exists(target):
> +        Log ('mkdir %s' % (RelativePath (target)))
> +        os.makedirs (target)
> +
> +def Copy(src, dst):
> +    src = NormalizePath(src)
> +    dst = NormalizePath(dst)
> +    for File in glob.glob(src):
> +        Log ('copy %s -> %s' % (RelativePath (File), RelativePath (dst)))
> +        shutil.copy (File, dst)
> +
> +def GenCapsuleDevice (BaseName, PayloadFileName, Guid, Version, Lsv, CapsulesPath, CapsulesSubDir):
> +    global gBaseToolsPath
> +    LogAlways ('Generate Capsule: {0} {1:08x} {2:08x} {3}'.format (Guid, Version, Lsv, PayloadFileName))
> +
> +    VersionString = '.'.join([str(ord(x)) for x in struct.pack('>I', Version).decode()])
> +
> +    FmpCapsuleFile = NormalizePath ((CapsulesPath, CapsulesSubDir, BaseName + '.' + VersionString + '.cap'))
> +    Command = GenerateCapsuleCommand.format (
> +                FMP_CAPSULE_GUID    = Guid,
> +                FMP_CAPSULE_VERSION = Version,
> +                FMP_CAPSULE_LSV     = Lsv,
> +                BASE_TOOLS_PATH     = gBaseToolsPath,
> +                FMP_CAPSULE_FILE    = FmpCapsuleFile,
> +                FMP_CAPSULE_PAYLOAD = PayloadFileName
> +                )
> +    Command = ' '.join(Command.splitlines()).strip()
> +    if gArgs.Verbose:
> +        Command = Command + ' -v'
> +
> +    Log (Command)
> +
> +    Process = subprocess.Popen(Command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
> +    ProcessOutput = Process.communicate()
> +
> +    if Process.returncode == 0:
> +        Log (ProcessOutput[0].decode())
> +    else:
> +        LogAlways (Command)
> +        LogAlways (ProcessOutput[0].decode())
> +        Error ('GenerateCapsule returned an error')
> +
> +    Copy (PayloadFileName, (CapsulesPath, 'firmware.bin'))
> +    MetaInfoXml = MetaInfoXmlTemplate
> +    MetaInfoXml = MetaInfoXml.replace ('FMP_CAPSULE_GUID', Guid)
> +    MetaInfoXml = MetaInfoXml.replace ('FMP_CAPSULE_BASE_NAME', BaseName)
> +    MetaInfoXml = MetaInfoXml.replace ('FMP_CAPSULE_VERSION_DECIMAL', str(Version))
> +    MetaInfoXml = MetaInfoXml.replace ('FMP_CAPSULE_STRING', VersionString)
> +    MetaInfoXml = MetaInfoXml.replace ('FMP_CAPSULE_DATE', str(datetime.date.today()))
> +    f = open (NormalizePath ((CapsulesPath, 'firmware.metainfo.xml')), 'w')
> +    f.write(MetaInfoXml)
> +    f.close()
> +
> +    f = open (NormalizePath ((CapsulesPath, 'Lvfs.ddf')), 'w')
> +    f.write(LvfsDdfTemplate)
> +    f.close()
> +
> +    if sys.platform == "win32":
> +        Command = 'makecab /f ' + NormalizePath ((CapsulesPath, 'Lvfs.ddf'))
> +    else:
> +        Command = 'gcab --create firmware.cab firmware.bin firmware.metainfo.xml'
> +    Log (Command)
> +
> +    Process = subprocess.Popen(Command, cwd=CapsulesPath, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
> +    ProcessOutput = Process.communicate()
> +
> +    if Process.returncode == 0:
> +        Log (ProcessOutput[0].decode())
> +    else:
> +        LogAlways (Command)
> +        LogAlways (ProcessOutput[0].decode())
> +        Error ('GenerateCapsule returned an error')
> +
> +    FmpCabinetFile = NormalizePath ((CapsulesPath, CapsulesSubDir, BaseName + '.' + VersionString + '.cab'))
> +
> +    Copy ((CapsulesPath, 'firmware.cab'), FmpCabinetFile)
> +
> +    RemoveFile ((CapsulesPath, 'firmware.cab'))
> +    RemoveFile ((CapsulesPath, 'setup.inf'))
> +    RemoveFile ((CapsulesPath, 'setup.rpt'))
> +    RemoveFile ((CapsulesPath, 'Lvfs.ddf'))
> +    RemoveFile ((CapsulesPath, 'firmware.metainfo.xml'))
> +    RemoveFile ((CapsulesPath, 'firmware.bin'))
> +
> +BiosIdTemplate = '''
> +BOARD_ID       = MNW2MAX
> +BOARD_REV      = $BOARD_REV
> +BOARD_EXT      = $ARCH
> +VERSION_MAJOR  = 0090
> +BUILD_TYPE     = $BUILD_TYPE
> +VERSION_MINOR  = 01
> +'''
> +
> +
> +if __name__ == '__main__':
> +    #
> +    # Create command line argument parser object
> +    #
> +    parser = argparse.ArgumentParser (
> +                        prog = __prog__,
> +                        description = __description__ + __copyright__,
> +                        conflict_handler = 'resolve'
> +                        )
> +    parser.add_argument (
> +             '-a', '--arch', dest = 'Arch', nargs = '+', action = 'append',
> +             required = True,
> +             help = '''ARCHS is one of list: IA32, X64, IPF, ARM, AARCH64 or EBC,
> +                       which overrides target.txt's TARGET_ARCH definition. To
> +                       specify more archs, please repeat this option.'''
> +             )
> +    parser.add_argument (
> +             '-t', '--tagname', dest = 'ToolChain', required = True,
> +             help = '''Using the Tool Chain Tagname to build the platform,
> +                       overriding target.txt's TOOL_CHAIN_TAG definition.'''
> +             )
> +    parser.add_argument (
> +             '-p', '--platform', dest = 'PlatformFile', required = True,
> +             help = '''Build the platform specified by the DSC file name argument,
> +                       overriding target.txt's ACTIVE_PLATFORM definition.'''
> +             )
> +    parser.add_argument (
> +             '-b', '--buildtarget', dest = 'BuildTarget', required = True,
> +             help = '''Using the TARGET to build the platform, overriding
> +                       target.txt's TARGET definition.'''
> +             )
> +    parser.add_argument (
> +             '--conf=', dest = 'ConfDirectory', required = True,
> +             help = '''Specify the customized Conf directory.'''
> +             )
> +    parser.add_argument (
> +             '-D', '--define', dest = 'Define', nargs='*', action = 'append',
> +             help = '''Macro: "Name [= Value]".'''
> +             )
> +    parser.add_argument (
> +             '-v', '--verbose', dest = 'Verbose', action = 'store_true',
> +             help = '''Turn on verbose output with informational messages printed'''
> +             )
> +    parser.add_argument (
> +             '--package', dest = 'Package', nargs = '*', action = 'append',
> +             help = '''The directory name of a package of tests to copy'''
> +             )
> +
> +    #
> +    # Parse command line arguments
> +    #
> +    gArgs, remaining = parser.parse_known_args()
> +    gArgs.BuildType = 'all'
> +    for BuildType in ['all', 'fds', 'genc', 'genmake', 'clean', 'cleanall', 'modules', 'libraries', 'run']:
> +        if BuildType in remaining:
> +            gArgs.BuildType = BuildType
> +            remaining.remove(BuildType)
> +            break
> +    gArgs.Remaining = ' '.join(remaining)
> +
> +    #
> +    # Get WORKSPACE environment variable
> +    #
> +    try:
> +        gWorkspace = os.environ['WORKSPACE']
> +    except:
> +        Error ('WORKSPACE environment variable not set')
> +
> +    #
> +    # Get PACKAGES_PATH and generate prioritized list of paths
> +    #
> +    PathList = [gWorkspace]
> +    try:
> +        PathList += os.environ['PACKAGES_PATH'].split(os.pathsep)
> +    except:
> +        pass
> +
> +    #
> +    # Determine full path to BaseTools
> +    #
> +    Vlv2Tbl2DevicePkgPath = ''
> +    for Path in PathList:
> +        if gBaseToolsPath == '':
> +            if os.path.exists (os.path.join (Path, 'BaseTools')):
> +                gBaseToolsPath = os.path.join (Path, 'BaseTools')
> +        if Vlv2Tbl2DevicePkgPath == '':
> +            if os.path.exists (os.path.join (Path, 'Vlv2TbltDevicePkg')):
> +                Vlv2Tbl2DevicePkgPath = os.path.join (Path, 'Vlv2TbltDevicePkg')
> +    if gBaseToolsPath == '':
> +        Error ('Can not find BaseTools in WORKSPACE or PACKAGES_PATH')
> +    if Vlv2Tbl2DevicePkgPath == '':
> +        Error ('Can not find Vlv2Tbl2DevicePkg in WORKSPACE or PACKAGES_PATH')
> +
> +    #
> +    # Parse OUTPUT_DIRECTORY from DSC file
> +    #
> +    for Path in PathList:
> +        if os.path.exists (os.path.join (Path, gArgs.PlatformFile)):
> +            Dsc = open (os.path.join (Path, gArgs.PlatformFile), 'r').readlines()
> +            break
> +    for Line in Dsc:
> +        if Line.strip().startswith('OUTPUT_DIRECTORY'):
> +            OutputDirectory = Line.strip().split('=')[1].strip()
> +            break
> +
> +    #
> +    # Determine full paths to EDK II build directory, EDK II build output
> +    # directory and the CPU arch of the UEFI phase.
> +    #
> +    CommandDir = os.path.dirname(sys.argv[0])
> +    EdkiiBuildDir = os.path.join (gWorkspace, OutputDirectory)
> +    EdkiiBuildOutput = os.path.join (EdkiiBuildDir, gArgs.BuildTarget + '_' + gArgs.ToolChain)
> +    UefiArch = gArgs.Arch[0][0]
> +    if len (gArgs.Arch) > 1:
> +        if ['X64'] in gArgs.Arch:
> +            UefiArch = 'X64'
> +
> +    if gArgs.BuildType == 'run':
> +        Error ("'run' target not supported")
> +    if gArgs.BuildType == 'clean':
> +        sys.exit (0)
> +
> +    #
> +    # Create output directories to put BiosId files
> +    #
> +    try:
> +        CreateDirectory ((gWorkspace, 'Build'))
> +    except:
> +        pass
> +    try:
> +        CreateDirectory ((EdkiiBuildDir))
> +    except:
> +        pass
> +    try:
> +        CreateDirectory ((EdkiiBuildOutput))
> +    except:
> +        pass
> +
> +    #
> +    # Generate BiosId files
> +    #
> +    BiosId = BiosIdTemplate
> +    if sys.platform == "win32":
> +        # Built from a Windows Host OS
> +        BiosId = BiosId.replace ('$BOARD_REV', 'W')
> +    else:
> +        # Built from a Linux/Unix/Mac Host OS
> +        BiosId = BiosId.replace ('$BOARD_REV', 'L')
> +    if UefiArch == 'X64':
> +      BiosId = BiosId.replace ('$ARCH', 'X64')
> +    else:
> +      BiosId = BiosId.replace ('$ARCH', 'I32')
> +    BiosId = BiosId.replace ('$BUILD_TYPE', gArgs.BuildTarget[0])
> +
> +    BiosIdFileName = NormalizePath ((EdkiiBuildOutput, 'BiosId.env'))
> +    f = open (BiosIdFileName, 'w')
> +    f.write(BiosId)
> +    f.close()
> +
> +    Command = 'python ' + NormalizePath ((Vlv2Tbl2DevicePkgPath, '../Tools/GenBiosId/GenBiosId.py'))
> +    Command = Command + ' -i '  + BiosIdFileName
> +    Command = Command + ' -o '  + NormalizePath ((EdkiiBuildOutput, 'BiosId.bin'))
> +    Command = Command + ' -ot ' + NormalizePath ((EdkiiBuildOutput, 'BiosId.txt'))
> +
> +    LogAlways (Command)
> +
> +    Process = subprocess.Popen(Command, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
> +    ProcessOutput = Process.communicate()
> +
> +    if Process.returncode == 0:
> +        Log (ProcessOutput[0].decode())
> +    else:
> +        LogAlways (Command)
> +        LogAlways (ProcessOutput[0].decode())
> +        Error ('GenBiosId returned an error')
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Readme.md b/Platform/Intel/Vlv2TbltDevicePkg/Readme.md
> index 97180ef7af..b52c23fdec 100644
> --- a/Platform/Intel/Vlv2TbltDevicePkg/Readme.md
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/Readme.md
> @@ -57,12 +57,15 @@ powershell Expand-Archive nasm-2.13.03-win64.zip .
>
>  set WORKSPACE=%CD%
>  set PACKAGES_PATH=%WORKSPACE%\edk2;%WORKSPACE%\edk2-platforms\Silicon\Intel;%WORKSPACE%\edk2-platforms\Platform\Intel;%WORKSPACE%\edk2-non-osi\Silicon\Intel
> +set EDK_TOOLS_PATH=%WORKSPACE%\edk2\BaseTools
>  path=%path%;%WORKSPACE%\openssl-1.0.2r-x64_86-win64
>  set NASM_PREFIX=%WORKSPACE%\nasm-2.13.03\
>
> -cd edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg
> +cd %WORKSPACE%\edk2
>
> -Build_IFWI.bat /m MNW2 Debug
> +edksetup.bat Rebuild
> +
> +build -a IA32 -a X64 -n 5 -t VS2015x86 -b DEBUG -p Vlv2TbltDevicePkg\PlatformPkgX64.dsc
>  ```
>
>  Once all the code and tools are downloaded and installed, only the following
> @@ -72,8 +75,14 @@ directory used to install the source and binaries.
>  ```
>  set WORKSPACE=%CD%
>  set PACKAGES_PATH=%WORKSPACE%\edk2;%WORKSPACE%\edk2-platforms\Silicon\Intel;%WORKSPACE%\edk2-platforms\Platform\Intel;%WORKSPACE%\edk2-non-osi\Silicon\Intel
> +set EDK_TOOLS_PATH=%WORKSPACE%\edk2\BaseTools
>  path=%path%;%WORKSPACE%\openssl-1.0.2r-x64_86-win64
>  set NASM_PREFIX=%WORKSPACE%\nasm-2.13.03\
> +
> +cd %WORKSPACE%\edk2
> +
> +edksetup.bat Rebuild
> +
>  ```
>
>  Once the environment is setup, the MinnowBoard MAX firmware and capsules can be
> @@ -82,39 +91,43 @@ rebuilt using the following commands.
>  * Build X64 Debug Image with report file
>
>  ```
> -cd edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg
> -Build_IFWI.bat /m /y MNW2 Debug
> +build -a IA32 -a X64 -n 5 -t VS2015x86 -b DEBUG -p Vlv2TbltDevicePkg\PlatformPkgX64.dsc -y Vlv.report
>  ```
>
>  * Build X64 Release Image with build log
>
>  ```
> -cd edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg
> -Build_IFWI.bat /m /l MNW2 Release
> +build -a IA32 -a X64 -n 5 -t VS2015x86 -b RELEASE Vlv2TbltDevicePkg\PlatformPkgX64.dsc -j Vlv.log
>  ```
>
>  * Build IA32 Debug Image
>
>  ```
> -cd edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg
> -Build_IFWI.bat /m /IA32 MNW2 Debug
> +build -a IA32 -n 5 -t VS2015x86 -b DEBUG -p Vlv2TbltDevicePkg\PlatformPkgIA32.dsc
>  ```
>
>  The generated firmware image is the build output directory below WORKSPACE.  For
>  exampple, the X64 Debug Image is at:
>
> -`Build\Vlv2TbltDevicePkg\DEBUG_VS2015x86\FV\Vlv.ROM`
> +`Build\Vlv2TbltDevicePkgX64\DEBUG_VS2015x86\FV\Vlv.fd`
>
>  And the IA32 Release image is at:
>
> -`Build\Vlv2TbltDevicePkgIA32\RELEASE_VS2015x86\FV\Vlv.ROM`
> +`Build\Vlv2TbltDevicePkgIA32\RELEASE_VS2015x86\FV\Vlv.fd`
>
>  The X64 CapsuleApp and generated UEFI Capsules are in the directory
>
> -`Build\Vlv2TbltDevicePkg\Capsules`
> +`Build\Vlv2TbltDevicePkgX64\Capsules`
>
>  # Linux Pre-requisites
>
> +* git
> +* python
> +* iasl
> +* nasm
> +* openssl
> +* gcab
> +
>  # Download and Build MinnowMax using Linux/GCC
>
>  Run the script below from an empty directory.  The script clones the EDK II
> @@ -132,10 +145,12 @@ git clone https://github.com/tianocore/edk2-platforms.git
>  git clone https://github.com/tianocore/edk2-non-osi.git
>
>  export WORKSPACE=$PWD
> +export PACKAGES_PATH=$WORKSPACE/edk2;$WORKSPACE/edk2-platforms/Silicon/Intel;$WORKSPACE/edk2-platforms/Platform/Intel;$WORKSPACE/edk2-non-osi/Silicon/Intel
To set the paths, it should be colons, not semicolons.
export PACKAGES_PATH=$WORKSPACE/edk2:$WORKSPACE/edk2-platforms/Silicon/Intel:$WORKSPACE/edk2-platforms/Platform/Intel:$WORKSPACE/edk2-non-osi/Silicon/Intel

> +cd $WORKSPACE/edk2
>
> -cd edk2-platforms/Platform/Intel/Vlv2TbltDevicePkg
> +. edksetup.sh BaseTools Rebuild
>
"Rebuild" is not defined in edksetup.sh.

> -./Build_IFWI.sh /m MNW2 Debug
> +build -a IA32 -a X64 -n 5 -t GCC5 -b DEBUG -p Vlv2TbltDevicePkg/PlatformPkgX64.dsc
>  ```
>
>  Once all the code is downloaded and installed, only the following commands are
> @@ -144,6 +159,10 @@ install the source and binaries.
>
>  ```
>  export WORKSPACE=$PWD/edk2
The WORKSPACE is not in edk2.

> +export PACKAGES_PATH=$WORKSPACE/edk2;$WORKSPACE/edk2-platforms/Silicon/Intel;$WORKSPACE/edk2-platforms/Platform/Intel;$WORKSPACE/edk2-non-osi/Silicon/Intel
Same as the previous one.

> +cd $WORKSPACE/edk2
> +
> +. edksetup.sh BaseTools Rebuild
Same as the previous one.

>  ```
>
>  Once the environment is setup, the MinnowBoard MAX firmware and capsules can be
> @@ -152,36 +171,33 @@ rebuilt using the following commands.
>  * Build X64 Debug Image with report file
>
>  ```
> -cd edk2-platforms/Platform/Intel/Vlv2TbltDevicePkg
> -./Build_IFWI.sh /m /y MNW2 Debug
> +build -a IA32 -a X64 -n 5 -t GCC5 -b DEBUG -p Vlv2TbltDevicePkg/PlatformPkgX64.dsc -y Vlv.report
>  ```
>
I'm not sure how to use this "report" file. It failed with the following error:

build.py...
 : error C0DE: Unknown fatal error when generating build report
        Vlv.report
(Python 3.7.3 on linux
Traceback (most recent call last):
  File "/home/gary/git/edk2-workspace/edk2/BaseTools/Source/Python/build/BuildReport.py", line 2271, in GenerateReport
    PlatformReport(Wa, MaList, self.ReportType).GenerateReport(File, BuildDuration, AutoGenTime, MakeTime, GenFdsTime, self.ReportType)
  File "/home/gary/git/edk2-workspace/edk2/BaseTools/Source/Python/build/BuildReport.py", line 2121, in __init__
    self.PredictionReport = PredictionReport(Wa)
  File "/home/gary/git/edk2-workspace/edk2/BaseTools/Source/Python/build/BuildReport.py", line 1546, in __init__
    FindIncludeFiles(Source.Path, Module.IncludePathList, IncludeList)
  File "/home/gary/git/edk2-workspace/edk2/BaseTools/Source/Python/build/BuildReport.py", line 185, in FindIncludeFiles
    FileContents = open(Source).read()
  File "/usr/lib64/python3.7/codecs.py", line 322, in decode
    (result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92 in position 5875: invalid start byte
)

Anyway, the firmware and capsule files were built. Will test them later.

Gary Lin

>  * Build X64 Release Image with build log
>
>  ```
> -cd edk2-platforms/Platform/Intel/Vlv2TbltDevicePkg
> -./Build_IFWI.sh /m /l MNW2 Release
> +build -a IA32 -a X64 -n 5 -t GCC5 -b RELEASE -p Vlv2TbltDevicePkg/PlatformPkgX64.dsc -j Vlv.log
>  ```
>
>  * Build IA32 Debug Image
>
>  ```
> -cd edk2-platforms/Platform/Intel/Vlv2TbltDevicePkg
> -./Build_IFWI.sh /m /IA32 MNW2 Debug
> +build -a IA32 -n 5 -t GCC5 -b DEBUG -p Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
>  ```
>
>  The generated firmware image is the build output directory below WORKSPACE.  For
>  exampple, the X64 Debug Image is at:
>
> -`Build/Vlv2TbltDevicePkg/DEBUG_GCC5/FV/Vlv.ROM`
> +`Build/Vlv2TbltDevicePkgX64/DEBUG_GCC5/FV/Vlv.fd`
>
>  And the IA32 Release image is at:
>
> -`Build/Vlv2TbltDevicePkgIA32/RELEASE_GCC5/FV/Vlv.ROM`
> +`Build/Vlv2TbltDevicePkgIA32/RELEASE_GCC5/FV/Vlv.fd`
>
>  The X64 CapsuleApp and generated UEFI Capsules are in the directory
>
> -`Build/Vlv2TbltDevicePkg/Capsules`
> +`Build/Vlv2TbltDevicePkgX64/Capsules`
>
>  # Use DediProg to update FLASH image on a MinnowBoard MAX Target
>
> @@ -192,7 +208,7 @@ The X64 CapsuleApp and generated UEFI Capsules are in the directory
>  * Boot MinnowBoard MAX to the Boot Manager
>  * Boot the `EFI Internal Shell` boot option
>  * Mount the USB FLASH Drive (usually `FS1`)
> -* Use `cd` command to go to `Capsules/TestCert` directory
> +* Use `cd` command to go to `Capsules/TestCert_*` directory
>  * Run the following command to apply all four capsules
>
>  ```
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
> deleted file mode 100644
> index fb634c490c..0000000000
> --- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
> +++ /dev/null
> @@ -1,303 +0,0 @@
> -@REM @file
> -@REM   Windows batch file to build BIOS ROM
> -@REM
> -@REM Copyright (c) 2006 - 2019, Intel Corporation. All rights reserved.<BR>
> -@REM SPDX-License-Identifier: BSD-2-Clause-Patent
> -@REM
> -
> -@echo off
> -setlocal EnableDelayedExpansion EnableExtensions
> -echo.
> -echo %date%  %time%
> -echo.
> -
> -::**********************************************************************
> -:: Initial Setup
> -::**********************************************************************
> -if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
> -set /a build_threads=1
> -set "Build_Flags= "
> -set exitCode=0
> -set Arch=X64
> -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 (
> -    for %%i IN (%PACKAGES_PATH%) DO (
> -      if exist %%~fi\edksetup.bat (
> -        set CORE_PATH=%%~fi
> -        goto CorePathFound
> -      )
> -    )
> -  ) else (
> -    echo.
> -    echo !!! ERROR !!! Cannot find edksetup.bat !!!
> -    echo.
> -    goto BldFail
> -  )
> -)
> -:CorePathFound
> -
> -::**********************************************************************
> -:: Detect full path to the Vlv2TbltDevicePkg
> -::**********************************************************************
> -set PLATFORM_PACKAGE=%WORKSPACE%\%PLATFORM_NAME%
> -if not exist %PLATFORM_PACKAGE% (
> -  if defined PACKAGES_PATH (
> -    for %%i IN (%PACKAGES_PATH%) DO (
> -      if exist %%~fi\%PLATFORM_NAME% (
> -        set PLATFORM_PACKAGE=%%~fi\%PLATFORM_NAME%
> -        goto PlatformPackageFound
> -      )
> -    )
> -  ) else (
> -    echo.
> -    echo !!! ERROR !!! Cannot find %PLATFORM_NAME% !!!
> -    echo.
> -    goto BldFail
> -  )
> -)
> -:PlatformPackageFound
> -
> -cd %CORE_PATH%
> -
> -::**********************************************************************
> -:: Run edksetup.bat and make sure tools are up to date
> -::**********************************************************************
> -
> -call %CORE_PATH%\edksetup.bat Rebuild
> -@echo off
> -
> -::**********************************************************************
> -:: Parse command line arguments
> -::**********************************************************************
> -
> -:: Optional arguments
> -:OptLoop
> -if /i "%~1"=="/?" goto Usage
> -
> -if /i "%~1"=="/l" (
> -    set GenLog=TRUE
> -    shift
> -    goto OptLoop
> -)
> -if /i "%~1"=="/y" (
> -    set GenReport=TRUE
> -    shift
> -    goto OptLoop
> -)
> -if /i "%~1"=="/m" (
> -    if defined NUMBER_OF_PROCESSORS (
> -        set /a build_threads=%NUMBER_OF_PROCESSORS%+1
> -    )
> -    shift
> -    goto OptLoop
> -)
> -if /i "%~1" == "/c" (
> -    set Clean=TRUE
> -    shift
> -    goto OptLoop
> -)
> -
> -if /i "%~1"=="/x64" (
> -    set Arch=X64
> -    shift
> -    goto OptLoop
> -)
> -if /i "%~1"=="/IA32" (
> -    set Arch=IA32
> -    shift
> -    goto OptLoop
> -)
> -
> -:: Required argument(s)
> -if "%~1"=="" goto Usage
> -
> -if /i "%~2" == "RELEASE" (
> -    set target=RELEASE
> -) else (
> -    set target=DEBUG
> -)
> -
> -::**********************************************************************
> -:: Detect TOOL_CHAIN_TAG
> -::**********************************************************************
> -
> -echo.
> -echo Setting the Build environment for VS2015/VS2013/VS2012/VS2010/VS2008...
> -if defined VS140COMNTOOLS (
> -  if not defined VSINSTALLDIR call "%VS140COMNTOOLS%\vsvars32.bat"
> -  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 if defined VS120COMNTOOLS (
> -  if not defined VSINSTALLDIR call "%VS120COMNTOOLS%\vsvars32.bat"
> -  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 if defined VS110COMNTOOLS (
> -  if not defined VSINSTALLDIR call "%VS110COMNTOOLS%\vsvars32.bat"
> -  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 if defined VS100COMNTOOLS (
> -  if not defined VSINSTALLDIR call "%VS100COMNTOOLS%\vsvars32.bat"
> -  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 if defined VS90COMNTOOLS (
> -  if not defined VSINSTALLDIR call "%VS90COMNTOOLS%\vsvars32.bat"
> -  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: VS2015/VS2013/VS2012/VS2010/VS2008 not installed correctly. VS140COMNTOOLS/VS120COMNTOOLS/VS110COMNTOOLS/VS100COMNTOOLS/VS90COMNTOOLS not defined ^^!
> -  echo.
> -  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 not exist %WORKSPACE%\Build\%PLATFORM_NAME%%Arch% mkdir %WORKSPACE%\Build\%PLATFORM_NAME%%Arch%
> -set BUILD_PATH=%WORKSPACE%\Build\%PLATFORM_NAME%%Arch%\%TARGET%_%TOOL_CHAIN_TAG%
> -if not exist %BUILD_PATH% mkdir %BUILD_PATH%
> -
> -::**********************************************************************
> -:: Check for clean operation
> -::**********************************************************************
> -
> -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" (
> -    set Build_Flags=%Build_Flags% -a IA32
> -) else if "%Arch%"=="X64" (
> -    set Build_Flags=%Build_Flags% -a IA32 -a X64
> -)
> -set Build_Flags=%Build_Flags% -t %TOOL_CHAIN_TAG%
> -set Build_Flags=%Build_Flags% -n %build_threads%
> -set Capsule_Build_Flags=%Build_Flags%
> -set Build_Flags=%Build_Flags% -p %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc
> -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
> -)
> -
> -::**********************************************************************
> -:: Generate BIOS ID
> -::**********************************************************************
> -
> -echo BOARD_ID       = MNW2MAX >  %BUILD_PATH%/BiosId.env
> -echo BOARD_REV      = W       >> %BUILD_PATH%/BiosId.env
> -if "%Arch%"=="IA32" (
> -  echo BOARD_EXT      = I32   >> %BUILD_PATH%/BiosId.env
> -)
> -if "%Arch%"=="X64" (
> -  echo BOARD_EXT      = X64   >> %BUILD_PATH%/BiosId.env
> -)
> -echo VERSION_MAJOR  = 0090    >> %BUILD_PATH%/BiosId.env
> -if "%TARGET%"=="DEBUG" (
> -  echo BUILD_TYPE     = D     >> %BUILD_PATH%/BiosId.env
> -)
> -if "%TARGET%"=="RELEASE" (
> -  echo BUILD_TYPE     = R     >> %BUILD_PATH%/BiosId.env
> -)
> -echo VERSION_MINOR  = 01      >> %BUILD_PATH%/BiosId.env
> -
> -%WORKSPACE%\edk2-platforms\Platform\Intel\Tools\GenBiosId\GenBiosId.py -i %BUILD_PATH%/BiosId.env -o %BUILD_PATH%/BiosId.bin -ot %BUILD_PATH%/BiosId.txt
> -
> -::**********************************************************************
> -:: Build BIOS
> -::**********************************************************************
> -
> -echo.
> -echo Invoking EDK2 build...
> -echo build %Build_Flags%
> -
> -call build %Build_Flags%
> -
> -if %ERRORLEVEL% NEQ 0 goto BldFail
> -
> -copy %BUILD_PATH%\FV\VLV.fd %BUILD_PATH%\FV\Vlv.ROM
> -
> -::**********************************************************************
> -:: Build Capsules
> -::**********************************************************************
> -echo Invoking EDK2 build for capsules...
> -echo build %Capsule_Build_Flags% -p %PLATFORM_PACKAGE%\PlatformCapsule%Arch%.dsc
> -call build %Capsule_Build_Flags% -p %PLATFORM_PACKAGE%\PlatformCapsule%Arch%.dsc
> -
> -goto Exit
> -
> -:Usage
> -echo.
> -echo ***************************************************************************
> -echo Build BIOS rom for VLV platforms.
> -echo.
> -echo Usage: bld_vlv.bat [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.bat MNW2                 : X64 Debug build for MinnowMax
> -echo    bld_vlv.bat /IA32 MNW2 release   : IA32 Release build for MinnowMax
> -echo.
> -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%
> -exit /b %exitCode%
> -
> -EndLocal
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
> deleted file mode 100755
> index c8db91c6dc..0000000000
> --- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
> +++ /dev/null
> @@ -1,222 +0,0 @@
> -#!/usr/bin/env bash
> -##**********************************************************************
> -## Function define
> -##**********************************************************************
> -function Usage() {
> -  echo
> -  echo "***************************************************************************"
> -  echo "Build BIOS rom for VLV platforms."
> -  echo
> -  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 "***************************************************************************"
> -  exit 0
> -}
> -
> -set -e
> -
> -cd ..
> -echo -e $(date)
> -##**********************************************************************
> -## Initial Setup
> -##**********************************************************************
> -#build_threads=($NUMBER_OF_PROCESSORS)+1
> -Build_Flags=
> -exitCode=0
> -build_threads=1
> -Arch=X64
> -GenLog=FALSE
> -GenReport=FALSE
> -Clean=FALSE
> -
> -
> -export CORE_PATH=$WORKSPACE/edk2
> -export PLATFORM_PATH=$WORKSPACE/edk2-platforms/Platform/Intel/
> -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
> -
> -## 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
> -. edksetup.sh BaseTools
> -make -C BaseTools
> -
> -## Define platform specific environment variables.
> -PLATFORM_NAME=Vlv2TbltDevicePkg
> -PLATFORM_PACKAGE=Vlv2TbltDevicePkg
> -PLATFORM_PKG_PATH=$PLATFORM_PATH/$PLATFORM_PACKAGE
> -
> -cd $PLATFORM_PKG_PATH
> -
> -##**********************************************************************
> -## Parse command line arguments
> -##**********************************************************************
> -
> -## Optional arguments
> -for (( i=1; i<=$#; ))
> -  do
> -    if [ "$1" == "/?" ]; then
> -      Usage
> -    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/L" ]; then
> -      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
> -      Clean=TRUE
> -      shift
> -    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/X64" ]; then
> -      Arch=X64
> -      shift
> -    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/IA32" ]; then
> -      Arch=IA32
> -      shift
> -    else
> -      break
> -    fi
> -  done
> -
> -## Required argument(s)
> -if [ "$2" == "" ]; then
> -  Usage
> -fi
> -
> -echo "Setting  $1  platform configuration and BIOS ID..."
> -
> -if [ "$(echo $2 | tr 'a-z' 'A-Z')" == "RELEASE" ]; then
> -  export TARGET=RELEASE
> -else
> -  export TARGET=DEBUG
> -fi
> -
> -##**********************************************************************
> -## Detect TOOL_CHAIN_TAG
> -##**********************************************************************
> -gcc_version=$(gcc -v 2>&1 | tail -1 | awk '{print $3}')
> -case $gcc_version in
> -      [1-3].*|4.[0-7].*)
> -        echo MNW2 requires GCC4.8 or later
> -        exit 1
> -        ;;
> -      4.8.*)
> -        export TOOL_CHAIN_TAG=GCC48
> -        ;;
> -      4.9.*|6.[0-2].*)
> -        export TOOL_CHAIN_TAG=GCC49
> -        ;;
> -      *)
> -        export TOOL_CHAIN_TAG=GCC5
> -        ;;
> -esac
> -
> -##**********************************************************************
> -## Generate $BUILD_PATH and make sure the directory exists
> -##**********************************************************************
> -if [ ! -d ${WORKSPACE}/Build ]; then
> -  mkdir ${WORKSPACE}/Build
> -fi
> -
> -if [ ! -d ${WORKSPACE}/Build/${PLATFORM_NAME}${Arch} ]; then
> -  mkdir ${WORKSPACE}/Build/${PLATFORM_NAME}${Arch}
> -fi
> -BUILD_PATH=${WORKSPACE}/Build/${PLATFORM_NAME}${Arch}/${TARGET}_${TOOL_CHAIN_TAG}
> -
> -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 -n $build_threads"
> -Capsule_Build_Flags="$Build_Flags"
> -Build_Flags="$Build_Flags -p ${PLATFORM_PKG_PATH}/PlatformPkg${Arch}.dsc"
> -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
> -##**********************************************************************
> -
> -echo BOARD_ID       = MNW2MAX >  $BUILD_PATH/BiosId.env
> -echo BOARD_REV      = L       >> $BUILD_PATH/BiosId.env
> -if [ $Arch == "IA32" ]; then
> -  echo BOARD_EXT      = I32   >> $BUILD_PATH/BiosId.env
> -fi
> -if [ $Arch == "X64" ]; then
> -  echo BOARD_EXT      = X64   >> $BUILD_PATH/BiosId.env
> -fi
> -echo VERSION_MAJOR  = 0090    >> $BUILD_PATH/BiosId.env
> -if [ $TARGET == "DEBUG" ]; then
> -  echo BUILD_TYPE     = D     >> $BUILD_PATH/BiosId.env
> -fi
> -if [ $TARGET == "RELEASE" ]; then
> -  echo BUILD_TYPE     = R     >> $BUILD_PATH/BiosId.env
> -fi
> -echo VERSION_MINOR  = 01      >> $BUILD_PATH/BiosId.env
> -
> -python $WORKSPACE/edk2-platforms/Platform/Intel/Tools/GenBiosId/GenBiosId.py -i $BUILD_PATH/BiosId.env -o $BUILD_PATH/BiosId.bin -ot $BUILD_PATH/BiosId.txt
> -
> -##**********************************************************************
> -## Build BIOS
> -##**********************************************************************
> -echo "Invoking EDK2 build..."
> -echo build $Build_Flags
> -build $Build_Flags
> -
> -cp -f $BUILD_PATH/FV/VLV.fd $BUILD_PATH/FV/Vlv.ROM
> -
> -##**********************************************************************
> -## Build Capsules
> -##**********************************************************************
> -echo "Invoking EDK2 build for capsules..."
> -echo build $Capsule_Build_Flags -p $PLATFORM_PKG_PATH/PlatformCapsule${Arch}.dsc
> -build      $Capsule_Build_Flags -p $PLATFORM_PKG_PATH/PlatformCapsule${Arch}.dsc
> -
> -echo
> -echo -------------------- The EDKII BIOS build has successfully completed. --------------------
> -echo
> -- 
> 2.21.0.windows.1
> 
> 
> 
> 
> 

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#44086): https://edk2.groups.io/g/devel/message/44086
Mute This Topic: https://groups.io/mt/32523935/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [edk2-platforms Patch V2 5/5] Vlv2Tbl2DevicePkg: Convert BAT/sh Build scripts to Python
Posted by Michael D Kinney 6 years, 6 months ago
Gary,

Thanks for the feedback.  I will send out a V3.

I have fixed the source files with non-ASCII characters that
are preventing the reports from being generated on Linux 
systems.  I will enter a BZ to update the build tools to 
be more resilient for this case.  Non-ASCII characters should
not be present in source files, but presence of non-ASCII
characters should not break the build with a python stack trace.
The report should still be generated correctly.

Thanks,

Mike

> -----Original Message-----
> From: Gary Lin [mailto:GLin@suse.com]
> Sent: Sunday, July 21, 2019 9:09 PM
> To: devel@edk2.groups.io; Kinney, Michael D
> <michael.d.kinney@intel.com>
> Cc: Qian, Yi <yi.qian@intel.com>; Sun, Zailiang
> <zailiang.sun@intel.com>
> Subject: Re: [edk2-devel] [edk2-platforms Patch V2 5/5]
> Vlv2Tbl2DevicePkg: Convert BAT/sh Build scripts to Python
> 
> On Thu, Jul 18, 2019 at 11:02:47PM -0700,  Michael D
> Kinney  wrote:
> > Convert Build_IFWI and bld_vlv BAT/sh scripts to OS
> > independent python script PeBuild.py.  This script
> > generates the BiosId file.  Standard EDK II build
> > commands are used to build FW images and capsules.
> >
> > * Sample VS2015x86 commands for IA32/X64 and
> DEBUG/RELEASE
> >   build -a IA32 -a X64 -t VS2015x86 -p
> Vlv2TbltDevicePkg\PlatformPkgX64.dsc
> >   build -a IA32 -a X64 -t VS2015x86 -p
> Vlv2TbltDevicePkg\PlatformPkgX64.dsc
> >   build -a IA32        -t VS2015x86 -p
> Vlv2TbltDevicePkg\PlatformPkgIA32.dsc
> >   build -a IA32        -t VS2015x86 -p
> Vlv2TbltDevicePkg\PlatformPkgIA32.dsc
> >
> > * Sample GCC5 commands for IA32/X64 and DEBUG/RELEASE
> >   build -a IA32 -a X64 -n 5 -t GCC5 -p
> Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> >   build -a IA32 -a X64 -n 5 -t GCC5 -p
> Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> >   build -a IA32        -n 5 -t GCC5 -p
> Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> >   build -a IA32        -n 5 -t GCC5 -p
> Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> >
> Hi Mike,
> 
> I found some errors in Readme.md
> 
> > 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>
> > ---
> >  .../Intel/Vlv2TbltDevicePkg/Build_IFWI.bat    | 118 --
> ----
> >  .../Intel/Vlv2TbltDevicePkg/Build_IFWI.sh     | 100 --
> ---
> >  .../Vlv2TbltDevicePkg/PlatformCapsule.fdf     |  48 --
> -
> >  .../Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc |  39 --
> >  .../Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc  |  39 --
> >  .../Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf   |  30 +-
> >  .../Vlv2TbltDevicePkg/PlatformPkgIA32.dsc     |  13 +-
> >  .../Vlv2TbltDevicePkg/PlatformPkgX64.dsc      |  13 +-
> >  Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py  | 348
> ++++++++++++++++++
> >  Platform/Intel/Vlv2TbltDevicePkg/Readme.md    |  62
> ++--
> >  Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat  | 303 --
> -------------
> >  Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh   | 222 --
> ---------
> >  12 files changed, 432 insertions(+), 903 deletions(-)
> >  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
> >  delete mode 100755
> Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
> >  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsule.fdf
> >  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleIA32.dsc
> >  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc
> >  create mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py
> >  delete mode 100644
> Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
> >  delete mode 100755
> Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
> >
> > diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
> b/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
> > deleted file mode 100644
> > index f65aa61f4a..0000000000
> > --- a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.bat
> > +++ /dev/null
> > @@ -1,118 +0,0 @@
> > -@REM @file
> > -@REM   Windows batch file to build BIOS ROM
> > -@REM
> > -@REM Copyright (c) 2006 - 2019, Intel Corporation. All
> rights reserved.<BR>
> > -@REM SPDX-License-Identifier: BSD-2-Clause-Patent
> > -@REM
> > -
> > -@echo off
> > -
> > -SetLocal EnableDelayedExpansion EnableExtensions
> > -
> > -:: Assign initial values
> > -set exitCode=0
> > -set "Build_Flags= "
> > -set PLATFORM_PACKAGE=Vlv2TbltDevicePkg
> > -
> > -set PLATFORM_PATH=%WORKSPACE%
> > -if not exist %PLATFORM_PATH%\%PLATFORM_PACKAGE% (
> > -  if defined PACKAGES_PATH (
> > -    for %%i IN (%PACKAGES_PATH%) DO (
> > -      if exist %%~fi\%PLATFORM_PACKAGE% (
> > -        set PLATFORM_PATH=%%~fi
> > -        goto PlatformPackageFound
> > -      )
> > -    )
> > -  ) else (
> > -    echo.
> > -    echo !!! ERROR !!! Cannot find %PLATFORM_PACKAGE%
> !!!
> > -    echo.
> > -    goto Exit
> > -  )
> > -)
> > -:PlatformPackageFound
> > -
> > -:: Parse Optional arguments
> > -:OptLoop
> > -if /i "%~1"=="/?" goto Usage
> > -
> > -if /i "%~1"=="/l" (
> > -    set Build_Flags=%Build_Flags% /l
> > -    shift
> > -    goto OptLoop
> > -)
> > -if /i "%~1"=="/y" (
> > -    set Build_Flags=%Build_Flags% /y
> > -    shift
> > -    goto OptLoop
> > -)
> > -if /i "%~1"=="/m" (
> > -    set Build_Flags=%Build_Flags% /m
> > -    shift
> > -    goto OptLoop
> > -)
> > -if /i "%~1" == "/c" (
> > -    set Build_Flags=%Build_Flags% /c
> > -    shift
> > -    goto OptLoop
> > -)
> > -if /i "%~1"=="/x64" (
> > -    set Build_Flags=%Build_Flags% /x64
> > -    shift
> > -    goto OptLoop
> > -)
> > -if /i "%~1"=="/IA32" (
> > -    set Build_Flags=%Build_Flags% /IA32
> > -    shift
> > -    goto OptLoop
> > -)
> > -
> > -:: Require 2 input parameters
> > -if "%~2"=="" goto Usage
> > -
> > -:: Assign required arguments
> > -set Platform_Type=%~1
> > -set Build_Target=%~2
> > -
> > -:: Build BIOS
> > -echo
> =========================================================
> =============
> > -echo Build_IFWI:  Calling BIOS build Script...
> > -
> > -call %PLATFORM_PATH%\%PLATFORM_PACKAGE%\bld_vlv.bat
> %Build_Flags% %Platform_Type% %Build_Target%
> > -
> > -if %ERRORLEVEL% NEQ 0 (
> > -    echo echo  -- Error Building BIOS  & echo.
> > -    set exitCode=1
> > -    goto exit
> > -)
> > -echo.
> > -echo Finished Building BIOS.
> > -goto Exit
> > -
> > -:Usage
> > -echo Script to build BIOS firmware and stitch the
> entire IFWI.
> > -echo.
> > -echo Usage: Build_IFWI.bat [options]  PlatformType
> BuildTarget
> > -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    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
> > -
> > -:Exit
> > -@REM  CD to platform package.
> > -cd %PLATFORM_PATH%
> > -exit /b %exitCode%
> > -
> > -EndLocal
> > diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
> b/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
> > deleted file mode 100755
> > index 153c8c5fae..0000000000
> > --- a/Platform/Intel/Vlv2TbltDevicePkg/Build_IFWI.sh
> > +++ /dev/null
> > @@ -1,100 +0,0 @@
> > -#!/usr/bin/env bash
> > -
> ##*******************************************************
> ***************
> > -## Function define
> > -
> ##*******************************************************
> ***************
> > -function Usage ( ) {
> > -  echo
> > -  echo "Script to build BIOS firmware and stitch the
> entire IFWI."
> > -  echo
> > -  echo "Usage: Build_IFWI.sh [options]  PlatformType
> BuildTarget"
> > -  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 "   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
> > -}
> > -
> > -set -e
> > -
> > -## Assign initial values
> > -exitCode=0
> > -Build_Flags=
> > -
> > -## Check whether WORKSPACE is set or not
> > -if [[ -z "$WORKSPACE" ]]; then
> > -  echo "Please export WORKSPACE before running
> Build_IFWI.sh"
> > -  echo "See the details in Readme.md"
> > -  exit 1
> > -fi
> > -
> > -## Create $WORKSPACE/Conf if necessary
> > -if [ ! -d $WORKSPACE/Conf ]; then
> > -  mkdir $WORKSPACE/Conf
> > -fi
> > -
> > -## Parse Optional arguments
> > -if [ "$1" == "/?" ]; then
> > -  Usage
> > -fi
> > -
> > -for (( i=1; i<=$#; ))
> > -  do
> > -    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')" == "/X64" ];
> then
> > -      Build_Flags="$Build_Flags /x64"
> > -      shift
> > -    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/IA32" ];
> then
> > -      Build_Flags="$Build_Flags /IA32"
> > -      shift
> > -    else
> > -      break
> > -    fi
> > -  done
> > -
> > -## Require 2 input parameters
> > -if [ "$2" == "" ]; then
> > -  Usage
> > -fi
> > -
> > -## Assign required arguments
> > -Platform_Type=$1
> > -Build_Target=$2
> > -
> > -## Build BIOS
> > -echo
> "========================================================
> =============="
> > -echo "Build_IFWI:  Calling BIOS build Script..."
> > -. bld_vlv.sh $Build_Flags $Platform_Type $Build_Target
> > -
> > -echo
> > -echo Finished Building BIOS.
> > -
> > -## Start Integration process
> > -echo
> =========================================================
> =============
> > -echo Skip "Build_IFWI:  Calling IFWI Stitching
> Script..."
> > -
> > -echo
> > -echo Build_IFWI is finished.
> > -echo The final IFWI file is located in Stitch
> > -echo
> =========================================================
> =============
> > diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsule.fdf
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsule.fdf
> > deleted file mode 100644
> > index d8b0074d6a..0000000000
> > ---
> a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsule.fdf
> > +++ /dev/null
> > @@ -1,48 +0,0 @@
> > -## @file
> > -# FDF file of Platform capsule.
> > -#
> > -# Copyright (c) 2016 - 2019, Intel Corporation.
> > -#
> > -# SPDX-License-Identifier: BSD-2-Clause-Patent
> > -#
> > -##
> > -
> > -[FV.SystemFirmwareUpdateCargo]
> > -FvAlignment        = 16
> > -ERASE_POLARITY     = 1
> > -MEMORY_MAPPED      = TRUE
> > -STICKY_WRITE       = TRUE
> > -LOCK_CAP           = TRUE
> > -LOCK_STATUS        = TRUE
> > -WRITE_DISABLED_CAP = TRUE
> > -WRITE_ENABLED_CAP  = TRUE
> > -WRITE_STATUS       = TRUE
> > -WRITE_LOCK_CAP     = TRUE
> > -WRITE_LOCK_STATUS  = TRUE
> > -READ_DISABLED_CAP  = TRUE
> > -READ_ENABLED_CAP   = TRUE
> > -READ_STATUS        = TRUE
> > -READ_LOCK_CAP      = TRUE
> > -READ_LOCK_STATUS   = TRUE
> > -
> > -FILE RAW = AF9C9EB2-12AD-4D3E-A4D4-96F6C9966215 { #
> PcdEdkiiSystemFirmwareFileGuid
> > -
> $(WORKSPACE)/$(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_T
> AG)/FV/Vlv.ROM
> > -  }
> > -
> > -[FmpPayload.FmpPayloadSystemFirmwareRsa2048]
> > -IMAGE_HEADER_INIT_VERSION = 0x02
> > -IMAGE_TYPE_ID             = 4096267b-da0a-42eb-b5eb-
> fef31d207cb4 # PcdSystemFmpCapsuleImageTypeIdGuid
> > -IMAGE_INDEX               = 0x1
> > -HARDWARE_INSTANCE         = 0x0
> > -MONOTONIC_COUNT           = 0x2
> > -CERTIFICATE_GUID          = A7717414-C616-4977-9420-
> 844712A735BF # RSA2048SHA256
> > -
> > -FILE DATA =
> $(WORKSPACE)/$(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_T
> AG)/FV/SYSTEMFIRMWAREUPDATECARGO.Fv
> > -
> > -[Capsule.Vlv2Rec]
> > -CAPSULE_GUID                = 6dcbd5ed-e82d-4c44-bda1-
> 7194199ad92a # gEfiFmpCapsuleGuid
> > -CAPSULE_FLAGS               =
> PersistAcrossReset,InitiateReset
> > -CAPSULE_HEADER_SIZE         = 0x20
> > -CAPSULE_HEADER_INIT_VERSION = 0x1
> > -
> > -FMP_PAYLOAD = FmpPayloadSystemFirmwareRsa2048
> > diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleIA32.ds
> c
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleIA32.ds
> c
> > deleted file mode 100644
> > index 246347b8fa..0000000000
> > ---
> a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleIA32.ds
> c
> > +++ /dev/null
> > @@ -1,39 +0,0 @@
> > -#/** @file
> > -# Platform capsule description.
> > -#
> > -# Copyright (c) 2016 - 2019, Intel Corporation. All
> rights reserved.<BR>
> > -#
> > -# SPDX-License-Identifier: BSD-2-Clause-Patent
> > -#
> > -#
> > -#**/
> > -
> > -[Defines]
> > -  PLATFORM_NAME                  = Vlv2TbltDevicePkg
> > -  PLATFORM_GUID                  = EE87F258-6ECC-4415-
> B1D8-23771BEE26E7
> > -  PLATFORM_VERSION               = 0.1
> > -  FLASH_DEFINITION               =
> Vlv2TbltDevicePkg/PlatformCapsule.fdf
> > -  OUTPUT_DIRECTORY               =
> Build/Vlv2TbltDevicePkgIA32
> > -  SUPPORTED_ARCHITECTURES        = IA32|X64
> > -  BUILD_TARGETS                  = DEBUG|RELEASE
> > -  SKUID_IDENTIFIER               = DEFAULT
> > -  POSTBUILD                      = python
> Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCaps
> uleAll.py
> > -
> > -
> #########################################################
> ##########################################
> > -#
> > -# Components Section - list of the modules and
> components that will be processed by compilation
> > -#                      tools and the EDK II tools to
> generate PE32/PE32+/Coff image files.
> > -#
> > -# Note: The EDK II DSC file is not used to specify how
> compiled binary images get placed
> > -#       into firmware volume images. This section is
> just a list of modules to compile from
> > -#       source into UEFI-compliant binaries.
> > -#       It is the FDF file that contains information
> on combining binary files into firmware
> > -#       volume images, whose concept is beyond UEFI
> and is described in PI specification.
> > -#       Binary modules do not need to be listed in
> this section, as they should be
> > -#       specified in the FDF file. For example: Shell
> binary, FAT binary (Fat.efi),
> > -#       Logo (Logo.bmp), and etc.
> > -#       There may also be modules listed in this
> section that are not required in the FDF file,
> > -#       When a module listed here is excluded from FDF
> file, then UEFI-compliant binary will be
> > -#       generated for it, but the binary will not be
> put into any firmware volume.
> > -#
> > -
> #########################################################
> ##########################################
> > diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc
> > deleted file mode 100644
> > index 68bde30f83..0000000000
> > ---
> a/Platform/Intel/Vlv2TbltDevicePkg/PlatformCapsuleX64.dsc
> > +++ /dev/null
> > @@ -1,39 +0,0 @@
> > -#/** @file
> > -# Platform capsule description.
> > -#
> > -# Copyright (c) 2016 - 2019, Intel Corporation. All
> rights reserved.<BR>
> > -#
> > -# SPDX-License-Identifier: BSD-2-Clause-Patent
> > -#
> > -#
> > -#**/
> > -
> > -[Defines]
> > -  PLATFORM_NAME                  = Vlv2TbltDevicePkg
> > -  PLATFORM_GUID                  = EE87F258-6ECC-4415-
> B1D8-23771BEE26E7
> > -  PLATFORM_VERSION               = 0.1
> > -  FLASH_DEFINITION               =
> Vlv2TbltDevicePkg/PlatformCapsule.fdf
> > -  OUTPUT_DIRECTORY               =
> Build/Vlv2TbltDevicePkgX64
> > -  SUPPORTED_ARCHITECTURES        = IA32|X64
> > -  BUILD_TARGETS                  = DEBUG|RELEASE
> > -  SKUID_IDENTIFIER               = DEFAULT
> > -  POSTBUILD                      = python
> Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCaps
> uleAll.py
> > -
> > -
> #########################################################
> ##########################################
> > -#
> > -# Components Section - list of the modules and
> components that will be processed by compilation
> > -#                      tools and the EDK II tools to
> generate PE32/PE32+/Coff image files.
> > -#
> > -# Note: The EDK II DSC file is not used to specify how
> compiled binary images get placed
> > -#       into firmware volume images. This section is
> just a list of modules to compile from
> > -#       source into UEFI-compliant binaries.
> > -#       It is the FDF file that contains information
> on combining binary files into firmware
> > -#       volume images, whose concept is beyond UEFI
> and is described in PI specification.
> > -#       Binary modules do not need to be listed in
> this section, as they should be
> > -#       specified in the FDF file. For example: Shell
> binary, FAT binary (Fat.efi),
> > -#       Logo (Logo.bmp), and etc.
> > -#       There may also be modules listed in this
> section that are not required in the FDF file,
> > -#       When a module listed here is excluded from FDF
> file, then UEFI-compliant binary will be
> > -#       generated for it, but the binary will not be
> put into any firmware volume.
> > -#
> > -
> #########################################################
> ##########################################
> > diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
> > index e958c1ebf2..48058b663a 100644
> > --- a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
> > +++ b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkg.fdf
> > @@ -711,9 +711,8 @@ [FV.FVMAIN_COMPACT]
> >  !endif
> >       }
> >
> > -[FV.SETUP_DATA]
> > -BlockSize          = $(FLASH_BLOCK_SIZE)
> > -#NumBlocks         = 0x10
> > +!if $(RECOVERY_ENABLE)
> > +[FV.SystemFirmwareUpdateCargo]
> >  FvAlignment        = 16
> >  ERASE_POLARITY     = 1
> >  MEMORY_MAPPED      = TRUE
> > @@ -731,6 +730,31 @@ [FV.SETUP_DATA]
> >  READ_LOCK_CAP      = TRUE
> >  READ_LOCK_STATUS   = TRUE
> >
> > +FILE RAW = AF9C9EB2-12AD-4D3E-A4D4-96F6C9966215 { #
> PcdEdkiiSystemFirmwareFileGuid
> > +    FD = Vlv
> > +#
> $(WORKSPACE)/$(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_T
> AG)/FV/Vlv.fd
> > +  }
> > +
> > +[FmpPayload.FmpPayloadSystemFirmwareRsa2048]
> > +IMAGE_HEADER_INIT_VERSION = 0x02
> > +IMAGE_TYPE_ID             = 4096267b-da0a-42eb-b5eb-
> fef31d207cb4 # PcdSystemFmpCapsuleImageTypeIdGuid
> > +IMAGE_INDEX               = 0x1
> > +HARDWARE_INSTANCE         = 0x0
> > +MONOTONIC_COUNT           = 0x2
> > +CERTIFICATE_GUID          = A7717414-C616-4977-9420-
> 844712A735BF # RSA2048SHA256
> > +
> > +FV = SystemFirmwareUpdateCargo
> > +#FILE DATA =
> $(WORKSPACE)/$(OUTPUT_DIRECTORY)/$(TARGET)_$(TOOL_CHAIN_T
> AG)/FV/SYSTEMFIRMWAREUPDATECARGO.Fv
> > +
> > +[Capsule.Vlv2Rec]
> > +CAPSULE_GUID                = 6dcbd5ed-e82d-4c44-bda1-
> 7194199ad92a # gEfiFmpCapsuleGuid
> > +CAPSULE_FLAGS               =
> PersistAcrossReset,InitiateReset
> > +CAPSULE_HEADER_SIZE         = 0x20
> > +CAPSULE_HEADER_INIT_VERSION = 0x1
> > +
> > +FMP_PAYLOAD = FmpPayloadSystemFirmwareRsa2048
> > +!endif
> > +
> >
> #########################################################
> #######################
> >  #
> >  # Rules are use with the [FV] section's module INF
> type to define
> > diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> > index 121ebc9eee..5149dd5aa4 100644
> > ---
> a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> > +++
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> > @@ -23,6 +23,8 @@ [Defines]
> >    BUILD_TARGETS                       = DEBUG|RELEASE
> >    SKUID_IDENTIFIER                    = DEFAULT
> >    VPD_TOOL_GUID                       = 8C3D856A-9BE6-
> 468E-850A-24F7A8D38E08
> > +  PREBUILD                            = python
> Vlv2TbltDevicePkg/PreBuild.py
> > +  POSTBUILD                           = python
> Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCaps
> uleAll.py
> >
> >    DEFINE RC_BINARY_RELEASE        = TRUE
> >    #
> > @@ -213,7 +215,7 @@ [LibraryClasses.common]
> >
> TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibN
> ull/TpmMeasurementLibNull.inf
> >  !endif
> >
> > -
> BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.i
> nf
> > +
> BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.i
> nf
> >
> >
> StallSmmLib|Vlv2TbltDevicePkg/Library/StallSmmLib/StallSm
> mLib.inf
> >
> > @@ -242,6 +244,10 @@ [LibraryClasses.common]
> >
> >
> BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.
> inf
> >
> > +!if $(RECOVERY_ENABLE)
> > +
> EdkiiSystemCapsuleLib|SignedCapsulePkg/Library/EdkiiSyste
> mCapsuleLib/EdkiiSystemCapsuleLib.inf
> > +!endif
> > +
> >  [LibraryClasses.IA32.SEC]
> >  !if $(PERFORMANCE_ENABLE) == TRUE
> >
> PerformanceLib|MdePkg/Library/BasePerformanceLibNull/Base
> PerformanceLibNull.inf
> > @@ -718,11 +724,10 @@
> [PcdsDynamicExDefault.common.DEFAULT]
> >    gEfiVLVTokenSpaceGuid.PcdCpuSmramCpuDataAddress|0
> >    gEfiVLVTokenSpaceGuid.PcdCpuLockBoxSize|0
> >
> gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|TRU
> E
> > -
> > -[PcdsDynamicExDefault.X64.DEFAULT]
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTy
> peIdGuid|{GUID("$(FMP_MINNOW_MAX_SYSTEM)")}|VOID*|0x10
> >  !if $(RECOVERY_ENABLE)
> > +
> gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmware
> ImageDescriptor|{0x0}|VOID*|0x100
> >
> gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmware
> FileGuid|{GUID("AF9C9EB2-12AD-4D3E-A4D4-
> 96F6C9966215")}|VOID*|0x10
> > -
> gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTy
> peIdGuid|{GUID("4096267b-da0a-42eb-b5eb-
> fef31d207cb4")}|VOID*|0x10
> >  !endif
> >
> >  [PcdsDynamicExVpd.common.DEFAULT]
> > diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> > index 3e4087f919..466512242c 100644
> > ---
> a/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> > +++
> b/Platform/Intel/Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> > @@ -23,6 +23,8 @@ [Defines]
> >    BUILD_TARGETS                       = DEBUG|RELEASE
> >    SKUID_IDENTIFIER                    = DEFAULT
> >    VPD_TOOL_GUID                       = 8C3D856A-9BE6-
> 468E-850A-24F7A8D38E08
> > +  PREBUILD                            = python
> Vlv2TbltDevicePkg/PreBuild.py
> > +  POSTBUILD                           = python
> Vlv2TbltDevicePkg/Feature/Capsule/GenerateCapsule/GenCaps
> uleAll.py
> >
> >    DEFINE RC_BINARY_RELEASE        = TRUE
> >    #
> > @@ -215,7 +217,7 @@ [LibraryClasses.common]
> >
> TpmMeasurementLib|MdeModulePkg/Library/TpmMeasurementLibN
> ull/TpmMeasurementLibNull.inf
> >  !endif
> >
> > -
> BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.i
> nf
> > +
> BiosIdLib|BoardModulePkg/Library/BiosIdLib/DxeBiosIdLib.i
> nf
> >
> >
> StallSmmLib|Vlv2TbltDevicePkg/Library/StallSmmLib/StallSm
> mLib.inf
> >
> > @@ -244,6 +246,10 @@ [LibraryClasses.common]
> >
> >
> BootLogoLib|MdeModulePkg/Library/BootLogoLib/BootLogoLib.
> inf
> >
> > +!if $(RECOVERY_ENABLE)
> > +
> EdkiiSystemCapsuleLib|SignedCapsulePkg/Library/EdkiiSyste
> mCapsuleLib/EdkiiSystemCapsuleLib.inf
> > +!endif
> > +
> >  [LibraryClasses.IA32.SEC]
> >  !if $(PERFORMANCE_ENABLE) == TRUE
> >
> PerformanceLib|MdePkg/Library/BasePerformanceLibNull/Base
> PerformanceLibNull.inf
> > @@ -720,11 +726,10 @@
> [PcdsDynamicExDefault.common.DEFAULT]
> >    gEfiVLVTokenSpaceGuid.PcdCpuSmramCpuDataAddress|0
> >    gEfiVLVTokenSpaceGuid.PcdCpuLockBoxSize|0
> >
> gEfiSecurityPkgTokenSpaceGuid.PcdUserPhysicalPresence|TRU
> E
> > -
> > -[PcdsDynamicExDefault.X64.DEFAULT]
> > +
> gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTy
> peIdGuid|{GUID("$(FMP_MINNOW_MAX_SYSTEM)")}|VOID*|0x10
> >  !if $(RECOVERY_ENABLE)
> > +
> gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmware
> ImageDescriptor|{0x0}|VOID*|0x100
> >
> gEfiSignedCapsulePkgTokenSpaceGuid.PcdEdkiiSystemFirmware
> FileGuid|{GUID("AF9C9EB2-12AD-4D3E-A4D4-
> 96F6C9966215")}|VOID*|0x10
> > -
> gEfiMdeModulePkgTokenSpaceGuid.PcdSystemFmpCapsuleImageTy
> peIdGuid|{GUID("4096267b-da0a-42eb-b5eb-
> fef31d207cb4")}|VOID*|0x10
> >  !endif
> >
> >  [PcdsDynamicExVpd.common.DEFAULT]
> > diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py
> b/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py
> > new file mode 100644
> > index 0000000000..220515c809
> > --- /dev/null
> > +++ b/Platform/Intel/Vlv2TbltDevicePkg/PreBuild.py
> > @@ -0,0 +1,348 @@
> > +## @file
> > +# PreBuild operations for Vlv2TbltDevicePkg
> > +#
> > +# Copyright (c) 2019, Intel Corporation. All rights
> reserved.<BR>
> > +#
> > +# SPDX-License-Identifier: BSD-2-Clause-Patent
> > +#
> > +
> > +'''
> > +PreBuild
> > +'''
> > +
> > +import os
> > +import sys
> > +import argparse
> > +import subprocess
> > +import glob
> > +import shutil
> > +import struct
> > +import datetime
> > +
> > +#
> > +# Globals for help information
> > +#
> > +__prog__        = 'PreBuild'
> > +__copyright__   = 'Copyright (c) 2019, Intel
> Corporation. All rights reserved.'
> > +__description__ = 'Vlv2Tbl2DevicePkg pre-build
> operations.\n'
> > +
> > +#
> > +# Globals
> > +#
> > +gWorkspace = ''
> > +gBaseToolsPath = ''
> > +gArgs      = None
> > +
> > +def LogAlways(Message):
> > +    sys.stdout.write (__prog__ + ': ' + Message +
> '\n')
> > +    sys.stdout.flush()
> > +
> > +def Log(Message):
> > +    global gArgs
> > +    if not gArgs.Verbose:
> > +        return
> > +    sys.stdout.write (__prog__ + ': ' + Message +
> '\n')
> > +    sys.stdout.flush()
> > +
> > +def Error(Message, ExitValue=1):
> > +    sys.stderr.write (__prog__ + ': ERROR: ' + Message
> + '\n')
> > +    sys.exit (ExitValue)
> > +
> > +def RelativePath(target):
> > +    global gWorkspace
> > +    Log('RelativePath' + target)
> > +    return os.path.relpath (target, gWorkspace)
> > +
> > +def NormalizePath(target):
> > +    if isinstance(target, tuple):
> > +        return os.path.normpath (os.path.join
> (*target))
> > +    else:
> > +        return os.path.normpath (target)
> > +
> > +def RemoveFile(target):
> > +    target = NormalizePath(target)
> > +    if not target or target == os.pathsep:
> > +        Error ('RemoveFile() invalid target')
> > +    if os.path.exists(target):
> > +        os.remove (target)
> > +        Log ('remove %s' % (RelativePath (target)))
> > +
> > +def RemoveDirectory(target):
> > +    target = NormalizePath(target)
> > +    if not target or target == os.pathsep:
> > +        Error ('RemoveDirectory() invalid target')
> > +    if os.path.exists(target):
> > +        Log ('rmdir %s' % (RelativePath (target)))
> > +        shutil.rmtree(target)
> > +
> > +def CreateDirectory(target):
> > +    target = NormalizePath(target)
> > +    if not os.path.exists(target):
> > +        Log ('mkdir %s' % (RelativePath (target)))
> > +        os.makedirs (target)
> > +
> > +def Copy(src, dst):
> > +    src = NormalizePath(src)
> > +    dst = NormalizePath(dst)
> > +    for File in glob.glob(src):
> > +        Log ('copy %s -> %s' % (RelativePath (File),
> RelativePath (dst)))
> > +        shutil.copy (File, dst)
> > +
> > +def GenCapsuleDevice (BaseName, PayloadFileName, Guid,
> Version, Lsv, CapsulesPath, CapsulesSubDir):
> > +    global gBaseToolsPath
> > +    LogAlways ('Generate Capsule: {0} {1:08x} {2:08x}
> {3}'.format (Guid, Version, Lsv, PayloadFileName))
> > +
> > +    VersionString = '.'.join([str(ord(x)) for x in
> struct.pack('>I', Version).decode()])
> > +
> > +    FmpCapsuleFile = NormalizePath ((CapsulesPath,
> CapsulesSubDir, BaseName + '.' + VersionString + '.cap'))
> > +    Command = GenerateCapsuleCommand.format (
> > +                FMP_CAPSULE_GUID    = Guid,
> > +                FMP_CAPSULE_VERSION = Version,
> > +                FMP_CAPSULE_LSV     = Lsv,
> > +                BASE_TOOLS_PATH     = gBaseToolsPath,
> > +                FMP_CAPSULE_FILE    = FmpCapsuleFile,
> > +                FMP_CAPSULE_PAYLOAD = PayloadFileName
> > +                )
> > +    Command = ' '.join(Command.splitlines()).strip()
> > +    if gArgs.Verbose:
> > +        Command = Command + ' -v'
> > +
> > +    Log (Command)
> > +
> > +    Process = subprocess.Popen(Command,
> stdin=subprocess.PIPE, stdout=subprocess.PIPE,
> stderr=subprocess.PIPE, shell=True)
> > +    ProcessOutput = Process.communicate()
> > +
> > +    if Process.returncode == 0:
> > +        Log (ProcessOutput[0].decode())
> > +    else:
> > +        LogAlways (Command)
> > +        LogAlways (ProcessOutput[0].decode())
> > +        Error ('GenerateCapsule returned an error')
> > +
> > +    Copy (PayloadFileName, (CapsulesPath,
> 'firmware.bin'))
> > +    MetaInfoXml = MetaInfoXmlTemplate
> > +    MetaInfoXml = MetaInfoXml.replace
> ('FMP_CAPSULE_GUID', Guid)
> > +    MetaInfoXml = MetaInfoXml.replace
> ('FMP_CAPSULE_BASE_NAME', BaseName)
> > +    MetaInfoXml = MetaInfoXml.replace
> ('FMP_CAPSULE_VERSION_DECIMAL', str(Version))
> > +    MetaInfoXml = MetaInfoXml.replace
> ('FMP_CAPSULE_STRING', VersionString)
> > +    MetaInfoXml = MetaInfoXml.replace
> ('FMP_CAPSULE_DATE', str(datetime.date.today()))
> > +    f = open (NormalizePath ((CapsulesPath,
> 'firmware.metainfo.xml')), 'w')
> > +    f.write(MetaInfoXml)
> > +    f.close()
> > +
> > +    f = open (NormalizePath ((CapsulesPath,
> 'Lvfs.ddf')), 'w')
> > +    f.write(LvfsDdfTemplate)
> > +    f.close()
> > +
> > +    if sys.platform == "win32":
> > +        Command = 'makecab /f ' + NormalizePath
> ((CapsulesPath, 'Lvfs.ddf'))
> > +    else:
> > +        Command = 'gcab --create firmware.cab
> firmware.bin firmware.metainfo.xml'
> > +    Log (Command)
> > +
> > +    Process = subprocess.Popen(Command,
> cwd=CapsulesPath, stdin=subprocess.PIPE,
> stdout=subprocess.PIPE, stderr=subprocess.PIPE,
> shell=True)
> > +    ProcessOutput = Process.communicate()
> > +
> > +    if Process.returncode == 0:
> > +        Log (ProcessOutput[0].decode())
> > +    else:
> > +        LogAlways (Command)
> > +        LogAlways (ProcessOutput[0].decode())
> > +        Error ('GenerateCapsule returned an error')
> > +
> > +    FmpCabinetFile = NormalizePath ((CapsulesPath,
> CapsulesSubDir, BaseName + '.' + VersionString + '.cab'))
> > +
> > +    Copy ((CapsulesPath, 'firmware.cab'),
> FmpCabinetFile)
> > +
> > +    RemoveFile ((CapsulesPath, 'firmware.cab'))
> > +    RemoveFile ((CapsulesPath, 'setup.inf'))
> > +    RemoveFile ((CapsulesPath, 'setup.rpt'))
> > +    RemoveFile ((CapsulesPath, 'Lvfs.ddf'))
> > +    RemoveFile ((CapsulesPath,
> 'firmware.metainfo.xml'))
> > +    RemoveFile ((CapsulesPath, 'firmware.bin'))
> > +
> > +BiosIdTemplate = '''
> > +BOARD_ID       = MNW2MAX
> > +BOARD_REV      = $BOARD_REV
> > +BOARD_EXT      = $ARCH
> > +VERSION_MAJOR  = 0090
> > +BUILD_TYPE     = $BUILD_TYPE
> > +VERSION_MINOR  = 01
> > +'''
> > +
> > +
> > +if __name__ == '__main__':
> > +    #
> > +    # Create command line argument parser object
> > +    #
> > +    parser = argparse.ArgumentParser (
> > +                        prog = __prog__,
> > +                        description = __description__
> + __copyright__,
> > +                        conflict_handler = 'resolve'
> > +                        )
> > +    parser.add_argument (
> > +             '-a', '--arch', dest = 'Arch', nargs =
> '+', action = 'append',
> > +             required = True,
> > +             help = '''ARCHS is one of list: IA32,
> X64, IPF, ARM, AARCH64 or EBC,
> > +                       which overrides target.txt's
> TARGET_ARCH definition. To
> > +                       specify more archs, please
> repeat this option.'''
> > +             )
> > +    parser.add_argument (
> > +             '-t', '--tagname', dest = 'ToolChain',
> required = True,
> > +             help = '''Using the Tool Chain Tagname to
> build the platform,
> > +                       overriding target.txt's
> TOOL_CHAIN_TAG definition.'''
> > +             )
> > +    parser.add_argument (
> > +             '-p', '--platform', dest =
> 'PlatformFile', required = True,
> > +             help = '''Build the platform specified by
> the DSC file name argument,
> > +                       overriding target.txt's
> ACTIVE_PLATFORM definition.'''
> > +             )
> > +    parser.add_argument (
> > +             '-b', '--buildtarget', dest =
> 'BuildTarget', required = True,
> > +             help = '''Using the TARGET to build the
> platform, overriding
> > +                       target.txt's TARGET
> definition.'''
> > +             )
> > +    parser.add_argument (
> > +             '--conf=', dest = 'ConfDirectory',
> required = True,
> > +             help = '''Specify the customized Conf
> directory.'''
> > +             )
> > +    parser.add_argument (
> > +             '-D', '--define', dest = 'Define',
> nargs='*', action = 'append',
> > +             help = '''Macro: "Name [= Value]".'''
> > +             )
> > +    parser.add_argument (
> > +             '-v', '--verbose', dest = 'Verbose',
> action = 'store_true',
> > +             help = '''Turn on verbose output with
> informational messages printed'''
> > +             )
> > +    parser.add_argument (
> > +             '--package', dest = 'Package', nargs =
> '*', action = 'append',
> > +             help = '''The directory name of a package
> of tests to copy'''
> > +             )
> > +
> > +    #
> > +    # Parse command line arguments
> > +    #
> > +    gArgs, remaining = parser.parse_known_args()
> > +    gArgs.BuildType = 'all'
> > +    for BuildType in ['all', 'fds', 'genc', 'genmake',
> 'clean', 'cleanall', 'modules', 'libraries', 'run']:
> > +        if BuildType in remaining:
> > +            gArgs.BuildType = BuildType
> > +            remaining.remove(BuildType)
> > +            break
> > +    gArgs.Remaining = ' '.join(remaining)
> > +
> > +    #
> > +    # Get WORKSPACE environment variable
> > +    #
> > +    try:
> > +        gWorkspace = os.environ['WORKSPACE']
> > +    except:
> > +        Error ('WORKSPACE environment variable not
> set')
> > +
> > +    #
> > +    # Get PACKAGES_PATH and generate prioritized list
> of paths
> > +    #
> > +    PathList = [gWorkspace]
> > +    try:
> > +        PathList +=
> os.environ['PACKAGES_PATH'].split(os.pathsep)
> > +    except:
> > +        pass
> > +
> > +    #
> > +    # Determine full path to BaseTools
> > +    #
> > +    Vlv2Tbl2DevicePkgPath = ''
> > +    for Path in PathList:
> > +        if gBaseToolsPath == '':
> > +            if os.path.exists (os.path.join (Path,
> 'BaseTools')):
> > +                gBaseToolsPath = os.path.join (Path,
> 'BaseTools')
> > +        if Vlv2Tbl2DevicePkgPath == '':
> > +            if os.path.exists (os.path.join (Path,
> 'Vlv2TbltDevicePkg')):
> > +                Vlv2Tbl2DevicePkgPath = os.path.join
> (Path, 'Vlv2TbltDevicePkg')
> > +    if gBaseToolsPath == '':
> > +        Error ('Can not find BaseTools in WORKSPACE or
> PACKAGES_PATH')
> > +    if Vlv2Tbl2DevicePkgPath == '':
> > +        Error ('Can not find Vlv2Tbl2DevicePkg in
> WORKSPACE or PACKAGES_PATH')
> > +
> > +    #
> > +    # Parse OUTPUT_DIRECTORY from DSC file
> > +    #
> > +    for Path in PathList:
> > +        if os.path.exists (os.path.join (Path,
> gArgs.PlatformFile)):
> > +            Dsc = open (os.path.join (Path,
> gArgs.PlatformFile), 'r').readlines()
> > +            break
> > +    for Line in Dsc:
> > +        if
> Line.strip().startswith('OUTPUT_DIRECTORY'):
> > +            OutputDirectory =
> Line.strip().split('=')[1].strip()
> > +            break
> > +
> > +    #
> > +    # Determine full paths to EDK II build directory,
> EDK II build output
> > +    # directory and the CPU arch of the UEFI phase.
> > +    #
> > +    CommandDir = os.path.dirname(sys.argv[0])
> > +    EdkiiBuildDir = os.path.join (gWorkspace,
> OutputDirectory)
> > +    EdkiiBuildOutput = os.path.join (EdkiiBuildDir,
> gArgs.BuildTarget + '_' + gArgs.ToolChain)
> > +    UefiArch = gArgs.Arch[0][0]
> > +    if len (gArgs.Arch) > 1:
> > +        if ['X64'] in gArgs.Arch:
> > +            UefiArch = 'X64'
> > +
> > +    if gArgs.BuildType == 'run':
> > +        Error ("'run' target not supported")
> > +    if gArgs.BuildType == 'clean':
> > +        sys.exit (0)
> > +
> > +    #
> > +    # Create output directories to put BiosId files
> > +    #
> > +    try:
> > +        CreateDirectory ((gWorkspace, 'Build'))
> > +    except:
> > +        pass
> > +    try:
> > +        CreateDirectory ((EdkiiBuildDir))
> > +    except:
> > +        pass
> > +    try:
> > +        CreateDirectory ((EdkiiBuildOutput))
> > +    except:
> > +        pass
> > +
> > +    #
> > +    # Generate BiosId files
> > +    #
> > +    BiosId = BiosIdTemplate
> > +    if sys.platform == "win32":
> > +        # Built from a Windows Host OS
> > +        BiosId = BiosId.replace ('$BOARD_REV', 'W')
> > +    else:
> > +        # Built from a Linux/Unix/Mac Host OS
> > +        BiosId = BiosId.replace ('$BOARD_REV', 'L')
> > +    if UefiArch == 'X64':
> > +      BiosId = BiosId.replace ('$ARCH', 'X64')
> > +    else:
> > +      BiosId = BiosId.replace ('$ARCH', 'I32')
> > +    BiosId = BiosId.replace ('$BUILD_TYPE',
> gArgs.BuildTarget[0])
> > +
> > +    BiosIdFileName = NormalizePath ((EdkiiBuildOutput,
> 'BiosId.env'))
> > +    f = open (BiosIdFileName, 'w')
> > +    f.write(BiosId)
> > +    f.close()
> > +
> > +    Command = 'python ' + NormalizePath
> ((Vlv2Tbl2DevicePkgPath,
> '../Tools/GenBiosId/GenBiosId.py'))
> > +    Command = Command + ' -i '  + BiosIdFileName
> > +    Command = Command + ' -o '  + NormalizePath
> ((EdkiiBuildOutput, 'BiosId.bin'))
> > +    Command = Command + ' -ot ' + NormalizePath
> ((EdkiiBuildOutput, 'BiosId.txt'))
> > +
> > +    LogAlways (Command)
> > +
> > +    Process = subprocess.Popen(Command,
> stdin=subprocess.PIPE, stdout=subprocess.PIPE,
> stderr=subprocess.PIPE, shell=True)
> > +    ProcessOutput = Process.communicate()
> > +
> > +    if Process.returncode == 0:
> > +        Log (ProcessOutput[0].decode())
> > +    else:
> > +        LogAlways (Command)
> > +        LogAlways (ProcessOutput[0].decode())
> > +        Error ('GenBiosId returned an error')
> > diff --git a/Platform/Intel/Vlv2TbltDevicePkg/Readme.md
> b/Platform/Intel/Vlv2TbltDevicePkg/Readme.md
> > index 97180ef7af..b52c23fdec 100644
> > --- a/Platform/Intel/Vlv2TbltDevicePkg/Readme.md
> > +++ b/Platform/Intel/Vlv2TbltDevicePkg/Readme.md
> > @@ -57,12 +57,15 @@ powershell Expand-Archive nasm-
> 2.13.03-win64.zip .
> >
> >  set WORKSPACE=%CD%
> >  set PACKAGES_PATH=%WORKSPACE%\edk2;%WORKSPACE%\edk2-
> platforms\Silicon\Intel;%WORKSPACE%\edk2-
> platforms\Platform\Intel;%WORKSPACE%\edk2-non-
> osi\Silicon\Intel
> > +set EDK_TOOLS_PATH=%WORKSPACE%\edk2\BaseTools
> >  path=%path%;%WORKSPACE%\openssl-1.0.2r-x64_86-win64
> >  set NASM_PREFIX=%WORKSPACE%\nasm-2.13.03\
> >
> > -cd edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg
> > +cd %WORKSPACE%\edk2
> >
> > -Build_IFWI.bat /m MNW2 Debug
> > +edksetup.bat Rebuild
> > +
> > +build -a IA32 -a X64 -n 5 -t VS2015x86 -b DEBUG -p
> Vlv2TbltDevicePkg\PlatformPkgX64.dsc
> >  ```
> >
> >  Once all the code and tools are downloaded and
> installed, only the following
> > @@ -72,8 +75,14 @@ directory used to install the source
> and binaries.
> >  ```
> >  set WORKSPACE=%CD%
> >  set PACKAGES_PATH=%WORKSPACE%\edk2;%WORKSPACE%\edk2-
> platforms\Silicon\Intel;%WORKSPACE%\edk2-
> platforms\Platform\Intel;%WORKSPACE%\edk2-non-
> osi\Silicon\Intel
> > +set EDK_TOOLS_PATH=%WORKSPACE%\edk2\BaseTools
> >  path=%path%;%WORKSPACE%\openssl-1.0.2r-x64_86-win64
> >  set NASM_PREFIX=%WORKSPACE%\nasm-2.13.03\
> > +
> > +cd %WORKSPACE%\edk2
> > +
> > +edksetup.bat Rebuild
> > +
> >  ```
> >
> >  Once the environment is setup, the MinnowBoard MAX
> firmware and capsules can be
> > @@ -82,39 +91,43 @@ rebuilt using the following
> commands.
> >  * Build X64 Debug Image with report file
> >
> >  ```
> > -cd edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg
> > -Build_IFWI.bat /m /y MNW2 Debug
> > +build -a IA32 -a X64 -n 5 -t VS2015x86 -b DEBUG -p
> Vlv2TbltDevicePkg\PlatformPkgX64.dsc -y Vlv.report
> >  ```
> >
> >  * Build X64 Release Image with build log
> >
> >  ```
> > -cd edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg
> > -Build_IFWI.bat /m /l MNW2 Release
> > +build -a IA32 -a X64 -n 5 -t VS2015x86 -b RELEASE
> Vlv2TbltDevicePkg\PlatformPkgX64.dsc -j Vlv.log
> >  ```
> >
> >  * Build IA32 Debug Image
> >
> >  ```
> > -cd edk2-platforms\Platform\Intel\Vlv2TbltDevicePkg
> > -Build_IFWI.bat /m /IA32 MNW2 Debug
> > +build -a IA32 -n 5 -t VS2015x86 -b DEBUG -p
> Vlv2TbltDevicePkg\PlatformPkgIA32.dsc
> >  ```
> >
> >  The generated firmware image is the build output
> directory below WORKSPACE.  For
> >  exampple, the X64 Debug Image is at:
> >
> > -`Build\Vlv2TbltDevicePkg\DEBUG_VS2015x86\FV\Vlv.ROM`
> > +`Build\Vlv2TbltDevicePkgX64\DEBUG_VS2015x86\FV\Vlv.fd`
> >
> >  And the IA32 Release image is at:
> >
> > -
> `Build\Vlv2TbltDevicePkgIA32\RELEASE_VS2015x86\FV\Vlv.ROM
> `
> >
> +`Build\Vlv2TbltDevicePkgIA32\RELEASE_VS2015x86\FV\Vlv.fd
> `
> >
> >  The X64 CapsuleApp and generated UEFI Capsules are in
> the directory
> >
> > -`Build\Vlv2TbltDevicePkg\Capsules`
> > +`Build\Vlv2TbltDevicePkgX64\Capsules`
> >
> >  # Linux Pre-requisites
> >
> > +* git
> > +* python
> > +* iasl
> > +* nasm
> > +* openssl
> > +* gcab
> > +
> >  # Download and Build MinnowMax using Linux/GCC
> >
> >  Run the script below from an empty directory.  The
> script clones the EDK II
> > @@ -132,10 +145,12 @@ git clone
> https://github.com/tianocore/edk2-platforms.git
> >  git clone https://github.com/tianocore/edk2-non-
> osi.git
> >
> >  export WORKSPACE=$PWD
> > +export PACKAGES_PATH=$WORKSPACE/edk2;$WORKSPACE/edk2-
> platforms/Silicon/Intel;$WORKSPACE/edk2-
> platforms/Platform/Intel;$WORKSPACE/edk2-non-
> osi/Silicon/Intel
> To set the paths, it should be colons, not semicolons.
> export PACKAGES_PATH=$WORKSPACE/edk2:$WORKSPACE/edk2-
> platforms/Silicon/Intel:$WORKSPACE/edk2-
> platforms/Platform/Intel:$WORKSPACE/edk2-non-
> osi/Silicon/Intel
> 
> > +cd $WORKSPACE/edk2
> >
> > -cd edk2-platforms/Platform/Intel/Vlv2TbltDevicePkg
> > +. edksetup.sh BaseTools Rebuild
> >
> "Rebuild" is not defined in edksetup.sh.
> 
> > -./Build_IFWI.sh /m MNW2 Debug
> > +build -a IA32 -a X64 -n 5 -t GCC5 -b DEBUG -p
> Vlv2TbltDevicePkg/PlatformPkgX64.dsc
> >  ```
> >
> >  Once all the code is downloaded and installed, only
> the following commands are
> > @@ -144,6 +159,10 @@ install the source and binaries.
> >
> >  ```
> >  export WORKSPACE=$PWD/edk2
> The WORKSPACE is not in edk2.
> 
> > +export PACKAGES_PATH=$WORKSPACE/edk2;$WORKSPACE/edk2-
> platforms/Silicon/Intel;$WORKSPACE/edk2-
> platforms/Platform/Intel;$WORKSPACE/edk2-non-
> osi/Silicon/Intel
> Same as the previous one.
> 
> > +cd $WORKSPACE/edk2
> > +
> > +. edksetup.sh BaseTools Rebuild
> Same as the previous one.
> 
> >  ```
> >
> >  Once the environment is setup, the MinnowBoard MAX
> firmware and capsules can be
> > @@ -152,36 +171,33 @@ rebuilt using the following
> commands.
> >  * Build X64 Debug Image with report file
> >
> >  ```
> > -cd edk2-platforms/Platform/Intel/Vlv2TbltDevicePkg
> > -./Build_IFWI.sh /m /y MNW2 Debug
> > +build -a IA32 -a X64 -n 5 -t GCC5 -b DEBUG -p
> Vlv2TbltDevicePkg/PlatformPkgX64.dsc -y Vlv.report
> >  ```
> >
> I'm not sure how to use this "report" file. It failed
> with the following error:
> 
> build.py...
>  : error C0DE: Unknown fatal error when generating build
> report
>         Vlv.report
> (Python 3.7.3 on linux
> Traceback (most recent call last):
>   File "/home/gary/git/edk2-
> workspace/edk2/BaseTools/Source/Python/build/BuildReport.
> py", line 2271, in GenerateReport
>     PlatformReport(Wa, MaList,
> self.ReportType).GenerateReport(File, BuildDuration,
> AutoGenTime, MakeTime, GenFdsTime, self.ReportType)
>   File "/home/gary/git/edk2-
> workspace/edk2/BaseTools/Source/Python/build/BuildReport.
> py", line 2121, in __init__
>     self.PredictionReport = PredictionReport(Wa)
>   File "/home/gary/git/edk2-
> workspace/edk2/BaseTools/Source/Python/build/BuildReport.
> py", line 1546, in __init__
>     FindIncludeFiles(Source.Path, Module.IncludePathList,
> IncludeList)
>   File "/home/gary/git/edk2-
> workspace/edk2/BaseTools/Source/Python/build/BuildReport.
> py", line 185, in FindIncludeFiles
>     FileContents = open(Source).read()
>   File "/usr/lib64/python3.7/codecs.py", line 322, in
> decode
>     (result, consumed) = self._buffer_decode(data,
> self.errors, final)
> UnicodeDecodeError: 'utf-8' codec can't decode byte 0x92
> in position 5875: invalid start byte
> )
> 
> Anyway, the firmware and capsule files were built. Will
> test them later.
> 
> Gary Lin
> 
> >  * Build X64 Release Image with build log
> >
> >  ```
> > -cd edk2-platforms/Platform/Intel/Vlv2TbltDevicePkg
> > -./Build_IFWI.sh /m /l MNW2 Release
> > +build -a IA32 -a X64 -n 5 -t GCC5 -b RELEASE -p
> Vlv2TbltDevicePkg/PlatformPkgX64.dsc -j Vlv.log
> >  ```
> >
> >  * Build IA32 Debug Image
> >
> >  ```
> > -cd edk2-platforms/Platform/Intel/Vlv2TbltDevicePkg
> > -./Build_IFWI.sh /m /IA32 MNW2 Debug
> > +build -a IA32 -n 5 -t GCC5 -b DEBUG -p
> Vlv2TbltDevicePkg/PlatformPkgIA32.dsc
> >  ```
> >
> >  The generated firmware image is the build output
> directory below WORKSPACE.  For
> >  exampple, the X64 Debug Image is at:
> >
> > -`Build/Vlv2TbltDevicePkg/DEBUG_GCC5/FV/Vlv.ROM`
> > +`Build/Vlv2TbltDevicePkgX64/DEBUG_GCC5/FV/Vlv.fd`
> >
> >  And the IA32 Release image is at:
> >
> > -`Build/Vlv2TbltDevicePkgIA32/RELEASE_GCC5/FV/Vlv.ROM`
> > +`Build/Vlv2TbltDevicePkgIA32/RELEASE_GCC5/FV/Vlv.fd`
> >
> >  The X64 CapsuleApp and generated UEFI Capsules are in
> the directory
> >
> > -`Build/Vlv2TbltDevicePkg/Capsules`
> > +`Build/Vlv2TbltDevicePkgX64/Capsules`
> >
> >  # Use DediProg to update FLASH image on a MinnowBoard
> MAX Target
> >
> > @@ -192,7 +208,7 @@ The X64 CapsuleApp and generated
> UEFI Capsules are in the directory
> >  * Boot MinnowBoard MAX to the Boot Manager
> >  * Boot the `EFI Internal Shell` boot option
> >  * Mount the USB FLASH Drive (usually `FS1`)
> > -* Use `cd` command to go to `Capsules/TestCert`
> directory
> > +* Use `cd` command to go to `Capsules/TestCert_*`
> directory
> >  * Run the following command to apply all four capsules
> >
> >  ```
> > diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
> b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
> > deleted file mode 100644
> > index fb634c490c..0000000000
> > --- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.bat
> > +++ /dev/null
> > @@ -1,303 +0,0 @@
> > -@REM @file
> > -@REM   Windows batch file to build BIOS ROM
> > -@REM
> > -@REM Copyright (c) 2006 - 2019, Intel Corporation. All
> rights reserved.<BR>
> > -@REM SPDX-License-Identifier: BSD-2-Clause-Patent
> > -@REM
> > -
> > -@echo off
> > -setlocal EnableDelayedExpansion EnableExtensions
> > -echo.
> > -echo %date%  %time%
> > -echo.
> > -
> > -
> ::*******************************************************
> ***************
> > -:: Initial Setup
> > -
> ::*******************************************************
> ***************
> > -if %WORKSPACE:~-1%==\ set WORKSPACE=%WORKSPACE:~0,-1%
> > -set /a build_threads=1
> > -set "Build_Flags= "
> > -set exitCode=0
> > -set Arch=X64
> > -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 (
> > -    for %%i IN (%PACKAGES_PATH%) DO (
> > -      if exist %%~fi\edksetup.bat (
> > -        set CORE_PATH=%%~fi
> > -        goto CorePathFound
> > -      )
> > -    )
> > -  ) else (
> > -    echo.
> > -    echo !!! ERROR !!! Cannot find edksetup.bat !!!
> > -    echo.
> > -    goto BldFail
> > -  )
> > -)
> > -:CorePathFound
> > -
> > -
> ::*******************************************************
> ***************
> > -:: Detect full path to the Vlv2TbltDevicePkg
> > -
> ::*******************************************************
> ***************
> > -set PLATFORM_PACKAGE=%WORKSPACE%\%PLATFORM_NAME%
> > -if not exist %PLATFORM_PACKAGE% (
> > -  if defined PACKAGES_PATH (
> > -    for %%i IN (%PACKAGES_PATH%) DO (
> > -      if exist %%~fi\%PLATFORM_NAME% (
> > -        set PLATFORM_PACKAGE=%%~fi\%PLATFORM_NAME%
> > -        goto PlatformPackageFound
> > -      )
> > -    )
> > -  ) else (
> > -    echo.
> > -    echo !!! ERROR !!! Cannot find %PLATFORM_NAME% !!!
> > -    echo.
> > -    goto BldFail
> > -  )
> > -)
> > -:PlatformPackageFound
> > -
> > -cd %CORE_PATH%
> > -
> > -
> ::*******************************************************
> ***************
> > -:: Run edksetup.bat and make sure tools are up to date
> > -
> ::*******************************************************
> ***************
> > -
> > -call %CORE_PATH%\edksetup.bat Rebuild
> > -@echo off
> > -
> > -
> ::*******************************************************
> ***************
> > -:: Parse command line arguments
> > -
> ::*******************************************************
> ***************
> > -
> > -:: Optional arguments
> > -:OptLoop
> > -if /i "%~1"=="/?" goto Usage
> > -
> > -if /i "%~1"=="/l" (
> > -    set GenLog=TRUE
> > -    shift
> > -    goto OptLoop
> > -)
> > -if /i "%~1"=="/y" (
> > -    set GenReport=TRUE
> > -    shift
> > -    goto OptLoop
> > -)
> > -if /i "%~1"=="/m" (
> > -    if defined NUMBER_OF_PROCESSORS (
> > -        set /a build_threads=%NUMBER_OF_PROCESSORS%+1
> > -    )
> > -    shift
> > -    goto OptLoop
> > -)
> > -if /i "%~1" == "/c" (
> > -    set Clean=TRUE
> > -    shift
> > -    goto OptLoop
> > -)
> > -
> > -if /i "%~1"=="/x64" (
> > -    set Arch=X64
> > -    shift
> > -    goto OptLoop
> > -)
> > -if /i "%~1"=="/IA32" (
> > -    set Arch=IA32
> > -    shift
> > -    goto OptLoop
> > -)
> > -
> > -:: Required argument(s)
> > -if "%~1"=="" goto Usage
> > -
> > -if /i "%~2" == "RELEASE" (
> > -    set target=RELEASE
> > -) else (
> > -    set target=DEBUG
> > -)
> > -
> > -
> ::*******************************************************
> ***************
> > -:: Detect TOOL_CHAIN_TAG
> > -
> ::*******************************************************
> ***************
> > -
> > -echo.
> > -echo Setting the Build environment for
> VS2015/VS2013/VS2012/VS2010/VS2008...
> > -if defined VS140COMNTOOLS (
> > -  if not defined VSINSTALLDIR call
> "%VS140COMNTOOLS%\vsvars32.bat"
> > -  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 if defined VS120COMNTOOLS (
> > -  if not defined VSINSTALLDIR call
> "%VS120COMNTOOLS%\vsvars32.bat"
> > -  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 if defined VS110COMNTOOLS (
> > -  if not defined VSINSTALLDIR call
> "%VS110COMNTOOLS%\vsvars32.bat"
> > -  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 if defined VS100COMNTOOLS (
> > -  if not defined VSINSTALLDIR call
> "%VS100COMNTOOLS%\vsvars32.bat"
> > -  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 if defined VS90COMNTOOLS (
> > -  if not defined VSINSTALLDIR call
> "%VS90COMNTOOLS%\vsvars32.bat"
> > -  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: VS2015/VS2013/VS2012/VS2010/VS2008
> not installed correctly.
> VS140COMNTOOLS/VS120COMNTOOLS/VS110COMNTOOLS/VS100COMNTOO
> LS/VS90COMNTOOLS not defined ^^!
> > -  echo.
> > -  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 not exist %WORKSPACE%\Build\%PLATFORM_NAME%%Arch%
> mkdir %WORKSPACE%\Build\%PLATFORM_NAME%%Arch%
> > -set
> BUILD_PATH=%WORKSPACE%\Build\%PLATFORM_NAME%%Arch%\%TARGE
> T%_%TOOL_CHAIN_TAG%
> > -if not exist %BUILD_PATH% mkdir %BUILD_PATH%
> > -
> > -
> ::*******************************************************
> ***************
> > -:: Check for clean operation
> > -
> ::*******************************************************
> ***************
> > -
> > -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" (
> > -    set Build_Flags=%Build_Flags% -a IA32
> > -) else if "%Arch%"=="X64" (
> > -    set Build_Flags=%Build_Flags% -a IA32 -a X64
> > -)
> > -set Build_Flags=%Build_Flags% -t %TOOL_CHAIN_TAG%
> > -set Build_Flags=%Build_Flags% -n %build_threads%
> > -set Capsule_Build_Flags=%Build_Flags%
> > -set Build_Flags=%Build_Flags% -p
> %PLATFORM_PACKAGE%/PlatformPkg%Arch%.dsc
> > -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
> > -)
> > -
> > -
> ::*******************************************************
> ***************
> > -:: Generate BIOS ID
> > -
> ::*******************************************************
> ***************
> > -
> > -echo BOARD_ID       = MNW2MAX >
> %BUILD_PATH%/BiosId.env
> > -echo BOARD_REV      = W       >>
> %BUILD_PATH%/BiosId.env
> > -if "%Arch%"=="IA32" (
> > -  echo BOARD_EXT      = I32   >>
> %BUILD_PATH%/BiosId.env
> > -)
> > -if "%Arch%"=="X64" (
> > -  echo BOARD_EXT      = X64   >>
> %BUILD_PATH%/BiosId.env
> > -)
> > -echo VERSION_MAJOR  = 0090    >>
> %BUILD_PATH%/BiosId.env
> > -if "%TARGET%"=="DEBUG" (
> > -  echo BUILD_TYPE     = D     >>
> %BUILD_PATH%/BiosId.env
> > -)
> > -if "%TARGET%"=="RELEASE" (
> > -  echo BUILD_TYPE     = R     >>
> %BUILD_PATH%/BiosId.env
> > -)
> > -echo VERSION_MINOR  = 01      >>
> %BUILD_PATH%/BiosId.env
> > -
> > -%WORKSPACE%\edk2-
> platforms\Platform\Intel\Tools\GenBiosId\GenBiosId.py -i
> %BUILD_PATH%/BiosId.env -o %BUILD_PATH%/BiosId.bin -ot
> %BUILD_PATH%/BiosId.txt
> > -
> > -
> ::*******************************************************
> ***************
> > -:: Build BIOS
> > -
> ::*******************************************************
> ***************
> > -
> > -echo.
> > -echo Invoking EDK2 build...
> > -echo build %Build_Flags%
> > -
> > -call build %Build_Flags%
> > -
> > -if %ERRORLEVEL% NEQ 0 goto BldFail
> > -
> > -copy %BUILD_PATH%\FV\VLV.fd %BUILD_PATH%\FV\Vlv.ROM
> > -
> > -
> ::*******************************************************
> ***************
> > -:: Build Capsules
> > -
> ::*******************************************************
> ***************
> > -echo Invoking EDK2 build for capsules...
> > -echo build %Capsule_Build_Flags% -p
> %PLATFORM_PACKAGE%\PlatformCapsule%Arch%.dsc
> > -call build %Capsule_Build_Flags% -p
> %PLATFORM_PACKAGE%\PlatformCapsule%Arch%.dsc
> > -
> > -goto Exit
> > -
> > -:Usage
> > -echo.
> > -echo
> *********************************************************
> ******************
> > -echo Build BIOS rom for VLV platforms.
> > -echo.
> > -echo Usage: bld_vlv.bat [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.bat MNW2                 : X64 Debug
> build for MinnowMax
> > -echo    bld_vlv.bat /IA32 MNW2 release   : IA32
> Release build for MinnowMax
> > -echo.
> > -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%
> > -exit /b %exitCode%
> > -
> > -EndLocal
> > diff --git
> a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
> b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
> > deleted file mode 100755
> > index c8db91c6dc..0000000000
> > --- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
> > +++ /dev/null
> > @@ -1,222 +0,0 @@
> > -#!/usr/bin/env bash
> > -
> ##*******************************************************
> ***************
> > -## Function define
> > -
> ##*******************************************************
> ***************
> > -function Usage() {
> > -  echo
> > -  echo
> "********************************************************
> *******************"
> > -  echo "Build BIOS rom for VLV platforms."
> > -  echo
> > -  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
> "********************************************************
> *******************"
> > -  exit 0
> > -}
> > -
> > -set -e
> > -
> > -cd ..
> > -echo -e $(date)
> > -
> ##*******************************************************
> ***************
> > -## Initial Setup
> > -
> ##*******************************************************
> ***************
> > -#build_threads=($NUMBER_OF_PROCESSORS)+1
> > -Build_Flags=
> > -exitCode=0
> > -build_threads=1
> > -Arch=X64
> > -GenLog=FALSE
> > -GenReport=FALSE
> > -Clean=FALSE
> > -
> > -
> > -export CORE_PATH=$WORKSPACE/edk2
> > -export PLATFORM_PATH=$WORKSPACE/edk2-
> platforms/Platform/Intel/
> > -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
> > -
> > -## 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
> > -. edksetup.sh BaseTools
> > -make -C BaseTools
> > -
> > -## Define platform specific environment variables.
> > -PLATFORM_NAME=Vlv2TbltDevicePkg
> > -PLATFORM_PACKAGE=Vlv2TbltDevicePkg
> > -PLATFORM_PKG_PATH=$PLATFORM_PATH/$PLATFORM_PACKAGE
> > -
> > -cd $PLATFORM_PKG_PATH
> > -
> > -
> ##*******************************************************
> ***************
> > -## Parse command line arguments
> > -
> ##*******************************************************
> ***************
> > -
> > -## Optional arguments
> > -for (( i=1; i<=$#; ))
> > -  do
> > -    if [ "$1" == "/?" ]; then
> > -      Usage
> > -    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/L" ];
> then
> > -      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
> > -      Clean=TRUE
> > -      shift
> > -    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/X64" ];
> then
> > -      Arch=X64
> > -      shift
> > -    elif [ "$(echo $1 | tr 'a-z' 'A-Z')" == "/IA32" ];
> then
> > -      Arch=IA32
> > -      shift
> > -    else
> > -      break
> > -    fi
> > -  done
> > -
> > -## Required argument(s)
> > -if [ "$2" == "" ]; then
> > -  Usage
> > -fi
> > -
> > -echo "Setting  $1  platform configuration and BIOS
> ID..."
> > -
> > -if [ "$(echo $2 | tr 'a-z' 'A-Z')" == "RELEASE" ];
> then
> > -  export TARGET=RELEASE
> > -else
> > -  export TARGET=DEBUG
> > -fi
> > -
> > -
> ##*******************************************************
> ***************
> > -## Detect TOOL_CHAIN_TAG
> > -
> ##*******************************************************
> ***************
> > -gcc_version=$(gcc -v 2>&1 | tail -1 | awk '{print
> $3}')
> > -case $gcc_version in
> > -      [1-3].*|4.[0-7].*)
> > -        echo MNW2 requires GCC4.8 or later
> > -        exit 1
> > -        ;;
> > -      4.8.*)
> > -        export TOOL_CHAIN_TAG=GCC48
> > -        ;;
> > -      4.9.*|6.[0-2].*)
> > -        export TOOL_CHAIN_TAG=GCC49
> > -        ;;
> > -      *)
> > -        export TOOL_CHAIN_TAG=GCC5
> > -        ;;
> > -esac
> > -
> > -
> ##*******************************************************
> ***************
> > -## Generate $BUILD_PATH and make sure the directory
> exists
> > -
> ##*******************************************************
> ***************
> > -if [ ! -d ${WORKSPACE}/Build ]; then
> > -  mkdir ${WORKSPACE}/Build
> > -fi
> > -
> > -if [ ! -d ${WORKSPACE}/Build/${PLATFORM_NAME}${Arch}
> ]; then
> > -  mkdir ${WORKSPACE}/Build/${PLATFORM_NAME}${Arch}
> > -fi
> > -
> BUILD_PATH=${WORKSPACE}/Build/${PLATFORM_NAME}${Arch}/${T
> ARGET}_${TOOL_CHAIN_TAG}
> > -
> > -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 -n $build_threads"
> > -Capsule_Build_Flags="$Build_Flags"
> > -Build_Flags="$Build_Flags -p
> ${PLATFORM_PKG_PATH}/PlatformPkg${Arch}.dsc"
> > -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
> > -
> ##*******************************************************
> ***************
> > -
> > -echo BOARD_ID       = MNW2MAX >
> $BUILD_PATH/BiosId.env
> > -echo BOARD_REV      = L       >>
> $BUILD_PATH/BiosId.env
> > -if [ $Arch == "IA32" ]; then
> > -  echo BOARD_EXT      = I32   >>
> $BUILD_PATH/BiosId.env
> > -fi
> > -if [ $Arch == "X64" ]; then
> > -  echo BOARD_EXT      = X64   >>
> $BUILD_PATH/BiosId.env
> > -fi
> > -echo VERSION_MAJOR  = 0090    >>
> $BUILD_PATH/BiosId.env
> > -if [ $TARGET == "DEBUG" ]; then
> > -  echo BUILD_TYPE     = D     >>
> $BUILD_PATH/BiosId.env
> > -fi
> > -if [ $TARGET == "RELEASE" ]; then
> > -  echo BUILD_TYPE     = R     >>
> $BUILD_PATH/BiosId.env
> > -fi
> > -echo VERSION_MINOR  = 01      >>
> $BUILD_PATH/BiosId.env
> > -
> > -python $WORKSPACE/edk2-
> platforms/Platform/Intel/Tools/GenBiosId/GenBiosId.py -i
> $BUILD_PATH/BiosId.env -o $BUILD_PATH/BiosId.bin -ot
> $BUILD_PATH/BiosId.txt
> > -
> > -
> ##*******************************************************
> ***************
> > -## Build BIOS
> > -
> ##*******************************************************
> ***************
> > -echo "Invoking EDK2 build..."
> > -echo build $Build_Flags
> > -build $Build_Flags
> > -
> > -cp -f $BUILD_PATH/FV/VLV.fd $BUILD_PATH/FV/Vlv.ROM
> > -
> > -
> ##*******************************************************
> ***************
> > -## Build Capsules
> > -
> ##*******************************************************
> ***************
> > -echo "Invoking EDK2 build for capsules..."
> > -echo build $Capsule_Build_Flags -p
> $PLATFORM_PKG_PATH/PlatformCapsule${Arch}.dsc
> > -build      $Capsule_Build_Flags -p
> $PLATFORM_PKG_PATH/PlatformCapsule${Arch}.dsc
> > -
> > -echo
> > -echo -------------------- The EDKII BIOS build has
> successfully completed. --------------------
> > -echo
> > --
> > 2.21.0.windows.1
> >
> >
> > 
> >
> >

-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#44143): https://edk2.groups.io/g/devel/message/44143
Mute This Topic: https://groups.io/mt/32523935/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-