From patchwork Fri Mar 22 16:50:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ross Burton X-Patchwork-Id: 41381 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 497A9C54E71 for ; Fri, 22 Mar 2024 16:50:24 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.54.1711126214143661691 for ; Fri, 22 Mar 2024 09:50:14 -0700 Authentication-Results: mx.groups.io; dkim=none (message not signed); spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ross.burton@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 11C39FEC for ; Fri, 22 Mar 2024 09:50:48 -0700 (PDT) Received: from oss-tx204.lab.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 7E70F3F67D for ; Fri, 22 Mar 2024 09:50:13 -0700 (PDT) From: ross.burton@arm.com To: poky@lists.yoctoproject.org Subject: [PATCH] genericarm64: add qemuboot configuration Date: Fri, 22 Mar 2024 16:50:09 +0000 Message-Id: <20240322165009.3704771-1-ross.burton@arm.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 List-Id: X-Webhook-Received: from li982-79.members.linode.com [45.33.32.79] by aws-us-west-2-korg-lkml-1.web.codeaurora.org with HTTPS for ; Fri, 22 Mar 2024 16:50:24 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/poky/message/13312 From: Ross Burton A basic SystemReady IR system can be provided by qemu-system-aarch64 and u-boot, so tell u-boot to build the qemu_arm64 machine and configure qemuboot to start that u-boot and search the virtio-attached wic image for the EFI boot partition. Currently this machine support emulated (Cortex-A76) and virtualised (KVM) execution, and virtio storage/network/console. Display support will be added shortly. Note that this machine still doesn't build U-Boot by default, as a u-boot binary for qemu in deploy would potentially confuse users who want to boot on real hardware and think this u-boot is needed. If you wish to use genericarm64 with runqemu, you'll need to manually bitbake u-boot. Signed-off-by: Ross Burton --- meta-yocto-bsp/conf/machine/genericarm64.conf | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/meta-yocto-bsp/conf/machine/genericarm64.conf b/meta-yocto-bsp/conf/machine/genericarm64.conf index 7c4c76ffe0c..4afd6c3a870 100644 --- a/meta-yocto-bsp/conf/machine/genericarm64.conf +++ b/meta-yocto-bsp/conf/machine/genericarm64.conf @@ -29,3 +29,30 @@ EFI_PROVIDER ?= "${@bb.utils.contains("DISTRO_FEATURES", "systemd", "systemd-boo # Try to bring up one physical serial console, or a virtualized serial console SERIAL_CONSOLES ?= "115200;ttyAMA0 115200;hvc0" + +# Allow u-boot to be built for use with qemu-system-aarch64. +# This u-boot is _not_ suitable for use with real hardware, and the expectation +# of this machine is that real hardware comes with the firmware pre-loaded. +UBOOT_MACHINE = "qemu_arm64_defconfig" + +# runqemu configuration to run a genericarm64 image inside a qemu-system-aarch64. You will need +# to build u-boot explicitly. +IMAGE_CLASSES += "qemuboot" +QB_SYSTEM_NAME = "qemu-system-aarch64" +# Boot the virtual machine with either an emulated Cortex-A76, or the host if using KVM +QB_MACHINE = "-machine virt" +QB_CPU = "-cpu cortex-a76" +QB_CPU_KVM = "-cpu host -machine gic-version=3" +QB_SMP = "-smp 4" +# Boot into U-Boot and let that scan the disk for the next step, don't pass any kernel or filesystem hints +QB_DEFAULT_BIOS = "u-boot.bin" +QB_DEFAULT_KERNEL = "none" +QB_DEFAULT_FSTYPE = "wic" +QB_FSINFO = "wic:no-kernel-in-fs" +# Mount the wic rootfs as a virtio block device +QB_ROOTFS_OPT = "-drive id=root,file=@ROOTFS@,if=none,format=raw -device virtio-blk-pci,drive=root" +# Virtio serial consoles +QB_SERIAL_OPT = "-device virtio-serial-pci -chardev null,id=virtcon -device virtconsole,chardev=virtcon" +QB_TCPSERIAL_OPT = "-device virtio-serial-pci -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1,nodelay=on -device virtconsole,chardev=virtcon" +# Virtio networking +QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no"