29 Dec 2013

Using OE/Yocto to create VMs

By default most OE builds will create a filesystem image, a kernel, and (perhaps) a bundle of kernel modules. This set of outputs makes it easy if you're looking to flash your build into real hardware or run it in emulation via qemu (i.e. runqemu). But what if you're looking to run your image in a virtual machine?

To run an image in a virtual machine you'll need a virtual disk image which contains a partition map and a bootloader. Fortunately OE provides support for generating one such type of virtual disk image: the vmdk.

Configure OE to Generate a VMDK

 

In order to get OE to generate a vmdk artifact simply edit your conf/local.conf to add vmdk to IMAGE_FSTYPES. Unfortunately, due to the way in which variables are handled in bitbake, it isn't possible to use the _append operator, only the += operator can be used:
IMAGE_FSTYPES += vmdk
Now when you perform a successful OE build, a vmdk will appear in your deploy/images folder.

Running a VMDK in a Virtual Machine

 

In order to run a vmdk in a virtual machine such as VirtualBox simply run through VirtualBox's "add a new machine" wizard. When it asks you about the disk, tell it you already have a disk, and select the vmdk generated by your OE build.

Unfortunately by default the VirtualBox wizard will add your disk under the SATA controller:



You'll need to switch it to be connected to the IDE controller:



Notes:

  • currently OE is only able to generate vmdk's for x86 machines since the current procedure requires syslinux (which only runs on x86 machines)
  • it is also possible to use runqemu to run a vmdk
  • my MACHINE setting for this example is "qemux86", and I'm building distroless

4 Dec 2013

Video Screen Captures in VirtualBox

A couple weeks ago, Oracle released VirtualBox 4.3.x and with it the ability to take video captures of whatever is going on in a VM! It has always been possible to take screen shots of whatever is going on in a VM, but taking videos is something new.

If you look at the Display options of the Settings panel, you'll notice a new tab entitled Video Capture.



From this panel you can modify various parameters related to the capture, and you can toggle the capture on and off. You can also toggle the video capture from the buttons at the bottom-right corner of a non-full-screened VM, or via the Devices menu for a VM that is full-screened.

Here's a video I shot of a *.vmdk image I created using Yocto (core-image-minimal) booting up: