<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<!DOCTYPE bugzilla SYSTEM "https://bugzilla.yoctoproject.org/page.cgi?id=bugzilla.dtd">

<bugzilla version="5.0.6"
          urlbase="https://bugzilla.yoctoproject.org/"
          
          maintainer="it-coreprojects-helpdesk@linuxfoundation.org"
>

    <bug>
          <bug_id>13384</bug_id>
          
          <creation_ts>2019-06-09 12:37:58 +0000</creation_ts>
          <short_desc>Support runqemu for MACHINE=beaglebone-yocto</short_desc>
          <delta_ts>2019-09-05 02:58:18 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>7</classification_id>
          <classification>Build System, Metadata &amp; Runtime</classification>
          <product>OE-Core</product>
          <component>Scripts and Tools</component>
          <version>3.0</version>
          <rep_platform>BeagleBone</rep_platform>
          <op_sys>arm</op_sys>
          <bug_status>RESOLVED</bug_status>
          <resolution>FIXED</resolution>
          
          
          <bug_file_loc></bug_file_loc>
          <status_whiteboard></status_whiteboard>
          <keywords></keywords>
          <priority>Medium</priority>
          <bug_severity>enhancement</bug_severity>
          <target_milestone>3.0</target_milestone>
          
          
          <everconfirmed>1</everconfirmed>
          <reporter name="Adrian Freihofer">adrian.freihofer</reporter>
          <assigned_to name="Adrian Freihofer">adrian.freihofer</assigned_to>
          <cc>adrian.freihofer</cc>
    
    <cc>randy.macleod</cc>
    
    <cc>ross.burton</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>No (bug/feature does not impact docs)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>84120</commentid>
    <comment_count>0</comment_count>
    <who name="Adrian Freihofer">adrian.freihofer</who>
    <bug_when>2019-06-09 12:37:58 +0000</bug_when>
    <thetext>The runqemu command is easy to use when MACHINE is set to one of the qemu* types. It would be nice to get the same ease of use, e.g. if MACHINE is set to beaglebone-yocto.

Achieving this for ARM devices is no longer so difficult. If the kernel has support for Qemu&apos;s virtual architecture built in, everything almost works out of the box. 

When #13336 is merged, the wic image is suitable to be booted into Qemu, as is the case for the hardware device.

This extension is especially useful for eSDk-based workflows. To provide users with an SDK suitable for both Qemu and target hardware development, two separate SDK builds are usually required: one for runqemu and one for the real hardware. With this extension, this would no longer be necessary for ARM devices.

Step 1: Add a new kernel feature to activate CONFIG_ARCH_VIRT as well as some VIRTIO drivers.

Step 2: Append the required QB_ bits to the beaglebone-yocto.conf file.

runqemu and bitbake core-image-minimal -c testimage should run without errors. (Allmost all tests will be skipped in this combination)</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84121</commentid>
    <comment_count>1</comment_count>
    <who name="Adrian Freihofer">adrian.freihofer</who>
    <bug_when>2019-06-09 12:59:41 +0000</bug_when>
    <thetext>Step 1: Kernel config feature has been sent to the mailing list:
https://lists.yoctoproject.org/pipermail/linux-yocto/2019-June/007754.html

Step 2: Is blocked until step 1 is merged. The patch is ready and will be sent to the mailing list if this enhancement gets accepted:

diff --git a/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf b/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf
index 35814cd8f1..5991f50e0c 100644
--- a/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf
+++ b/meta-yocto-bsp/conf/machine/beaglebone-yocto.conf
@@ -20,7 +20,7 @@ WKS_FILE ?= &quot;beaglebone-yocto.wks&quot;
 IMAGE_INSTALL_append = &quot; kernel-devicetree kernel-image-zimage&quot;
 do_image_wic[depends] += &quot;mtools-native:do_populate_sysroot dosfstools-native:do_populate_sysroot u-boot:do_deploy&quot;
 
-SERIAL_CONSOLES ?= &quot;115200;ttyS0 115200;ttyO0&quot;
+SERIAL_CONSOLES ?= &quot;115200;ttyS0 115200;ttyO0 115200;ttyAMA0&quot;
 SERIAL_CONSOLES_CHECK = &quot;${SERIAL_CONSOLES}&quot;
 
 PREFERRED_PROVIDER_virtual/kernel ?= &quot;linux-yocto&quot;
@@ -39,3 +39,21 @@ UBOOT_LOADADDRESS = &quot;0x80008000&quot;
 MACHINE_FEATURES = &quot;usbgadget usbhost vfat alsa&quot;
 
 IMAGE_BOOT_FILES ?= &quot;u-boot.${UBOOT_SUFFIX} MLO zImage am335x-bone.dtb am335x-boneblack.dtb am335x-bonegreen.dtb&quot;
+
+# support runqemu
+EXTRA_IMAGEDEPENDS += &quot;qemu-native qemu-helper-native&quot;
+IMAGE_CLASSES += &quot;qemuboot&quot;
+QB_DEFAULT_FSTYPE = &quot;wic&quot;
+QB_FSINFO = &quot;wic:no-kernel-in-fs&quot;
+QB_KERNEL_ROOT = &quot;/dev/vda2&quot;
+QB_SYSTEM_NAME = &quot;qemu-system-arm&quot;
+QB_MEM = &quot;-m 512&quot;
+QB_MACHINE = &quot;-machine virt&quot;
+QB_CPU = &quot;-cpu cortex-a15&quot;
+QB_KERNEL_CMDLINE_APPEND = &quot;console=ttyAMA0 systemd.mask=systemd-networkd&quot;
+QB_OPT_APPEND = &quot;-device virtio-rng-device -nographic&quot;
+QB_TAP_OPT = &quot;-netdev tap,id=net0,ifname=@TAP@,script=no,downscript=no&quot;
+QB_NETWORK_DEVICE = &quot;-device virtio-net-device,netdev=net0,mac=@MAC@&quot;
+QB_ROOTFS_OPT = &quot;-drive id=disk0,file=@ROOTFS@,if=none,format=raw -device virtio-blk-device,drive=disk0&quot;
+QB_SERIAL_OPT = &quot;&quot;
+QB_TCPSERIAL_OPT = &quot;-device virtio-serial-device -chardev socket,id=virtcon,port=@PORT@,host=127.0.0.1 -device virtconsole,chardev=virtcon&quot;</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84176</commentid>
    <comment_count>2</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2019-06-13 14:39:32 +0000</bug_when>
    <thetext>This would be convenient but it would require work to maintain and do QA for this machine. If this is accepted, are you able to commit to doing this work?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84198</commentid>
    <comment_count>3</comment_count>
    <who name="Adrian Freihofer">adrian.freihofer</who>
    <bug_when>2019-06-13 21:26:34 +0000</bug_when>
    <thetext>Hi Randy,

It&apos;s a fair question. But I don&apos;t see much effort for maintenance. Of course I will try to keep this feature running in the future.

But just to make that clear. It&apos;s not my intention to make &quot;MACHINE=beaglebone runqemu&quot; an important Yocto feature with QA and a build job on the autombuilder. I don&apos;t see much value in it, because qemuarm MACHINE is 99% equal and well maintained.

The current situation is that runqemu does not work for MACHINE=beaglebone. I just want to fix this because it is easy to fix and could serve as a general example for booting ARM-based devices in Qemu without compiling an additional MACHINE such as qemuarm. My main goal is to be able to perform image tests on a CI infrastructure with as little additional build effort as possible. The patch will be very simple, without affecting anything else in Yocto.

Regards,
Adrian</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84221</commentid>
    <comment_count>4</comment_count>
    <who name="Adrian Freihofer">adrian.freihofer</who>
    <bug_when>2019-06-16 15:51:25 +0000</bug_when>
    <thetext>A v2 kernel config for bb was sent to the list: 
https://lists.yoctoproject.org/pipermail/linux-yocto/2019-June/007768.html

With this patch runqemu just runs, also with graphics.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>84872</commentid>
    <comment_count>5</comment_count>
    <who name="Randy MacLeod">randy.macleod</who>
    <bug_when>2019-09-05 02:58:18 +0000</bug_when>
    <thetext>2.8 is now 3.0 so fix up the Version and Milestone entries.</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>