Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: "Yann E. MORIN" <yann.morin.1998@free.fr>
To: Julien Olivain <ju.o@free.fr>
Cc: Romain Naour <romain.naour@gmail.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	buildroot@buildroot.org
Subject: Re: [Buildroot] [PATCH v2 2/2] configs/qemu_riscv64_virt_efi: new defconfig
Date: Sun, 24 Dec 2023 17:57:24 +0100	[thread overview]
Message-ID: <ZYhi9J9kSDngX5jI@landeda> (raw)
In-Reply-To: <20231223212948.2512412-2-ju.o@free.fr>

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

  reply	other threads:[~2023-12-24 16:57 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=ZYhi9J9kSDngX5jI@landeda \
    --to=yann.morin.1998@free.fr \
    --cc=buildroot@buildroot.org \
    --cc=ju.o@free.fr \
    --cc=romain.naour@gmail.com \
    --cc=thomas.petazzoni@bootlin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox