All of lore.kernel.org
 help / color / mirror / Atom feed
* [Buildroot] [PATCH 1/2] boot/grub2: add RISC-V 64bit EFI support
@ 2023-12-23 19:41 Julien Olivain
  2023-12-23 19:41 ` [Buildroot] [PATCH 2/2] configs/qemu_riscv64_virt_efi: new defconfig Julien Olivain
  2023-12-23 21:29 ` [Buildroot] [PATCH v2 1/2] boot/grub2: add RISC-V 64bit EFI support Julien Olivain
  0 siblings, 2 replies; 9+ messages in thread
From: Julien Olivain @ 2023-12-23 19:41 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Julien Olivain, Thomas Petazzoni

Grub can be built as a RISC-V UEFI application since commit [1]. This
commit was first included in grub version 2.04.

This commit enables this support.

[1] https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commitdiff;h=f1957dc8a3347278a095bc8f44197662559a8ba3

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 boot/grub2/Config.in | 10 ++++++++++
 boot/grub2/grub2.mk  |  9 +++++++++
 2 files changed, 19 insertions(+)

diff --git a/boot/grub2/Config.in b/boot/grub2/Config.in
index f05f33ccc7..7c235e96f7 100644
--- a/boot/grub2/Config.in
+++ b/boot/grub2/Config.in
@@ -4,6 +4,7 @@ config BR2_TARGET_GRUB2_ARCH_SUPPORTS
 	default y if BR2_x86_64
 	default y if BR2_arm
 	default y if BR2_aarch64
+	default y if BR2_RISCV_64
 	depends on BR2_USE_MMU
 
 config BR2_TARGET_GRUB2
@@ -102,6 +103,15 @@ config BR2_TARGET_GRUB2_ARM64_EFI
 	  Aarch64 platform and you want to boot Grub 2 as an EFI
 	  application.
 
+config BR2_TARGET_GRUB2_RISCV64_EFI
+	bool "riscv64-efi"
+	depends on BR2_RISCV_64
+	select BR2_TARGET_GRUB2_HAS_EFI_BOOT
+	help
+	  Select this option if the platform you're targetting is a
+	  64bit RISC-V platform and you want to boot Grub 2 as an EFI
+	  application.
+
 if BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
 
 comment "Options for the x86 legacy BIOS or ARM U-Boot support"
diff --git a/boot/grub2/grub2.mk b/boot/grub2/grub2.mk
index b9be826885..679eac5f46 100644
--- a/boot/grub2/grub2.mk
+++ b/boot/grub2/grub2.mk
@@ -93,6 +93,15 @@ GRUB2_BUILTIN_CONFIG_arm64-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
 GRUB2_BUILTIN_MODULES_arm64-efi = $(GRUB2_BUILTIN_MODULES_EFI)
 GRUB2_TUPLES-$(BR2_TARGET_GRUB2_ARM64_EFI) += arm64-efi
 
+GRUB2_IMAGE_riscv64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootriscv64.efi
+GRUB2_CFG_riscv64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg
+GRUB2_PREFIX_riscv64-efi = /EFI/BOOT
+GRUB2_TARGET_riscv64-efi = riscv64
+GRUB2_PLATFORM_riscv64-efi = efi
+GRUB2_BUILTIN_CONFIG_riscv64-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
+GRUB2_BUILTIN_MODULES_riscv64-efi = $(GRUB2_BUILTIN_MODULES_EFI)
+GRUB2_TUPLES-$(BR2_TARGET_GRUB2_RISCV64_EFI) += riscv64-efi
+
 # Grub2 is kind of special: it considers CC, LD and so on to be the
 # tools to build the host programs and uses TARGET_CC, TARGET_CFLAGS,
 # TARGET_CPPFLAGS, TARGET_LDFLAGS to build the bootloader itself.
-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH 2/2] configs/qemu_riscv64_virt_efi: new defconfig
  2023-12-23 19:41 [Buildroot] [PATCH 1/2] boot/grub2: add RISC-V 64bit EFI support Julien Olivain
@ 2023-12-23 19:41 ` Julien Olivain
  2023-12-23 21:29 ` [Buildroot] [PATCH v2 1/2] boot/grub2: add RISC-V 64bit EFI support Julien Olivain
  1 sibling, 0 replies; 9+ messages in thread
From: Julien Olivain @ 2023-12-23 19:41 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Julien Olivain, Thomas Petazzoni

This defconfig enables edk2 UEFI shell and grub2 riscv64-efi boot
of a Linux Kernel.

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
Patch series tested on branch master at commit 50eed20 with commands:

    make check-package
    ...
    0 warnings generated

    make qemu_riscv64_virt_efi_defconfig
    make
    output/images/start-qemu.sh

Once logged as root in emulator:

    dmesg | grep -i efi
    mount -t efivarfs efivarfs /sys/firmware/efi/efivars
    ls -al /sys/firmware/efi/efivars
---
 DEVELOPERS                                    |  2 ++
 .../riscv64-virt-efi/assemble-flash-images    | 11 ++++++
 board/qemu/riscv64-virt-efi/genimage.cfg      | 34 ++++++++++++++++++
 board/qemu/riscv64-virt-efi/grub.cfg          |  6 ++++
 board/qemu/riscv64-virt-efi/readme.txt        | 36 +++++++++++++++++++
 configs/qemu_riscv64_virt_efi_defconfig       | 19 ++++++++++
 6 files changed, 108 insertions(+)
 create mode 100755 board/qemu/riscv64-virt-efi/assemble-flash-images
 create mode 100644 board/qemu/riscv64-virt-efi/genimage.cfg
 create mode 100644 board/qemu/riscv64-virt-efi/grub.cfg
 create mode 100644 board/qemu/riscv64-virt-efi/readme.txt
 create mode 100644 configs/qemu_riscv64_virt_efi_defconfig

diff --git a/DEVELOPERS b/DEVELOPERS
index bad07d51aa..cfd8b7bd8f 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1713,11 +1713,13 @@ F:	configs/ts7680_defconfig
 F:	package/paho-mqtt-c
 
 N:	Julien Olivain <ju.o@free.fr>
+F:	board/qemu/riscv64-virt-efi/
 F:	board/spike/
 F:	board/technexion/imx8mmpico/
 F:	board/technexion/imx8mpico/
 F:	configs/imx8mmpico_defconfig
 F:	configs/imx8mpico_defconfig
+F:	configs/qemu_riscv64_virt_efi_defconfig
 F:	configs/spike_riscv64_defconfig
 F:	package/fluid-soundfont/
 F:	package/fluidsynth/
diff --git a/board/qemu/riscv64-virt-efi/assemble-flash-images b/board/qemu/riscv64-virt-efi/assemble-flash-images
new file mode 100755
index 0000000000..abcaa2c93b
--- /dev/null
+++ b/board/qemu/riscv64-virt-efi/assemble-flash-images
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+set -e
+
+BOARD_DIR="$(dirname "$0")"
+
+cp -f "${BOARD_DIR}"/grub.cfg "${BINARIES_DIR}"/efi-part/EFI/BOOT/grub.cfg
+
+# The QEMU riscv64 virt machine expects flash devices to be 32M.
+truncate -s 32M "${BINARIES_DIR}"/RISCV_VIRT_CODE.fd
+truncate -s 32M "${BINARIES_DIR}"/RISCV_VIRT_VARS.fd
diff --git a/board/qemu/riscv64-virt-efi/genimage.cfg b/board/qemu/riscv64-virt-efi/genimage.cfg
new file mode 100644
index 0000000000..46950591e0
--- /dev/null
+++ b/board/qemu/riscv64-virt-efi/genimage.cfg
@@ -0,0 +1,34 @@
+image efi-part.vfat {
+	vfat {
+		file EFI {
+			image = "efi-part/EFI"
+		}
+
+		file Image {
+			image = "Image"
+		}
+	}
+
+	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 {
+		# For partition-type-uuid value, see:
+		# https://uapi-group.org/specifications/specs/discoverable_partitions_specification/
+		# SD_GPT_ROOT_RISCV64
+		partition-type-uuid = 72ec70a6-cf74-40e6-bd49-4bda08e8f224
+		image = "rootfs.ext2"
+	}
+}
diff --git a/board/qemu/riscv64-virt-efi/grub.cfg b/board/qemu/riscv64-virt-efi/grub.cfg
new file mode 100644
index 0000000000..d99e19c4cd
--- /dev/null
+++ b/board/qemu/riscv64-virt-efi/grub.cfg
@@ -0,0 +1,6 @@
+set default="0"
+set timeout="5"
+
+menuentry "Buildroot" {
+	linux /Image root=PARTLABEL=root rootwait
+}
diff --git a/board/qemu/riscv64-virt-efi/readme.txt b/board/qemu/riscv64-virt-efi/readme.txt
new file mode 100644
index 0000000000..6b9651a011
--- /dev/null
+++ b/board/qemu/riscv64-virt-efi/readme.txt
@@ -0,0 +1,36 @@
+Intro
+=====
+
+This is a RISC-V 64bit UEFI Linux boot demo in QEmu virt machine.
+
+Build
+=====
+
+    make qemu_riscv64_virt_efi_defconfig
+    make
+
+Emulation
+=========
+
+Run the emulation with:
+
+    qemu-system-riscv64 \
+        -M virt,pflash0=pflash0,pflash1=pflash1,acpi=off \
+        -smp 4 \
+        -m 1024 \
+        -nographic \
+        -blockdev node-name=pflash0,driver=file,read-only=on,filename=output/images/RISCV_VIRT_CODE.fd \
+        -blockdev node-name=pflash1,driver=file,filename=output/images/RISCV_VIRT_VARS.fd \
+        \
+        -drive file=output/images/disk.img,format=raw,id=hd0 \
+        -device virtio-blk-device,drive=hd0 \
+        \
+        -netdev user,id=net0 \
+        -device virtio-net-device,netdev=net0 # qemu_riscv64_virt_efi_defconfig
+
+Note: for information, qemu version >= 8.0.0 is needed for this UEFI
+Linux demo. It introduced the two pflash memories (previous versions
+had only one). 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.
diff --git a/configs/qemu_riscv64_virt_efi_defconfig b/configs/qemu_riscv64_virt_efi_defconfig
new file mode 100644
index 0000000000..d26af132d5
--- /dev/null
+++ b/configs/qemu_riscv64_virt_efi_defconfig
@@ -0,0 +1,19 @@
+BR2_riscv=y
+BR2_TOOLCHAIN_EXTERNAL=y
+BR2_SYSTEM_DHCP="eth0"
+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="$(BR2_DEFCONFIG) -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.1.69"
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=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
-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 1/2] boot/grub2: add RISC-V 64bit EFI support
  2023-12-23 19:41 [Buildroot] [PATCH 1/2] boot/grub2: add RISC-V 64bit EFI support Julien Olivain
  2023-12-23 19:41 ` [Buildroot] [PATCH 2/2] configs/qemu_riscv64_virt_efi: new defconfig Julien Olivain
@ 2023-12-23 21:29 ` Julien Olivain
  2023-12-23 21:29   ` [Buildroot] [PATCH v2 2/2] configs/qemu_riscv64_virt_efi: new defconfig Julien Olivain
                     ` (2 more replies)
  1 sibling, 3 replies; 9+ messages in thread
From: Julien Olivain @ 2023-12-23 21:29 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Julien Olivain, Thomas Petazzoni

Grub can be built as a RISC-V UEFI application since commit [1]. This
commit was first included in grub version 2.04.

This commit enables this support.

[1] https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commitdiff;h=f1957dc8a3347278a095bc8f44197662559a8ba3

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
 boot/grub2/Config.in | 10 ++++++++++
 boot/grub2/grub2.mk  |  9 +++++++++
 2 files changed, 19 insertions(+)

diff --git a/boot/grub2/Config.in b/boot/grub2/Config.in
index f05f33ccc7..7c235e96f7 100644
--- a/boot/grub2/Config.in
+++ b/boot/grub2/Config.in
@@ -4,6 +4,7 @@ config BR2_TARGET_GRUB2_ARCH_SUPPORTS
 	default y if BR2_x86_64
 	default y if BR2_arm
 	default y if BR2_aarch64
+	default y if BR2_RISCV_64
 	depends on BR2_USE_MMU
 
 config BR2_TARGET_GRUB2
@@ -102,6 +103,15 @@ config BR2_TARGET_GRUB2_ARM64_EFI
 	  Aarch64 platform and you want to boot Grub 2 as an EFI
 	  application.
 
+config BR2_TARGET_GRUB2_RISCV64_EFI
+	bool "riscv64-efi"
+	depends on BR2_RISCV_64
+	select BR2_TARGET_GRUB2_HAS_EFI_BOOT
+	help
+	  Select this option if the platform you're targetting is a
+	  64bit RISC-V platform and you want to boot Grub 2 as an EFI
+	  application.
+
 if BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
 
 comment "Options for the x86 legacy BIOS or ARM U-Boot support"
diff --git a/boot/grub2/grub2.mk b/boot/grub2/grub2.mk
index b9be826885..679eac5f46 100644
--- a/boot/grub2/grub2.mk
+++ b/boot/grub2/grub2.mk
@@ -93,6 +93,15 @@ GRUB2_BUILTIN_CONFIG_arm64-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
 GRUB2_BUILTIN_MODULES_arm64-efi = $(GRUB2_BUILTIN_MODULES_EFI)
 GRUB2_TUPLES-$(BR2_TARGET_GRUB2_ARM64_EFI) += arm64-efi
 
+GRUB2_IMAGE_riscv64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootriscv64.efi
+GRUB2_CFG_riscv64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg
+GRUB2_PREFIX_riscv64-efi = /EFI/BOOT
+GRUB2_TARGET_riscv64-efi = riscv64
+GRUB2_PLATFORM_riscv64-efi = efi
+GRUB2_BUILTIN_CONFIG_riscv64-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
+GRUB2_BUILTIN_MODULES_riscv64-efi = $(GRUB2_BUILTIN_MODULES_EFI)
+GRUB2_TUPLES-$(BR2_TARGET_GRUB2_RISCV64_EFI) += riscv64-efi
+
 # Grub2 is kind of special: it considers CC, LD and so on to be the
 # tools to build the host programs and uses TARGET_CC, TARGET_CFLAGS,
 # TARGET_CPPFLAGS, TARGET_LDFLAGS to build the bootloader itself.
-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* [Buildroot] [PATCH v2 2/2] configs/qemu_riscv64_virt_efi: new defconfig
  2023-12-23 21:29 ` [Buildroot] [PATCH v2 1/2] boot/grub2: add RISC-V 64bit EFI support Julien Olivain
@ 2023-12-23 21:29   ` Julien Olivain
  2023-12-24 16:57     ` Yann E. MORIN
  2023-12-24 16:56   ` [Buildroot] [PATCH v2 1/2] boot/grub2: add RISC-V 64bit EFI support Yann E. MORIN
  2023-12-24 16:58   ` Yann E. MORIN
  2 siblings, 1 reply; 9+ messages in thread
From: Julien Olivain @ 2023-12-23 21:29 UTC (permalink / raw)
  To: buildroot; +Cc: Romain Naour, Julien Olivain, Thomas Petazzoni

This defconfig enables edk2 UEFI shell and grub2 riscv64-efi boot
of a Linux Kernel.

Signed-off-by: Julien Olivain <ju.o@free.fr>
---
Changes v1 -> v2:
- Remove BR2_TOOLCHAIN_EXTERNAL=y in defconfig.
  (it was an incorrect leftover from a test)
- Add BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1 in defconfig.

Patch series tested on branch master at commit 1667987 with commands:

    make check-package
    ...
    0 warnings generated

    make qemu_riscv64_virt_efi_defconfig
    make
    output/images/start-qemu.sh

Once logged as root in emulator:

    dmesg | grep -i efi
    mount -t efivarfs efivarfs /sys/firmware/efi/efivars
    ls -al /sys/firmware/efi/efivars
---
 DEVELOPERS                                    |  2 ++
 .../riscv64-virt-efi/assemble-flash-images    | 11 ++++++
 board/qemu/riscv64-virt-efi/genimage.cfg      | 34 ++++++++++++++++++
 board/qemu/riscv64-virt-efi/grub.cfg          |  6 ++++
 board/qemu/riscv64-virt-efi/readme.txt        | 36 +++++++++++++++++++
 configs/qemu_riscv64_virt_efi_defconfig       | 19 ++++++++++
 6 files changed, 108 insertions(+)
 create mode 100755 board/qemu/riscv64-virt-efi/assemble-flash-images
 create mode 100644 board/qemu/riscv64-virt-efi/genimage.cfg
 create mode 100644 board/qemu/riscv64-virt-efi/grub.cfg
 create mode 100644 board/qemu/riscv64-virt-efi/readme.txt
 create mode 100644 configs/qemu_riscv64_virt_efi_defconfig

diff --git a/DEVELOPERS b/DEVELOPERS
index bad07d51aa..cfd8b7bd8f 100644
--- a/DEVELOPERS
+++ b/DEVELOPERS
@@ -1713,11 +1713,13 @@ F:	configs/ts7680_defconfig
 F:	package/paho-mqtt-c
 
 N:	Julien Olivain <ju.o@free.fr>
+F:	board/qemu/riscv64-virt-efi/
 F:	board/spike/
 F:	board/technexion/imx8mmpico/
 F:	board/technexion/imx8mpico/
 F:	configs/imx8mmpico_defconfig
 F:	configs/imx8mpico_defconfig
+F:	configs/qemu_riscv64_virt_efi_defconfig
 F:	configs/spike_riscv64_defconfig
 F:	package/fluid-soundfont/
 F:	package/fluidsynth/
diff --git a/board/qemu/riscv64-virt-efi/assemble-flash-images b/board/qemu/riscv64-virt-efi/assemble-flash-images
new file mode 100755
index 0000000000..abcaa2c93b
--- /dev/null
+++ b/board/qemu/riscv64-virt-efi/assemble-flash-images
@@ -0,0 +1,11 @@
+#! /bin/sh
+
+set -e
+
+BOARD_DIR="$(dirname "$0")"
+
+cp -f "${BOARD_DIR}"/grub.cfg "${BINARIES_DIR}"/efi-part/EFI/BOOT/grub.cfg
+
+# The QEMU riscv64 virt machine expects flash devices to be 32M.
+truncate -s 32M "${BINARIES_DIR}"/RISCV_VIRT_CODE.fd
+truncate -s 32M "${BINARIES_DIR}"/RISCV_VIRT_VARS.fd
diff --git a/board/qemu/riscv64-virt-efi/genimage.cfg b/board/qemu/riscv64-virt-efi/genimage.cfg
new file mode 100644
index 0000000000..46950591e0
--- /dev/null
+++ b/board/qemu/riscv64-virt-efi/genimage.cfg
@@ -0,0 +1,34 @@
+image efi-part.vfat {
+	vfat {
+		file EFI {
+			image = "efi-part/EFI"
+		}
+
+		file Image {
+			image = "Image"
+		}
+	}
+
+	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 {
+		# For partition-type-uuid value, see:
+		# https://uapi-group.org/specifications/specs/discoverable_partitions_specification/
+		# SD_GPT_ROOT_RISCV64
+		partition-type-uuid = 72ec70a6-cf74-40e6-bd49-4bda08e8f224
+		image = "rootfs.ext2"
+	}
+}
diff --git a/board/qemu/riscv64-virt-efi/grub.cfg b/board/qemu/riscv64-virt-efi/grub.cfg
new file mode 100644
index 0000000000..d99e19c4cd
--- /dev/null
+++ b/board/qemu/riscv64-virt-efi/grub.cfg
@@ -0,0 +1,6 @@
+set default="0"
+set timeout="5"
+
+menuentry "Buildroot" {
+	linux /Image root=PARTLABEL=root rootwait
+}
diff --git a/board/qemu/riscv64-virt-efi/readme.txt b/board/qemu/riscv64-virt-efi/readme.txt
new file mode 100644
index 0000000000..6b9651a011
--- /dev/null
+++ b/board/qemu/riscv64-virt-efi/readme.txt
@@ -0,0 +1,36 @@
+Intro
+=====
+
+This is a RISC-V 64bit UEFI Linux boot demo in QEmu virt machine.
+
+Build
+=====
+
+    make qemu_riscv64_virt_efi_defconfig
+    make
+
+Emulation
+=========
+
+Run the emulation with:
+
+    qemu-system-riscv64 \
+        -M virt,pflash0=pflash0,pflash1=pflash1,acpi=off \
+        -smp 4 \
+        -m 1024 \
+        -nographic \
+        -blockdev node-name=pflash0,driver=file,read-only=on,filename=output/images/RISCV_VIRT_CODE.fd \
+        -blockdev node-name=pflash1,driver=file,filename=output/images/RISCV_VIRT_VARS.fd \
+        \
+        -drive file=output/images/disk.img,format=raw,id=hd0 \
+        -device virtio-blk-device,drive=hd0 \
+        \
+        -netdev user,id=net0 \
+        -device virtio-net-device,netdev=net0 # qemu_riscv64_virt_efi_defconfig
+
+Note: for information, qemu version >= 8.0.0 is needed for this UEFI
+Linux demo. It introduced the two pflash memories (previous versions
+had only one). 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.
diff --git a/configs/qemu_riscv64_virt_efi_defconfig b/configs/qemu_riscv64_virt_efi_defconfig
new file mode 100644
index 0000000000..79aadf78ca
--- /dev/null
+++ b/configs/qemu_riscv64_virt_efi_defconfig
@@ -0,0 +1,19 @@
+BR2_riscv=y
+BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1=y
+BR2_SYSTEM_DHCP="eth0"
+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="$(BR2_DEFCONFIG) -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.1.69"
+BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=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
-- 
2.43.0

_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH v2 1/2] boot/grub2: add RISC-V 64bit EFI support
  2023-12-23 21:29 ` [Buildroot] [PATCH v2 1/2] boot/grub2: add RISC-V 64bit EFI support Julien Olivain
  2023-12-23 21:29   ` [Buildroot] [PATCH v2 2/2] configs/qemu_riscv64_virt_efi: new defconfig Julien Olivain
@ 2023-12-24 16:56   ` Yann E. MORIN
  2023-12-24 16:58   ` Yann E. MORIN
  2 siblings, 0 replies; 9+ messages in thread
From: Yann E. MORIN @ 2023-12-24 16:56 UTC (permalink / raw)
  To: Julien Olivain; +Cc: Romain Naour, Thomas Petazzoni, buildroot

Julien, All,

On 2023-12-23 22:29 +0100, Julien Olivain spake thusly:
> Grub can be built as a RISC-V UEFI application since commit [1]. This
> commit was first included in grub version 2.04.
> 
> This commit enables this support.
> 
> [1] https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commitdiff;h=f1957dc8a3347278a095bc8f44197662559a8ba3
> 
> Signed-off-by: Julien Olivain <ju.o@free.fr>

Applied to master, thanks.

Regards,
Yann E. MORIN.

> ---
>  boot/grub2/Config.in | 10 ++++++++++
>  boot/grub2/grub2.mk  |  9 +++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/boot/grub2/Config.in b/boot/grub2/Config.in
> index f05f33ccc7..7c235e96f7 100644
> --- a/boot/grub2/Config.in
> +++ b/boot/grub2/Config.in
> @@ -4,6 +4,7 @@ config BR2_TARGET_GRUB2_ARCH_SUPPORTS
>  	default y if BR2_x86_64
>  	default y if BR2_arm
>  	default y if BR2_aarch64
> +	default y if BR2_RISCV_64
>  	depends on BR2_USE_MMU
>  
>  config BR2_TARGET_GRUB2
> @@ -102,6 +103,15 @@ config BR2_TARGET_GRUB2_ARM64_EFI
>  	  Aarch64 platform and you want to boot Grub 2 as an EFI
>  	  application.
>  
> +config BR2_TARGET_GRUB2_RISCV64_EFI
> +	bool "riscv64-efi"
> +	depends on BR2_RISCV_64
> +	select BR2_TARGET_GRUB2_HAS_EFI_BOOT
> +	help
> +	  Select this option if the platform you're targetting is a
> +	  64bit RISC-V platform and you want to boot Grub 2 as an EFI
> +	  application.
> +
>  if BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
>  
>  comment "Options for the x86 legacy BIOS or ARM U-Boot support"
> diff --git a/boot/grub2/grub2.mk b/boot/grub2/grub2.mk
> index b9be826885..679eac5f46 100644
> --- a/boot/grub2/grub2.mk
> +++ b/boot/grub2/grub2.mk
> @@ -93,6 +93,15 @@ GRUB2_BUILTIN_CONFIG_arm64-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
>  GRUB2_BUILTIN_MODULES_arm64-efi = $(GRUB2_BUILTIN_MODULES_EFI)
>  GRUB2_TUPLES-$(BR2_TARGET_GRUB2_ARM64_EFI) += arm64-efi
>  
> +GRUB2_IMAGE_riscv64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootriscv64.efi
> +GRUB2_CFG_riscv64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg
> +GRUB2_PREFIX_riscv64-efi = /EFI/BOOT
> +GRUB2_TARGET_riscv64-efi = riscv64
> +GRUB2_PLATFORM_riscv64-efi = efi
> +GRUB2_BUILTIN_CONFIG_riscv64-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
> +GRUB2_BUILTIN_MODULES_riscv64-efi = $(GRUB2_BUILTIN_MODULES_EFI)
> +GRUB2_TUPLES-$(BR2_TARGET_GRUB2_RISCV64_EFI) += riscv64-efi
> +
>  # Grub2 is kind of special: it considers CC, LD and so on to be the
>  # tools to build the host programs and uses TARGET_CC, TARGET_CFLAGS,
>  # TARGET_CPPFLAGS, TARGET_LDFLAGS to build the bootloader itself.
> -- 
> 2.43.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH v2 2/2] configs/qemu_riscv64_virt_efi: new defconfig
  2023-12-23 21:29   ` [Buildroot] [PATCH v2 2/2] configs/qemu_riscv64_virt_efi: new defconfig Julien Olivain
@ 2023-12-24 16:57     ` Yann E. MORIN
  0 siblings, 0 replies; 9+ messages in thread
From: Yann E. MORIN @ 2023-12-24 16:57 UTC (permalink / raw)
  To: Julien Olivain; +Cc: Romain Naour, Thomas Petazzoni, buildroot

Julien, All,

On 2023-12-23 22:29 +0100, Julien Olivain spake thusly:
> This defconfig enables edk2 UEFI shell and grub2 riscv64-efi boot
> of a Linux Kernel.
> 
> Signed-off-by: Julien Olivain <ju.o@free.fr>

After tracking the EDK2 build issue with per-package the whole day, and
conluding that it was not specific to this defconfig, I applied to
master, thanks!

Regards,
Yann E. MORIN.

> ---
> Changes v1 -> v2:
> - Remove BR2_TOOLCHAIN_EXTERNAL=y in defconfig.
>   (it was an incorrect leftover from a test)
> - Add BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1 in defconfig.
> 
> Patch series tested on branch master at commit 1667987 with commands:
> 
>     make check-package
>     ...
>     0 warnings generated
> 
>     make qemu_riscv64_virt_efi_defconfig
>     make
>     output/images/start-qemu.sh
> 
> Once logged as root in emulator:
> 
>     dmesg | grep -i efi
>     mount -t efivarfs efivarfs /sys/firmware/efi/efivars
>     ls -al /sys/firmware/efi/efivars
> ---
>  DEVELOPERS                                    |  2 ++
>  .../riscv64-virt-efi/assemble-flash-images    | 11 ++++++
>  board/qemu/riscv64-virt-efi/genimage.cfg      | 34 ++++++++++++++++++
>  board/qemu/riscv64-virt-efi/grub.cfg          |  6 ++++
>  board/qemu/riscv64-virt-efi/readme.txt        | 36 +++++++++++++++++++
>  configs/qemu_riscv64_virt_efi_defconfig       | 19 ++++++++++
>  6 files changed, 108 insertions(+)
>  create mode 100755 board/qemu/riscv64-virt-efi/assemble-flash-images
>  create mode 100644 board/qemu/riscv64-virt-efi/genimage.cfg
>  create mode 100644 board/qemu/riscv64-virt-efi/grub.cfg
>  create mode 100644 board/qemu/riscv64-virt-efi/readme.txt
>  create mode 100644 configs/qemu_riscv64_virt_efi_defconfig
> 
> diff --git a/DEVELOPERS b/DEVELOPERS
> index bad07d51aa..cfd8b7bd8f 100644
> --- a/DEVELOPERS
> +++ b/DEVELOPERS
> @@ -1713,11 +1713,13 @@ F:	configs/ts7680_defconfig
>  F:	package/paho-mqtt-c
>  
>  N:	Julien Olivain <ju.o@free.fr>
> +F:	board/qemu/riscv64-virt-efi/
>  F:	board/spike/
>  F:	board/technexion/imx8mmpico/
>  F:	board/technexion/imx8mpico/
>  F:	configs/imx8mmpico_defconfig
>  F:	configs/imx8mpico_defconfig
> +F:	configs/qemu_riscv64_virt_efi_defconfig
>  F:	configs/spike_riscv64_defconfig
>  F:	package/fluid-soundfont/
>  F:	package/fluidsynth/
> diff --git a/board/qemu/riscv64-virt-efi/assemble-flash-images b/board/qemu/riscv64-virt-efi/assemble-flash-images
> new file mode 100755
> index 0000000000..abcaa2c93b
> --- /dev/null
> +++ b/board/qemu/riscv64-virt-efi/assemble-flash-images
> @@ -0,0 +1,11 @@
> +#! /bin/sh
> +
> +set -e
> +
> +BOARD_DIR="$(dirname "$0")"
> +
> +cp -f "${BOARD_DIR}"/grub.cfg "${BINARIES_DIR}"/efi-part/EFI/BOOT/grub.cfg
> +
> +# The QEMU riscv64 virt machine expects flash devices to be 32M.
> +truncate -s 32M "${BINARIES_DIR}"/RISCV_VIRT_CODE.fd
> +truncate -s 32M "${BINARIES_DIR}"/RISCV_VIRT_VARS.fd
> diff --git a/board/qemu/riscv64-virt-efi/genimage.cfg b/board/qemu/riscv64-virt-efi/genimage.cfg
> new file mode 100644
> index 0000000000..46950591e0
> --- /dev/null
> +++ b/board/qemu/riscv64-virt-efi/genimage.cfg
> @@ -0,0 +1,34 @@
> +image efi-part.vfat {
> +	vfat {
> +		file EFI {
> +			image = "efi-part/EFI"
> +		}
> +
> +		file Image {
> +			image = "Image"
> +		}
> +	}
> +
> +	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 {
> +		# For partition-type-uuid value, see:
> +		# https://uapi-group.org/specifications/specs/discoverable_partitions_specification/
> +		# SD_GPT_ROOT_RISCV64
> +		partition-type-uuid = 72ec70a6-cf74-40e6-bd49-4bda08e8f224
> +		image = "rootfs.ext2"
> +	}
> +}
> diff --git a/board/qemu/riscv64-virt-efi/grub.cfg b/board/qemu/riscv64-virt-efi/grub.cfg
> new file mode 100644
> index 0000000000..d99e19c4cd
> --- /dev/null
> +++ b/board/qemu/riscv64-virt-efi/grub.cfg
> @@ -0,0 +1,6 @@
> +set default="0"
> +set timeout="5"
> +
> +menuentry "Buildroot" {
> +	linux /Image root=PARTLABEL=root rootwait
> +}
> diff --git a/board/qemu/riscv64-virt-efi/readme.txt b/board/qemu/riscv64-virt-efi/readme.txt
> new file mode 100644
> index 0000000000..6b9651a011
> --- /dev/null
> +++ b/board/qemu/riscv64-virt-efi/readme.txt
> @@ -0,0 +1,36 @@
> +Intro
> +=====
> +
> +This is a RISC-V 64bit UEFI Linux boot demo in QEmu virt machine.
> +
> +Build
> +=====
> +
> +    make qemu_riscv64_virt_efi_defconfig
> +    make
> +
> +Emulation
> +=========
> +
> +Run the emulation with:
> +
> +    qemu-system-riscv64 \
> +        -M virt,pflash0=pflash0,pflash1=pflash1,acpi=off \
> +        -smp 4 \
> +        -m 1024 \
> +        -nographic \
> +        -blockdev node-name=pflash0,driver=file,read-only=on,filename=output/images/RISCV_VIRT_CODE.fd \
> +        -blockdev node-name=pflash1,driver=file,filename=output/images/RISCV_VIRT_VARS.fd \
> +        \
> +        -drive file=output/images/disk.img,format=raw,id=hd0 \
> +        -device virtio-blk-device,drive=hd0 \
> +        \
> +        -netdev user,id=net0 \
> +        -device virtio-net-device,netdev=net0 # qemu_riscv64_virt_efi_defconfig
> +
> +Note: for information, qemu version >= 8.0.0 is needed for this UEFI
> +Linux demo. It introduced the two pflash memories (previous versions
> +had only one). 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.
> diff --git a/configs/qemu_riscv64_virt_efi_defconfig b/configs/qemu_riscv64_virt_efi_defconfig
> new file mode 100644
> index 0000000000..79aadf78ca
> --- /dev/null
> +++ b/configs/qemu_riscv64_virt_efi_defconfig
> @@ -0,0 +1,19 @@
> +BR2_riscv=y
> +BR2_PACKAGE_HOST_LINUX_HEADERS_CUSTOM_6_1=y
> +BR2_SYSTEM_DHCP="eth0"
> +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="$(BR2_DEFCONFIG) -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.1.69"
> +BR2_LINUX_KERNEL_USE_ARCH_DEFAULT_CONFIG=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
> -- 
> 2.43.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH v2 1/2] boot/grub2: add RISC-V 64bit EFI support
  2023-12-23 21:29 ` [Buildroot] [PATCH v2 1/2] boot/grub2: add RISC-V 64bit EFI support Julien Olivain
  2023-12-23 21:29   ` [Buildroot] [PATCH v2 2/2] configs/qemu_riscv64_virt_efi: new defconfig Julien Olivain
  2023-12-24 16:56   ` [Buildroot] [PATCH v2 1/2] boot/grub2: add RISC-V 64bit EFI support Yann E. MORIN
@ 2023-12-24 16:58   ` Yann E. MORIN
  2023-12-29 15:47     ` Julien Olivain
  2 siblings, 1 reply; 9+ messages in thread
From: Yann E. MORIN @ 2023-12-24 16:58 UTC (permalink / raw)
  To: Julien Olivain; +Cc: Romain Naour, Thomas Petazzoni, buildroot

Julien, All,

On 2023-12-23 22:29 +0100, Julien Olivain spake thusly:
> Grub can be built as a RISC-V UEFI application since commit [1]. This
> commit was first included in grub version 2.04.
> 
> This commit enables this support.
> 
> [1] https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commitdiff;h=f1957dc8a3347278a095bc8f44197662559a8ba3
> 
> Signed-off-by: Julien Olivain <ju.o@free.fr>

Oh, I forgot to add: it would be awesome if you coulde extend the
existing runtiem test to include a risc-v test:
    support/testing/tests/boot/test_grub.py

Also, it would be nice to extend the readme for grub:
    boot/grub2/readme.txt

Regards,
Yann E. MORIN.

> ---
>  boot/grub2/Config.in | 10 ++++++++++
>  boot/grub2/grub2.mk  |  9 +++++++++
>  2 files changed, 19 insertions(+)
> 
> diff --git a/boot/grub2/Config.in b/boot/grub2/Config.in
> index f05f33ccc7..7c235e96f7 100644
> --- a/boot/grub2/Config.in
> +++ b/boot/grub2/Config.in
> @@ -4,6 +4,7 @@ config BR2_TARGET_GRUB2_ARCH_SUPPORTS
>  	default y if BR2_x86_64
>  	default y if BR2_arm
>  	default y if BR2_aarch64
> +	default y if BR2_RISCV_64
>  	depends on BR2_USE_MMU
>  
>  config BR2_TARGET_GRUB2
> @@ -102,6 +103,15 @@ config BR2_TARGET_GRUB2_ARM64_EFI
>  	  Aarch64 platform and you want to boot Grub 2 as an EFI
>  	  application.
>  
> +config BR2_TARGET_GRUB2_RISCV64_EFI
> +	bool "riscv64-efi"
> +	depends on BR2_RISCV_64
> +	select BR2_TARGET_GRUB2_HAS_EFI_BOOT
> +	help
> +	  Select this option if the platform you're targetting is a
> +	  64bit RISC-V platform and you want to boot Grub 2 as an EFI
> +	  application.
> +
>  if BR2_TARGET_GRUB2_HAS_LEGACY_BOOT
>  
>  comment "Options for the x86 legacy BIOS or ARM U-Boot support"
> diff --git a/boot/grub2/grub2.mk b/boot/grub2/grub2.mk
> index b9be826885..679eac5f46 100644
> --- a/boot/grub2/grub2.mk
> +++ b/boot/grub2/grub2.mk
> @@ -93,6 +93,15 @@ GRUB2_BUILTIN_CONFIG_arm64-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
>  GRUB2_BUILTIN_MODULES_arm64-efi = $(GRUB2_BUILTIN_MODULES_EFI)
>  GRUB2_TUPLES-$(BR2_TARGET_GRUB2_ARM64_EFI) += arm64-efi
>  
> +GRUB2_IMAGE_riscv64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/bootriscv64.efi
> +GRUB2_CFG_riscv64-efi = $(BINARIES_DIR)/efi-part/EFI/BOOT/grub.cfg
> +GRUB2_PREFIX_riscv64-efi = /EFI/BOOT
> +GRUB2_TARGET_riscv64-efi = riscv64
> +GRUB2_PLATFORM_riscv64-efi = efi
> +GRUB2_BUILTIN_CONFIG_riscv64-efi = $(GRUB2_BUILTIN_CONFIG_EFI)
> +GRUB2_BUILTIN_MODULES_riscv64-efi = $(GRUB2_BUILTIN_MODULES_EFI)
> +GRUB2_TUPLES-$(BR2_TARGET_GRUB2_RISCV64_EFI) += riscv64-efi
> +
>  # Grub2 is kind of special: it considers CC, LD and so on to be the
>  # tools to build the host programs and uses TARGET_CC, TARGET_CFLAGS,
>  # TARGET_CPPFLAGS, TARGET_LDFLAGS to build the bootloader itself.
> -- 
> 2.43.0
> 
> _______________________________________________
> buildroot mailing list
> buildroot@buildroot.org
> https://lists.buildroot.org/mailman/listinfo/buildroot

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH v2 1/2] boot/grub2: add RISC-V 64bit EFI support
  2023-12-24 16:58   ` Yann E. MORIN
@ 2023-12-29 15:47     ` Julien Olivain
  2023-12-29 20:47       ` Yann E. MORIN
  0 siblings, 1 reply; 9+ messages in thread
From: Julien Olivain @ 2023-12-29 15:47 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: Romain Naour, Thomas Petazzoni, buildroot

Hi Yann, All,

On 24/12/2023 17:58, Yann E. MORIN wrote:
> Julien, All,
> 
> On 2023-12-23 22:29 +0100, Julien Olivain spake thusly:
>> Grub can be built as a RISC-V UEFI application since commit [1]. This
>> commit was first included in grub version 2.04.
>> 
>> This commit enables this support.
>> 
>> [1] 
>> https://git.savannah.gnu.org/gitweb/?p=grub.git;a=commitdiff;h=f1957dc8a3347278a095bc8f44197662559a8ba3
>> 
>> Signed-off-by: Julien Olivain <ju.o@free.fr>
> 
> Oh, I forgot to add: it would be awesome if you coulde extend the
> existing runtiem test to include a risc-v test:
>     support/testing/tests/boot/test_grub.py

In fact, I already had a test ready. I didn't send it because
the current Buildroot docker image does not include qemu with
RISC-V system emulation. See [1]. I sent a patch, accepted in
commit [2] to enable this support, but the image was not regenerated
since then.

Moreover, this RISCV 64bit EFI boot requires qemu >= 8.0.0.
Buildroot docker image is still on Debian 11 bullseye, which
includes qemu 5.2.0. Debian 12.4 bookworm only includes qemu 7.2.0,
see [3].

Do you think in that specific case I could include add
BR2_PACKAGE_HOST_QEMU=y in this specific runtime test config?

> Also, it would be nice to extend the readme for grub:
>     boot/grub2/readme.txt

I added that to my task list!

> Regards,
> Yann E. MORIN.
> 

Best regards,

Julien.

[1] 
https://gitlab.com/buildroot.org/buildroot/-/blob/master/.gitlab-ci.yml?ref_type=heads#L4
[2] 
https://gitlab.com/buildroot.org/buildroot/-/commit/93c7b55c778e3dd4d84945918e5d97d5f56256c5
[3] https://packages.debian.org/bookworm/qemu-system-misc
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [Buildroot] [PATCH v2 1/2] boot/grub2: add RISC-V 64bit EFI support
  2023-12-29 15:47     ` Julien Olivain
@ 2023-12-29 20:47       ` Yann E. MORIN
  0 siblings, 0 replies; 9+ messages in thread
From: Yann E. MORIN @ 2023-12-29 20:47 UTC (permalink / raw)
  To: Julien Olivain; +Cc: Romain Naour, Thomas Petazzoni, buildroot

Julien, All,

On 2023-12-29 16:47 +0100, Julien Olivain spake thusly:
> On 24/12/2023 17:58, Yann E. MORIN wrote:
> > On 2023-12-23 22:29 +0100, Julien Olivain spake thusly:
> > > Grub can be built as a RISC-V UEFI application since commit [1]. This
> > > commit was first included in grub version 2.04.
> > Oh, I forgot to add: it would be awesome if you coulde extend the
> > existing runtiem test to include a risc-v test:
> >     support/testing/tests/boot/test_grub.py
> In fact, I already had a test ready. I didn't send it because
> the current Buildroot docker image does not include qemu with
> RISC-V system emulation. See [1]. I sent a patch, accepted in
> commit [2] to enable this support, but the image was not regenerated
> since then.

Hm... I also have a pending series about reorganising the docker images:
    https://patchwork.ozlabs.org/project/buildroot/list/?series=386976

I did not include a bump of the image yet, to not make it too complex a
series, but the goal was to indeed update to a more recent base image,
like bookworm.

> Moreover, this RISCV 64bit EFI boot requires qemu >= 8.0.0.
> Buildroot docker image is still on Debian 11 bullseye, which
> includes qemu 5.2.0. Debian 12.4 bookworm only includes qemu 7.2.0,
> see [3].

Bullseye backports only has 7.2, but Bookworm backports has 8.1.2:
    https://packages.debian.org/bookworm-backports/qemu-system-misc

So, if we bump to bookworm, we could get a more recent qemu.

An alternative would be to switch to another distro that is more up to
date, like Fedora (39 has qemu 8.1.3) or Ubuntu (23.10 has qemu 8.0.4).

> Do you think in that specific case I could include add
> BR2_PACKAGE_HOST_QEMU=y in this specific runtime test config?

I would not care, but I think the runtime test infra can not use the
qemu from the build; it only uses the qemu from the system AFAICS; see
support/testing/infra/emulator.py@39.

So, for now, it means we can't have a runtime test for EIF grub2 on
riscv64.

> > Also, it would be nice to extend the readme for grub:
> >     boot/grub2/readme.txt
> I added that to my task list!

Wee! :-)

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 561 099 427 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'
_______________________________________________
buildroot mailing list
buildroot@buildroot.org
https://lists.buildroot.org/mailman/listinfo/buildroot

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2023-12-29 20:47 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-23 19:41 [Buildroot] [PATCH 1/2] boot/grub2: add RISC-V 64bit EFI support Julien Olivain
2023-12-23 19:41 ` [Buildroot] [PATCH 2/2] configs/qemu_riscv64_virt_efi: new defconfig Julien Olivain
2023-12-23 21:29 ` [Buildroot] [PATCH v2 1/2] boot/grub2: add RISC-V 64bit EFI support Julien Olivain
2023-12-23 21:29   ` [Buildroot] [PATCH v2 2/2] configs/qemu_riscv64_virt_efi: new defconfig Julien Olivain
2023-12-24 16:57     ` Yann E. MORIN
2023-12-24 16:56   ` [Buildroot] [PATCH v2 1/2] boot/grub2: add RISC-V 64bit EFI support Yann E. MORIN
2023-12-24 16:58   ` Yann E. MORIN
2023-12-29 15:47     ` Julien Olivain
2023-12-29 20:47       ` Yann E. MORIN

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.