[edk2] [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Add option /m to enable multiple thread build

Yonghong Zhu posted 1 patch 6 years, 6 months ago
Failed in applying to current master (apply log)
BuildBIOS.bat                             | 12 ++++++++++--
Platform/BroxtonPlatformPkg/BuildBios.bat |  8 ++++++++
Platform/BroxtonPlatformPkg/BuildIFWI.bat | 13 +++++++++++--
3 files changed, 29 insertions(+), 4 deletions(-)
[edk2] [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Add option /m to enable multiple thread build
Posted by Yonghong Zhu 6 years, 6 months ago
current in windows it takes ~10 minutes to build a image, so we add
/m option to use EDK II build tool's multiple thread build function,
it can save about half build time.

Cc: zwei4 <david.wei@intel.com>
Contributed-under: TianoCore Contribution Agreement 1.1
Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
---
 BuildBIOS.bat                             | 12 ++++++++++--
 Platform/BroxtonPlatformPkg/BuildBios.bat |  8 ++++++++
 Platform/BroxtonPlatformPkg/BuildIFWI.bat | 13 +++++++++++--
 3 files changed, 29 insertions(+), 4 deletions(-)

diff --git a/BuildBIOS.bat b/BuildBIOS.bat
index 4bb4b03..baf7cdd 100644
--- a/BuildBIOS.bat
+++ b/BuildBIOS.bat
@@ -10,10 +10,11 @@ set PlatformName=
 set BuildTarget=Debug
 set Compiler=/vs13
 set Arch=/x64
 set FabId=/B
 set BoardId=/MN
+set buildthread=
 
 :: Optional arguments
 :OptLoop
 
 if /i "%~1"=="" goto Usage
@@ -84,22 +85,29 @@ if /i "%~1"=="/BG" (
     echo.
     shift
     goto OptLoop
 )
 
+if /i "%~1"=="/m" (
+    set buildthread=/m
+    echo.
+    shift
+    goto OptLoop
+)
+
 :: Required argument(s)
 :: Require 2 input parameters
 if "%~2"=="" goto Usage
 
 :: Assign required arguments
 set PlatformName=%~1
 set BuildTarget=%~2
 
 :OptLoopEnd
 echo ---- Call Build Script of Broxton ----
-echo calling : Platform\%PlatformName%PlatformPkg\BuildIFWI.bat  %Compiler% %Arch% %BoardId% %FabId% /fspw %BuildFlags% MINN %BuildTarget% 
-call Platform\%PlatformName%PlatformPkg\BuildIFWI.bat  %Compiler% %Arch% %BoardId% %FabId% /fspw %BuildFlags% MINN %BuildTarget% 
+echo calling : Platform\%PlatformName%PlatformPkg\BuildIFWI.bat %buildthread% %Compiler% %Arch% %BoardId% %FabId% /fspw %BuildFlags% MINN %BuildTarget% 
+call Platform\%PlatformName%PlatformPkg\BuildIFWI.bat %buildthread% %Compiler% %Arch% %BoardId% %FabId% /fspw %BuildFlags% MINN %BuildTarget% 
 
 goto Exit
 
 :Usage
 echo Usage: BuildBIOS.bat [options] ^<PlatformName^> ^<BuildTarget^>
diff --git a/Platform/BroxtonPlatformPkg/BuildBios.bat b/Platform/BroxtonPlatformPkg/BuildBios.bat
index 3ac411e..1e240e8 100644
--- a/Platform/BroxtonPlatformPkg/BuildBios.bat
+++ b/Platform/BroxtonPlatformPkg/BuildBios.bat
@@ -177,10 +177,18 @@ if /i "%~1"=="/BG" (
     echo.
     shift
     goto OptLoop
 )
 
+if /i "%~1"=="/m" (
+    if defined NUMBER_OF_PROCESSORS (
+        set /a build_threads=%NUMBER_OF_PROCESSORS%
+    )
+    shift
+    goto OptLoop
+)
+
 :: Required argument(s)
 if "%~2"=="" (
    echo. & echo -- ERROR: Not Enough Arguments Provided
    echo -- Please review the Help screen "/?" -- & echo.
    goto ExitFail
diff --git a/Platform/BroxtonPlatformPkg/BuildIFWI.bat b/Platform/BroxtonPlatformPkg/BuildIFWI.bat
index 1af0bf9..5042580 100644
--- a/Platform/BroxtonPlatformPkg/BuildIFWI.bat
+++ b/Platform/BroxtonPlatformPkg/BuildIFWI.bat
@@ -6,10 +6,11 @@ set exitCode=0
 set "Build_Flags= "
 set Arch=X64
 set SkipUsageFlag=FALSE
 set FabId=B
 set BoardId=MN
+set buildthread=
 set WORKSPACE=%CD%
 if %WORKSPACE:~-1%==\ (
   set WORKSPACE=%WORKSPACE:~0,-1%
 )
 set CORE_PATH=%WORKSPACE%\Core
@@ -102,10 +103,18 @@ if /i "%~1"=="/BG" (
     set Build_Flags=%Build_Flags% /BG
     shift
     goto OptLoop
 )
 
+if /i "%~1"=="/m" (
+    set buildthread=/m
+    echo.
+    shift
+    goto OptLoop
+)
+
+
 :: Require 2 input parameters
 if "%~2"=="" (
    echo. & echo -- ERROR: Not Enough Arguments Provided
    echo -- Please review the Help screen "/?" -- & echo.
    goto exit
@@ -118,12 +127,12 @@ set Build_Target=%~2
 :: Build BIOS
 echo ================================================================================
 echo Build_IFWI:  Calling BIOS build Script...
 echo.
 
-echo - call BuildBios.bat %Build_Flags% %Platform_Type% %Build_Target%
-call %WORKSPACE%\%PLATFORM_PATH%\BuildBios.bat %Build_Flags% %Platform_Type% %Build_Target%
+echo - call BuildBios.bat %buildthread% %Build_Flags% %Platform_Type% %Build_Target%
+call %WORKSPACE%\%PLATFORM_PATH%\BuildBios.bat %buildthread% %Build_Flags% %Platform_Type% %Build_Target%
 if ErrorLevel 1 (
     echo echo  -- Error Building BIOS  & echo.
     set exitCode=1
     goto exit
 )
-- 
2.6.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel
Re: [edk2] [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Add option /m to enable multiple thread build
Posted by Wei, David 6 years, 6 months ago
Reviewed-by: zwei4 <david.wei@intel.com>

Thanks,
David  Wei

Intel SSG/STO/UEFI BIOS                                 

> -----Original Message-----
> From: Zhu, Yonghong
> Sent: Friday, September 29, 2017 9:18 PM
> To: edk2-devel@lists.01.org
> Cc: Wei, David <david.wei@intel.com>
> Subject: [Patch][edk2-platforms/devel-MinnowBoard3-UDK2017] Add
> option /m to enable multiple thread build
> 
> current in windows it takes ~10 minutes to build a image, so we add
> /m option to use EDK II build tool's multiple thread build function,
> it can save about half build time.
> 
> Cc: zwei4 <david.wei@intel.com>
> Contributed-under: TianoCore Contribution Agreement 1.1
> Signed-off-by: Yonghong Zhu <yonghong.zhu@intel.com>
> ---
>  BuildBIOS.bat                             | 12 ++++++++++--
>  Platform/BroxtonPlatformPkg/BuildBios.bat |  8 ++++++++
>  Platform/BroxtonPlatformPkg/BuildIFWI.bat | 13 +++++++++++--
>  3 files changed, 29 insertions(+), 4 deletions(-)
> 
> diff --git a/BuildBIOS.bat b/BuildBIOS.bat
> index 4bb4b03..baf7cdd 100644
> --- a/BuildBIOS.bat
> +++ b/BuildBIOS.bat
> @@ -10,10 +10,11 @@ set PlatformName=
>  set BuildTarget=Debug
>  set Compiler=/vs13
>  set Arch=/x64
>  set FabId=/B
>  set BoardId=/MN
> +set buildthread=
> 
>  :: Optional arguments
>  :OptLoop
> 
>  if /i "%~1"=="" goto Usage
> @@ -84,22 +85,29 @@ if /i "%~1"=="/BG" (
>      echo.
>      shift
>      goto OptLoop
>  )
> 
> +if /i "%~1"=="/m" (
> +    set buildthread=/m
> +    echo.
> +    shift
> +    goto OptLoop
> +)
> +
>  :: Required argument(s)
>  :: Require 2 input parameters
>  if "%~2"=="" goto Usage
> 
>  :: Assign required arguments
>  set PlatformName=%~1
>  set BuildTarget=%~2
> 
>  :OptLoopEnd
>  echo ---- Call Build Script of Broxton ----
> -echo calling :
> Platform\%PlatformName%PlatformPkg\BuildIFWI.bat  %Compiler% %Arch%
>  %BoardId% %FabId% /fspw %BuildFlags% MINN %BuildTarget%
> -call
> Platform\%PlatformName%PlatformPkg\BuildIFWI.bat  %Compiler% %Arch%
>  %BoardId% %FabId% /fspw %BuildFlags% MINN %BuildTarget%
> +echo calling :
> Platform\%PlatformName%PlatformPkg\BuildIFWI.bat %buildthread% %Co
> mpiler% %Arch% %BoardId% %FabId% /fspw %BuildFlags%
> MINN %BuildTarget%
> +call
> Platform\%PlatformName%PlatformPkg\BuildIFWI.bat %buildthread% %Co
> mpiler% %Arch% %BoardId% %FabId% /fspw %BuildFlags%
> MINN %BuildTarget%
> 
>  goto Exit
> 
>  :Usage
>  echo Usage: BuildBIOS.bat [options] ^<PlatformName^> ^<BuildTarget^>
> diff --git a/Platform/BroxtonPlatformPkg/BuildBios.bat
> b/Platform/BroxtonPlatformPkg/BuildBios.bat
> index 3ac411e..1e240e8 100644
> --- a/Platform/BroxtonPlatformPkg/BuildBios.bat
> +++ b/Platform/BroxtonPlatformPkg/BuildBios.bat
> @@ -177,10 +177,18 @@ if /i "%~1"=="/BG" (
>      echo.
>      shift
>      goto OptLoop
>  )
> 
> +if /i "%~1"=="/m" (
> +    if defined NUMBER_OF_PROCESSORS (
> +        set /a build_threads=%NUMBER_OF_PROCESSORS%
> +    )
> +    shift
> +    goto OptLoop
> +)
> +
>  :: Required argument(s)
>  if "%~2"=="" (
>     echo. & echo -- ERROR: Not Enough Arguments Provided
>     echo -- Please review the Help screen "/?" -- & echo.
>     goto ExitFail
> diff --git a/Platform/BroxtonPlatformPkg/BuildIFWI.bat
> b/Platform/BroxtonPlatformPkg/BuildIFWI.bat
> index 1af0bf9..5042580 100644
> --- a/Platform/BroxtonPlatformPkg/BuildIFWI.bat
> +++ b/Platform/BroxtonPlatformPkg/BuildIFWI.bat
> @@ -6,10 +6,11 @@ set exitCode=0
>  set "Build_Flags= "
>  set Arch=X64
>  set SkipUsageFlag=FALSE
>  set FabId=B
>  set BoardId=MN
> +set buildthread=
>  set WORKSPACE=%CD%
>  if %WORKSPACE:~-1%==\ (
>    set WORKSPACE=%WORKSPACE:~0,-1%
>  )
>  set CORE_PATH=%WORKSPACE%\Core
> @@ -102,10 +103,18 @@ if /i "%~1"=="/BG" (
>      set Build_Flags=%Build_Flags% /BG
>      shift
>      goto OptLoop
>  )
> 
> +if /i "%~1"=="/m" (
> +    set buildthread=/m
> +    echo.
> +    shift
> +    goto OptLoop
> +)
> +
> +
>  :: Require 2 input parameters
>  if "%~2"=="" (
>     echo. & echo -- ERROR: Not Enough Arguments Provided
>     echo -- Please review the Help screen "/?" -- & echo.
>     goto exit
> @@ -118,12 +127,12 @@ set Build_Target=%~2
>  :: Build BIOS
>  echo
> ==========================================================
> ======================
>  echo Build_IFWI:  Calling BIOS build Script...
>  echo.
> 
> -echo - call BuildBios.bat %Build_Flags% %Platform_Type% %Build_Target%
> -
> call %WORKSPACE%\%PLATFORM_PATH%\BuildBios.bat %Build_Flags% %Pla
> tform_Type% %Build_Target%
> +echo - call
> BuildBios.bat %buildthread% %Build_Flags% %Platform_Type% %Build_Targe
> t%
> +call %WORKSPACE%\%PLATFORM_PATH%\BuildBios.bat %buildthread% %B
> uild_Flags% %Platform_Type% %Build_Target%
>  if ErrorLevel 1 (
>      echo echo  -- Error Building BIOS  & echo.
>      set exitCode=1
>      goto exit
>  )
> --
> 2.6.1.windows.1

_______________________________________________
edk2-devel mailing list
edk2-devel@lists.01.org
https://lists.01.org/mailman/listinfo/edk2-devel