From ea56fa3d4706dae4e662e01fddb24a2826abfcbd Mon Sep 17 00:00:00 2001 From: Abner Chang Date: Fri, 3 Apr 2020 13:48:57 +0800 Subject: 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 Reviewed-by: Sean Brogan Cc: Bret Barkelew Cc: Sean Brogan Cc: Bob Feng Cc: Leif Lindholm Cc: Michael D Kinney Cc: Liming Gao Cc: Gilbert Chen Cc: Daniel Helmut Schaefer --- .../LinuxGcc5ToolChain/LinuxGcc5ToolChain.py | 38 ++++++++++++++++++++++ 1 file changed, 38 insertions(+) (limited to 'BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py') diff --git a/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py b/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py index c31641e931..81075438d2 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.
# 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 -- cgit v1.2.3