<?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>11068</bug_id>
          
          <creation_ts>2017-02-17 11:18:01 +0000</creation_ts>
          <short_desc>QEMU as a supported platform</short_desc>
          <delta_ts>2017-04-24 10:49:58 +0000</delta_ts>
          <reporter_accessible>1</reporter_accessible>
          <cclist_accessible>1</cclist_accessible>
          <classification_id>6</classification_id>
          <classification>Yocto Project Subprojects</classification>
          <product>IoT Reference OS Kit</product>
          <component>intel-iot-refkit-platform-support</component>
          <version>unspecified</version>
          <rep_platform>x86</rep_platform>
          <op_sys>Multiple</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>2.3 M4</target_milestone>
          
          <blocked>11061</blocked>
    
    <blocked>11203</blocked>
          <everconfirmed>1</everconfirmed>
          <reporter name="Dmitry Rozhkov">dmitry.rojkov</reporter>
          <assigned_to name="Dmitry Rozhkov">dmitry.rojkov</assigned_to>
          <cc>matti-pekka.sivosuo</cc>
    
    <cc>mikko.ylinen</cc>
    
    <cc>patrick.ohly</cc>
    
    <cc>simo.kuusela</cc>
          
          
          <cf_os>---</cf_os>
          <cf_regression_type>---</cf_regression_type>
          
          <cf_docchange>Yes (doc changes required)</cf_docchange>

      

      

      

          <comment_sort_order>oldest_to_newest</comment_sort_order>  
          <long_desc isprivate="0" >
    <commentid>70795</commentid>
    <comment_count>0</comment_count>
    <who name="Dmitry Rozhkov">dmitry.rojkov</who>
    <bug_when>2017-02-17 11:18:01 +0000</bug_when>
    <thetext>As a developer I want to have the possibility to run RefKit in a QEMU VM and to access it with ssh.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70798</commentid>
    <comment_count>1</comment_count>
    <who name="Patrick Ohly">patrick.ohly</who>
    <bug_when>2017-02-17 13:32:06 +0000</bug_when>
    <thetext>Does this item include automatic testing under qemu?</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70803</commentid>
    <comment_count>2</comment_count>
    <who name="Dmitry Rozhkov">dmitry.rojkov</who>
    <bug_when>2017-02-17 14:06:05 +0000</bug_when>
    <thetext>(In reply to comment #1)
&gt; Does this item include automatic testing under qemu?

I&apos;d create a separate bug for that.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70856</commentid>
    <comment_count>3</comment_count>
    <who name="Dmitry Rozhkov">dmitry.rojkov</who>
    <bug_when>2017-02-21 14:33:32 +0000</bug_when>
    <thetext>With this patch for meta-intel

&gt; diff --git a/conf/machine/include/qemuboot-intel.inc b/conf/machine/include/qemuboot-intel.inc
&gt; index 82a72ac..cb52330 100644
&gt; --- a/conf/machine/include/qemuboot-intel.inc
&gt; +++ b/conf/machine/include/qemuboot-intel.inc
&gt; @@ -17,4 +17,3 @@ QB_AUDIO_OPT = &quot;-soundhw ac97,es1370&quot;
&gt;  QB_KERNEL_CMDLINE_APPEND = &quot;vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1&quot;
&gt;  # Add the &apos;virtio-rng-pci&apos; device otherwise the guest may run out of entropy
&gt;  QB_OPT_APPEND = &quot;-vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci&quot;
&gt; -QB_SLIRP_OPT = &quot;-net nic,model=e1000 -net user,hostfwd=tcp::2222-:22&quot;

I can run successfully

&gt; $ runqemu refkit-image-common ext4 intel-corei7-64 slirp

(Non-slirp configuration requires a DHCP server running on host and listening on all tap interfaces)

The running VM acquires its IP from qemu&apos;s built-in DHCP server. Only 2 test cases fail from testplan/refkit-image-common.manifest: 
 - check systemd boot journal error
 - test_speaker_test (oeqa.runtime.alsa.alsa.AlsaTest).

The first failure is caused by the hardcoded &quot;ip=dhcp&quot; bootparam in the runqemu script which prevents renaming eth0 to whatever pleases systemd. Hopefully this can be fixed with making runqemu not override the &quot;bootparam=&quot; user input.

The second failure is due to unconfigured sound hardware in the VM. I&apos;d rather exclude this test case from qemuboot test plans because
1) QEMU doesn&apos;t really emulate the hardware that our SUT is supposed to have (hdmi:CARD=PCH,DEV=0) and
2) even when modified to run `speaker-test -D front:CARD=I82801AAICH,DEV=0 -c 2 -l 1` (and added qemuparam=&quot;-soundhw ac97,es1370&quot;) the test case gets killed by OOM killer. Not sure we want to test QEMU here.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70858</commentid>
    <comment_count>4</comment_count>
    <who name="Patrick Ohly">patrick.ohly</who>
    <bug_when>2017-02-21 15:03:00 +0000</bug_when>
    <thetext>(In reply to comment #3)
&gt; &gt; $ runqemu refkit-image-common ext4 intel-corei7-64 slirp
[...] 
&gt; The first failure is caused by the hardcoded &quot;ip=dhcp&quot; bootparam in the
&gt; runqemu script which prevents renaming eth0 to whatever pleases systemd.
&gt; Hopefully this can be fixed with making runqemu not override the
&gt; &quot;bootparam=&quot; user input.

That will go away once we switch to booting with OVMF as firmware (patch currently stuck because of compile issues on some OE-core configurations) and the wic image, because then runqemu can&apos;t set that boot parameter.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>70862</commentid>
    <comment_count>5</comment_count>
    <who name="Dmitry Rozhkov">dmitry.rojkov</who>
    <bug_when>2017-02-21 15:24:06 +0000</bug_when>
    <thetext>(In reply to comment #4)
&gt; (In reply to comment #3)
&gt; &gt; &gt; $ runqemu refkit-image-common ext4 intel-corei7-64 slirp
&gt; [...] 
&gt; &gt; The first failure is caused by the hardcoded &quot;ip=dhcp&quot; bootparam in the
&gt; &gt; runqemu script which prevents renaming eth0 to whatever pleases systemd.
&gt; &gt; Hopefully this can be fixed with making runqemu not override the
&gt; &gt; &quot;bootparam=&quot; user input.
&gt; 
&gt; That will go away once we switch to booting with OVMF as firmware (patch
&gt; currently stuck because of compile issues on some OE-core configurations)
&gt; and the wic image, because then runqemu can&apos;t set that boot parameter.

Oh, that&apos;s good.

Though I&apos;ve already submitted a patch to oe-core which won&apos;t harm anyway. At least it can help not to override &quot;mem=&quot;.

https://patchwork.openembedded.org/patch/137475/

And one more patch to meta-intel

https://lists.yoctoproject.org/pipermail/meta-intel/2017-February/004602.html</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71346</commentid>
    <comment_count>6</comment_count>
    <who name="Dmitry Rozhkov">dmitry.rojkov</who>
    <bug_when>2017-03-16 10:14:38 +0000</bug_when>
    <thetext>Currently we&apos;re waiting for

https://github.com/intel/intel-iot-refkit/pull/70
https://github.com/intel/intel-iot-refkit/pull/69

to be merged. Then perhaps Simo can help with enabling automatic tests under QEMU in our CI.

To run a test suite one needs to

1. run a VM with `runqemu nographic serial refkit-image-common ext4 intel-corei7-64 bootparams=&quot;ip=off&quot; slirp` (when inside bitbake&apos;s env)

2. on the same host where the VM is running run the suite with `cd /path/to/iottest; python runtest.py -f testplan/refkit-image-common.manifest -m intel-corei7-64 -t 127.0.0.1:2222 -s 10.0.2.2`.

An alternative to the command in the step 1 could be something like

&gt; ${BUILD_DIR}/tmp-glibc/work/intel_corei7_64-refkit-linux/refkit-image-common/1.0-r0/recipe-sysroot-native/usr/bin/qemu-system-x86_64 -device virtio-net-pci,netdev=net0,mac=52:54:00:12:35:02 -netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23 -drive file=${BUILD_DIR}/tmp-glibc/deploy/images/intel-corei7-64/refkit-image-common-intel-corei7-64.ext4,if=virtio,format=raw -vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci  -nographic  -cpu Nehalem -m 256  -serial mon:stdio -serial null -kernel ${BUILD_DIR}/tmp-glibc/deploy/images/intel-corei7-64/bzImage-intel-corei7-64.bin -append &apos;root=/dev/vda rw highres=off  console=ttyS0 mem=256M vga=0 uvesafb.mode_option=640x480-32 oprofile.timer=1 uvesafb.task_timeout=-1 ip=off&apos;

I&apos;m trying to understand how EFI would work in QEMU (when QEMU consumes wic images instead of ext4 rootfs and kernel), but I haven&apos;t advanced much so far.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71354</commentid>
    <comment_count>7</comment_count>
    <who name="Patrick Ohly">patrick.ohly</who>
    <bug_when>2017-03-16 14:47:04 +0000</bug_when>
    <thetext>(In reply to comment #6)
&gt; I&apos;m trying to understand how EFI would work in QEMU (when QEMU consumes wic
&gt; images instead of ext4 rootfs and kernel), but I haven&apos;t advanced much so
&gt; far.

Use &quot;bitbake ovmf&quot; (works with current OE-core master) and then &quot;runqemu ovmf refkit-image-common wic intel-corei7-64&quot;.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71390</commentid>
    <comment_count>8</comment_count>
    <who name="Dmitry Rozhkov">dmitry.rojkov</who>
    <bug_when>2017-03-17 14:28:15 +0000</bug_when>
    <thetext>(In reply to comment #7)
&gt; 
&gt; Use &quot;bitbake ovmf&quot; (works with current OE-core master) and then &quot;runqemu
&gt; ovmf refkit-image-common wic intel-corei7-64&quot;.

Thanks! I didn&apos;t notice runqemu has got this option.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71443</commentid>
    <comment_count>9</comment_count>
    <who name="Dmitry Rozhkov">dmitry.rojkov</who>
    <bug_when>2017-03-20 08:05:31 +0000</bug_when>
    <thetext>The PR https://github.com/intel/intel-iot-refkit/pull/69 is in master now, but

meta-intel update has been excluded from

https://github.com/intel/intel-iot-refkit/pull/70

the new PR is

https://github.com/intel/intel-iot-refkit/pull/77.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71625</commentid>
    <comment_count>10</comment_count>
    <who name="Simo Kuusela">simo.kuusela</who>
    <bug_when>2017-03-23 07:44:56 +0000</bug_when>
    <thetext>Running &quot;bitbake ovmf&quot; and then &quot;runqemu refkit-image-common wic&quot; works for me but the problem is that I can&apos;t connect to qemu with ssh. It doesn&apos;t seem to get the 192.168.7.2 ip address that it should, instead it gets something like 169.254.232.81. Is it only me or is there still some problems using qemu? I also tried runqemu with &quot;slirp&quot; and it throws some error. Also tried without it and using DHCP server on host for &quot;tap&quot; interfaces but didn&apos;t work either.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>71627</commentid>
    <comment_count>11</comment_count>
    <who name="Dmitry Rozhkov">dmitry.rojkov</who>
    <bug_when>2017-03-23 08:59:54 +0000</bug_when>
    <thetext>By default QEMU uses tap interfaces, but setting up a local DHCP server can be tricky if you run dnsmasq locally. SLIRP is much easier as QEMU can use its built-in DHCP server in this mode.

To avoid the error when using SLIRP your meta-intel layer must contain this patch

https://lists.yoctoproject.org/pipermail/meta-intel/2017-February/004602.html

Alternatively you can delete the line 

&gt; qm_slirp_opt = -net nic,model=e1000 -net user,hostfwd=tcp::2222-:22

from your

&gt; ${BUILD_DIR}/tmp-glibc/deploy/images/intel-corei7-64/refkit-image-common-intel-corei7-64.qemuboot.conf

file. Or just run QEMU directly without the runqemu wrapper:

&gt; ${BUILD_DIR}/tmp-glibc/work/intel_corei7_64-refkit-linux/refkit-image-common/1.0-r0/recipe-sysroot-native/usr/bin/qemu-system-x86_64 -device virtio-net-pci,netdev=net0,mac=52:54:00:12:35:02 -netdev user,id=net0,hostfwd=tcp::2222-:22,hostfwd=tcp::2323-:23 -drive if=virtio,file=${BUILD_DIR}/tmp-glibc/deploy/images/intel-corei7-64/refkit-image-common-intel-corei7-64.wic,format=raw -no-reboot -vga vmware -show-cursor -usb -usbdevice tablet -device virtio-rng-pci -drive if=pflash,format=qcow2,file=${BUILD_DIR}/tmp-glibc/deploy/images/intel-corei7-64/ovmf.qcow2 -vga std   -cpu Nehalem -m 256 -serial mon:vc -serial null</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72378</commentid>
    <comment_count>12</comment_count>
    <who name="Mikko Ylinen">mikko.ylinen</who>
    <bug_when>2017-04-12 09:45:20 +0000</bug_when>
    <thetext>Dima, I think this is working fine but in order to close the bug we&apos;d still need a short howto doc to explain how to use it. Can you write a short doc explaining how to run the images using runqemu.

Simo is looking a simple &apos;test case&apos; for this.</thetext>
  </long_desc><long_desc isprivate="0" >
    <commentid>72434</commentid>
    <comment_count>13</comment_count>
    <who name="Dmitry Rozhkov">dmitry.rojkov</who>
    <bug_when>2017-04-13 06:08:16 +0000</bug_when>
    <thetext>HOWTO added in https://github.com/intel/intel-iot-refkit/pull/115</thetext>
  </long_desc>
      
      

    </bug>

</bugzilla>