From: Sascha Hauer <s.hauer@pengutronix.de>
To: Ahmad Fatoum <a.fatoum@barebox.org>
Cc: barebox@lists.infradead.org, David Dgien <dgienda125@gmail.com>
Subject: Re: [PATCH 02/12] ARM: qemu-virt: add image for use as -bios
Date: Fri, 16 Jan 2026 09:33:44 +0100 [thread overview]
Message-ID: <aWn36P7Q9UKkpkkd@pengutronix.de> (raw)
In-Reply-To: <20260115115924.3428886-3-a.fatoum@barebox.org>
On Thu, Jan 15, 2026 at 12:54:28PM +0100, Ahmad Fatoum wrote:
> We previously used barebox-dt-2nd.img as image for Qemu Virt.
> Adding a dedicated image however allows us to use -kernel to specify,
> well, a kernel, which can make some testing scenarios more straight
> forward, once we implement support for barebox to lookup -kernel and
> -append QEMU options.
>
> Signed-off-by: Ahmad Fatoum <a.fatoum@barebox.org>
> ---
> arch/arm/boards/Makefile | 1 +
> arch/arm/boards/qemu-virt/Makefile | 2 +-
> arch/arm/boards/qemu-virt/lowlevel.c | 80 +++++++++++++++++++++++
> images/Makefile.vexpress | 5 ++
> include/compressed-dtb.h | 1 +
> test/arm/virt-el2@multi_v8_defconfig.yaml | 23 +++++++
> test/arm/virt@multi_v8_defconfig.yaml | 4 +-
> 7 files changed, 113 insertions(+), 3 deletions(-)
> create mode 100644 arch/arm/boards/qemu-virt/lowlevel.c
> create mode 100644 test/arm/virt-el2@multi_v8_defconfig.yaml
>
> diff --git a/arch/arm/boards/Makefile b/arch/arm/boards/Makefile
> index 4c586de2a985..dd2f2c324e25 100644
> --- a/arch/arm/boards/Makefile
> +++ b/arch/arm/boards/Makefile
> @@ -189,6 +189,7 @@ obj-$(CONFIG_MACH_RK3568_EVB) += rockchip-rk3568-evb/
> obj-$(CONFIG_MACH_RK3568_BPI_R2PRO) += rockchip-rk3568-bpi-r2pro/
> obj-$(CONFIG_MACH_PINE64_PINETAB2) += pine64-pinetab2/
> obj-$(CONFIG_MACH_PINE64_QUARTZ64) += pine64-quartz64/
> +obj-$(CONFIG_BOARD_ARM_VIRT) += qemu-virt/
> obj-$(CONFIG_MACH_RADXA_ROCK3) += radxa-rock3/
> obj-$(CONFIG_MACH_RADXA_ROCK5) += radxa-rock5/
> obj-$(CONFIG_MACH_VARISCITE_DT8MCUSTOMBOARD_IMX8MP) += variscite-dt8mcustomboard-imx8mp/
> diff --git a/arch/arm/boards/qemu-virt/Makefile b/arch/arm/boards/qemu-virt/Makefile
> index ad283446eaf1..458f5209008d 100644
> --- a/arch/arm/boards/qemu-virt/Makefile
> +++ b/arch/arm/boards/qemu-virt/Makefile
> @@ -1,3 +1,3 @@
> # SPDX-License-Identifier: GPL-2.0-only
>
> -obj-y += board.o
> +lwl-y += lowlevel.o
> diff --git a/arch/arm/boards/qemu-virt/lowlevel.c b/arch/arm/boards/qemu-virt/lowlevel.c
> new file mode 100644
> index 000000000000..6397bf165d4c
> --- /dev/null
> +++ b/arch/arm/boards/qemu-virt/lowlevel.c
> @@ -0,0 +1,80 @@
> +// SPDX-License-Identifier: GPL-2.0-only
> +
> +#include <linux/sizes.h>
> +#include <asm/barebox-arm.h>
> +#include <asm/reloc.h>
> +#include <compressed-dtb.h>
> +#include <debug_ll.h>
> +#include <console.h>
> +#include <stdio.h>
> +#include <debug_ll/pl011.h>
> +#include <pbl.h>
> +
> +#define RAM_BASE 0x40000000
> +#define PL011_BASE IOMEM(0x9000000)
> +
> +extern char __dtb_qemu_virt32_start[];
> +extern char __dtb_qemu_virt64_start[];
> +
> +static void *find_fdt(void *r0)
> +{
> + void *fdt, *ram = (void *)RAM_BASE;
> + const char *origin;
> +
> + if (blob_is_fdt(ram)) {
> + origin = "-bios";
> + fdt = ram;
> + } else if (r0 >= ram && blob_is_fdt(r0)) {
> + origin = "-kernel";
> + fdt = r0;
> + } else if (IS_ENABLED(CONFIG_ARM32)) {
> + origin = "built-in";
> + fdt = __dtb_qemu_virt32_start;
> + } else {
> + origin = "built-in";
> + fdt = __dtb_qemu_virt64_start;
> + }
> +
> + printf("Using %s device tree at %p\n", origin, fdt);
Doesn't make a difference for PBL, but I think pr_info would be more
appropriate here.
> #define BAREBOX_BOARDDATA_COMPRESSED_DTB_MAGIC 0x7b66bcbd
> diff --git a/test/arm/virt-el2@multi_v8_defconfig.yaml b/test/arm/virt-el2@multi_v8_defconfig.yaml
> new file mode 100644
> index 000000000000..8aa514fb4179
> --- /dev/null
> +++ b/test/arm/virt-el2@multi_v8_defconfig.yaml
You anticipated ARM32 above, how about adding these for
multi_v7_defconfig as well?
Sascha
--
Pengutronix e.K. | |
Steuerwalder Str. 21 | http://www.pengutronix.de/ |
31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
next prev parent reply other threads:[~2026-01-16 8:34 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-01-15 11:54 [PATCH 00/12] ARM32: modules: fix bitrot and add test Ahmad Fatoum
2026-01-15 11:54 ` [PATCH 01/12] boards: qemu-virt: reserve BIOS device tree Ahmad Fatoum
2026-01-15 11:54 ` [PATCH 02/12] ARM: qemu-virt: add image for use as -bios Ahmad Fatoum
2026-01-16 8:33 ` Sascha Hauer [this message]
2026-01-16 10:21 ` Ahmad Fatoum
2026-01-16 12:52 ` Ahmad Fatoum
2026-01-16 15:16 ` Sascha Hauer
2026-01-15 11:54 ` [PATCH 03/12] kbuild: build *.mod.c with -std=gnu11 Ahmad Fatoum
2026-01-15 11:54 ` [PATCH 04/12] ARM32: mark modules as incompatible with ARM_MMU_PERMISSIONS Ahmad Fatoum
2026-01-15 11:54 ` [PATCH 05/12] treewide: fix some missing EXPORT_SYMBOL Ahmad Fatoum
2026-01-15 11:54 ` [PATCH 06/12] pci: ecam: enable build as module Ahmad Fatoum
2026-01-15 11:54 ` [PATCH 07/12] kbuild: add support for installing and stripping modules Ahmad Fatoum
2026-01-15 11:54 ` [PATCH 08/12] ARM32: module: handle more relocations Ahmad Fatoum
2026-01-15 11:54 ` [PATCH 09/12] commands: pm_domain: make command tristate Ahmad Fatoum
2026-01-15 11:54 ` [PATCH 10/12] test: conftest: add support for describing FW_CFG environment in YAML Ahmad Fatoum
2026-01-15 11:54 ` [PATCH 11/12] defaultenv: add barebox_modules_env target Ahmad Fatoum
2026-01-15 11:54 ` [PATCH 12/12] test: arm: add simple driver/command module test Ahmad Fatoum
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=aWn36P7Q9UKkpkkd@pengutronix.de \
--to=s.hauer@pengutronix.de \
--cc=a.fatoum@barebox.org \
--cc=barebox@lists.infradead.org \
--cc=dgienda125@gmail.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