Re: [edk2-devel] [edk2-platforms Patch 06/28] Vlv2TbltDevicePkg/bld_vlv.sh: Update the script to fit edk2-platforms

2019-07-10 Thread Sun, Zailiang
Reviewed-By: Zailiang Sun 

> -Original Message-
> From: Kinney, Michael D
> Sent: Thursday, July 11, 2019 3:05 AM
> To: devel@edk2.groups.io
> Cc: Gary Lin ; Sun, Zailiang ; Qian,
> Yi 
> Subject: [edk2-platforms Patch 06/28] Vlv2TbltDevicePkg/bld_vlv.sh: Update
> the script to fit edk2-platforms
> 
> From: Gary Lin 
> 
> * Add "set -e" to exit immediately on error
> 
> * Update the paths to fit the directory changes
> 
>   WORKSPACE
> +--edk2 (CORE)
> |
> +--edk2-platforms
> |   |
> |   +---Platform
> |   ||
> |   |+---Intel
> |   | |
> |   | +---Vlv2TbltDevicePkg (PLATFORM)
> |   |
> |   +---Silicon
> ||
> |+---Intel
> | |
> | +---Vlv2DeviceRefCodePkg (SILICON)
> |
> +--edk2-non-osi
> |
> +---Silicon
>  |
>  +---Intel
>   |
>   +---Vlv2SocBinPkg (BINARY)
> 
> * Sync a part of bld_vlv.sh from the devel-MinnowBoardMax-UDK2017
> branch
>   to enable capsule building
> 
> * Export TARGET and TOOL_CHAIN_TAG so that the GenerateCapsule scripts
>   can use those variables
> 
> Cc: Zailiang Sun 
> Cc: Yi Qian 
> Cc: Michael D Kinney 
> Signed-off-by: Gary Lin 
> ---
>  Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh | 57 -
>  1 file changed, 33 insertions(+), 24 deletions(-)
> 
> diff --git a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
> b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
> index 27772f47de..0aa1edfb22 100755
> --- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
> +++ b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
> @@ -7,7 +7,7 @@ function Usage() {
>echo
> "**
> *"
>echo "Build BIOS rom for VLV platforms."
>echo
> -  echo "Usage: bld_vlv.bat  PlatformType [Build Target]"
> +  echo "Usage: bld_vlv.sh  PlatformType [Build Target]"
>echo
>echo
>echo "   Platform Types:  MNW2"
> @@ -19,44 +19,52 @@ function Usage() {
>exit 0
>  }
> 
> +set -e
> 
> +cd ..
>  echo -e $(date)
> 
> ##
> **
>  ## Initial Setup
> 
> ##
> **
> -#WORKSPACE=$(pwd)
> +export WORKSPACE=$(pwd)
>  #build_threads=($NUMBER_OF_PROCESSORS)+1
>  Build_Flags=
>  exitCode=0
>  Arch=X64
>  SpiLock=0
> 
> +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:$CO
> RE_PATH
> +cd ./edk2
> +
>  ## Clean up previous build files.
> -if [ -e $(pwd)/EDK2.log ]; then
> -  rm $(pwd)/EDK2.log
> +if [ -e $CORE_PATH/EDK2.log ]; then
> +  rm $CORE_PATH/EDK2.log
>  fi
> 
> -if [ -e $(pwd)/Unitool.log ]; then
> -  rm $(pwd)/Unitool.log
> +if [ -e $CORE_PATH/Unitool.log ]; then
> +  rm $CORE_PATH/Unitool.log
>  fi
> 
> -if [ -e $(pwd)/Conf/target.txt ]; then
> -  rm $(pwd)/Conf/target.txt
> +if [ -e $CORE_PATH/Conf/target.txt ]; then
> +  rm $CORE_PATH/Conf/target.txt
>  fi
> 
> -if [ -e $(pwd)/Conf/BiosId.env ]; then
> -  rm $(pwd)/Conf/BiosId.env
> +if [ -e $CORE_PATH/Conf/BiosId.env ]; then
> +  rm $CORE_PATH/Conf/BiosId.env
>  fi
> 
> -if [ -e $(pwd)/Conf/tools_def.txt ]; then
> -  rm $(pwd)/Conf/tools_def.txt
> +if [ -e $CORE_PATH/Conf/tools_def.txt ]; then
> +  rm $CORE_PATH/Conf/tools_def.txt
>  fi
> 
> -if [ -e $(pwd)/Conf/build_rule.txt ]; then
> -  rm $(pwd)/Conf/build_rule.txt
> +if [ -e $CORE_PATH/Conf/build_rule.txt ]; then
> +  rm $CORE_PATH/Conf/build_rule.txt
>  fi
> 
> -
>  ## Setup EDK environment. Edksetup puts new copies of target.txt,
> tools_def.txt, build_rule.txt in WorkSpace\Conf  ## Also run edksetup as
> soon as possible to avoid it from changing environment variables we're
> overriding  . edksetup.sh BaseTools @@ -64,8 +72,9 @@ make -C BaseTools
> 
>  ## Define platform specific environment variables.
>  PLATFORM_PACKAGE=Vlv2TbltDevicePkg
> -config_file=$WORKSPACE/$PLATFORM_PACKAGE/PlatformPkgConfig.dsc
> -
> auto_config_inc=$WORKSPACE/$PLATFORM_PACKAGE/AutoPlatformCFG.tx
> t
> +PLATFORM_PKG_PATH=$PLATFORM_PATH/$PLATFORM_PACKAGE
> +config_file=$PLATFORM_PKG_PATH/PlatformPkgConfig.dsc
> +auto_config_inc=$PLATFORM_PKG_PATH/AutoPlatformCFG.txt
> 
>  ## create new AutoPlatformCFG.txt file
>  if [ -f "$auto_config_inc" ]; then
> @@ -112,10 +121,10 @@ fi
> 
>  ## Remove the values for Platform_Type and Build_Target from BiosIdX.env
> and stage in Conf  if [ $Arch == "IA32" ]; then
> -  cp $PLATFORM_PACKAGE/BiosIdR.envConf/BiosId.env
> +  cp 

[edk2-devel] [edk2-platforms Patch 06/28] Vlv2TbltDevicePkg/bld_vlv.sh: Update the script to fit edk2-platforms

2019-07-10 Thread Michael D Kinney
From: Gary Lin 

* Add "set -e" to exit immediately on error

* Update the paths to fit the directory changes

  WORKSPACE
+--edk2 (CORE)
|
+--edk2-platforms
|   |
|   +---Platform
|   ||
|   |+---Intel
|   | |
|   | +---Vlv2TbltDevicePkg (PLATFORM)
|   |
|   +---Silicon
||
|+---Intel
| |
| +---Vlv2DeviceRefCodePkg (SILICON)
|
+--edk2-non-osi
|
+---Silicon
 |
 +---Intel
  |
  +---Vlv2SocBinPkg (BINARY)

* Sync a part of bld_vlv.sh from the devel-MinnowBoardMax-UDK2017 branch
  to enable capsule building

* Export TARGET and TOOL_CHAIN_TAG so that the GenerateCapsule scripts
  can use those variables

Cc: Zailiang Sun 
Cc: Yi Qian 
Cc: Michael D Kinney 
Signed-off-by: Gary Lin 
---
 Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh | 57 -
 1 file changed, 33 insertions(+), 24 deletions(-)

diff --git a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh 
b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
index 27772f47de..0aa1edfb22 100755
--- a/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
+++ b/Platform/Intel/Vlv2TbltDevicePkg/bld_vlv.sh
@@ -7,7 +7,7 @@ function Usage() {
   echo 
"***"
   echo "Build BIOS rom for VLV platforms."
   echo
-  echo "Usage: bld_vlv.bat  PlatformType [Build Target]"
+  echo "Usage: bld_vlv.sh  PlatformType [Build Target]"
   echo
   echo
   echo "   Platform Types:  MNW2"
@@ -19,44 +19,52 @@ function Usage() {
   exit 0
 }
 
+set -e
 
+cd ..
 echo -e $(date)
 ##**
 ## Initial Setup
 ##**
-#WORKSPACE=$(pwd)
+export WORKSPACE=$(pwd)
 #build_threads=($NUMBER_OF_PROCESSORS)+1
 Build_Flags=
 exitCode=0
 Arch=X64
 SpiLock=0
 
+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
+cd ./edk2
+
 ## Clean up previous build files.
-if [ -e $(pwd)/EDK2.log ]; then
-  rm $(pwd)/EDK2.log
+if [ -e $CORE_PATH/EDK2.log ]; then
+  rm $CORE_PATH/EDK2.log
 fi
 
-if [ -e $(pwd)/Unitool.log ]; then
-  rm $(pwd)/Unitool.log
+if [ -e $CORE_PATH/Unitool.log ]; then
+  rm $CORE_PATH/Unitool.log
 fi
 
-if [ -e $(pwd)/Conf/target.txt ]; then
-  rm $(pwd)/Conf/target.txt
+if [ -e $CORE_PATH/Conf/target.txt ]; then
+  rm $CORE_PATH/Conf/target.txt
 fi
 
-if [ -e $(pwd)/Conf/BiosId.env ]; then
-  rm $(pwd)/Conf/BiosId.env
+if [ -e $CORE_PATH/Conf/BiosId.env ]; then
+  rm $CORE_PATH/Conf/BiosId.env
 fi
 
-if [ -e $(pwd)/Conf/tools_def.txt ]; then
-  rm $(pwd)/Conf/tools_def.txt
+if [ -e $CORE_PATH/Conf/tools_def.txt ]; then
+  rm $CORE_PATH/Conf/tools_def.txt
 fi
 
-if [ -e $(pwd)/Conf/build_rule.txt ]; then
-  rm $(pwd)/Conf/build_rule.txt
+if [ -e $CORE_PATH/Conf/build_rule.txt ]; then
+  rm $CORE_PATH/Conf/build_rule.txt
 fi
 
-
 ## Setup EDK environment. Edksetup puts new copies of target.txt, 
tools_def.txt, build_rule.txt in WorkSpace\Conf
 ## Also run edksetup as soon as possible to avoid it from changing environment 
variables we're overriding
 . edksetup.sh BaseTools
@@ -64,8 +72,9 @@ make -C BaseTools
 
 ## Define platform specific environment variables.
 PLATFORM_PACKAGE=Vlv2TbltDevicePkg
-config_file=$WORKSPACE/$PLATFORM_PACKAGE/PlatformPkgConfig.dsc
-auto_config_inc=$WORKSPACE/$PLATFORM_PACKAGE/AutoPlatformCFG.txt
+PLATFORM_PKG_PATH=$PLATFORM_PATH/$PLATFORM_PACKAGE
+config_file=$PLATFORM_PKG_PATH/PlatformPkgConfig.dsc
+auto_config_inc=$PLATFORM_PKG_PATH/AutoPlatformCFG.txt
 
 ## create new AutoPlatformCFG.txt file
 if [ -f "$auto_config_inc" ]; then
@@ -112,10 +121,10 @@ fi
 
 ## Remove the values for Platform_Type and Build_Target from BiosIdX.env and 
stage in Conf
 if [ $Arch == "IA32" ]; then
-  cp $PLATFORM_PACKAGE/BiosIdR.envConf/BiosId.env
+  cp $PLATFORM_PKG_PATH/BiosIdR.env Conf/BiosId.env
   echo DEFINE X64_CONFIG = FALSE  >> $auto_config_inc
 else
-  cp $PLATFORM_PACKAGE/BiosIdx64R.env  Conf/BiosId.env
+  cp $PLATFORM_PKG_PATH/BiosIdx64R.env Conf/BiosId.env
   echo DEFINE X64_CONFIG = TRUE   >> $auto_config_inc
 fi
 sed -i '/^BOARD_ID/d' Conf/BiosId.env
@@ -142,11 +151,11 @@ fi
 Platform_Type=$1
 
 if [ "$(echo $2 | tr 'a-z' 'A-Z')" == "RELEASE" ]; then
-  TARGET=RELEASE
+  export TARGET=RELEASE
   BUILD_TYPE=R
   echo BUILD_TYPE = R >> Conf/BiosId.env
 else
-  TARGET=DEBUG
+  export TARGET=DEBUG
   BUILD_TYPE=D
   echo BUILD_TYPE = D >> Conf/BiosId.env
 fi