From patchwork Sat Jun 21 16:26:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 65423 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 EB219C7EE31 for ; Sat, 21 Jun 2025 16:27:04 +0000 (UTC) Received: from mta-65-228.siemens.flowmailer.net (mta-65-228.siemens.flowmailer.net [185.136.65.228]) by mx.groups.io with SMTP id smtpd.web11.10496.1750523219089960009 for ; Sat, 21 Jun 2025 09:27:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=W0PK22YQ; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.228, mailfrom: fm-1329275-202506211626551fbf1e7a02f30e48c8-jjbmrq@rts-flowmailer.siemens.com) Received: by mta-65-228.siemens.flowmailer.net with ESMTPSA id 202506211626551fbf1e7a02f30e48c8 for ; Sat, 21 Jun 2025 18:26:56 +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=W0PK22YQBC8wz1zG/VDQ3gIz73DiUp+orr9H2AIvtnRVyzvB8q23Kw5yqmwZmMsojHPn+Y +ptzzVKH5JyGe3gWNXVaGOz4j+u4pHPV9aMc1XoL2hY8uSvyhsYVwEzFCCZ0csgDtEGJX/3c W4tesZJQu+GNYFZKxe+z5TCQeybamb449ZNA2P/FLhloHjoFl5iY2/2eoSxB+9BZ9+JWxs91 h1kELCWJAUdyl81F1/1wvaaBoW3Oevjn5n6QnIKeQewNlANi73yawwf7hAQIic+76AXHSW5H 3IO1w2+jmDO1CzXTqlz4dePM1c+WfRezkXkulRqc8jRE3Jnf/OO6AxDw==; From: AdrianF To: poky@lists.yoctoproject.org Cc: Adrian Freihofer Subject: [PATCH 1/4] beaglebone-yocto: support initramfs in qemu Date: Sat, 21 Jun 2025 18:26:23 +0200 Message-ID: <20250621162642.804605-2-adrian.freihofer@siemens.com> In-Reply-To: <20250621162642.804605-1-adrian.freihofer@siemens.com> References: <20250621162642.804605-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 ; Sat, 21 Jun 2025 16:27:04 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/poky/message/13660 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 Sat Jun 21 16:26:24 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 65422 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 E645DC7EE30 for ; Sat, 21 Jun 2025 16:27:04 +0000 (UTC) Received: from mta-64-227.siemens.flowmailer.net (mta-64-227.siemens.flowmailer.net [185.136.64.227]) by mx.groups.io with SMTP id smtpd.web10.10477.1750523219479370936 for ; Sat, 21 Jun 2025 09:27:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=TCqTTnAy; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.227, mailfrom: fm-1329275-20250621162657b6625d205045b263a5-gwkny0@rts-flowmailer.siemens.com) Received: by mta-64-227.siemens.flowmailer.net with ESMTPSA id 20250621162657b6625d205045b263a5 for ; Sat, 21 Jun 2025 18:26:57 +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=TCqTTnAy5HJZ7W3hpGsTS+0v1kRCC8WYRufXexY3QT/1Hf8c09d22fuCkaqYw9//kghitF 8GghiPbGZylS4CAprQN4DuoBbYav+SU9P9zxPWKrmzZGhJBsrRYo+DG3lYB/ozN7Vv5b3e49 ZFq90Tj88tKNOIS6nJj+E+gjW0dYGvtekKnsu3djoQ9gpAhNuvT5ufvpkgFjBRn4rHqdnxQ/ jQv8zh3OdMzQ3CL5P19cbM0J0qG+JQyKPQPWFU9GxOE5YQFtCtMY10savF70HWxF4sLq8qny lnS6bzmdPC7cFdx2HhsmiQeXgUTnLb4nFitQDrAFR7iTjwvctSMLqycg==; From: AdrianF To: poky@lists.yoctoproject.org Cc: Adrian Freihofer Subject: [PATCH 2/4] beaglebone-yocto: support FIT images Date: Sat, 21 Jun 2025 18:26:24 +0200 Message-ID: <20250621162642.804605-3-adrian.freihofer@siemens.com> In-Reply-To: <20250621162642.804605-1-adrian.freihofer@siemens.com> References: <20250621162642.804605-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 ; Sat, 21 Jun 2025 16:27:04 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/poky/message/13661 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 Sat Jun 21 16:26:25 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 65421 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 D7799C7115C for ; Sat, 21 Jun 2025 16:27:04 +0000 (UTC) Received: from mta-65-227.siemens.flowmailer.net (mta-65-227.siemens.flowmailer.net [185.136.65.227]) by mx.groups.io with SMTP id smtpd.web10.10478.1750523219994428478 for ; Sat, 21 Jun 2025 09:27:00 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=UB0s6FOm; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.65.227, mailfrom: fm-1329275-2025062116265888fae3e7119ff58af6-amt_j0@rts-flowmailer.siemens.com) Received: by mta-65-227.siemens.flowmailer.net with ESMTPSA id 2025062116265888fae3e7119ff58af6 for ; Sat, 21 Jun 2025 18:26:58 +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=UB0s6FOmexRTc78z/zBsTEO1yc5A0N6a/LLTpsH8HkZq2lJIOJY3lck2yxqmdB4VAgI3eF 8dOu5KSaUU/InLcIG8NSm+NZHtZ8CDsYABaa6i3Jx2kEf4SG8vzRDJ1zQ8Wqo/Vl6nXEUqJQ zbDycJavtIez24V0QrdAhS60JRSbXBZy0f47tL7YAU+d3N51ujgLRfuRreNd/PsS8S+dhI+m h3S7Ly02nrs+w9JalMoxCbRm++Ux84UC0Bl74g1iqK2VHL64cLtUXqbMue2oVixkqiw8uWiY xkU7Phe7AuXuYNa0Jhvh4dshW9cMPB1N0bqMXd8PuTYZrNEEFsY3mE+A==; From: AdrianF To: poky@lists.yoctoproject.org Cc: Adrian Freihofer Subject: [PATCH 3/4] beaglebone-yocto: remove redundant boot files Date: Sat, 21 Jun 2025 18:26:25 +0200 Message-ID: <20250621162642.804605-4-adrian.freihofer@siemens.com> In-Reply-To: <20250621162642.804605-1-adrian.freihofer@siemens.com> References: <20250621162642.804605-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 ; Sat, 21 Jun 2025 16:27:04 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/poky/message/13662 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 Sat Jun 21 16:26:26 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: AdrianF X-Patchwork-Id: 65424 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 D85C3C77B7C for ; Sat, 21 Jun 2025 16:27:04 +0000 (UTC) Received: from mta-64-226.siemens.flowmailer.net (mta-64-226.siemens.flowmailer.net [185.136.64.226]) by mx.groups.io with SMTP id smtpd.web10.10479.1750523221489254273 for ; Sat, 21 Jun 2025 09:27:01 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=adrian.freihofer@siemens.com header.s=fm2 header.b=wjno2Fcy; spf=pass (domain: rts-flowmailer.siemens.com, ip: 185.136.64.226, mailfrom: fm-1329275-202506211626599959c6506e13e1b27b-wxnk2z@rts-flowmailer.siemens.com) Received: by mta-64-226.siemens.flowmailer.net with ESMTPSA id 202506211626599959c6506e13e1b27b for ; Sat, 21 Jun 2025 18:26:59 +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=P/q6beG2FGuPZtm8Mmk/jDnSLuRkHVoMBPfk1Vmp4Dk=; b=wjno2FcyKjNU31kwD+PxStn9/bqz+Zg8JREzBOrpv9ZwkUtLwpbW/xWJkEI+HtFdQ7nsFb aQYT+Hj/KgydqoKKs9jBvLnaRkXiZSDot0Gjmd3eNI/aCgAU56jto5Owf7GLLduFUeprJYiI ZJCcLpZZkVDeI4vOpzZgTGl2vtwBCCuTp4NTJ/qc7XgF5C7nsQ87ORQudjtpOXfNK5PGdA+P RMebtDCaro0FozvZXtypBQvR1PA8geXfnw5bjp1IO+VQygrZngDSmazm+0yCY3x4IslSMkmj IOMddDmGUG0FN2iGDytlMULghYAhPgz/UL2bKv/a2JyB66KW1SzfGsuQ==; From: AdrianF To: poky@lists.yoctoproject.org Cc: Adrian Freihofer Subject: [PATCH 4/4] oe-selftest: add a beaglebone-yocto fitimage Qemu test Date: Sat, 21 Jun 2025 18:26:26 +0200 Message-ID: <20250621162642.804605-5-adrian.freihofer@siemens.com> In-Reply-To: <20250621162642.804605-1-adrian.freihofer@siemens.com> References: <20250621162642.804605-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 ; Sat, 21 Jun 2025 16:27:04 -0000 X-Groupsio-URL: https://lists.yoctoproject.org/g/poky/message/13663 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 --- .../selftest/cases/beaglebone_yocto_qemu.py | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 meta-yocto-bsp/lib/oeqa/selftest/cases/beaglebone_yocto_qemu.py diff --git a/meta-yocto-bsp/lib/oeqa/selftest/cases/beaglebone_yocto_qemu.py b/meta-yocto-bsp/lib/oeqa/selftest/cases/beaglebone_yocto_qemu.py new file mode 100644 index 00000000000..aeae431fd2c --- /dev/null +++ b/meta-yocto-bsp/lib/oeqa/selftest/cases/beaglebone_yocto_qemu.py @@ -0,0 +1,39 @@ + +from oeqa.selftest.case import OESelftestTestCase +from oeqa.utils.commands import runCmd, bitbake, runqemu, runqemu_check_taps +from oeqa.core.decorator import OETestTag + + +class BeagleboneYoctoQemuTests(OESelftestTestCase): + + @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)