* [Buildroot] [PATCH 1/1] support/testing/tests/boot/test_grub.py: new test for RISCV64 EFI
@ 2024-11-05 20:41 Julien Olivain
2024-11-11 20:16 ` Thomas Petazzoni via buildroot
0 siblings, 1 reply; 2+ messages in thread
From: Julien Olivain @ 2024-11-05 20:41 UTC (permalink / raw)
To: buildroot; +Cc: Thomas Petazzoni, Julien Olivain
Commit f439b47ed "boot/grub2: add RISC-V 64bit EFI support" [1]
introduced the grub2 RISC-V UEFI support.
At that time, it was not possible to have a runtime test for this.
qemu-system-riscv64 is not in the Buildroot Docker reference image,
and the base distribution (Debian 11) does not provide a
sufficiently recent version. A qemu-system-riscv64 >= 8.0.0 is needed.
Commit 0d4177598 "support/testing/infra/emulator.py: add build host
dir to qemu search path" [2] added the capability to use the
Buildroot host-qemu package inside runtime test.
With this support, it is now possible to add a runtime test for a
grub2 UEFI boot on RISC-V 64bit.
[1] https://gitlab.com/buildroot.org/buildroot/-/commit/f439b47ed6e987306c7de6d9c3be11de04935377
[2] https://gitlab.com/buildroot.org/buildroot/-/commit/0d4177598ce7e73f2b97ac58c21fb177343643e3
Signed-off-by: Julien Olivain <ju.o@free.fr>
---
support/testing/tests/boot/test_grub.py | 44 +++++++++++++++++++++++++
1 file changed, 44 insertions(+)
diff --git a/support/testing/tests/boot/test_grub.py b/support/testing/tests/boot/test_grub.py
index c753a16c34..d9b5ed2143 100644
--- a/support/testing/tests/boot/test_grub.py
+++ b/support/testing/tests/boot/test_grub.py
@@ -172,3 +172,47 @@ class TestGrubAArch64EFI(infra.basetest.BRTest):
cmd = "efivar -l"
self.assertRunOk(cmd)
+
+
+class TestGrubRiscV64EFI(infra.basetest.BRTest):
+ config = \
+ """
+ BR2_riscv=y
+ BR2_TOOLCHAIN_EXTERNAL=y
+ BR2_ROOTFS_POST_IMAGE_SCRIPT="board/qemu/post-image.sh board/qemu/riscv64-virt-efi/assemble-flash-images support/scripts/genimage.sh"
+ BR2_ROOTFS_POST_SCRIPT_ARGS="-c board/qemu/riscv64-virt-efi/genimage.cfg"
+ BR2_LINUX_KERNEL=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION=y
+ BR2_LINUX_KERNEL_CUSTOM_VERSION_VALUE="6.6.59"
+ BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=y
+ BR2_PACKAGE_EFIVAR=y
+ BR2_TARGET_ROOTFS_EXT2=y
+ # BR2_TARGET_ROOTFS_TAR is not set
+ BR2_TARGET_EDK2=y
+ BR2_TARGET_GRUB2=y
+ BR2_TARGET_GRUB2_RISCV64_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
+ """
+
+ def test_run(self):
+ disk = os.path.join(self.builddir, "images", "disk.img")
+ flash0 = os.path.join(self.builddir, "images", "RISCV_VIRT_CODE.fd")
+ flash1 = os.path.join(self.builddir, "images", "RISCV_VIRT_VARS.fd")
+ qemu_opts = [
+ "-M", "virt,pflash0=pflash0,pflash1=pflash1,acpi=off",
+ "-blockdev", f"node-name=pflash0,driver=file,read-only=on,filename={flash0}",
+ "-blockdev", f"node-name=pflash1,driver=file,filename={flash1}",
+ "-drive", f"file={disk},format=raw,if=virtio"
+ ]
+ self.emulator.boot(arch="riscv64", options=qemu_opts)
+ self.emulator.login()
+
+ cmd = "mount -t efivarfs none /sys/firmware/efi/efivars"
+ self.assertRunOk(cmd)
+
+ cmd = "efivar -l"
+ self.assertRunOk(cmd)
--
2.47.0
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [Buildroot] [PATCH 1/1] support/testing/tests/boot/test_grub.py: new test for RISCV64 EFI
2024-11-05 20:41 [Buildroot] [PATCH 1/1] support/testing/tests/boot/test_grub.py: new test for RISCV64 EFI Julien Olivain
@ 2024-11-11 20:16 ` Thomas Petazzoni via buildroot
0 siblings, 0 replies; 2+ messages in thread
From: Thomas Petazzoni via buildroot @ 2024-11-11 20:16 UTC (permalink / raw)
To: Julien Olivain; +Cc: buildroot
On Tue, 5 Nov 2024 21:41:44 +0100
Julien Olivain <ju.o@free.fr> wrote:
> Commit f439b47ed "boot/grub2: add RISC-V 64bit EFI support" [1]
> introduced the grub2 RISC-V UEFI support.
>
> At that time, it was not possible to have a runtime test for this.
> qemu-system-riscv64 is not in the Buildroot Docker reference image,
> and the base distribution (Debian 11) does not provide a
> sufficiently recent version. A qemu-system-riscv64 >= 8.0.0 is needed.
>
> Commit 0d4177598 "support/testing/infra/emulator.py: add build host
> dir to qemu search path" [2] added the capability to use the
> Buildroot host-qemu package inside runtime test.
>
> With this support, it is now possible to add a runtime test for a
> grub2 UEFI boot on RISC-V 64bit.
>
> [1] https://gitlab.com/buildroot.org/buildroot/-/commit/f439b47ed6e987306c7de6d9c3be11de04935377
> [2] https://gitlab.com/buildroot.org/buildroot/-/commit/0d4177598ce7e73f2b97ac58c21fb177343643e3
>
> Signed-off-by: Julien Olivain <ju.o@free.fr>
> ---
> support/testing/tests/boot/test_grub.py | 44 +++++++++++++++++++++++++
> 1 file changed, 44 insertions(+)
Applied to master, thanks.
Thomas
--
Thomas Petazzoni, CTO, Bootlin
Embedded Linux and Kernel engineering
https://bootlin.com
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2024-11-11 20:16 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-11-05 20:41 [Buildroot] [PATCH 1/1] support/testing/tests/boot/test_grub.py: new test for RISCV64 EFI Julien Olivain
2024-11-11 20:16 ` Thomas Petazzoni via buildroot
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox