]> git.proxmox.com Git - mirror_edk2.git/commitdiff
BaseTools: Enable RISC-V architecture for RISC-V EDK2 CI.
authorAbner Chang <abner.chang@hpe.com>
Fri, 3 Apr 2020 05:48:57 +0000 (13:48 +0800)
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
Thu, 7 May 2020 03:17:15 +0000 (03:17 +0000)
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>
BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml [new file with mode: 0644]
BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py

diff --git a/BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml b/BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml
new file mode 100644 (file)
index 0000000..8abbcd7
--- /dev/null
@@ -0,0 +1,22 @@
+## @file\r
+# Download GCC RISCV64 compiler from RISC-V Organization release site\r
+# Set shell variable GCC5_RISCV64_INSTALL to this folder\r
+#\r
+# This is only downloaded when a build activates scope gcc_riscv64_unknown\r
+#\r
+# Copyright (c) Microsoft Corporation.\r
+# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>\r
+# SPDX-License-Identifier: BSD-2-Clause-Patent\r
+##\r
+{\r
+  "scope": "gcc_riscv64_unknown",\r
+  "type": "web",\r
+  "name": "gcc_riscv64_unknown",\r
+  "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",\r
+  "version": "9.2.0",\r
+  "compression_type": "tar",\r
+  "sha256": "28373643b69f0ce008273c3dc63f172aa1121952f1b9ae94d7485ac94af7f344",\r
+  "internal_path": "/gcc-riscv-9.2.0-2020.04-x86_64_riscv64-unknown-gnu",\r
+  "flags": ["set_shell_var", ],\r
+  "var_name": "GCC5_RISCV64_INSTALL"\r
+}\r
index c31641e9314268a70f8a739a5ad7275c2bfe1bc1..81075438d2e8c195d2adc894c79b932e6819d283 100644 (file)
@@ -4,6 +4,7 @@
 # This plugin works in conjuncture with the tools_def\r
 #\r
 # Copyright (c) Microsoft Corporation\r
+# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>\r
 # SPDX-License-Identifier: BSD-2-Clause-Patent\r
 ##\r
 import os\r
@@ -36,6 +37,12 @@ class LinuxGcc5ToolChain(IUefiBuildPlugin):
                 self.Logger.critical("Failed in check arm")\r
                 return ret\r
 \r
+            # Check RISCV64 compiler\r
+            ret = self._check_riscv64()\r
+            if ret != 0:\r
+                self.Logger.critical("Failed in check riscv64")\r
+                return ret\r
+\r
         return 0\r
 \r
     def _check_arm(self):\r
@@ -83,3 +90,34 @@ class LinuxGcc5ToolChain(IUefiBuildPlugin):
             return -2\r
 \r
         return 0\r
+\r
+    def _check_riscv64(self):\r
+        # now check for install dir.  If set then set the Prefix\r
+        install_path = shell_environment.GetEnvironment(\r
+        ).get_shell_var("GCC5_RISCV64_INSTALL")\r
+        if install_path is None:\r
+            return 0\r
+\r
+        # check to see if full path already configured\r
+        if shell_environment.GetEnvironment().get_shell_var("GCC5_RISCV64_PREFIX") is not None:\r
+            self.Logger.info("GCC5_RISCV64_PREFIX is already set.")\r
+\r
+        else:\r
+            # make GCC5_RISCV64_PREFIX to align with tools_def.txt\r
+            prefix = os.path.join(install_path, "bin", "riscv64-unknown-elf-")\r
+            shell_environment.GetEnvironment().set_shell_var("GCC5_RISCV64_PREFIX", prefix)\r
+\r
+        # now confirm it exists\r
+        if not os.path.exists(shell_environment.GetEnvironment().get_shell_var("GCC5_RISCV64_PREFIX") + "gcc"):\r
+            self.Logger.error(\r
+                "Path for GCC5_RISCV64_PREFIX toolchain is invalid")\r
+            return -2\r
+\r
+        # Check if LD_LIBRARY_PATH is set for the libraries of RISC-V GCC toolchain\r
+        if shell_environment.GetEnvironment().get_shell_var("LD_LIBRARY_PATH") is not None:\r
+            self.Logger.info("LD_LIBRARY_PATH is already set.")\r
+\r
+        prefix = os.path.join(install_path, "lib")\r
+        shell_environment.GetEnvironment().set_shell_var("LD_LIBRARY_PATH", prefix)\r
+\r
+        return 0\r