summaryrefslogtreecommitdiffstats
path: root/BaseTools/Plugin
diff options
context:
space:
mode:
authorChao Li <lichao@loongson.cn>2021-11-15 17:58:05 +0800
committermergify[bot] <37929162+mergify[bot]@users.noreply.github.com>2022-10-14 02:16:33 +0000
commitbcdafe1179e2de1b47a8f3fa9d134a241da8da6a (patch)
tree46b719d657a8581b70a18394a9edaa0a2091605b /BaseTools/Plugin
parent114e6075b668279697b6d25e1c2dbd28b246735b (diff)
downloadedk2-bcdafe1179e2de1b47a8f3fa9d134a241da8da6a.tar.gz
edk2-bcdafe1179e2de1b47a8f3fa9d134a241da8da6a.tar.bz2
edk2-bcdafe1179e2de1b47a8f3fa9d134a241da8da6a.zip
BaseTools: Enable LoongArch64 architecture for LoongArch64 EDK2 CI.
REF: https://bugzilla.tianocore.org/show_bug.cgi?id=4053 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> Reviewed-by: Michael D Kinney <michael.d.kinney@intel.com>
Diffstat (limited to 'BaseTools/Plugin')
-rw-r--r--BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py b/BaseTools/Plugin/LinuxGcc5ToolChain/LinuxGcc5ToolChain.py
index f0685d8040..dab7a87997 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_LOONGARCH64_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