From patchwork Thu Aug 10 07:42:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Xianglai Li X-Patchwork-Id: 13348890 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6580EC04A94 for ; Thu, 10 Aug 2023 07:44:11 +0000 (UTC) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qU0KJ-0005MM-IX; Thu, 10 Aug 2023 03:43:23 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1qU0KH-0005ME-Km for qemu-devel@nongnu.org; Thu, 10 Aug 2023 03:43:21 -0400 Received: from mail.loongson.cn ([114.242.206.163]) by eggs.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1qU0KD-0003V3-HG for qemu-devel@nongnu.org; Thu, 10 Aug 2023 03:43:21 -0400 Received: from loongson.cn (unknown [10.2.5.185]) by gateway (Coremail) with SMTP id _____8AxZ+gGldRks3oUAA--.8434S3; Thu, 10 Aug 2023 15:43:03 +0800 (CST) Received: from localhost.localdomain (unknown [10.2.5.185]) by localhost.localdomain (Coremail) with SMTP id AQAAf8CxbSMDldRk9bhSAA--.26845S2; Thu, 10 Aug 2023 15:42:59 +0800 (CST) From: xianglai li To: qemu-devel@nongnu.org Cc: Paolo Bonzini , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Thomas Huth , =?utf-8?q?Philippe_Mathieu-Daud=C3=A9?= , Gerd Hoffmann , Xiaojuan Yang , Song Gao , Bibo Mao Subject: [PATCH] roms: Support compile the efi bios for loongarch Date: Thu, 10 Aug 2023 15:42:58 +0800 Message-Id: <260307952ffe5382a55d66a4999034490e04f7df.1691653307.git.lixianglai@loongson.cn> X-Mailer: git-send-email 2.39.1 MIME-Version: 1.0 X-CM-TRANSID: AQAAf8CxbSMDldRk9bhSAA--.26845S2 X-CM-SenderInfo: 5ol0xt5qjotxo6or00hjvr0hdfq/ X-Coremail-Antispam: 1Uk129KBjDUn29KB7ZKAUJUUUUU529EdanIXcx71UUUUU7KY7 ZEXasCq-sGcSsGvfJ3UbIjqfuFe4nvWSU5nxnvy29KBjDU0xBIdaVrnUUvcSsGvfC2Kfnx nUUI43ZEXa7xR_UUUUUUUUU== Received-SPF: pass client-ip=114.242.206.163; envelope-from=lixianglai@loongson.cn; helo=mail.loongson.cn X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org 1.Add edk2-platform submodule 2.Added loongarch UEFI BIOS support to compiled scripts. 3.The cross-compilation toolchain on x86 can be obtained from the link below: https://github.com/loongson/build-tools/tree/2022.09.06 Cc: Paolo Bonzini Cc: "Marc-André Lureau" Cc: "Daniel P. Berrangé" Cc: Thomas Huth Cc: "Philippe Mathieu-Daudé" Cc: Gerd Hoffmann Cc: Xiaojuan Yang Cc: Song Gao Cc: Bibo Mao Signed-off-by: xianglai li --- .gitmodules | 3 +++ meson.build | 2 +- pc-bios/meson.build | 2 ++ roms/edk2-build.config | 14 ++++++++++++++ roms/edk2-build.py | 4 ++-- roms/edk2-platforms | 1 + 6 files changed, 23 insertions(+), 3 deletions(-) create mode 160000 roms/edk2-platforms diff --git a/.gitmodules b/.gitmodules index 73cae4cd4d..0cb57123fa 100644 --- a/.gitmodules +++ b/.gitmodules @@ -43,3 +43,6 @@ [submodule "tests/lcitool/libvirt-ci"] path = tests/lcitool/libvirt-ci url = https://gitlab.com/libvirt/libvirt-ci.git +[submodule "roms/edk2-platforms"] + path = roms/edk2-platforms + url = https://github.com/tianocore/edk2-platforms.git diff --git a/meson.build b/meson.build index 98e68ef0b1..b398caf2ce 100644 --- a/meson.build +++ b/meson.build @@ -153,7 +153,7 @@ if targetos != 'darwin' modular_tcg = ['i386-softmmu', 'x86_64-softmmu'] endif -edk2_targets = [ 'arm-softmmu', 'aarch64-softmmu', 'i386-softmmu', 'x86_64-softmmu' ] +edk2_targets = [ 'arm-softmmu', 'aarch64-softmmu', 'i386-softmmu', 'x86_64-softmmu', 'loongarch64-softmmu' ] unpack_edk2_blobs = false foreach target : edk2_targets if target in target_dirs diff --git a/pc-bios/meson.build b/pc-bios/meson.build index a7224ef469..fc73222b6c 100644 --- a/pc-bios/meson.build +++ b/pc-bios/meson.build @@ -9,6 +9,8 @@ if unpack_edk2_blobs 'edk2-i386-vars.fd', 'edk2-x86_64-code.fd', 'edk2-x86_64-secure-code.fd', + 'edk2-loongarch64-code.fd', + 'edk2-loongarch64-vars.fd', ] foreach f : fds diff --git a/roms/edk2-build.config b/roms/edk2-build.config index 66ef9ffcb9..7960c4c2c5 100644 --- a/roms/edk2-build.config +++ b/roms/edk2-build.config @@ -1,5 +1,6 @@ [global] core = edk2 +pkgs = edk2-platforms #################################################################################### # options @@ -122,3 +123,16 @@ plat = RiscVVirtQemu dest = ../pc-bios cpy1 = FV/RISCV_VIRT.fd edk2-riscv.fd pad1 = edk2-riscv.fd 32m + +#################################################################################### +# LoongArch64 + +[build.loongach64.qemu] +conf = Platform/Loongson/LoongArchQemuPkg/Loongson.dsc +arch = LOONGARCH64 +plat = LoongArchQemu +dest = ../pc-bios +cpy1 = FV/QEMU_EFI.fd edk2-loongarch64-code.fd +pad1 = edk2-loongarch64-code.fd 4m +cpy2 = FV/QEMU_VARS.fd edk2-loongarch64-vars.fd +pad2 = edk2-loongarch64-vars.fd 16m diff --git a/roms/edk2-build.py b/roms/edk2-build.py index 870893f7c8..dbd641e51e 100755 --- a/roms/edk2-build.py +++ b/roms/edk2-build.py @@ -269,8 +269,8 @@ def prepare_env(cfg): # for cross builds if binary_exists('arm-linux-gnu-gcc'): os.environ['GCC5_ARM_PREFIX'] = 'arm-linux-gnu-' - if binary_exists('loongarch64-linux-gnu-gcc'): - os.environ['GCC5_LOONGARCH64_PREFIX'] = 'loongarch64-linux-gnu-' + if binary_exists('loongarch64-unknown-linux-gnu-gcc'): + os.environ['GCC5_LOONGARCH64_PREFIX'] = 'loongarch64-unknown-linux-gnu-' hostarch = os.uname().machine if binary_exists('aarch64-linux-gnu-gcc') and hostarch != 'aarch64': diff --git a/roms/edk2-platforms b/roms/edk2-platforms new file mode 160000 index 0000000000..84ccada592 --- /dev/null +++ b/roms/edk2-platforms @@ -0,0 +1 @@ +Subproject commit 84ccada59257a8151a592a416017fbb03b8ed3cf