From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pl1-f182.google.com (mail-pl1-f182.google.com [209.85.214.182]) by mx.groups.io with SMTP id smtpd.web08.3760.1612831863234331990 for ; Mon, 08 Feb 2021 16:51:03 -0800 Authentication-Results: mx.groups.io; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cAkAWrfK; spf=pass (domain: gmail.com, ip: 209.85.214.182, mailfrom: matthewfcarlson@gmail.com) Received: by mail-pl1-f182.google.com with SMTP id e9so8792626plh.3 for ; Mon, 08 Feb 2021 16:51:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ykhpoZ5MdNQhd633Nxktj5DML3O+9eW/bSPVZagSgb4=; b=cAkAWrfK0BAalW92s5CbsDkz3YuWswpxCHAJlJ9YAYmNhuwUotx2abnYJzjIY4cCFF MVTHMQStcB9uzMjVyVA3RWp3CBoQN1eAyGpiJOAQQN7855/54sY+JHy6U+EBALaf89ov Ft2eult9ekXvoxeJSscTwULt9Py955MK9GZsw+AYfgpOsZZSnWCjt4SmybquVErANT0U pcYt8HZhqQB5TQ9ld+lPhcpRjg0nMtJTBomIXBRTUIbakSSVJ4pBMnWGg7pyluGfxZUj 9i68xnufVBcYwtrWEmXk43YDshycz1EoIBvCFXxKcZVIMiaqv6TbpFcPGuQaDoAJWW4/ q29w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ykhpoZ5MdNQhd633Nxktj5DML3O+9eW/bSPVZagSgb4=; b=hMlhtUlKOng6QWSo9EehFXjTh2iEw+fJl+hU5ypCv5cYP/2Ke+IsyKx5RFrFerXdfH YZoTXWTqr3MQonVMMDyT/hE6iiApHtSsg5hhZRBM/GerHnzNEu/Goguzc7qlxMUgAL90 HxDE2ROpp3wegt3Yiu4Cm3ZlgO5YKPWYXKzElupdAnavbtAhDkKL8nhfW6EsQYk1ay+o KZZfurJ9DBCUucWq1DDVANwJ8qhFCXiGA9cvAo/eknIMFUNoDi48WPM1AQ3d+c4Av7JB Dd2MBxT5tLBprOGm8au14QiAnA62rixH5VelBZ5FQjcdymZa2gNgrBXHQoZ3fD0p1u4u X6Lw== X-Gm-Message-State: AOAM532JClFpwsRy8GQs2bGGnRIxE23j1qze4xYQM05egPtbPV5Msj+C 3YdDr+3ydRBAgQlhbYg8rAk2RK6wtBN5wQ== X-Google-Smtp-Source: ABdhPJzgFOQ0PXKSaEoeCJwKoW4CPXAHWpyr//9pWWkH7Eg8NZIx7VeZFtioEIdvCoeQgcaGxVc9wQ== X-Received: by 2002:a17:90a:4588:: with SMTP id v8mr1445310pjg.58.1612831862382; Mon, 08 Feb 2021 16:51:02 -0800 (PST) Return-Path: Received: from localhost.localdomain ([50.34.38.126]) by smtp.gmail.com with ESMTPSA id d13sm453118pjz.3.2021.02.08.16.51.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Feb 2021 16:51:01 -0800 (PST) From: "Matthew Carlson" To: devel@edk2.groups.io Cc: Bob Feng , Liming Gao , Yuwei Chen , Matthew Carlson Subject: [PATCH v5 1/1] BaseTools: Use pip module if available, CI uses it by default Date: Mon, 8 Feb 2021 16:50:33 -0800 Message-Id: <20210209005033.596-2-matthewfcarlson@gmail.com> X-Mailer: git-send-email 2.29.0.vfs.0.0 In-Reply-To: <20210209005033.596-1-matthewfcarlson@gmail.com> References: <20210209005033.596-1-matthewfcarlson@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Matthew Carlson Use the new edk2-basetools pip module. Includes a helpful message in setup to let users know which has been selected. Cc: Bob Feng Cc: Liming Gao Cc: Yuwei Chen Reviewed-by: Bob Feng Signed-off-by: Matthew Carlson --- .pytool/CISettings.py = | 51 +++++++++++++++----- BaseTools/BinPipWrappers/PosixLike/AmlToC = | 14 ++++++ BaseTools/BinPipWrappers/PosixLike/BPDG = | 12 +++++ BaseTools/BinPipWrappers/PosixLike/BrotliCompress = | 34 +++++++++++++ BaseTools/BinPipWrappers/PosixLike/DevicePath = | 29 +++++++++++ BaseTools/BinPipWrappers/PosixLike/Ecc = | 13 +++++ BaseTools/BinPipWrappers/PosixLike/EfiRom = | 29 +++++++++++ BaseTools/BinPipWrappers/PosixLike/GenCrc32 = | 29 +++++++++++ BaseTools/BinPipWrappers/PosixLike/GenDepex = | 12 +++++ BaseTools/BinPipWrappers/PosixLike/GenFds = | 12 +++++ BaseTools/BinPipWrappers/PosixLike/GenFfs = | 29 +++++++++++ BaseTools/BinPipWrappers/PosixLike/GenFv = | 29 +++++++++++ BaseTools/BinPipWrappers/PosixLike/GenFw = | 29 +++++++++++ BaseTools/BinPipWrappers/PosixLike/GenPatchPcdTable = | 12 +++++ BaseTools/BinPipWrappers/PosixLike/GenSec = | 29 +++++++++++ BaseTools/BinPipWrappers/PosixLike/GenerateCapsule = | 12 +++++ BaseTools/BinPipWrappers/PosixLike/LzmaCompress = | 29 +++++++++++ BaseTools/BinPipWrappers/PosixLike/LzmaF86Compress = | 19 ++++++++ BaseTools/BinPipWrappers/PosixLike/PatchPcdValue = | 12 +++++ BaseTools/BinPipWrappers/PosixLike/Pkcs7Sign = | 12 +++++ BaseTools/BinPipWrappers/PosixLike/Rsa2048Sha256GenerateKeys = | 12 +++++ BaseTools/BinPipWrappers/PosixLike/Rsa2048Sha256Sign = | 12 +++++ BaseTools/BinPipWrappers/PosixLike/Split = | 29 +++++++++++ BaseTools/BinPipWrappers/PosixLike/TargetTool = | 12 +++++ BaseTools/BinPipWrappers/PosixLike/TianoCompress = | 29 +++++++++++ BaseTools/BinPipWrappers/PosixLike/Trim = | 13 +++++ BaseTools/BinPipWrappers/PosixLike/UPT = | 12 +++++ BaseTools/BinPipWrappers/PosixLike/VfrCompile = | 29 +++++++++++ BaseTools/BinPipWrappers/PosixLike/VolInfo = | 29 +++++++++++ BaseTools/BinPipWrappers/PosixLike/build = | 12 +++++ BaseTools/{BinWrappers =3D> BinPipWrappers}/PosixLike/posix_path_env.yaml = | 21 ++++---- BaseTools/BinPipWrappers/WindowsLike/AmlToC.bat = | 3 ++ BaseTools/BinPipWrappers/WindowsLike/BPDG.bat = | 3 ++ BaseTools/BinPipWrappers/WindowsLike/Ecc.bat = | 3 ++ BaseTools/BinPipWrappers/WindowsLike/GenDepex.bat = | 3 ++ BaseTools/BinPipWrappers/WindowsLike/GenFds.bat = | 3 ++ BaseTools/BinPipWrappers/WindowsLike/GenPatchPcdTable.bat = | 3 ++ BaseTools/BinPipWrappers/WindowsLike/GenerateCapsule.bat = | 1 + BaseTools/BinPipWrappers/WindowsLike/PatchPcdValue.bat = | 3 ++ BaseTools/BinPipWrappers/WindowsLike/Pkcs7Sign.bat = | 3 ++ BaseTools/BinPipWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat = | 1 + BaseTools/BinPipWrappers/WindowsLike/Rsa2048Sha256Sign.bat = | 3 ++ BaseTools/BinPipWrappers/WindowsLike/Split.bat = | 3 ++ BaseTools/BinPipWrappers/WindowsLike/TargetTool.bat = | 3 ++ BaseTools/BinPipWrappers/WindowsLike/Trim.bat = | 3 ++ BaseTools/BinPipWrappers/WindowsLike/UPT.bat = | 3 ++ BaseTools/BinPipWrappers/WindowsLike/build.bat = | 3 ++ BaseTools/{BinWrappers =3D> BinPipWrappers}/WindowsLike/win_build_tools_pa= th_env.yaml | 3 +- BaseTools/BinWrappers/PosixLike/posix_path_env.yaml = | 1 + BaseTools/BinWrappers/WindowsLike/win_build_tools_path_env.yaml = | 1 + BaseTools/BuildEnv = | 14 +++++- BaseTools/Scripts/PatchCheck.py = | 1 + BaseTools/Source/Python/README.md = | 29 +++++++++++ BaseTools/toolsetup.bat = | 19 ++++++++ pip-requirements.txt = | 1 + 55 files changed, 745 insertions(+), 25 deletions(-) diff --git a/.pytool/CISettings.py b/.pytool/CISettings.py index e6c5ac700ab2..5f71eca1992e 100644 --- a/.pytool/CISettings.py +++ b/.pytool/CISettings.py @@ -22,16 +22,24 @@ class Settings(CiBuildSettingsManager, UpdateSettingsMa= nager, SetupSettingsManag self.ActualTargets =3D []=0D self.ActualArchitectures =3D []=0D self.ActualToolChainTag =3D ""=0D + self.UseBuiltInBaseTools =3D None=0D + self.ActualScopes =3D None=0D =0D # ####################################################################= ################### #=0D # Extra CmdLine configuration = #=0D # ####################################################################= ################### #=0D =0D def AddCommandLineOptions(self, parserObj):=0D - pass=0D + group =3D parserObj.add_mutually_exclusive_group()=0D + group.add_argument("-force_piptools", "--fpt", dest=3D"force_pipto= ols", action=3D"store_true", default=3DFalse, help=3D"Force the system to u= se pip tools")=0D + group.add_argument("-no_piptools", "--npt", dest=3D"no_piptools", = action=3D"store_true", default=3DFalse, help=3D"Force the system to not use= pip tools")=0D =0D def RetrieveCommandLineOptions(self, args):=0D - pass=0D + super().RetrieveCommandLineOptions(args)=0D + if args.force_piptools:=0D + self.UseBuiltInBaseTools =3D True=0D + if args.no_piptools:=0D + self.UseBuiltInBaseTools =3D False=0D =0D # ####################################################################= ################### #=0D # Default Support for this Ci Build = #=0D @@ -128,19 +136,38 @@ class Settings(CiBuildSettingsManager, UpdateSettings= Manager, SetupSettingsManag =0D def GetActiveScopes(self):=0D ''' return tuple containing scopes that should be active for this = process '''=0D - scopes =3D ("cibuild", "edk2-build", "host-based-test")=0D + if self.ActualScopes is None:=0D + scopes =3D ("cibuild", "edk2-build", "host-based-test")=0D =0D - self.ActualToolChainTag =3D shell_environment.GetBuildVars().GetVa= lue("TOOL_CHAIN_TAG", "")=0D + self.ActualToolChainTag =3D shell_environment.GetBuildVars().G= etValue("TOOL_CHAIN_TAG", "")=0D =0D - if GetHostInfo().os.upper() =3D=3D "LINUX" and self.ActualToolChai= nTag.upper().startswith("GCC"):=0D - if "AARCH64" in self.ActualArchitectures:=0D - scopes +=3D ("gcc_aarch64_linux",)=0D - if "ARM" in self.ActualArchitectures:=0D - scopes +=3D ("gcc_arm_linux",)=0D - if "RISCV64" in self.ActualArchitectures:=0D - scopes +=3D ("gcc_riscv64_unknown",)=0D + is_linux =3D GetHostInfo().os.upper() =3D=3D "LINUX"=0D =0D - return scopes=0D + if self.UseBuiltInBaseTools is None:=0D + is_linux =3D GetHostInfo().os.upper() =3D=3D "LINUX"=0D + # try and import the pip module for basetools=0D + try:=0D + import edk2basetools=0D + self.UseBuiltInBaseTools =3D True=0D + except ImportError:=0D + self.UseBuiltInBaseTools =3D False=0D + pass=0D +=0D + if self.UseBuiltInBaseTools =3D=3D True:=0D + scopes +=3D ('pipbuild-unix',) if is_linux else ('pipbuild= -win',)=0D + logging.warning("Using Pip Tools based BaseTools")=0D + else:=0D + logging.warning("Falling back to using in-tree BaseTools")= =0D +=0D + if is_linux and self.ActualToolChainTag.upper().startswith("GC= C"):=0D + if "AARCH64" in self.ActualArchitectures:=0D + scopes +=3D ("gcc_aarch64_linux",)=0D + if "ARM" in self.ActualArchitectures:=0D + scopes +=3D ("gcc_arm_linux",)=0D + if "RISCV64" in self.ActualArchitectures:=0D + scopes +=3D ("gcc_riscv64_unknown",)=0D + self.ActualScopes =3D scopes=0D + return self.ActualScopes=0D =0D def GetRequiredSubmodules(self):=0D ''' return iterable containing RequiredSubmodule objects.=0D diff --git a/BaseTools/BinPipWrappers/PosixLike/AmlToC b/BaseTools/BinPipWr= appers/PosixLike/AmlToC new file mode 100755 index 000000000000..1dd28e966288 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/AmlToC @@ -0,0 +1,14 @@ +#!/usr/bin/env bash +#python `dirname $0`/RunToolFromSource.py `basename $0` $* + +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +dir=3D$(dirname "$full_cmd") +exe=3D$(basename "$full_cmd") + +export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" +exec "${python_exe:-python}" "$dir/../../Source/Python/$exe/$exe.py" "$@" diff --git a/BaseTools/BinPipWrappers/PosixLike/BPDG b/BaseTools/BinPipWrap= pers/PosixLike/BPDG new file mode 100755 index 000000000000..a08cbd8de5c5 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/BPDG @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +#python `dirname $0`/RunToolFromSource.py `basename $0` $* + +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +cmd=3D${full_cmd##*/} + +exec "${python_exe:-python}" -m edk2basetools.$cmd.EccMain "$@" diff --git a/BaseTools/BinPipWrappers/PosixLike/BrotliCompress b/BaseTools/= BinPipWrappers/PosixLike/BrotliCompress new file mode 100755 index 000000000000..663860bb3e57 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/BrotliCompress @@ -0,0 +1,34 @@ +#!/usr/bin/env bash +# +# This script will exec Brotli tool with -e/-d options. +# +# Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# +QLT=3D"-q 9 -w 22" +ARGS=3D + +while test $# -gt 0 +do + case $1 in + -e) + ;; + -d) + ARGS+=3D"$1 " + ;; + -o|-g) + ARGS+=3D"$1 $2 " + shift + ;; + -q) + QLT=3D"$1 $2 " + shift + ;; + *) + ARGS+=3D"$1 " + ;; + esac + shift +done + +exec Brotli $QLT $ARGS diff --git a/BaseTools/BinPipWrappers/PosixLike/DevicePath b/BaseTools/BinP= ipWrappers/PosixLike/DevicePath new file mode 100755 index 000000000000..0945d86d9209 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/DevicePath @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +dir=3D$(dirname "$full_cmd") +cmd=3D${full_cmd##*/} + +if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] +then + exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" +elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] +then + if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] + then + echo "BaseTools C Tool binary was not found ($cmd)" + echo "You may need to run:" + echo " make -C $EDK_TOOLS_PATH/Source/C" + else + exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" + fi +elif [ -e "$dir/../../Source/C/bin/$cmd" ] +then + exec "$dir/../../Source/C/bin/$cmd" "$@" +else + echo "Unable to find the real '$cmd' to run" + echo "This message was printed by" + echo " $0" + exit 127 +fi + diff --git a/BaseTools/BinPipWrappers/PosixLike/Ecc b/BaseTools/BinPipWrapp= ers/PosixLike/Ecc new file mode 100755 index 000000000000..598728915095 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/Ecc @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +#python `dirname $0`/RunToolFromSource.py `basename $0` $* + +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +cmd=3D${full_cmd##*/} + +export PYTHONPATH=3D"$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}" +exec "${python_exe:-python}" -m $cmd.EccMain "$@" diff --git a/BaseTools/BinPipWrappers/PosixLike/EfiRom b/BaseTools/BinPipWr= appers/PosixLike/EfiRom new file mode 100755 index 000000000000..0945d86d9209 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/EfiRom @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +dir=3D$(dirname "$full_cmd") +cmd=3D${full_cmd##*/} + +if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] +then + exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" +elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] +then + if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] + then + echo "BaseTools C Tool binary was not found ($cmd)" + echo "You may need to run:" + echo " make -C $EDK_TOOLS_PATH/Source/C" + else + exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" + fi +elif [ -e "$dir/../../Source/C/bin/$cmd" ] +then + exec "$dir/../../Source/C/bin/$cmd" "$@" +else + echo "Unable to find the real '$cmd' to run" + echo "This message was printed by" + echo " $0" + exit 127 +fi + diff --git a/BaseTools/BinPipWrappers/PosixLike/GenCrc32 b/BaseTools/BinPip= Wrappers/PosixLike/GenCrc32 new file mode 100755 index 000000000000..0945d86d9209 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/GenCrc32 @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +dir=3D$(dirname "$full_cmd") +cmd=3D${full_cmd##*/} + +if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] +then + exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" +elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] +then + if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] + then + echo "BaseTools C Tool binary was not found ($cmd)" + echo "You may need to run:" + echo " make -C $EDK_TOOLS_PATH/Source/C" + else + exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" + fi +elif [ -e "$dir/../../Source/C/bin/$cmd" ] +then + exec "$dir/../../Source/C/bin/$cmd" "$@" +else + echo "Unable to find the real '$cmd' to run" + echo "This message was printed by" + echo " $0" + exit 127 +fi + diff --git a/BaseTools/BinPipWrappers/PosixLike/GenDepex b/BaseTools/BinPip= Wrappers/PosixLike/GenDepex new file mode 100755 index 000000000000..df75e43f9ec1 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/GenDepex @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +#python `dirname $0`/RunToolFromSource.py `basename $0` $* + +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +cmd=3D${full_cmd##*/} + +exec "${python_exe:-python}" -m edk2basetools.AutoGen.$cmd "$@" diff --git a/BaseTools/BinPipWrappers/PosixLike/GenFds b/BaseTools/BinPipWr= appers/PosixLike/GenFds new file mode 100755 index 000000000000..b27e84eaa210 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/GenFds @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +#python `dirname $0`/RunToolFromSource.py `basename $0` $* + +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +cmd=3D${full_cmd##*/} + +exec "${python_exe:-python}" -m edk2basetools.$cmd "$@" diff --git a/BaseTools/BinPipWrappers/PosixLike/GenFfs b/BaseTools/BinPipWr= appers/PosixLike/GenFfs new file mode 100755 index 000000000000..0945d86d9209 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/GenFfs @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +dir=3D$(dirname "$full_cmd") +cmd=3D${full_cmd##*/} + +if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] +then + exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" +elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] +then + if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] + then + echo "BaseTools C Tool binary was not found ($cmd)" + echo "You may need to run:" + echo " make -C $EDK_TOOLS_PATH/Source/C" + else + exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" + fi +elif [ -e "$dir/../../Source/C/bin/$cmd" ] +then + exec "$dir/../../Source/C/bin/$cmd" "$@" +else + echo "Unable to find the real '$cmd' to run" + echo "This message was printed by" + echo " $0" + exit 127 +fi + diff --git a/BaseTools/BinPipWrappers/PosixLike/GenFv b/BaseTools/BinPipWra= ppers/PosixLike/GenFv new file mode 100755 index 000000000000..0945d86d9209 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/GenFv @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +dir=3D$(dirname "$full_cmd") +cmd=3D${full_cmd##*/} + +if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] +then + exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" +elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] +then + if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] + then + echo "BaseTools C Tool binary was not found ($cmd)" + echo "You may need to run:" + echo " make -C $EDK_TOOLS_PATH/Source/C" + else + exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" + fi +elif [ -e "$dir/../../Source/C/bin/$cmd" ] +then + exec "$dir/../../Source/C/bin/$cmd" "$@" +else + echo "Unable to find the real '$cmd' to run" + echo "This message was printed by" + echo " $0" + exit 127 +fi + diff --git a/BaseTools/BinPipWrappers/PosixLike/GenFw b/BaseTools/BinPipWra= ppers/PosixLike/GenFw new file mode 100755 index 000000000000..0945d86d9209 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/GenFw @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +dir=3D$(dirname "$full_cmd") +cmd=3D${full_cmd##*/} + +if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] +then + exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" +elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] +then + if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] + then + echo "BaseTools C Tool binary was not found ($cmd)" + echo "You may need to run:" + echo " make -C $EDK_TOOLS_PATH/Source/C" + else + exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" + fi +elif [ -e "$dir/../../Source/C/bin/$cmd" ] +then + exec "$dir/../../Source/C/bin/$cmd" "$@" +else + echo "Unable to find the real '$cmd' to run" + echo "This message was printed by" + echo " $0" + exit 127 +fi + diff --git a/BaseTools/BinPipWrappers/PosixLike/GenPatchPcdTable b/BaseTool= s/BinPipWrappers/PosixLike/GenPatchPcdTable new file mode 100755 index 000000000000..9d143c7fc6c2 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/GenPatchPcdTable @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +#python `dirname $0`/RunToolFromSource.py `basename $0` $* + +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +cmd=3D${full_cmd##*/} + +exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@" diff --git a/BaseTools/BinPipWrappers/PosixLike/GenSec b/BaseTools/BinPipWr= appers/PosixLike/GenSec new file mode 100755 index 000000000000..0945d86d9209 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/GenSec @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +dir=3D$(dirname "$full_cmd") +cmd=3D${full_cmd##*/} + +if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] +then + exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" +elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] +then + if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] + then + echo "BaseTools C Tool binary was not found ($cmd)" + echo "You may need to run:" + echo " make -C $EDK_TOOLS_PATH/Source/C" + else + exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" + fi +elif [ -e "$dir/../../Source/C/bin/$cmd" ] +then + exec "$dir/../../Source/C/bin/$cmd" "$@" +else + echo "Unable to find the real '$cmd' to run" + echo "This message was printed by" + echo " $0" + exit 127 +fi + diff --git a/BaseTools/BinPipWrappers/PosixLike/GenerateCapsule b/BaseTools= /BinPipWrappers/PosixLike/GenerateCapsule new file mode 100755 index 000000000000..366a268802c4 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/GenerateCapsule @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +#python `dirname $0`/RunToolFromSource.py `basename $0` $* + +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +cmd=3D${full_cmd##*/} + +exec "${python_exe:-python}" -m edk2basetools.Capsule.$cmd "$@" diff --git a/BaseTools/BinPipWrappers/PosixLike/LzmaCompress b/BaseTools/Bi= nPipWrappers/PosixLike/LzmaCompress new file mode 100755 index 000000000000..0945d86d9209 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/LzmaCompress @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +dir=3D$(dirname "$full_cmd") +cmd=3D${full_cmd##*/} + +if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] +then + exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" +elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] +then + if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] + then + echo "BaseTools C Tool binary was not found ($cmd)" + echo "You may need to run:" + echo " make -C $EDK_TOOLS_PATH/Source/C" + else + exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" + fi +elif [ -e "$dir/../../Source/C/bin/$cmd" ] +then + exec "$dir/../../Source/C/bin/$cmd" "$@" +else + echo "Unable to find the real '$cmd' to run" + echo "This message was printed by" + echo " $0" + exit 127 +fi + diff --git a/BaseTools/BinPipWrappers/PosixLike/LzmaF86Compress b/BaseTools= /BinPipWrappers/PosixLike/LzmaF86Compress new file mode 100755 index 000000000000..b55352ae4c79 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/LzmaF86Compress @@ -0,0 +1,19 @@ +#!/usr/bin/env bash +# +# This script will exec LzmaCompress tool with --f86 option that enables c= onverter for x86 code. +# +# (C) Copyright 2016 Hewlett Packard Enterprise Development LP
+# Copyright (c) 2012, Intel Corporation. All rights reserved.
+# SPDX-License-Identifier: BSD-2-Clause-Patent +# + +for arg; do + case $arg in + -e|-d) + set -- "$@" --f86 + break + ;; + esac +done + +exec LzmaCompress "$@" diff --git a/BaseTools/BinPipWrappers/PosixLike/PatchPcdValue b/BaseTools/B= inPipWrappers/PosixLike/PatchPcdValue new file mode 100755 index 000000000000..9d143c7fc6c2 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/PatchPcdValue @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +#python `dirname $0`/RunToolFromSource.py `basename $0` $* + +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +cmd=3D${full_cmd##*/} + +exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@" diff --git a/BaseTools/BinPipWrappers/PosixLike/Pkcs7Sign b/BaseTools/BinPi= pWrappers/PosixLike/Pkcs7Sign new file mode 100755 index 000000000000..9d143c7fc6c2 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/Pkcs7Sign @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +#python `dirname $0`/RunToolFromSource.py `basename $0` $* + +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +cmd=3D${full_cmd##*/} + +exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@" diff --git a/BaseTools/BinPipWrappers/PosixLike/Rsa2048Sha256GenerateKeys b= /BaseTools/BinPipWrappers/PosixLike/Rsa2048Sha256GenerateKeys new file mode 100755 index 000000000000..aca2f3a6fe2a --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/Rsa2048Sha256GenerateKeys @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +#python `dirname $0`/RunToolFromSource.py `basename $0` $* + +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +cmd=3D${full_cmd##*/} + +exec "${python_exe:-python}" -m edk2basetools.Rsa2048Sha256Sign.$cmd "$@" diff --git a/BaseTools/BinPipWrappers/PosixLike/Rsa2048Sha256Sign b/BaseToo= ls/BinPipWrappers/PosixLike/Rsa2048Sha256Sign new file mode 100755 index 000000000000..068364070518 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/Rsa2048Sha256Sign @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +#python `dirname $0`/RunToolFromSource.py `basename $0` $* + +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +cmd=3D${full_cmd##*/} + +exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@" \ No newline at end of file diff --git a/BaseTools/BinPipWrappers/PosixLike/Split b/BaseTools/BinPipWra= ppers/PosixLike/Split new file mode 100755 index 000000000000..0945d86d9209 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/Split @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +dir=3D$(dirname "$full_cmd") +cmd=3D${full_cmd##*/} + +if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] +then + exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" +elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] +then + if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] + then + echo "BaseTools C Tool binary was not found ($cmd)" + echo "You may need to run:" + echo " make -C $EDK_TOOLS_PATH/Source/C" + else + exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" + fi +elif [ -e "$dir/../../Source/C/bin/$cmd" ] +then + exec "$dir/../../Source/C/bin/$cmd" "$@" +else + echo "Unable to find the real '$cmd' to run" + echo "This message was printed by" + echo " $0" + exit 127 +fi + diff --git a/BaseTools/BinPipWrappers/PosixLike/TargetTool b/BaseTools/BinP= ipWrappers/PosixLike/TargetTool new file mode 100755 index 000000000000..9d143c7fc6c2 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/TargetTool @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +#python `dirname $0`/RunToolFromSource.py `basename $0` $* + +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +cmd=3D${full_cmd##*/} + +exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@" diff --git a/BaseTools/BinPipWrappers/PosixLike/TianoCompress b/BaseTools/B= inPipWrappers/PosixLike/TianoCompress new file mode 100755 index 000000000000..0945d86d9209 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/TianoCompress @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +dir=3D$(dirname "$full_cmd") +cmd=3D${full_cmd##*/} + +if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] +then + exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" +elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] +then + if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] + then + echo "BaseTools C Tool binary was not found ($cmd)" + echo "You may need to run:" + echo " make -C $EDK_TOOLS_PATH/Source/C" + else + exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" + fi +elif [ -e "$dir/../../Source/C/bin/$cmd" ] +then + exec "$dir/../../Source/C/bin/$cmd" "$@" +else + echo "Unable to find the real '$cmd' to run" + echo "This message was printed by" + echo " $0" + exit 127 +fi + diff --git a/BaseTools/BinPipWrappers/PosixLike/Trim b/BaseTools/BinPipWrap= pers/PosixLike/Trim new file mode 100755 index 000000000000..0bd14ee03872 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/Trim @@ -0,0 +1,13 @@ +#!/usr/bin/env bash +#python `dirname $0`/RunToolFromSource.py `basename $0` $* + +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +cmd=3D$(basename "$full_cmd") + +exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@" + diff --git a/BaseTools/BinPipWrappers/PosixLike/UPT b/BaseTools/BinPipWrapp= ers/PosixLike/UPT new file mode 100755 index 000000000000..068364070518 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/UPT @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +#python `dirname $0`/RunToolFromSource.py `basename $0` $* + +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +cmd=3D${full_cmd##*/} + +exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@" \ No newline at end of file diff --git a/BaseTools/BinPipWrappers/PosixLike/VfrCompile b/BaseTools/BinP= ipWrappers/PosixLike/VfrCompile new file mode 100755 index 000000000000..0945d86d9209 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/VfrCompile @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +dir=3D$(dirname "$full_cmd") +cmd=3D${full_cmd##*/} + +if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] +then + exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" +elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] +then + if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] + then + echo "BaseTools C Tool binary was not found ($cmd)" + echo "You may need to run:" + echo " make -C $EDK_TOOLS_PATH/Source/C" + else + exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" + fi +elif [ -e "$dir/../../Source/C/bin/$cmd" ] +then + exec "$dir/../../Source/C/bin/$cmd" "$@" +else + echo "Unable to find the real '$cmd' to run" + echo "This message was printed by" + echo " $0" + exit 127 +fi + diff --git a/BaseTools/BinPipWrappers/PosixLike/VolInfo b/BaseTools/BinPipW= rappers/PosixLike/VolInfo new file mode 100755 index 000000000000..0945d86d9209 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/VolInfo @@ -0,0 +1,29 @@ +#!/usr/bin/env bash + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +dir=3D$(dirname "$full_cmd") +cmd=3D${full_cmd##*/} + +if [ -n "$WORKSPACE" ] && [ -e "$WORKSPACE/Conf/BaseToolsCBinaries" ] +then + exec "$WORKSPACE/Conf/BaseToolsCBinaries/$cmd" +elif [ -n "$WORKSPACE" ] && [ -e "$EDK_TOOLS_PATH/Source/C" ] +then + if [ ! -e "$EDK_TOOLS_PATH/Source/C/bin/$cmd" ] + then + echo "BaseTools C Tool binary was not found ($cmd)" + echo "You may need to run:" + echo " make -C $EDK_TOOLS_PATH/Source/C" + else + exec "$EDK_TOOLS_PATH/Source/C/bin/$cmd" "$@" + fi +elif [ -e "$dir/../../Source/C/bin/$cmd" ] +then + exec "$dir/../../Source/C/bin/$cmd" "$@" +else + echo "Unable to find the real '$cmd' to run" + echo "This message was printed by" + echo " $0" + exit 127 +fi + diff --git a/BaseTools/BinPipWrappers/PosixLike/build b/BaseTools/BinPipWra= ppers/PosixLike/build new file mode 100755 index 000000000000..9d143c7fc6c2 --- /dev/null +++ b/BaseTools/BinPipWrappers/PosixLike/build @@ -0,0 +1,12 @@ +#!/usr/bin/env bash +#python `dirname $0`/RunToolFromSource.py `basename $0` $* + +# If a ${PYTHON_COMMAND} command is available, use it in preference to pyt= hon +if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then + python_exe=3D${PYTHON_COMMAND} +fi + +full_cmd=3D${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028= for a discussion of why $0 is not a good choice here +cmd=3D${full_cmd##*/} + +exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@" diff --git a/BaseTools/BinWrappers/PosixLike/posix_path_env.yaml b/BaseTool= s/BinPipWrappers/PosixLike/posix_path_env.yaml similarity index 74% copy from BaseTools/BinWrappers/PosixLike/posix_path_env.yaml copy to BaseTools/BinPipWrappers/PosixLike/posix_path_env.yaml index 8b32e010bb1d..830670305c0c 100644 --- a/BaseTools/BinWrappers/PosixLike/posix_path_env.yaml +++ b/BaseTools/BinPipWrappers/PosixLike/posix_path_env.yaml @@ -1,10 +1,11 @@ -## @file=0D -# Set this folder on the path for all linux builds=0D -#=0D -# Copyright (c) Microsoft Corporation.=0D -# SPDX-License-Identifier: BSD-2-Clause-Patent=0D -##=0D -{=0D - "scope": "global-nix",=0D - "flags": ["set_path"]=0D -}=0D +## @file +# Set this folder on the path for all linux builds +# +# Copyright (c) Microsoft Corporation. +# SPDX-License-Identifier: BSD-2-Clause-Patent +## +{ + "scope": "pipbuild-unix", + "override_id": "binwrappers", + "flags": ["set_path"] +} diff --git a/BaseTools/BinPipWrappers/WindowsLike/AmlToC.bat b/BaseTools/Bi= nPipWrappers/WindowsLike/AmlToC.bat new file mode 100644 index 000000000000..d347d6484467 --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/AmlToC.bat @@ -0,0 +1,3 @@ +@setlocal=0D +@set ToolName=3D%~n0%=0D +@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*=0D diff --git a/BaseTools/BinPipWrappers/WindowsLike/BPDG.bat b/BaseTools/BinP= ipWrappers/WindowsLike/BPDG.bat new file mode 100644 index 000000000000..d347d6484467 --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/BPDG.bat @@ -0,0 +1,3 @@ +@setlocal=0D +@set ToolName=3D%~n0%=0D +@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*=0D diff --git a/BaseTools/BinPipWrappers/WindowsLike/Ecc.bat b/BaseTools/BinPi= pWrappers/WindowsLike/Ecc.bat new file mode 100644 index 000000000000..16a0a799a43b --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/Ecc.bat @@ -0,0 +1,3 @@ +@setlocal=0D +@set ToolName=3D%~n0%=0D +@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.EccMain %*=0D diff --git a/BaseTools/BinPipWrappers/WindowsLike/GenDepex.bat b/BaseTools/= BinPipWrappers/WindowsLike/GenDepex.bat new file mode 100644 index 000000000000..481b5ac47d24 --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/GenDepex.bat @@ -0,0 +1,3 @@ +@setlocal=0D +@set ToolName=3D%~n0%=0D +@%PYTHON_COMMAND% -m edk2basetools.AutoGen.%ToolName% %*=0D diff --git a/BaseTools/BinPipWrappers/WindowsLike/GenFds.bat b/BaseTools/Bi= nPipWrappers/WindowsLike/GenFds.bat new file mode 100644 index 000000000000..d347d6484467 --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/GenFds.bat @@ -0,0 +1,3 @@ +@setlocal=0D +@set ToolName=3D%~n0%=0D +@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*=0D diff --git a/BaseTools/BinPipWrappers/WindowsLike/GenPatchPcdTable.bat b/Ba= seTools/BinPipWrappers/WindowsLike/GenPatchPcdTable.bat new file mode 100644 index 000000000000..d347d6484467 --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/GenPatchPcdTable.bat @@ -0,0 +1,3 @@ +@setlocal=0D +@set ToolName=3D%~n0%=0D +@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*=0D diff --git a/BaseTools/BinPipWrappers/WindowsLike/GenerateCapsule.bat b/Bas= eTools/BinPipWrappers/WindowsLike/GenerateCapsule.bat new file mode 100644 index 000000000000..34c43ac7fc99 --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/GenerateCapsule.bat @@ -0,0 +1 @@ +@%PYTHON_COMMAND% -m edk2basetools.Capsule.GenerateCapsule %*=0D diff --git a/BaseTools/BinPipWrappers/WindowsLike/PatchPcdValue.bat b/BaseT= ools/BinPipWrappers/WindowsLike/PatchPcdValue.bat new file mode 100644 index 000000000000..d347d6484467 --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/PatchPcdValue.bat @@ -0,0 +1,3 @@ +@setlocal=0D +@set ToolName=3D%~n0%=0D +@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*=0D diff --git a/BaseTools/BinPipWrappers/WindowsLike/Pkcs7Sign.bat b/BaseTools= /BinPipWrappers/WindowsLike/Pkcs7Sign.bat new file mode 100644 index 000000000000..d347d6484467 --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/Pkcs7Sign.bat @@ -0,0 +1,3 @@ +@setlocal=0D +@set ToolName=3D%~n0%=0D +@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*=0D diff --git a/BaseTools/BinPipWrappers/WindowsLike/Rsa2048Sha256GenerateKeys= .bat b/BaseTools/BinPipWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat new file mode 100644 index 000000000000..cdc2e3ea373d --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat @@ -0,0 +1 @@ +@%PYTHON_COMMAND% -m edk2basetools.Rsa2048Sha256Sign.Rsa2048Sha256Generate= Keys %*=0D diff --git a/BaseTools/BinPipWrappers/WindowsLike/Rsa2048Sha256Sign.bat b/B= aseTools/BinPipWrappers/WindowsLike/Rsa2048Sha256Sign.bat new file mode 100644 index 000000000000..d347d6484467 --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/Rsa2048Sha256Sign.bat @@ -0,0 +1,3 @@ +@setlocal=0D +@set ToolName=3D%~n0%=0D +@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*=0D diff --git a/BaseTools/BinPipWrappers/WindowsLike/Split.bat b/BaseTools/Bin= PipWrappers/WindowsLike/Split.bat new file mode 100644 index 000000000000..d347d6484467 --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/Split.bat @@ -0,0 +1,3 @@ +@setlocal=0D +@set ToolName=3D%~n0%=0D +@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*=0D diff --git a/BaseTools/BinPipWrappers/WindowsLike/TargetTool.bat b/BaseTool= s/BinPipWrappers/WindowsLike/TargetTool.bat new file mode 100644 index 000000000000..d347d6484467 --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/TargetTool.bat @@ -0,0 +1,3 @@ +@setlocal=0D +@set ToolName=3D%~n0%=0D +@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*=0D diff --git a/BaseTools/BinPipWrappers/WindowsLike/Trim.bat b/BaseTools/BinP= ipWrappers/WindowsLike/Trim.bat new file mode 100644 index 000000000000..d347d6484467 --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/Trim.bat @@ -0,0 +1,3 @@ +@setlocal=0D +@set ToolName=3D%~n0%=0D +@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*=0D diff --git a/BaseTools/BinPipWrappers/WindowsLike/UPT.bat b/BaseTools/BinPi= pWrappers/WindowsLike/UPT.bat new file mode 100644 index 000000000000..d347d6484467 --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/UPT.bat @@ -0,0 +1,3 @@ +@setlocal=0D +@set ToolName=3D%~n0%=0D +@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*=0D diff --git a/BaseTools/BinPipWrappers/WindowsLike/build.bat b/BaseTools/Bin= PipWrappers/WindowsLike/build.bat new file mode 100644 index 000000000000..d347d6484467 --- /dev/null +++ b/BaseTools/BinPipWrappers/WindowsLike/build.bat @@ -0,0 +1,3 @@ +@setlocal=0D +@set ToolName=3D%~n0%=0D +@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*=0D diff --git a/BaseTools/BinWrappers/WindowsLike/win_build_tools_path_env.yam= l b/BaseTools/BinPipWrappers/WindowsLike/win_build_tools_path_env.yaml similarity index 70% copy from BaseTools/BinWrappers/WindowsLike/win_build_tools_path_env.yaml copy to BaseTools/BinPipWrappers/WindowsLike/win_build_tools_path_env.yaml index 83f5856e75c6..9fdbe1bcb06b 100644 --- a/BaseTools/BinWrappers/WindowsLike/win_build_tools_path_env.yaml +++ b/BaseTools/BinPipWrappers/WindowsLike/win_build_tools_path_env.yaml @@ -5,6 +5,7 @@ # SPDX-License-Identifier: BSD-2-Clause-Patent=0D ##=0D {=0D - "scope": "global-win",=0D + "scope": "pipbuild-win",=0D + "override_id": "binwrappers",=0D "flags": ["set_path"]=0D }=0D diff --git a/BaseTools/BinWrappers/PosixLike/posix_path_env.yaml b/BaseTool= s/BinWrappers/PosixLike/posix_path_env.yaml index 8b32e010bb1d..99529235ec9a 100644 --- a/BaseTools/BinWrappers/PosixLike/posix_path_env.yaml +++ b/BaseTools/BinWrappers/PosixLike/posix_path_env.yaml @@ -5,6 +5,7 @@ # SPDX-License-Identifier: BSD-2-Clause-Patent=0D ##=0D {=0D + "id": "binwrappers",=0D "scope": "global-nix",=0D "flags": ["set_path"]=0D }=0D diff --git a/BaseTools/BinWrappers/WindowsLike/win_build_tools_path_env.yam= l b/BaseTools/BinWrappers/WindowsLike/win_build_tools_path_env.yaml index 83f5856e75c6..43da76f354e5 100644 --- a/BaseTools/BinWrappers/WindowsLike/win_build_tools_path_env.yaml +++ b/BaseTools/BinWrappers/WindowsLike/win_build_tools_path_env.yaml @@ -5,6 +5,7 @@ # SPDX-License-Identifier: BSD-2-Clause-Patent=0D ##=0D {=0D + "id": "binwrappers",=0D "scope": "global-win",=0D "flags": ["set_path"]=0D }=0D diff --git a/BaseTools/BuildEnv b/BaseTools/BuildEnv index 5943bb9ef908..275f4c5901aa 100755 --- a/BaseTools/BuildEnv +++ b/BaseTools/BuildEnv @@ -46,7 +46,7 @@ RestorePreviousConfiguration() { done fi fi -=20=20 + PREVIOUS_CONF_FILE=3D$CONF_PATH/BuildEnv.sh if [ -e $PREVIOUS_CONF_FILE ] then @@ -198,7 +198,17 @@ AddEdkToolsToPath() { =20 EDK_TOOLS_PATH_BIN=3D`GetEdkToolsPathBinDirectory` =20 - AddDirToStartOfPath $EDK_TOOLS_PATH/BinWrappers/PosixLike + # check if the edk2basetools pip package is available + if $PYTHON_COMMAND -c "import edk2basetools" &> /dev/null; then + # if it is, use the pip version of the wrappers + echo "Using Pip Basetools" + AddDirToStartOfPath $EDK_TOOLS_PATH/BinPipWrappers/PosixLike + else + echo "Using EDK2 in-source Basetools" + AddDirToStartOfPath $EDK_TOOLS_PATH/BinWrappers/PosixLike + fi + + AddDirToStartOfPath $EDK_TOOLS_PATH_BIN =20 } diff --git a/BaseTools/Scripts/PatchCheck.py b/BaseTools/Scripts/PatchCheck= .py index 68c984ed0e4d..80754e763c5a 100755 --- a/BaseTools/Scripts/PatchCheck.py +++ b/BaseTools/Scripts/PatchCheck.py @@ -359,6 +359,7 @@ class GitDiffCheck: self.force_notabs =3D True=0D if self.filename.endswith('.sh') or \=0D self.filename.startswith('BaseTools/BinWrappers/PosixL= ike/') or \=0D + self.filename.startswith('BaseTools/BinPipWrappers/Pos= ixLike/') or \=0D self.filename.startswith('BaseTools/Bin/CYGWIN_NT-5.1-= i686/') or \=0D self.filename =3D=3D 'BaseTools/BuildEnv':=0D #=0D diff --git a/BaseTools/Source/Python/README.md b/BaseTools/Source/Python/RE= ADME.md new file mode 100644 index 000000000000..56f5b0ff027b --- /dev/null +++ b/BaseTools/Source/Python/README.md @@ -0,0 +1,29 @@ +# Edk2 Basetools=0D +=0D +This folder has traditionally held the source of Python based tools used b= y EDK2. =0D +The official repo this source has moved to https://github.com/tianocore/ed= k2-basetools.=0D +This folder will remain in the tree until the next stable release (expecte= d 202102).=0D +There is a new folder under Basetools `BinPipWrappers` that uses the pip m= odule rather than this tree for Basetools.=0D +By adding the scope `pipbuild-win` or `pipbuild-unix` (depending on your h= ost system), the SDE will use the =0D +`BinPipWrappers` instead of the regular `BinWrappers`.=0D +=0D +## Why Move It?=0D +=0D +The discussion is on the mailing list. The RFC is here: https://edk2.group= s.io/g/rfc/topic/74009714#270=0D +The benefits allow for the Basetools project to be used separately from ED= K2 itself as well as offering it in a=0D +globally accessible manner. =0D +This makes it much easier to build a module using Basetools. =0D +Separating the Basetools into their own repo allows for easier CI and cont= ribution process.=0D +Additional pros, cons, and process can be found on the mailing list.=0D +=0D +## How Do I Install It?=0D +=0D +By default, EDK2 is tied to and tested with a specific version of the Base= tools through `pip-requirements.txt`.=0D +You can simply run:=0D +=0D +```bash=0D +pip install -r pip-requirements.txt=0D +```=0D +=0D +This will install the required module, thought we strongly suggest setting= up a virtual environment.=0D +Additionally, you can also install a local clone of the Basetools as well = as a specific git commit.=0D diff --git a/BaseTools/toolsetup.bat b/BaseTools/toolsetup.bat index 61ebf4ae09bc..4b5256ab6e93 100755 --- a/BaseTools/toolsetup.bat +++ b/BaseTools/toolsetup.bat @@ -393,12 +393,31 @@ goto end goto check_freezer_path=0D )=0D =0D +=0D +=0D :check_freezer_path=0D endlocal=0D +=0D + %PYTHON_COMMAND% -c "import edk2basetools" >NUL 2>NUL=0D + if %ERRORLEVEL% EQU 0 (=0D + goto use_pip_basetools=0D + ) else (=0D + goto use_builtin_basetools=0D + )=0D +=0D +:use_builtin_basetools=0D + @echo Using EDK2 in-source Basetools=0D if defined BASETOOLS_PYTHON_SOURCE goto print_python_info=0D set "PATH=3D%BASE_TOOLS_PATH%\BinWrappers\WindowsLike;%PATH%"=0D set BASETOOLS_PYTHON_SOURCE=3D%BASE_TOOLS_PATH%\Source\Python=0D set PYTHONPATH=3D%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%=0D + goto print_python_info=0D +=0D +:use_pip_basetools=0D + @echo Using Pip Basetools=0D + set "PATH=3D%BASE_TOOLS_PATH%\BinPipWrappers\WindowsLike;%PATH%"=0D + set BASETOOLS_PYTHON_SOURCE=3Dedk2basetools=0D + goto print_python_info=0D =0D :print_python_info=0D echo PATH =3D %PATH%=0D diff --git a/pip-requirements.txt b/pip-requirements.txt index 0fecd37f2a83..aea2e6ece431 100644 --- a/pip-requirements.txt +++ b/pip-requirements.txt @@ -14,4 +14,5 @@ =0D edk2-pytool-library=3D=3D0.10.*=0D edk2-pytool-extensions~=3D0.13.3=0D +edk2-basetools=3D=3D0.1.2=0D antlr4-python3-runtime=3D=3D4.7.1=0D --=20 2.29.0.vfs.0.0