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>
This commit is contained in:
Chao Li 2021-11-15 17:58:05 +08:00 committed by mergify[bot]
parent 114e6075b6
commit bcdafe1179
2 changed files with 53 additions and 0 deletions

View File

@ -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/2022.09.06/loongarch64-clfs-6.3-cross-tools-gcc-full.tar.xz",
"version": "13.0.0",
"sha256":"27a43c5bb127794f091d0e75da0003c4d0eec28a958d8f2cc7cd290a6e6133ab",
"compression_type": "tar",
"internal_path": "/cross-tools/",
"flags": ["set_shell_var", ],
"var_name": "GCC5_LOONGARCH64_INSTALL"
}

View File

@ -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