From patchwork Fri Jun 20 08:08:18 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 65335 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 C2AFBC77B7C for ; Fri, 20 Jun 2025 08:08:55 +0000 (UTC) Received: from mta-64-228.siemens.flowmailer.net (mta-64-228.siemens.flowmailer.net [185.136.64.228]) by mx.groups.io with SMTP id smtpd.web10.2781.1750406928918605516 for ; Fri, 20 Jun 2025 01:08:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=EHFXdFkD; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.228, mailfrom: fm-1329275-2025062008084520d084ed3f76601e49-jvrgwv@rts-flowmailer.siemens.com) Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 2025062008084520d084ed3f76601e49 for ; Fri, 20 Jun 2025 10:08:45 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=adrian.freihofer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=diI4R72fzEjqu7bGBpvpzKZ/nHAnTAWy41pI2s3uDl8=; b=EHFXdFkDSj7nENLFByICUbq+PZl0KTW0V15YqIcJ466RFInX/l56bOWbMEsO61+yaMjxPA hFl681tPUbL2vuBhUchX13ocSSyWTJq7dEetrQr8EYZwuJ7B9Qx3BfoWwYtnUpa2ybKbe/cm qw5NlS4zvQWNm3/0t35vMAv77Mncm63Dn/VHk5cKYF0SuY7/nXEn+Sy29jGP7ApqtptGthtU 5g6p7OkE6jB9G8NhHA9blcqxHIHVyAI0xQ1eRhV8cMtPhZM2JiB8MVgrQtPFmywMKQ/2zhBf lZoQksLiGTicQgI+4LD/ADpSEhfIbkZKduQ1nbaC2fT3ZtOnkVr8GIdA==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer Subject: [PATCH 1/5] beaglebone-yocto: support initramfs in qemu Date: Fri, 20 Jun 2025 10:08:18 +0200 Message-ID: <20250620080840.562802-2-adrian.freihofer@siemens.com> In-Reply-To: <20250620080840.562802-1-adrian.freihofer@siemens.com> References: <20250620080840.562802-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer 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, 20 Jun 2025 08:08:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/219110 From: Adrian Freihofer Support booting with initramfs also in Qemu. If INITRAMFS_IMAGE is defined, Qemu gets it via -initrd parameter. Signed-off-by: Adrian Freihofer --- meta-yocto-bsp/conf/machine/beaglebone-yocto.conf | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf b/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf index db9cfec497a..d4b72361650 100644 --- a/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf +++ b/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf @@ -46,7 +46,10 @@ QB_SYSTEM_NAME = "qemu-system-arm" QB_MACHINE = "-machine virt" QB_CPU = "-cpu cortex-a15" QB_KERNEL_CMDLINE_APPEND = "console=ttyAMA0 systemd.mask=systemd-networkd" -QB_OPT_APPEND = "-device virtio-rng-device" +QB_OPT_APPEND = "\ + -device virtio-rng-device \ + ${@' -initrd %s/%s.%s' % (d.getVar('DEPLOY_DIR_IMAGE'), d.getVar('INITRAMFS_IMAGE_NAME'), d.getVar('INITRAMFS_FSTYPES')) if d.getVar('INITRAMFS_IMAGE') else ''} \ +" QB_TAP_OPT = "-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no" QB_NETWORK_DEVICE = "-device virtio-net-device,netdev=net0,mac=@MAC@" QB_ROOTFS_OPT = "-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0" From patchwork Fri Jun 20 08:08:19 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 65331 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 B2EFCC71155 for ; Fri, 20 Jun 2025 08:08:55 +0000 (UTC) Received: from mta-64-228.siemens.flowmailer.net (mta-64-228.siemens.flowmailer.net [185.136.64.228]) by mx.groups.io with SMTP id smtpd.web11.2770.1750406928871294159 for ; Fri, 20 Jun 2025 01:08:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=v5QtYnfn; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.228, mailfrom: fm-1329275-20250620080845b516e89ea1b75a7bf0-ctc97x@rts-flowmailer.siemens.com) Received: by mta-64-228.siemens.flowmailer.net with ESMTPSA id 20250620080845b516e89ea1b75a7bf0 for ; Fri, 20 Jun 2025 10:08:45 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=adrian.freihofer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=806lQhIWTfZSWzmRvWVnEy6kxtGm15j0hSzWIaZuSK8=; b=v5QtYnfnj7NpS9XrMfNDyRbGdIu9Vz3T+nTCNUnfPs9l8IY3NjlvqQW9jhRcsZEoA5uVWN dzjeCjsqkHgFQjo69u1Ulf1tNJ/k7fKlO2zqh0VO7k2fqFl4PborQoP7bXKayAjFcLld2Fj+ s9LxCjjlreg0z6T8pAMXSu8B3jLNfz/pyKNtzzuJHoMFW/4YeAi7KQMTLf/QkJe8/WaBZPAo hcw+FfCuiCS95kQghz4o+yl2SbySN8wzlN2s5Rua9m05Qr32DNXr+JiI9p/lhey+9yq8QGEx SL/IaLoOcLSehx659llJSpz+PdMfyxRf56XGmyyMlOTKbs69Hcgfms3Q==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer Subject: [PATCH 2/5] beaglebone-yocto: support FIT images Date: Fri, 20 Jun 2025 10:08:19 +0200 Message-ID: <20250620080840.562802-3-adrian.freihofer@siemens.com> In-Reply-To: <20250620080840.562802-1-adrian.freihofer@siemens.com> References: <20250620080840.562802-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer 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, 20 Jun 2025 08:08:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/219105 From: Adrian Freihofer Introduce the FIT_IMAGE_KERNEL variable, which allows switching from the zImage kernel to a FIT image kernel. This variable is not intended to be officially documented; the goal is for the beaglebone-yocto MACHINE to serve as an example for both use cases: zImage and FIT image. The following tests have been performed on a beaglebone-black device with poky and core-image-minimal running from SDCard: * MACHINE = "beaglebone-yocto" Still boots the zImage kernel as before this commit * MACHINE = "beaglebone-yocto" FIT_IMAGE_KERNEL = "1" Boots a FIT image kernel as expected * MACHINE = "beaglebone-yocto" INITRAMFS_IMAGE = "core-image-initramfs-boot" FIT_IMAGE_KERNEL = "1" Boots a FIT image kernel with initramfs as expected Also booting like that behaves as expected: fatload mmc 0:1 $loadaddr /kernel iminfo $loadaddr setenv bootargs console=ttyS0,115200n8 root=/dev/mmcblk0p2 ro \ rootfstype=ext4 rootwait shell_debug=true bootm ${loadaddr}#conf-am335x-boneblack.dtb All the tested configurations just boot from the SDCard without manual tweaks. Signed-off-by: Adrian Freihofer --- .../conf/machine/beaglebone-yocto.conf | 31 +++++++++++++++++-- 1 file changed, 28 insertions(+), 3 deletions(-) diff --git a/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf b/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf index d4b72361650..321d2c27c2a 100644 --- a/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf +++ b/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf @@ -14,8 +14,20 @@ include conf/machine/include/arm/armv7a/tune-cortexa8.inc IMAGE_FSTYPES += "tar.bz2 jffs2 wic wic.bmap" EXTRA_IMAGECMD:jffs2 = "-lnp " WKS_FILE ?= "beaglebone-yocto.wks" -MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "kernel-image kernel-devicetree" -do_image_wic[depends] += "mtools-native:do_populate_sysroot dosfstools-native:do_populate_sysroot virtual/bootloader:do_deploy" + +# Setting this variable to "1" switches from zImage kernel to FIT image kernel +FIT_IMAGE_KERNEL ?= "0" + +# Note: This is redundant if wic creates a separate /boot partition +MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "${@'linux-yocto-fitimage' if d.getVar('FIT_IMAGE_KERNEL') == '1' else 'kernel-image kernel-devicetree'}" + +KERNEL_CLASSES += "${@'kernel-fit-extra-artifacts' if d.getVar('FIT_IMAGE_KERNEL') == '1' else ''}" +do_image_wic[depends] += "\ + mtools-native:do_populate_sysroot \ + dosfstools-native:do_populate_sysroot \ + virtual/bootloader:do_deploy \ + ${@'linux-yocto-fitimage:do_deploy' if d.getVar('FIT_IMAGE_KERNEL') == '1' else ''} \ +" SERIAL_CONSOLES ?= "115200;ttyS0 115200;ttyO0 115200;ttyAMA0" @@ -26,15 +38,28 @@ KERNEL_IMAGETYPE = "zImage" DTB_FILES = "am335x-bone.dtb am335x-boneblack.dtb am335x-bonegreen.dtb" KERNEL_DEVICETREE = '${@' '.join('ti/omap/%s' % d for d in '${DTB_FILES}'.split())}' +# Configure the image.bbclass to depend on the fitImage instead of only +# the kernel to ensure the fitImage is built with the image +KERNEL_DEPLOY_DEPEND = "${@'linux-yocto-fitimage:do_deploy' if d.getVar('FIT_IMAGE_KERNEL') == '1' else 'virtual/kernel:do_deploy'}" + PREFERRED_PROVIDER_virtual/bootloader ?= "u-boot" SPL_BINARY = "MLO" UBOOT_SUFFIX = "img" UBOOT_MACHINE = "am335x_evm_defconfig" +UBOOT_ENTRYPOINT = "0x80008000" +UBOOT_LOADADDRESS = "0x80008000" +UBOOT_DTB_LOADADDRESS = "0x88000000" +UBOOT_DTBO_LOADADDRESS = "0x88080000" +UBOOT_RD_LOADADDRESS = "0x89000000" +UBOOT_RD_ENTRYPOINT = "0x89000000" MACHINE_FEATURES = "usbgadget usbhost vfat alsa" -IMAGE_BOOT_FILES ?= "u-boot.${UBOOT_SUFFIX} ${SPL_BINARY} ${KERNEL_IMAGETYPE} ${DTB_FILES}" +# Configure wic to create a /boot partition with either zImage or fitImage +IMAGE_BOOT_FILES ?= "u-boot.${UBOOT_SUFFIX} ${SPL_BINARY} \ + ${@'fitImage' if d.getVar('FIT_IMAGE_KERNEL') == '1' else '${KERNEL_IMAGETYPE} ${DTB_FILES}'} \ +" # support runqemu EXTRA_IMAGEDEPENDS += "qemu-native qemu-helper-native" From patchwork Fri Jun 20 08:08:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 65333 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 CDFD1C77B7F for ; Fri, 20 Jun 2025 08:08:55 +0000 (UTC) Received: from mta-65-225.siemens.flowmailer.net (mta-65-225.siemens.flowmailer.net [185.136.65.225]) by mx.groups.io with SMTP id smtpd.web10.2779.1750406928901185603 for ; Fri, 20 Jun 2025 01:08:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=StETzAXc; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.225, mailfrom: fm-1329275-2025062008084516404f089e3ad9c530-awgxsm@rts-flowmailer.siemens.com) Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 2025062008084516404f089e3ad9c530 for ; Fri, 20 Jun 2025 10:08:45 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=adrian.freihofer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=2C5/drcqhX73RDPnMTxoAcEhdNjVGxWuM35wzHdCCvc=; b=StETzAXcY2Keas7oUfzGAgCgWpeS/ZQMGzwXSqhA80Y6Mee6trkcPIc2vDfybekn5+8UB/ uRWFOODQwvbHWAUNmInDmQW3bh1OuCcWbW/ic80/RAEBnRD3X+1wW7ONn8XWWW1q5REysrqK eXAwt/z1eCIZacuf0RYznSfV13YHTFaRyTPddMl41qHQ6FrKuM4caXe0q1sctuiQXeIw7LL7 7BYNzCX/sR5sCHVx8CRUHg0KBvCPfLdzy1X3sZ0XNjsxgb3FMvqkNwFmW7wg8b54c5KuBBVP TidWR4cCHZEcQGZ9xJGDDZDX/7HwTYOLQh96tZ1WEV82SixcHHXKwsxw==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer Subject: [PATCH 3/5] beaglebone-yocto: remove redundant boot files Date: Fri, 20 Jun 2025 10:08:20 +0200 Message-ID: <20250620080840.562802-4-adrian.freihofer@siemens.com> In-Reply-To: <20250620080840.562802-1-adrian.freihofer@siemens.com> References: <20250620080840.562802-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer 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, 20 Jun 2025 08:08:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/219106 From: Adrian Freihofer The beaglebone-yocto MACHINE uses wic to create the final image. The wks file defines a boot partition like that: part /boot --source bootimg_partition --ondisk mmcblk0 This copies the files listed in IMAGE_BOOT_FILES variable from the DEPLOY_DIR_IMAGE to the dedicated boot partition. Therefore installing the kernel and the u-boot also into the rootfs is redundant. This is tested on a beaglebone-black: * Without this commit: systemd boots. Unmounting /boot shows the useless artifacts in the rootfs /boot directory. * With this commit: The system boots. Unmounting /boot leads to an empty /boot directory. Signed-off-by: Adrian Freihofer --- meta-yocto-bsp/conf/machine/beaglebone-yocto.conf | 3 --- 1 file changed, 3 deletions(-) diff --git a/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf b/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf index 321d2c27c2a..4ebb771323f 100644 --- a/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf +++ b/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf @@ -18,9 +18,6 @@ WKS_FILE ?= "beaglebone-yocto.wks" # Setting this variable to "1" switches from zImage kernel to FIT image kernel FIT_IMAGE_KERNEL ?= "0" -# Note: This is redundant if wic creates a separate /boot partition -MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "${@'linux-yocto-fitimage' if d.getVar('FIT_IMAGE_KERNEL') == '1' else 'kernel-image kernel-devicetree'}" - KERNEL_CLASSES += "${@'kernel-fit-extra-artifacts' if d.getVar('FIT_IMAGE_KERNEL') == '1' else ''}" do_image_wic[depends] += "\ mtools-native:do_populate_sysroot \ From patchwork Fri Jun 20 08:08:21 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 65332 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 BAF2AC7115B for ; Fri, 20 Jun 2025 08:08:55 +0000 (UTC) Received: from mta-65-225.siemens.flowmailer.net (mta-65-225.siemens.flowmailer.net [185.136.65.225]) by mx.groups.io with SMTP id smtpd.web11.2772.1750406929173322719 for ; Fri, 20 Jun 2025 01:08:50 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=JqlzkasG; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.225, mailfrom: fm-1329275-20250620080845ce2bd9ca462726ebe3-br5bbb@rts-flowmailer.siemens.com) Received: by mta-65-225.siemens.flowmailer.net with ESMTPSA id 20250620080845ce2bd9ca462726ebe3 for ; Fri, 20 Jun 2025 10:08:45 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=adrian.freihofer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=Z+AsWPEjp0Gv6T7owRDH5KOOSiiEztANe7dTdqascfI=; b=JqlzkasGSzAjzyxhfHsiJ5jZWx81xcum8KOwG4aP8y7dKoiBE6VfOEJtzjXzCFgwlgHbWS 4xNxd3N47VOaG6NGa2qWxxXv+Oa+UGX8Gh9Foj1q+YiiyHthUnmI/cVBCwoR5PGPbuoC9QsS iQKU/mAJVnVwVvCXnGbVtK8DBfjSW6oPCi6G0TJ3fvtoHzRj6uqEVdGbhSM6/T8MgAAA1iLd EEitkk1DKlnCcaXC9jfWWXAMYSBH8wgzPMn5LFKqtU2uU9uxwB23W49B7L1+AV+KVcPnxgQa Y2yMztA89ebx5FTUhANO//4C7kfMIOGIwoqDNep26eycZuU/1LRHjp/A==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer Subject: [PATCH 4/5] oe-selftest: devtool: split tap detection into function Date: Fri, 20 Jun 2025 10:08:21 +0200 Message-ID: <20250620080840.562802-5-adrian.freihofer@siemens.com> In-Reply-To: <20250620080840.562802-1-adrian.freihofer@siemens.com> References: <20250620080840.562802-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer 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, 20 Jun 2025 08:08:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/219109 From: Adrian Freihofer Make the check for tap devices available as a function which can be used by other tests as well. Signed-off-by: Adrian Freihofer --- meta/lib/oeqa/selftest/cases/devtool.py | 14 ++------------ meta/lib/oeqa/utils/commands.py | 12 ++++++++++++ 2 files changed, 14 insertions(+), 12 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/devtool.py b/meta/lib/oeqa/selftest/cases/devtool.py index 0155ee62ee0..6ba77e2f9bf 100644 --- a/meta/lib/oeqa/selftest/cases/devtool.py +++ b/meta/lib/oeqa/selftest/cases/devtool.py @@ -16,7 +16,7 @@ import json from oeqa.selftest.case import OESelftestTestCase from oeqa.utils.commands import runCmd, bitbake, get_bb_var, create_temp_layer -from oeqa.utils.commands import get_bb_vars, runqemu, get_test_layer +from oeqa.utils.commands import get_bb_vars, runqemu, runqemu_check_taps, get_test_layer from oeqa.core.decorator import OETestTag oldmetapath = None @@ -277,18 +277,8 @@ class DevtoolTestCase(OESelftestTestCase): machine = get_bb_var('MACHINE') if not machine.startswith('qemu'): self.skipTest('This test only works with qemu machines') - if not os.path.exists('/etc/runqemu-nosudo'): + if not runqemu_check_taps(): self.skipTest('You must set up tap devices with scripts/runqemu-gen-tapdevs before running this test') - result = runCmd('PATH="$PATH:/sbin:/usr/sbin" ip tuntap show', ignore_status=True) - if result.status != 0: - result = runCmd('PATH="$PATH:/sbin:/usr/sbin" ifconfig -a', ignore_status=True) - if result.status != 0: - self.skipTest('Failed to determine if tap devices exist with ifconfig or ip: %s' % result.output) - for line in result.output.splitlines(): - if line.startswith('tap'): - break - else: - self.skipTest('No tap devices found - you must set up tap devices with scripts/runqemu-gen-tapdevs before running this test') def _test_devtool_add_git_url(self, git_url, version, pn, resulting_src_uri, srcrev=None): self.track_for_cleanup(self.workspacedir) diff --git a/meta/lib/oeqa/utils/commands.py b/meta/lib/oeqa/utils/commands.py index 2a47f90e327..8cb4a9be6d3 100644 --- a/meta/lib/oeqa/utils/commands.py +++ b/meta/lib/oeqa/utils/commands.py @@ -388,6 +388,18 @@ def runqemu(pn, ssh=True, runqemuparams='', image_fstype=None, launch_cmd=None, targetlogger.removeHandler(handler) qemu.stop() +def runqemu_check_taps(): + """Check if tap devices for runqemu are available""" + if not os.path.exists('/etc/runqemu-nosudo'): + return False + result = runCmd('PATH="$PATH:/sbin:/usr/sbin" ip tuntap show', ignore_status=True) + if result.status != 0: + return False + for line in result.output.splitlines(): + if line.startswith('tap'): + return True + return False + def updateEnv(env_file): """ Source a file and update environment. From patchwork Fri Jun 20 08:08:22 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 65334 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 B4CCDC7115D for ; Fri, 20 Jun 2025 08:08:55 +0000 (UTC) Received: from mta-65-226.siemens.flowmailer.net (mta-65-226.siemens.flowmailer.net [185.136.65.226]) by mx.groups.io with SMTP id smtpd.web10.2780.1750406928901358525 for ; Fri, 20 Jun 2025 01:08:49 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=C0bjoJ+F; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.226, mailfrom: fm-1329275-20250620080845ad6761252798a47099-fxkgkk@rts-flowmailer.siemens.com) Received: by mta-65-226.siemens.flowmailer.net with ESMTPSA id 20250620080845ad6761252798a47099 for ; Fri, 20 Jun 2025 10:08:45 +0200 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; s=fm2; d=siemens.com; i=adrian.freihofer@siemens.com; h=Date:From:Subject:To:Message-ID:MIME-Version:Content-Type:Content-Transfer-Encoding:Cc:References:In-Reply-To; bh=Nk4jGrk1eaRVnlV+C72rGFcihTNdn0kxNEhlKxPSDKg=; b=C0bjoJ+FgewSAnGu7IvpjbxWOL7B3h0fionzcmzSZ7F7oo/RW1CmTru8UmKZ5URpTmZIof TxsbvEDuyUPj+OuasdJJXvbbFKH6muCzcdaam1yWgRTzMZiWoxjF2tdZ+cf/1YTinPV55zj8 hzBXyo0ZqKiY3X+BNrqbbjEWWH+uTM/c0Zfc1LF4ru+ilW2gt7quLU+Bzgwkb3kZs21WUjd3 2rbzGzB68ASZDa8cFLFoSRZu/1Ocx/g5DWgDm/nNh3nWmoX2Imf8zbF7SnuDBTARzzEbX6uz vbFDBjW07G84r/dbP8fbrabF29QWsQ2FuS6ceV7GBXQbQonLhzyC76ZQ==; From: AdrianF To: openembedded-core@lists.openembedded.org Cc: Adrian Freihofer Subject: [PATCH 5/5] oe-selftest: add a beaglebone-yocto fitimage Qemu test Date: Fri, 20 Jun 2025 10:08:22 +0200 Message-ID: <20250620080840.562802-6-adrian.freihofer@siemens.com> In-Reply-To: <20250620080840.562802-1-adrian.freihofer@siemens.com> References: <20250620080840.562802-1-adrian.freihofer@siemens.com> MIME-Version: 1.0 X-Flowmailer-Platform: Siemens Feedback-ID: 519:519-1329275:519-21489:flowmailer 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, 20 Jun 2025 08:08:55 -0000 X-Groupsio-URL: https://lists.openembedded.org/g/openembedded-core/message/219108 From: Adrian Freihofer The kernel configuration of the beaglebone-yocto MACHINE supports booting on real hardware as well as in Qemu. Add an oe-selftest which tests that booting in Qemu is possible even when the kernel is a FIT image kernel with a RAM disk. Since Qemu does not support FIT images, Qemu boots the zImage in direct kernel mode. This works with or without initramfs. Signed-off-by: Adrian Freihofer --- meta/lib/oeqa/selftest/cases/fitimage.py | 37 ++++++++++++++++++++++-- 1 file changed, 34 insertions(+), 3 deletions(-) diff --git a/meta/lib/oeqa/selftest/cases/fitimage.py b/meta/lib/oeqa/selftest/cases/fitimage.py index 3c408577476..9e0db30258e 100644 --- a/meta/lib/oeqa/selftest/cases/fitimage.py +++ b/meta/lib/oeqa/selftest/cases/fitimage.py @@ -9,13 +9,12 @@ import re import shlex import logging import pprint -import tempfile import oe.fitimage from oeqa.selftest.case import OESelftestTestCase -from oeqa.utils.commands import runCmd, bitbake, get_bb_vars, get_bb_var - +from oeqa.utils.commands import runCmd, bitbake, get_bb_vars, get_bb_var, runqemu, runqemu_check_taps +from oeqa.core.decorator import OETestTag class BbVarsMockGenKeys: def __init__(self, keydir, gen_keys="0", sign_enabled="0", keyname="", sign_ind="0", img_keyname=""): @@ -1020,6 +1019,38 @@ FIT_HASH_ALG = "sha256" self._gen_signing_key(bb_vars) self._test_fitimage(bb_vars) + @OETestTag("runqemu") + def test_fit_image_initramfs_qemu(self): + """ + Summary: Verify building an image including a FIT image kernel and booting in Qemu works. + Expected: 1. core-image-minimal including a FIT image in /boot gets built + 2. Qemu can boot the zImage and initramfs with direct kernel boot + since Qemu does not support FIT images + """ + + config = """ +DISTRO = "poky" +MACHINE = "beaglebone-yocto" +INITRAMFS_IMAGE = "core-image-initramfs-boot" +FIT_IMAGE_KERNEL = "1" +# Do not override kernel command line network configuration +BAD_RECOMMENDATIONS:append:pn-oe-selftest-image = " init-ifupdown" +""" + self.write_config(config) + if not runqemu_check_taps(): + self.skipTest('No tap devices found - you must set up tap devices with scripts/runqemu-gen-tapdevs before running this test') + testimage = "oe-selftest-image" + bitbake(testimage) + # Boot the image + with runqemu(testimage) as qemu: + # Run a test command to see if it was installed properly + sshargs = '-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' + result = runCmd('ssh %s root@%s %s' % (sshargs, qemu.ip, "ls -1 /boot")) + self.logger.debug("ls -1 /boot: %s" % str(result.output)) + boot_files = result.output.splitlines() + self.assertIn("fitImage", boot_files) + self.assertNotIn("zImage", boot_files) + class FitImagePyTests(KernelFitImageBase): """Test cases for the fitimage.py module without calling bitbake"""