]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Use pip module if available, CI uses it by default
authorMatthew Carlson <matthewfcarlson@gmail.com>
Tue, 9 Feb 2021 00:50:33 +0000 (08:50 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Tue, 9 Feb 2021 03:56:37 +0000 (03:56 +0000)
Use the new edk2-basetools pip module.
Includes a helpful message in setup to let users know which has been
selected.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>
Reviewed-by: Bob Feng <bob.c.feng@intel.com>
Reviewed-by: Yuwei <Chen<yuwei.chen@intel.com>
Signed-off-by: Matthew Carlson <matthewfcarlson@gmail.com>
55 files changed:
.pytool/CISettings.py
BaseTools/BinPipWrappers/PosixLike/AmlToC [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/BPDG [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/BrotliCompress [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/DevicePath [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/Ecc [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/EfiRom [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/GenCrc32 [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/GenDepex [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/GenFds [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/GenFfs [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/GenFv [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/GenFw [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/GenPatchPcdTable [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/GenSec [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/GenerateCapsule [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/LzmaCompress [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/LzmaF86Compress [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/PatchPcdValue [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/Pkcs7Sign [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/Rsa2048Sha256GenerateKeys [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/Rsa2048Sha256Sign [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/Split [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/TargetTool [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/TianoCompress [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/Trim [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/UPT [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/VfrCompile [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/VolInfo [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/build [new file with mode: 0755]
BaseTools/BinPipWrappers/PosixLike/posix_path_env.yaml [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/AmlToC.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/BPDG.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/Ecc.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/GenDepex.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/GenFds.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/GenPatchPcdTable.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/GenerateCapsule.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/PatchPcdValue.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/Pkcs7Sign.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/Rsa2048Sha256Sign.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/Split.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/TargetTool.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/Trim.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/UPT.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/build.bat [new file with mode: 0644]
BaseTools/BinPipWrappers/WindowsLike/win_build_tools_path_env.yaml [new file with mode: 0644]
BaseTools/BinWrappers/PosixLike/posix_path_env.yaml
BaseTools/BinWrappers/WindowsLike/win_build_tools_path_env.yaml
BaseTools/BuildEnv
BaseTools/Scripts/PatchCheck.py
BaseTools/Source/Python/README.md [new file with mode: 0644]
BaseTools/toolsetup.bat
pip-requirements.txt

index e6c5ac700ab2348b11273ebf7917552570ee1864..5f71eca1992e370fa4d0110c8c4e980c06c840d6 100644 (file)
@@ -22,16 +22,24 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManag
         self.ActualTargets = []\r
         self.ActualArchitectures = []\r
         self.ActualToolChainTag = ""\r
+        self.UseBuiltInBaseTools = None\r
+        self.ActualScopes = None\r
 \r
     # ####################################################################################### #\r
     #                             Extra CmdLine configuration                                 #\r
     # ####################################################################################### #\r
 \r
     def AddCommandLineOptions(self, parserObj):\r
-        pass\r
+        group = parserObj.add_mutually_exclusive_group()\r
+        group.add_argument("-force_piptools", "--fpt", dest="force_piptools", action="store_true", default=False, help="Force the system to use pip tools")\r
+        group.add_argument("-no_piptools", "--npt", dest="no_piptools", action="store_true", default=False, help="Force the system to not use pip tools")\r
 \r
     def RetrieveCommandLineOptions(self, args):\r
-        pass\r
+        super().RetrieveCommandLineOptions(args)\r
+        if args.force_piptools:\r
+            self.UseBuiltInBaseTools = True\r
+        if args.no_piptools:\r
+            self.UseBuiltInBaseTools = False\r
 \r
     # ####################################################################################### #\r
     #                        Default Support for this Ci Build                                #\r
@@ -128,19 +136,38 @@ class Settings(CiBuildSettingsManager, UpdateSettingsManager, SetupSettingsManag
 \r
     def GetActiveScopes(self):\r
         ''' return tuple containing scopes that should be active for this process '''\r
-        scopes = ("cibuild", "edk2-build", "host-based-test")\r
-\r
-        self.ActualToolChainTag = shell_environment.GetBuildVars().GetValue("TOOL_CHAIN_TAG", "")\r
-\r
-        if GetHostInfo().os.upper() == "LINUX" and self.ActualToolChainTag.upper().startswith("GCC"):\r
-            if "AARCH64" in self.ActualArchitectures:\r
-                scopes += ("gcc_aarch64_linux",)\r
-            if "ARM" in self.ActualArchitectures:\r
-                scopes += ("gcc_arm_linux",)\r
-            if "RISCV64" in self.ActualArchitectures:\r
-                scopes += ("gcc_riscv64_unknown",)\r
-\r
-        return scopes\r
+        if self.ActualScopes is None:\r
+            scopes = ("cibuild", "edk2-build", "host-based-test")\r
+\r
+            self.ActualToolChainTag = shell_environment.GetBuildVars().GetValue("TOOL_CHAIN_TAG", "")\r
+\r
+            is_linux = GetHostInfo().os.upper() == "LINUX"\r
+\r
+            if self.UseBuiltInBaseTools is None:\r
+                is_linux = GetHostInfo().os.upper() == "LINUX"\r
+                # try and import the pip module for basetools\r
+                try:\r
+                    import edk2basetools\r
+                    self.UseBuiltInBaseTools = True\r
+                except ImportError:\r
+                    self.UseBuiltInBaseTools = False\r
+                    pass\r
+\r
+            if self.UseBuiltInBaseTools == True:\r
+                scopes += ('pipbuild-unix',) if is_linux else ('pipbuild-win',)\r
+                logging.warning("Using Pip Tools based BaseTools")\r
+            else:\r
+                logging.warning("Falling back to using in-tree BaseTools")\r
+\r
+            if is_linux and self.ActualToolChainTag.upper().startswith("GCC"):\r
+                if "AARCH64" in self.ActualArchitectures:\r
+                    scopes += ("gcc_aarch64_linux",)\r
+                if "ARM" in self.ActualArchitectures:\r
+                    scopes += ("gcc_arm_linux",)\r
+                if "RISCV64" in self.ActualArchitectures:\r
+                    scopes += ("gcc_riscv64_unknown",)\r
+            self.ActualScopes = scopes\r
+        return self.ActualScopes\r
 \r
     def GetRequiredSubmodules(self):\r
         ''' return iterable containing RequiredSubmodule objects.\r
diff --git a/BaseTools/BinPipWrappers/PosixLike/AmlToC b/BaseTools/BinPipWrappers/PosixLike/AmlToC
new file mode 100755 (executable)
index 0000000..1dd28e9
--- /dev/null
@@ -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 python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+exe=$(basename "$full_cmd")
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" "$dir/../../Source/Python/$exe/$exe.py" "$@"
diff --git a/BaseTools/BinPipWrappers/PosixLike/BPDG b/BaseTools/BinPipWrappers/PosixLike/BPDG
new file mode 100755 (executable)
index 0000000..a08cbd8
--- /dev/null
@@ -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 python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+cmd=${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 (executable)
index 0000000..663860b
--- /dev/null
@@ -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.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+#
+QLT="-q 9 -w 22"
+ARGS=
+
+while test $# -gt 0
+do
+  case $1 in
+    -e)
+      ;;
+    -d)
+      ARGS+="$1 "
+      ;;
+    -o|-g)
+      ARGS+="$1 $2 "
+      shift
+      ;;
+    -q)
+      QLT="$1 $2 "
+      shift
+      ;;
+    *)
+      ARGS+="$1 "
+      ;;
+  esac
+  shift
+done
+
+exec Brotli $QLT $ARGS
diff --git a/BaseTools/BinPipWrappers/PosixLike/DevicePath b/BaseTools/BinPipWrappers/PosixLike/DevicePath
new file mode 100755 (executable)
index 0000000..0945d86
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${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/BinPipWrappers/PosixLike/Ecc
new file mode 100755 (executable)
index 0000000..5987289
--- /dev/null
@@ -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 python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+cmd=${full_cmd##*/}
+
+export PYTHONPATH="$dir/../../Source/Python${PYTHONPATH:+:"$PYTHONPATH"}"
+exec "${python_exe:-python}" -m $cmd.EccMain "$@"
diff --git a/BaseTools/BinPipWrappers/PosixLike/EfiRom b/BaseTools/BinPipWrappers/PosixLike/EfiRom
new file mode 100755 (executable)
index 0000000..0945d86
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${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/BinPipWrappers/PosixLike/GenCrc32
new file mode 100755 (executable)
index 0000000..0945d86
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${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/BinPipWrappers/PosixLike/GenDepex
new file mode 100755 (executable)
index 0000000..df75e43
--- /dev/null
@@ -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 python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+cmd=${full_cmd##*/}
+
+exec "${python_exe:-python}" -m edk2basetools.AutoGen.$cmd "$@"
diff --git a/BaseTools/BinPipWrappers/PosixLike/GenFds b/BaseTools/BinPipWrappers/PosixLike/GenFds
new file mode 100755 (executable)
index 0000000..b27e84e
--- /dev/null
@@ -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 python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+cmd=${full_cmd##*/}
+
+exec "${python_exe:-python}" -m edk2basetools.$cmd "$@"
diff --git a/BaseTools/BinPipWrappers/PosixLike/GenFfs b/BaseTools/BinPipWrappers/PosixLike/GenFfs
new file mode 100755 (executable)
index 0000000..0945d86
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${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/BinPipWrappers/PosixLike/GenFv
new file mode 100755 (executable)
index 0000000..0945d86
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${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/BinPipWrappers/PosixLike/GenFw
new file mode 100755 (executable)
index 0000000..0945d86
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${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/BaseTools/BinPipWrappers/PosixLike/GenPatchPcdTable
new file mode 100755 (executable)
index 0000000..9d143c7
--- /dev/null
@@ -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 python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+cmd=${full_cmd##*/}
+
+exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@"
diff --git a/BaseTools/BinPipWrappers/PosixLike/GenSec b/BaseTools/BinPipWrappers/PosixLike/GenSec
new file mode 100755 (executable)
index 0000000..0945d86
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${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 (executable)
index 0000000..366a268
--- /dev/null
@@ -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 python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+cmd=${full_cmd##*/}
+
+exec "${python_exe:-python}" -m edk2basetools.Capsule.$cmd "$@"
diff --git a/BaseTools/BinPipWrappers/PosixLike/LzmaCompress b/BaseTools/BinPipWrappers/PosixLike/LzmaCompress
new file mode 100755 (executable)
index 0000000..0945d86
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${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 (executable)
index 0000000..b55352a
--- /dev/null
@@ -0,0 +1,19 @@
+#!/usr/bin/env bash
+#
+# This script will exec LzmaCompress tool with --f86 option that enables converter for x86 code.
+#
+# (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
+# Copyright (c) 2012, Intel Corporation. All rights reserved.<BR>
+# 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/BinPipWrappers/PosixLike/PatchPcdValue
new file mode 100755 (executable)
index 0000000..9d143c7
--- /dev/null
@@ -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 python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+cmd=${full_cmd##*/}
+
+exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@"
diff --git a/BaseTools/BinPipWrappers/PosixLike/Pkcs7Sign b/BaseTools/BinPipWrappers/PosixLike/Pkcs7Sign
new file mode 100755 (executable)
index 0000000..9d143c7
--- /dev/null
@@ -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 python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+cmd=${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 (executable)
index 0000000..aca2f3a
--- /dev/null
@@ -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 python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+cmd=${full_cmd##*/}
+
+exec "${python_exe:-python}" -m edk2basetools.Rsa2048Sha256Sign.$cmd "$@"
diff --git a/BaseTools/BinPipWrappers/PosixLike/Rsa2048Sha256Sign b/BaseTools/BinPipWrappers/PosixLike/Rsa2048Sha256Sign
new file mode 100755 (executable)
index 0000000..ead26cb
--- /dev/null
@@ -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 python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+cmd=${full_cmd##*/}
+
+exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@"\r
\ No newline at end of file
diff --git a/BaseTools/BinPipWrappers/PosixLike/Split b/BaseTools/BinPipWrappers/PosixLike/Split
new file mode 100755 (executable)
index 0000000..0945d86
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${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/BinPipWrappers/PosixLike/TargetTool
new file mode 100755 (executable)
index 0000000..9d143c7
--- /dev/null
@@ -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 python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+cmd=${full_cmd##*/}
+
+exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@"
diff --git a/BaseTools/BinPipWrappers/PosixLike/TianoCompress b/BaseTools/BinPipWrappers/PosixLike/TianoCompress
new file mode 100755 (executable)
index 0000000..0945d86
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${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/BinPipWrappers/PosixLike/Trim
new file mode 100755 (executable)
index 0000000..0bd14ee
--- /dev/null
@@ -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 python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+cmd=$(basename "$full_cmd")
+
+exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@"
+
diff --git a/BaseTools/BinPipWrappers/PosixLike/UPT b/BaseTools/BinPipWrappers/PosixLike/UPT
new file mode 100755 (executable)
index 0000000..ead26cb
--- /dev/null
@@ -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 python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+cmd=${full_cmd##*/}
+
+exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@"\r
\ No newline at end of file
diff --git a/BaseTools/BinPipWrappers/PosixLike/VfrCompile b/BaseTools/BinPipWrappers/PosixLike/VfrCompile
new file mode 100755 (executable)
index 0000000..0945d86
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${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/BinPipWrappers/PosixLike/VolInfo
new file mode 100755 (executable)
index 0000000..0945d86
--- /dev/null
@@ -0,0 +1,29 @@
+#!/usr/bin/env bash
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+dir=$(dirname "$full_cmd")
+cmd=${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/BinPipWrappers/PosixLike/build
new file mode 100755 (executable)
index 0000000..9d143c7
--- /dev/null
@@ -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 python
+if command -v ${PYTHON_COMMAND} >/dev/null 2>&1; then
+    python_exe=${PYTHON_COMMAND}
+fi
+
+full_cmd=${BASH_SOURCE:-$0} # see http://mywiki.wooledge.org/BashFAQ/028 for a discussion of why $0 is not a good choice here
+cmd=${full_cmd##*/}
+
+exec "${python_exe:-python}" -m edk2basetools.$cmd.$cmd "$@"
diff --git a/BaseTools/BinPipWrappers/PosixLike/posix_path_env.yaml b/BaseTools/BinPipWrappers/PosixLike/posix_path_env.yaml
new file mode 100644 (file)
index 0000000..eb1db9e
--- /dev/null
@@ -0,0 +1,11 @@
+## @file\r
+# Set this folder on the path for all linux builds\r
+#\r
+# Copyright (c) Microsoft Corporation.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+##\r
+{\r
+  "scope": "pipbuild-unix",\r
+  "override_id": "binwrappers",\r
+  "flags": ["set_path"]\r
+}\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/AmlToC.bat b/BaseTools/BinPipWrappers/WindowsLike/AmlToC.bat
new file mode 100644 (file)
index 0000000..d347d64
--- /dev/null
@@ -0,0 +1,3 @@
+@setlocal\r
+@set ToolName=%~n0%\r
+@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/BPDG.bat b/BaseTools/BinPipWrappers/WindowsLike/BPDG.bat
new file mode 100644 (file)
index 0000000..d347d64
--- /dev/null
@@ -0,0 +1,3 @@
+@setlocal\r
+@set ToolName=%~n0%\r
+@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/Ecc.bat b/BaseTools/BinPipWrappers/WindowsLike/Ecc.bat
new file mode 100644 (file)
index 0000000..16a0a79
--- /dev/null
@@ -0,0 +1,3 @@
+@setlocal\r
+@set ToolName=%~n0%\r
+@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.EccMain %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/GenDepex.bat b/BaseTools/BinPipWrappers/WindowsLike/GenDepex.bat
new file mode 100644 (file)
index 0000000..481b5ac
--- /dev/null
@@ -0,0 +1,3 @@
+@setlocal\r
+@set ToolName=%~n0%\r
+@%PYTHON_COMMAND% -m edk2basetools.AutoGen.%ToolName% %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/GenFds.bat b/BaseTools/BinPipWrappers/WindowsLike/GenFds.bat
new file mode 100644 (file)
index 0000000..d347d64
--- /dev/null
@@ -0,0 +1,3 @@
+@setlocal\r
+@set ToolName=%~n0%\r
+@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/GenPatchPcdTable.bat b/BaseTools/BinPipWrappers/WindowsLike/GenPatchPcdTable.bat
new file mode 100644 (file)
index 0000000..d347d64
--- /dev/null
@@ -0,0 +1,3 @@
+@setlocal\r
+@set ToolName=%~n0%\r
+@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/GenerateCapsule.bat b/BaseTools/BinPipWrappers/WindowsLike/GenerateCapsule.bat
new file mode 100644 (file)
index 0000000..34c43ac
--- /dev/null
@@ -0,0 +1 @@
+@%PYTHON_COMMAND% -m edk2basetools.Capsule.GenerateCapsule %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/PatchPcdValue.bat b/BaseTools/BinPipWrappers/WindowsLike/PatchPcdValue.bat
new file mode 100644 (file)
index 0000000..d347d64
--- /dev/null
@@ -0,0 +1,3 @@
+@setlocal\r
+@set ToolName=%~n0%\r
+@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/Pkcs7Sign.bat b/BaseTools/BinPipWrappers/WindowsLike/Pkcs7Sign.bat
new file mode 100644 (file)
index 0000000..d347d64
--- /dev/null
@@ -0,0 +1,3 @@
+@setlocal\r
+@set ToolName=%~n0%\r
+@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat b/BaseTools/BinPipWrappers/WindowsLike/Rsa2048Sha256GenerateKeys.bat
new file mode 100644 (file)
index 0000000..cdc2e3e
--- /dev/null
@@ -0,0 +1 @@
+@%PYTHON_COMMAND% -m edk2basetools.Rsa2048Sha256Sign.Rsa2048Sha256GenerateKeys %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/Rsa2048Sha256Sign.bat b/BaseTools/BinPipWrappers/WindowsLike/Rsa2048Sha256Sign.bat
new file mode 100644 (file)
index 0000000..d347d64
--- /dev/null
@@ -0,0 +1,3 @@
+@setlocal\r
+@set ToolName=%~n0%\r
+@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/Split.bat b/BaseTools/BinPipWrappers/WindowsLike/Split.bat
new file mode 100644 (file)
index 0000000..d347d64
--- /dev/null
@@ -0,0 +1,3 @@
+@setlocal\r
+@set ToolName=%~n0%\r
+@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/TargetTool.bat b/BaseTools/BinPipWrappers/WindowsLike/TargetTool.bat
new file mode 100644 (file)
index 0000000..d347d64
--- /dev/null
@@ -0,0 +1,3 @@
+@setlocal\r
+@set ToolName=%~n0%\r
+@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/Trim.bat b/BaseTools/BinPipWrappers/WindowsLike/Trim.bat
new file mode 100644 (file)
index 0000000..d347d64
--- /dev/null
@@ -0,0 +1,3 @@
+@setlocal\r
+@set ToolName=%~n0%\r
+@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/UPT.bat b/BaseTools/BinPipWrappers/WindowsLike/UPT.bat
new file mode 100644 (file)
index 0000000..d347d64
--- /dev/null
@@ -0,0 +1,3 @@
+@setlocal\r
+@set ToolName=%~n0%\r
+@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/build.bat b/BaseTools/BinPipWrappers/WindowsLike/build.bat
new file mode 100644 (file)
index 0000000..d347d64
--- /dev/null
@@ -0,0 +1,3 @@
+@setlocal\r
+@set ToolName=%~n0%\r
+@%PYTHON_COMMAND% -m edk2basetools.%ToolName%.%ToolName% %*\r
diff --git a/BaseTools/BinPipWrappers/WindowsLike/win_build_tools_path_env.yaml b/BaseTools/BinPipWrappers/WindowsLike/win_build_tools_path_env.yaml
new file mode 100644 (file)
index 0000000..9fdbe1b
--- /dev/null
@@ -0,0 +1,11 @@
+## @file\r
+# Add this folder to the path on Windows\r
+#\r
+# Copyright (c) Microsoft Corporation.\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+##\r
+{\r
+  "scope": "pipbuild-win",\r
+  "override_id": "binwrappers",\r
+  "flags": ["set_path"]\r
+}\r
index 8b32e010bb1d357dc9d2d237fe211da3fc059da9..99529235ec9a5f3ec8e2efc80c5966adefbd730b 100644 (file)
@@ -5,6 +5,7 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent\r
 ##\r
 {\r
+  "id": "binwrappers",\r
   "scope": "global-nix",\r
   "flags": ["set_path"]\r
 }\r
index 83f5856e75c660410f06cc12dea665d013721a5a..43da76f354e573213c8eaa904aaeeec9690172b8 100644 (file)
@@ -5,6 +5,7 @@
 # SPDX-License-Identifier: BSD-2-Clause-Patent\r
 ##\r
 {\r
+  "id": "binwrappers",\r
   "scope": "global-win",\r
   "flags": ["set_path"]\r
 }\r
index 5943bb9ef90890dacddad57cc8877756e16fb316..8d283e10c01518022c4704d93432a6c40e181c9f 100755 (executable)
@@ -46,7 +46,7 @@ RestorePreviousConfiguration() {
       done
     fi
   fi
-  
+\r
   PREVIOUS_CONF_FILE=$CONF_PATH/BuildEnv.sh
   if [ -e $PREVIOUS_CONF_FILE ]
   then
@@ -198,7 +198,17 @@ AddEdkToolsToPath() {
 
   EDK_TOOLS_PATH_BIN=`GetEdkToolsPathBinDirectory`
 
-  AddDirToStartOfPath $EDK_TOOLS_PATH/BinWrappers/PosixLike
+  # check if the edk2basetools pip package is available\r
+  if $PYTHON_COMMAND -c "import edk2basetools" &> /dev/null; then\r
+    # if it is, use the pip version of the wrappers\r
+    echo "Using Pip Basetools"\r
+    AddDirToStartOfPath $EDK_TOOLS_PATH/BinPipWrappers/PosixLike\r
+  else\r
+    echo "Using EDK2 in-source Basetools"\r
+    AddDirToStartOfPath $EDK_TOOLS_PATH/BinWrappers/PosixLike\r
+  fi\r
+\r
+\r
   AddDirToStartOfPath $EDK_TOOLS_PATH_BIN
 
 }
index 68c984ed0e4d4a95f811048e0e8ba260233a6a77..80754e763c5ad3b3c0ca858093a91a088e32d8bf 100755 (executable)
@@ -359,6 +359,7 @@ class GitDiffCheck:
                 self.force_notabs = True\r
                 if self.filename.endswith('.sh') or \\r
                     self.filename.startswith('BaseTools/BinWrappers/PosixLike/') or \\r
+                    self.filename.startswith('BaseTools/BinPipWrappers/PosixLike/') or \\r
                     self.filename.startswith('BaseTools/Bin/CYGWIN_NT-5.1-i686/') or \\r
                     self.filename == 'BaseTools/BuildEnv':\r
                     #\r
diff --git a/BaseTools/Source/Python/README.md b/BaseTools/Source/Python/README.md
new file mode 100644 (file)
index 0000000..8c4d9e7
--- /dev/null
@@ -0,0 +1,29 @@
+# Edk2 Basetools\r
+\r
+This folder has traditionally held the source of Python based tools used by EDK2.\r
+The official repo this source has moved to https://github.com/tianocore/edk2-basetools.\r
+This folder will remain in the tree until the next stable release (expected 202102).\r
+There is a new folder under Basetools `BinPipWrappers` that uses the pip module rather than this tree for Basetools.\r
+By adding the scope `pipbuild-win` or `pipbuild-unix` (depending on your host system), the SDE will use the\r
+`BinPipWrappers` instead of the regular `BinWrappers`.\r
+\r
+## Why Move It?\r
+\r
+The discussion is on the mailing list. The RFC is here: https://edk2.groups.io/g/rfc/topic/74009714#270\r
+The benefits allow for the Basetools project to be used separately from EDK2 itself as well as offering it in a\r
+globally accessible manner.\r
+This makes it much easier to build a module using Basetools.\r
+Separating the Basetools into their own repo allows for easier CI and contribution process.\r
+Additional pros, cons, and process can be found on the mailing list.\r
+\r
+## How Do I Install It?\r
+\r
+By default, EDK2 is tied to and tested with a specific version of the Basetools through `pip-requirements.txt`.\r
+You can simply run:\r
+\r
+```bash\r
+pip install -r pip-requirements.txt\r
+```\r
+\r
+This will install the required module, thought we strongly suggest setting up a virtual environment.\r
+Additionally, you can also install a local clone of the Basetools as well as a specific git commit.\r
index 61ebf4ae09bc64fc67d03f9bb22215d8270da46e..4b5256ab6e93eda8787f4ad0ecc5b5b090d764fd 100755 (executable)
@@ -393,12 +393,31 @@ goto end
     goto check_freezer_path\r
   )\r
 \r
+\r
+\r
 :check_freezer_path\r
   endlocal\r
+\r
+  %PYTHON_COMMAND% -c "import edk2basetools" >NUL 2>NUL\r
+  if %ERRORLEVEL% EQU 0 (\r
+    goto use_pip_basetools\r
+  ) else (\r
+    goto use_builtin_basetools\r
+  )\r
+\r
+:use_builtin_basetools\r
+  @echo Using EDK2 in-source Basetools\r
   if defined BASETOOLS_PYTHON_SOURCE goto print_python_info\r
   set "PATH=%BASE_TOOLS_PATH%\BinWrappers\WindowsLike;%PATH%"\r
   set BASETOOLS_PYTHON_SOURCE=%BASE_TOOLS_PATH%\Source\Python\r
   set PYTHONPATH=%BASETOOLS_PYTHON_SOURCE%;%PYTHONPATH%\r
+  goto print_python_info\r
+\r
+:use_pip_basetools\r
+  @echo Using Pip Basetools\r
+  set "PATH=%BASE_TOOLS_PATH%\BinPipWrappers\WindowsLike;%PATH%"\r
+  set BASETOOLS_PYTHON_SOURCE=edk2basetools\r
+  goto print_python_info\r
 \r
 :print_python_info\r
   echo                PATH = %PATH%\r
index 0fecd37f2a8319117945c406717ef6e47252b83e..aea2e6ece4310a9732fbf465282c07da0a9867f0 100644 (file)
@@ -14,4 +14,5 @@
 \r
 edk2-pytool-library==0.10.*\r
 edk2-pytool-extensions~=0.13.3\r
+edk2-basetools==0.1.2\r
 antlr4-python3-runtime==4.7.1\r