configs/qemu_loongarch64_virt_efi: new defconfig

Add qemu_loongarch64_virt_efi_defconfig, which builds EDK2
and host QEMU to test LoongArch64 buildroot.

Signed-off-by: Jiaxun Yang <jiaxun.yang@flygoat.com>
Reviewed-by: Romain Naour <romain.naour@smile.fr>
Tested-by: Romain Naour <romain.naour@smile.fr>
Reviewed-by: Julien Olivain <ju.o@free.fr>
Tested-by: Julien Olivain <ju.o@free.fr>
Signed-off-by: Julien Olivain <ju.o@free.fr>
This commit is contained in:
Jiaxun Yang
2025-06-18 19:20:35 +01:00
committed by Julien Olivain
parent e20271ba37
commit ef55ca4075
6 changed files with 99 additions and 0 deletions

View File

@@ -1645,7 +1645,9 @@ F: package/rtty/
N: Jiaxun Yang <jiaxun.yang@flygoat.com>
F: arch/Config.in.loongarch
F: board/loongarch64-efi
F: board/qemu/loongarch64-virt-efi
F: configs/loongarch64_efi_defconfig
F: configs/qemu_loongarch64_virt_efi_defconfig
N: Joachim Wiberg <troglobit@gmail.com>
F: configs/globalscale_espressobin_defconfig

View File

@@ -0,0 +1,30 @@
image efi-part.vfat {
vfat {
file EFI {
image = "efi-part/EFI"
}
file vmlinux.efi {
image = "vmlinux.efi"
}
}
size = 64M
}
image disk.img {
hdimage {
partition-table-type = "gpt"
}
partition boot {
image = "efi-part.vfat"
partition-type-uuid = U
offset = 32K
bootable = true
}
partition root {
partition-type-uuid = root-loongarch64
image = "rootfs.ext2"
}
}

View File

@@ -0,0 +1,6 @@
set default="0"
set timeout="5"
menuentry "Buildroot" {
linux /vmlinux.efi root=PARTLABEL=root rootwait console=ttyS0
}

View File

@@ -0,0 +1,5 @@
#!/bin/sh
BOARD_DIR="$(dirname "$0")"
cp -f "${BOARD_DIR}/grub.cfg" "${BINARIES_DIR}/efi-part/EFI/BOOT/grub.cfg"

View File

@@ -0,0 +1,31 @@
Intro
=====
This is a LoongArch 64bit UEFI Linux boot demo in QEMU virt machine.
Build
=====
make qemu_loongarch64_virt-efi_defconfig
make
Emulation
=========
Run the emulation with:
qemu-system-loongarch64 \
-M virt \
-smp 2 \
-m 1024 \
-nographic \
-bios output/images/QEMU_EFI.fd \
-drive file=output/images/disk.img,format=raw \
-netdev user,id=net0 \
-device virtio-net-pci,netdev=net0 # qemu_loongarch64_virt_efi_defconfig
Note: for information, qemu version >= 9.0.0 is needed for this UEFI
Linux demo. The host-qemu package in Buildroot (enabled in this
defconfig) is sufficient to run this demo. In case another qemu is
used (for example, from the host OS), make sure to check the version
requirement.

View File

@@ -0,0 +1,25 @@
BR2_loongarch64=y
BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_12=y
BR2_GLOBAL_PATCH_DIR="board/qemu/patches"
BR2_DOWNLOAD_FORCE_CHECK_HASHES=y
BR2_ROOTFS_DEVICE_CREATION_DYNAMIC_EUDEV=y
BR2_SYSTEM_DHCP="eth0"
BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/loongarch64-virt-efi/post-image.sh board/qemu/post-image.sh support/scripts/genimage.sh"
BR2_ROOTFS_POST_SCRIPT_ARGS="$(BR2_DEFCONFIG) -c board/qemu/loongarch64-virt-efi/genimage.cfg"
BR2_LINUX_KERNEL=y
BR2_LINUX_KERNEL_CUSTOM_VERSION=y
BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.12.27"
BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
BR2_LINUX_KERNEL_NEEDS_HOST_OPENSSL=y
BR2_LINUX_KERNEL_NEEDS_HOST_LIBELF=y
BR2_TARGET_ROOTFS_EXT2=y
BR2_TARGET_ROOTFS_EXT2_SIZE="200M"
# BR2_TARGET_ROOTFS_TAR is not set
BR2_TARGET_EDK2=y
BR2_TARGET_GRUB2=y
BR2_TARGET_GRUB2_LOONGARCH64_EFI=y
BR2_PACKAGE_HOST_DOSFSTOOLS=y
BR2_PACKAGE_HOST_GENIMAGE=y
BR2_PACKAGE_HOST_MTOOLS=y
BR2_PACKAGE_HOST_QEMU=y
BR2_PACKAGE_HOST_QEMU_SYSTEM_MODE=y