public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
* [staging/LoongArch RESEND PATCH v1 16/33] BaseTools: Enable LoongArch64 architecture for LoongArch64 EDK2 CI.
@ 2022-02-09  6:55 Chao Li
  2022-04-08  6:52 ` [edk2-devel] " Abner Chang
  0 siblings, 1 reply; 2+ messages in thread
From: Chao Li @ 2022-02-09  6:55 UTC (permalink / raw)
  To: devel; +Cc: Bob Feng, Liming Gao, Yuwei Chen

EDK CI for LoongArch64 architecture

Enable LoongArch64 architecture for LoongArch64 EDK2 CI testing.

Cc: Bob Feng <bob.c.feng@intel.com>
Cc: Liming Gao <gaoliming@byosoft.com.cn>
Cc: Yuwei Chen <yuwei.chen@intel.com>

Signed-off-by: Chao Li <lichao@loongson.cn>
---
 ...gcc_loongarch64_unknown_linux_ext_dep.yaml | 22 +++++++++++++
 .../LinuxGcc5ToolChain/LinuxGcc5ToolChain.py  | 31 +++++++++++++++++++
 2 files changed, 53 insertions(+)
 create mode 100644 BaseTools/Bin/gcc_loongarch64_unknown_linux_ext_dep.yaml

diff --git a/BaseTools/Bin/gcc_loongarch64_unknown_linux_ext_dep.yaml b/BaseTools/Bin/gcc_loongarch64_unknown_linux_ext_dep.yaml
new file mode 100644
index 0000000000..6bdd7388f8
--- /dev/null
+++ b/BaseTools/Bin/gcc_loongarch64_unknown_linux_ext_dep.yaml
@@ -0,0 +1,22 @@
+## @file
+# Download GCC LoongArch64 compiler from LoongArch GitHub release site
+# Set shell variable GCC5_LOONGARCH64_INSTALL to this folder
+#
+# This is only downloaded when a build activates scope gcc_loongarch64_unknown_linux
+#
+# Copyright (c) Microsoft Corporation.
+# Copyright (c) 2022 Loongson Technology Corporation Limited. All rights reserved.<BR>
+# SPDX-License-Identifier: BSD-2-Clause-Patent
+##
+{
+  "scope": "gcc_loongarch64_unknown_linux",
+  "type": "web",
+  "name": "gcc_loongarch64_unknown_linux",
+  "source": "https://github.com/loongson/build-tools/releases/download/2021.12.21/loongarch64-clfs-2021-12-18-cross-tools-gcc-full.tar.xz",
+  "version": "12.0.0 20210810",
+  "sha256": "07f4e93423e76c57c775390099c76273b67cde2e441ed78192a2f4da9168c65a",
+  "compression_type": "tar",
+  "internal_path": "/cross-tools/",
+  "flags": ["set_shell_var", ],
+  "var_name": "GCC5_LOONGARCH64_INSTALL"
+}
diff --git a/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py b/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py
index f0685d8040..5615f8bb35 100644
--- a/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py
+++ b/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py
@@ -5,6 +5,7 @@
 #
 # Copyright (c) Microsoft Corporation
 # Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
+# Copyright (c) 2022 Loongson Technology Corporation Limited. All rights reserved.<BR>
 # SPDX-License-Identifier: BSD-2-Clause-Patent
 ##
 import os
@@ -43,6 +44,12 @@ class LinuxGcc5ToolChain(IUefiBuildPlugin):
                 self.Logger.critical("Failed in check riscv64")
                 return ret
 
+            # Check LoongArch64 compiler
+            ret = self._check_loongarch64()
+            if ret != 0:
+                self.Logger.critical("Failed in check loongarch64")
+                return ret
+
         return 0
 
     def _check_arm(self):
@@ -121,3 +128,27 @@ class LinuxGcc5ToolChain(IUefiBuildPlugin):
         shell_environment.GetEnvironment().set_shell_var("LD_LIBRARY_PATH", prefix)
 
         return 0
+
+    def _check_loongarch64(self):
+        # check to see if full path already configured
+        if shell_environment.GetEnvironment().get_shell_var("GCC5_LOONGARCH64_PREFIX") is not None:
+            self.Logger.info("GCC5_LOONGARCH64_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_LOONGARCH64_INSTALL")
+            if install_path is None:
+                return 0
+
+            # make GCC5_AARCH64_PREFIX to align with tools_def.txt
+            prefix = os.path.join(install_path, "bin", "loongarch64-unknown-linux-gnu-")
+            shell_environment.GetEnvironment().set_shell_var("GCC5_LOONGARCH64_PREFIX", prefix)
+
+        # now confirm it exists
+        if not os.path.exists(shell_environment.GetEnvironment().get_shell_var("GCC5_LOONGARCH64_PREFIX") + "gcc"):
+            self.Logger.error(
+                "Path for GCC5_LOONGARCH64_PREFIX toolchain is invalid")
+            return -2
+
+        return 0
-- 
2.27.0


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [edk2-devel] [staging/LoongArch RESEND PATCH v1 16/33] BaseTools: Enable LoongArch64 architecture for LoongArch64 EDK2 CI.
  2022-02-09  6:55 [staging/LoongArch RESEND PATCH v1 16/33] BaseTools: Enable LoongArch64 architecture for LoongArch64 EDK2 CI Chao Li
@ 2022-04-08  6:52 ` Abner Chang
  0 siblings, 0 replies; 2+ messages in thread
From: Abner Chang @ 2022-04-08  6:52 UTC (permalink / raw)
  To: devel@edk2.groups.io, lichao@loongson.cn; +Cc: Bob Feng, Liming Gao, Yuwei Chen

Acked-by: Abner Chang <abner.chang@hpe.com>

> -----Original Message-----
> From: devel@edk2.groups.io <devel@edk2.groups.io> On Behalf Of Chao Li
> Sent: Wednesday, February 9, 2022 2:55 PM
> To: devel@edk2.groups.io
> Cc: Bob Feng <bob.c.feng@intel.com>; Liming Gao
> <gaoliming@byosoft.com.cn>; Yuwei Chen <yuwei.chen@intel.com>
> Subject: [edk2-devel] [staging/LoongArch RESEND PATCH v1 16/33]
> BaseTools: Enable LoongArch64 architecture for LoongArch64 EDK2 CI.
> 
> EDK CI for LoongArch64 architecture
> 
> Enable LoongArch64 architecture for LoongArch64 EDK2 CI testing.
> 
> Cc: Bob Feng <bob.c.feng@intel.com>
> Cc: Liming Gao <gaoliming@byosoft.com.cn>
> Cc: Yuwei Chen <yuwei.chen@intel.com>
> 
> Signed-off-by: Chao Li <lichao@loongson.cn>
> ---
>  ...gcc_loongarch64_unknown_linux_ext_dep.yaml | 22 +++++++++++++
>  .../LinuxGcc5ToolChain/LinuxGcc5ToolChain.py  | 31
> +++++++++++++++++++
>  2 files changed, 53 insertions(+)
>  create mode 100644
> BaseTools/Bin/gcc_loongarch64_unknown_linux_ext_dep.yaml
> 
> diff --git a/BaseTools/Bin/gcc_loongarch64_unknown_linux_ext_dep.yaml
> b/BaseTools/Bin/gcc_loongarch64_unknown_linux_ext_dep.yaml
> new file mode 100644
> index 0000000000..6bdd7388f8
> --- /dev/null
> +++ b/BaseTools/Bin/gcc_loongarch64_unknown_linux_ext_dep.yaml
> @@ -0,0 +1,22 @@
> +## @file
> +# Download GCC LoongArch64 compiler from LoongArch GitHub release site
> +# Set shell variable GCC5_LOONGARCH64_INSTALL to this folder
> +#
> +# This is only downloaded when a build activates scope
> gcc_loongarch64_unknown_linux
> +#
> +# Copyright (c) Microsoft Corporation.
> +# Copyright (c) 2022 Loongson Technology Corporation Limited. All rights
> reserved.<BR>
> +# SPDX-License-Identifier: BSD-2-Clause-Patent
> +##
> +{
> +  "scope": "gcc_loongarch64_unknown_linux",
> +  "type": "web",
> +  "name": "gcc_loongarch64_unknown_linux",
> +  "source": "https://github.com/loongson/build-
> tools/releases/download/2021.12.21/loongarch64-clfs-2021-12-18-cross-
> tools-gcc-full.tar.xz",
> +  "version": "12.0.0 20210810",
> +  "sha256":
> "07f4e93423e76c57c775390099c76273b67cde2e441ed78192a2f4da9168c65a",
> +  "compression_type": "tar",
> +  "internal_path": "/cross-tools/",
> +  "flags": ["set_shell_var", ],
> +  "var_name": "GCC5_LOONGARCH64_INSTALL"
> +}
> diff --git a/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py
> b/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py
> index f0685d8040..5615f8bb35 100644
> --- a/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py
> +++ b/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py
> @@ -5,6 +5,7 @@
>  #
>  # Copyright (c) Microsoft Corporation
>  # Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights
> reserved.<BR>
> +# Copyright (c) 2022 Loongson Technology Corporation Limited. All rights
> reserved.<BR>
>  # SPDX-License-Identifier: BSD-2-Clause-Patent
>  ##
>  import os
> @@ -43,6 +44,12 @@ class LinuxGcc5ToolChain(IUefiBuildPlugin):
>                  self.Logger.critical("Failed in check riscv64")
>                  return ret
> 
> +            # Check LoongArch64 compiler
> +            ret = self._check_loongarch64()
> +            if ret != 0:
> +                self.Logger.critical("Failed in check loongarch64")
> +                return ret
> +
>          return 0
> 
>      def _check_arm(self):
> @@ -121,3 +128,27 @@ class LinuxGcc5ToolChain(IUefiBuildPlugin):
> 
> shell_environment.GetEnvironment().set_shell_var("LD_LIBRARY_PATH",
> prefix)
> 
>          return 0
> +
> +    def _check_loongarch64(self):
> +        # check to see if full path already configured
> +        if
> shell_environment.GetEnvironment().get_shell_var("GCC5_LOONGARCH64
> _PREFIX") is not None:
> +            self.Logger.info("GCC5_LOONGARCH64_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_LOONGARCH64_INSTALL")
> +            if install_path is None:
> +                return 0
> +
> +            # make GCC5_AARCH64_PREFIX to align with tools_def.txt
> +            prefix = os.path.join(install_path, "bin", "loongarch64-unknown-linux-
> gnu-")
> +
> shell_environment.GetEnvironment().set_shell_var("GCC5_LOONGARCH64
> _PREFIX", prefix)
> +
> +        # now confirm it exists
> +        if not
> os.path.exists(shell_environment.GetEnvironment().get_shell_var("GCC5_L
> OONGARCH64_PREFIX") + "gcc"):
> +            self.Logger.error(
> +                "Path for GCC5_LOONGARCH64_PREFIX toolchain is invalid")
> +            return -2
> +
> +        return 0
> --
> 2.27.0
> 
> 
> 
> 
> 


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2022-04-08  6:52 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-09  6:55 [staging/LoongArch RESEND PATCH v1 16/33] BaseTools: Enable LoongArch64 architecture for LoongArch64 EDK2 CI Chao Li
2022-04-08  6:52 ` [edk2-devel] " Abner Chang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox