edk2/OvmfPkg/LoongArchVirt
Qihang Gao ae8814ff6b OvmfPkg/LoongArchVirt: Add Hash2DxeCrypto to satisfy TcpDxe dependency
The TcpDxe driver requires the Hash2 protocol to be available for its
dispatch. On the LoongArchVirt QEMU platform, this protocol was not
previously included, leading to failures when the network stack attempted
to initialize.

Add SecurityPkg/Hash2DxeCrypto to both the DSC and FDF files, ensuring
that the Hash2 protocol is installed and can be consumed by TcpDxe.

Signed-off-by: Qihang Gao <gaoqihang@loongson.cn>
2026-08-03 11:07:16 +00:00
..
Drivers/StableTimerDxe OvmfPkg/LoongArchVirt: Add stable timer driver 2024-06-18 15:02:15 +00:00
Feature/SecureBoot/SecureBootKeys OvmfPkg/LoongArchVirt: Add Secure Boot key layout scaffolding 2026-03-20 01:33:21 +00:00
Library OvmfPkg/LoongArchVirt: Fix ResetSystemLibConstructor signature and header 2026-07-02 11:18:20 +00:00
PlatformPei OvmfPkg/LoongArchVirt: Add TPM platform PEI support 2026-07-09 16:07:34 +00:00
Sec MdePkg: Move StackCheckLibStaticInit to StackCheckLib 2025-02-07 02:23:11 +00:00
LoongArchVirt.fdf.inc OvmfPkg/LoongArchVirt: Modify loongarch uefi firmware size 2024-09-12 13:25:43 +00:00
LoongArchVirtQemu.dsc OvmfPkg/LoongArchVirt: Add Hash2DxeCrypto to satisfy TcpDxe dependency 2026-08-03 11:07:16 +00:00
LoongArchVirtQemu.fdf OvmfPkg/LoongArchVirt: Add Hash2DxeCrypto to satisfy TcpDxe dependency 2026-08-03 11:07:16 +00:00
Readme.md OvmfPkg/LoongArchVirt: document Secure Boot variable policy settings 2026-06-12 11:24:44 +00:00
VarStore.fdf.inc OvmfPkg/LoongArchVirt: Add build file 2024-06-18 15:02:15 +00:00

LoongArch QEMU virt platform

Overview

LoongArch QEMU virt is a generic platform that does not require any actual hardware. The minimum required QEMU version is 8.1, the minimum required GCC version is GCC13, the minimum required Binutils version is 2.40.

Prepare (X86 Linux Environment)

Fedora39 and higher

Install LoongArch64 cross compiler, LoongArch system QEMU.

yum install gcc-loongarch64-linux-gnu
yum install qemu-system-loongarch64

Others X86 OS ENV

Configure cross-tools

Download:

wget https://github.com/loongson/build-tools/releases/download/2023.08.08/x86_64-cross-tools-loongarch64-binutils_2.41-gcc_13.2.0.tar.xz

Configure the cross-tools environment:

mkdir /opt/loongarch64_cross-toolchain/
tar -vxf x86_64-cross-tools-loongarch64-binutils_2.41-gcc_13.2.0.tar.xz -C /opt/loongarch64_cross-toolchain/
export PATH=/opt/loongarch64_cross-toolchain/cross-tools/bin:$PATH

Note: Please obtain the latest cross-compilation toolchains.

Build QEMU

git clone https://gitlab.com/qemu-project/qemu.git

Note: Please refer to QEMU compilation rules, located in qemu/doc/system/loongarch/virt.rst.

Build LoongArch QEMU virtual machine firmware

Get edk2 resouces

git clone --recurse-submodule https://github.com/tianocore/edk2.git

Building LoongArch QEMU virt FW with GCC

export WORKSPACE=`pwd`
export GCC_LOONGARCH64_PREFIX=loongarch64-unknown-linux-gnu-
export PACKAGES_PATH=$WORKSPACE/edk2
export EDK_TOOLS_PATH=$WORKSPACE/edk2/BaseTools
source edk2/edksetup.sh --reconfig
make -C edk2/BaseTools
source edk2/edksetup.sh BaseTools
build -b RELEASE -t GCC -a LOONGARCH64 -p OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc

Secure Boot

LoongArchVirt Secure Boot builds that are intended to keep Secure Boot state locked from the guest should use the QEMU UEFI variable store:

build -b RELEASE -t GCC -a LOONGARCH64 \
  -p OvmfPkg/LoongArchVirt/LoongArchVirtQemu.dsc \
  -D SECURE_BOOT_ENABLE=TRUE \
  -D QEMU_PV_VARS=TRUE

When using QEMU_PV_VARS=TRUE, configure the QEMU uefi-vars-sysbus device with policy options that keep Secure Boot enabled and prevent guest-side Custom Mode changes:

-device uefi-vars-sysbus,jsonfile=/path/to/varstore.json,\

disable-custom-mode=on,force-secure-boot=on

Without these QEMU-side policy options, the VM manager does not lock the guest out of Custom Mode or Secure Boot state changes through UEFI variable services. LoongArchVirt does not provide a hardware-backed physical-presence mechanism, so locked Secure Boot deployments must express this policy in the QEMU configuration.

Refer to OvmfPkg/QEMU_PV_VARS.md for more information about the QEMU UEFI variable store.

Test LoongArch QEMU virtual machine firmware

qemu-system-loongarch64 \
-m 4G \
-M virt \
-smp 2 \
-cpu la464 \
-bios Build/LoongArchVirtQemu/RELEASE_GCC/FV/QEMU_EFI.fd \
-serial stdio

Test LoongArch QEMU virtual machine OS