summaryrefslogtreecommitdiff
path: root/BaseTools
diff options
context:
space:
mode:
authorAbner Chang <abner.chang@hpe.com>2020-04-03 13:48:57 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2020-05-07 03:17:15 +0000
commitea56fa3d4706dae4e662e01fddb24a2826abfcbd (patch)
tree99eff9fc605c852b913f3e53e203d54de1f5eab1 /BaseTools
parentfaef5a367c8345df906be3755e15e0dabc3105b3 (diff)
downloadedk2-ea56fa3d4706dae4e662e01fddb24a2826abfcbd.zip
edk2-ea56fa3d4706dae4e662e01fddb24a2826abfcbd.tar.gz
edk2-ea56fa3d4706dae4e662e01fddb24a2826abfcbd.tar.bz2
BaseTools: Enable RISC-V architecture for RISC-V EDK2 CI.
BZ:2562: https://bugzilla.tianocore.org/show_bug.cgi?id=2562 EDK CI for RISC-V architecture Enable RISC-V architecture for RISC-V EDK2 CI testing. Signed-off-by: Abner Chang <abner.chang@hpe.com> Reviewed-by: Sean Brogan <sean.brogan@microsoft.com> Cc: Bret Barkelew <Bret.Barkelew@microsoft.com> Cc: Sean Brogan <sean.brogan@microsoft.com> Cc: Bob Feng <bob.c.feng@intel.com> Cc: Leif Lindholm <leif@nuviainc.com> Cc: Michael D Kinney <michael.d.kinney@intel.com> Cc: Liming Gao <liming.gao@intel.com> Cc: Gilbert Chen <gilbert.chen@hpe.com> Cc: Daniel Helmut Schaefer <daniel.schaefer@hpe.com>
Diffstat (limited to 'BaseTools')
-rw-r--r--BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml22
-rw-r--r--BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py38
2 files changed, 60 insertions, 0 deletions
diff --git a/BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml b/BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml
new file mode 100644
index 0000000..8abbcd7
--- /dev/null
+++ b/BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml
@@ -0,0 +1,22 @@
+## @file
+# Download GCC RISCV64 compiler from RISC-V Organization release site
+# Set shell variable GCC5_RISCV64_INSTALL to this folder
+#
+# This is only downloaded when a build activates scope gcc_riscv64_unknown
+#
+# Copyright (c) Microsoft Corporation.
+# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+ "scope": "gcc_riscv64_unknown",
+ "type": "web",
+ "name": "gcc_riscv64_unknown",
+ "source": "https://raw.githubusercontent.com/riscv/riscv-uefi-edk2-docs/master/gcc-riscv-edk2-ci-toolchain/gcc-riscv-9.2.0-2020.04-x86_64_riscv64-unknown-gnu.tar.xz",
+ "version": "9.2.0",
+ "compression_type": "tar",
+ "sha256": "28373643b69f0ce008273c3dc63f172aa1121952f1b9ae94d7485ac94af7f344",
+ "internal_path": "/gcc-riscv-9.2.0-2020.04-x86_64_riscv64-unknown-gnu",
+ "flags": ["set_shell_var", ],
+ "var_name": "GCC5_RISCV64_INSTALL"
+}
diff --git a/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py b/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py
index c31641e..8107543 100644
--- a/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py
+++ b/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py
@@ -4,6 +4,7 @@
# This plugin works in conjuncture with the tools_def
#
# Copyright (c) Microsoft Corporation
+# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
# SPDX-License-Identifier: BSD-2-Clause-Patent
##
import os
@@ -36,6 +37,12 @@ class LinuxGcc5ToolChain(IUefiBuildPlugin):
self.Logger.critical("Failed in check arm")
return ret
+ # Check RISCV64 compiler
+ ret = self._check_riscv64()
+ if ret != 0:
+ self.Logger.critical("Failed in check riscv64")
+ return ret
+
return 0
def _check_arm(self):
@@ -83,3 +90,34 @@ class LinuxGcc5ToolChain(IUefiBuildPlugin):
return -2
return 0
+
+ def _check_riscv64(self):
+ # now check for install dir.  If set then set the Prefix
+ install_path = shell_environment.GetEnvironment(
+ ).get_shell_var("GCC5_RISCV64_INSTALL")
+ if install_path is None:
+ return 0
+
+ # check to see if full path already configured
+ if shell_environment.GetEnvironment().get_shell_var("GCC5_RISCV64_PREFIX") is not None:
+ self.Logger.info("GCC5_RISCV64_PREFIX is already set.")
+
+ else:
+ # make GCC5_RISCV64_PREFIX to align with tools_def.txt
+ prefix = os.path.join(install_path, "bin", "riscv64-unknown-elf-")
+ shell_environment.GetEnvironment().set_shell_var("GCC5_RISCV64_PREFIX", prefix)
+
+ # now confirm it exists
+ if not os.path.exists(shell_environment.GetEnvironment().get_shell_var("GCC5_RISCV64_PREFIX") + "gcc"):
+ self.Logger.error(
+ "Path for GCC5_RISCV64_PREFIX toolchain is invalid")
+ return -2
+
+ # Check if LD_LIBRARY_PATH is set for the libraries of RISC-V GCC toolchain
+ if shell_environment.GetEnvironment().get_shell_var("LD_LIBRARY_PATH") is not None:
+ self.Logger.info("LD_LIBRARY_PATH is already set.")
+
+ prefix = os.path.join(install_path, "lib")
+ shell_environment.GetEnvironment().set_shell_var("LD_LIBRARY_PATH", prefix)
+
+ return 0