public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Abner Chang" <abner.chang@hpe.com>
To: devel@edk2.groups.io
Cc: abner.chang@hpe.com, Bret Barkelew <Bret.Barkelew@microsoft.com>,
	Sean Brogan <sean.brogan@microsoft.com>,
	Bob Feng <bob.c.feng@intel.com>,
	Leif Lindholm <leif@nuviainc.com>,
	Michael D Kinney <michael.d.kinney@intel.com>,
	Liming Gao <liming.gao@intel.com>,
	Gilbert Chen <gilbert.chen@hpe.com>,
	Daniel Helmut Schaefer <daniel.schaefer@hpe.com>
Subject: [edk2/master PATCH RISC-V CI v1 4/6] BaseTools: Enable RISC-V architecture for RISC-V EDK2 CI.
Date: Wed,  4 Mar 2020 13:26:05 +0800	[thread overview]
Message-ID: <20200304052607.31801-5-abner.chang@hpe.com> (raw)
In-Reply-To: <20200304052607.31801-1-abner.chang@hpe.com>

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>

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>
---
 .../Bin/gcc_riscv64_unknown_ext_dep.yaml      | 21 +++++++++++++
 .../LinuxGcc5ToolChain/LinuxGcc5ToolChain.py  | 31 +++++++++++++++++++
 2 files changed, 52 insertions(+)
 create mode 100644 BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml

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 0000000000..38fe300a68
--- /dev/null
+++ b/BaseTools/Bin/gcc_riscv64_unknown_ext_dep.yaml
@@ -0,0 +1,21 @@
+## @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://media.githubusercontent.com/media/riscv/riscv-uefi-edk2-docs/master/gcc-riscv-edk2-ci-toolchain/gcc-riscv-9.2.0-2020.02-x86_64_riscv64-unknown-gnu.tar.xz",
+  "version": "9.2.0",
+  "compression_type": "tar",
+  "internal_path": "/gcc-riscv-9.2.0-2020.02-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 c31641e931..502d2c21d2 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,27 @@ class LinuxGcc5ToolChain(IUefiBuildPlugin):
             return -2
 
         return 0
+
+    def _check_riscv64(self):
+        # 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:
+            # 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
+
+            # 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
+
+        return 0
-- 
2.25.0


  parent reply	other threads:[~2020-03-04  6:02 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-04  5:26 [edk2/master PATCH RISC-V CI v1 0/6] RISC-V EDK2 CI configuration files Abner Chang
2020-03-04  5:26 ` [edk2/master PATCH RISC-V CI v1 1/6] RiscVPlatformPkg: Add RiscVPlatformPkg yaml file for EDK2 CI Abner Chang
2020-03-04  5:26 ` [edk2/master PATCH RISC-V CI v1 2/6] RiscVPkg: Add RiscVPkg " Abner Chang
2020-03-07 22:18   ` [edk2-devel] " Sean
2020-03-04  5:26 ` [edk2/master PATCH RISC-V CI v1 3/6] MdeModulePkg: Revise MdeModulePkg yaml file for RISC-V " Abner Chang
2020-03-07 22:15   ` [edk2-devel] " Sean
2020-03-04  5:26 ` Abner Chang [this message]
2020-03-07 22:13   ` [edk2-devel] [edk2/master PATCH RISC-V CI v1 4/6] BaseTools: Enable RISC-V architecture " Sean
2020-03-09  1:34     ` Abner Chang
2020-03-04  5:26 ` [edk2/master PATCH RISC-V CI v1 5/6] .azurepipelines: Add RISC-V architecture on " Abner Chang
2020-03-04  5:26 ` [edk2/master PATCH RISC-V CI v1 6/6] .pytool: " Abner Chang
2020-03-07 22:08   ` [edk2-devel] " Sean
2020-03-09  1:31     ` Abner Chang

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-list from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200304052607.31801-5-abner.chang@hpe.com \
    --to=devel@edk2.groups.io \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox