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 <[email protected]>
> ---
>  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 |

Reply via email to