Virtual Guru's Blog – Home of Virtualization Workshops

October 15, 2010

12minutes: Chromium OS FAQ: Evaluating in Virtualization QEMU/KVM, VMware and Virtualbox

Filed under: 12minutes, best_practices, ChromeOS — Tags: , — natiku @ 4:13 pm

12 Minutes: Chromium OS Procedure for creating virtual images change recently, so here is my steps:

Last Updated for: 0.9.85 2010/10/16 1739

Chromium OS use embedded design with focus on small amount of platforms – boards.
If you don’t have compatible with Chromium OS , Virtualization can be a vital alternative.
Chromium OS is for a 32bit OS so you can probalyl run it OK on wide range of Virtualization platforms.

Many evaluators are surprised them Virtualization Tools from concrete platform can’t be installed on Chromium OS due to embedded design with Read-Only Root approach.

1. Virtual Images are now created inside of chroot

whoami
 chronocb

cd ~/chromiumos/src/scripts/

repo sync

 ./image_to_vm.sh --help
  This script must be run inside the chroot. Run this first:
    /buildarea/chromiumos/src/scripts/enter_chroot.sh

(cros-chroot)$ ./image_to_vm.sh --help
USAGE: ./image_to_vm.sh [flags] args
flags:
  --board:  Board for which the image was built (default: 'x86-generic')
  --[no]factory:  Modify the image for manufacturing testing (default: false)
  --[no]factory_install:  Modify the image for factory install shim (default: false)
  --[no]force_copy:  Always rebuild test image (default: false)
  --format:  Output format, either qemu, vmware or virtualbox (default: 'qemu')
  --from:  Directory containing rootfs.image and mbr.image (default: '')
  --[no]full:  Build full image with all partitions. (default: false)
  --[no]make_vmx:  Create a vmx file for use with vmplayer (vmware only). (default: true)
  --mem:  Memory size for the vm config in MBs (vmware only). (default: 1024)
  --rootfs_partition_size:  rootfs parition size in MBs. (default: 1024)
  --state_image:  Stateful partition image (defaults to creating new statful partition) (default: '')
  --statefulfs_size:  Stateful partition size in MBs. (default: -1)
  --[no]test_image:  Copies normal image to chromiumos_test_image.bin, modifies it for test. (default: false)
  --to:  Destination folder for VM output file(s) (default: '')
  --vbox_disk:  Filename for the output disk (virtualbox only). (default: 'os.vdi')
  --vdisk_size:  virtual disk size in MBs. (default: 3072)
  --vmdk:  Filename for the vmware disk image (vmware only). (default: 'ide.vmdk')
  --vmx:  Filename for the vmware config (vmware only). (default: 'chromiumos.vmx')
  -h,--[no]help:  show this help (default: false)

Creating Virtual Image for QEMU/KVM

PS: Because QEMU/KVM and XEN in HVM mode share most code, you will be probably able to run in XEN in HVM mode too.

(cros-chroot)$ ./image_to_vm.sh --format qemu --board=x86-generic 
+ dd if=/home/chronocb/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/chromiumos_image.bin 
   of=part_1 bs=512 skip=1527808 count=2097152
...
...
...
Creating final image
Created image at /home/chronocb/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1
If you have qemu-kvm installed, you can start the image by:
sudo kvm -m 1024 -vga std -pidfile /tmp/kvm.pid -net nic,model=e1000  -net user,hostfwd=tcp::922-:22 \
        -hda /home/chronocb/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/chromiumos_qemu_image.bin

(cros-chroot)$ ls -l -h ~/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/chromiumos_qemu_image.bin
-rw-r--r-- 1 chronocb eng 3.0G Oct 16 18:41 ~/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/chromiumos_qemu_image.bin

PS: Image is in sparse format

(cros-chroot)$ du -h  ~/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/chromiumos_qemu_image.bin
1.8G	 ~/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/chromiumos_qemu_image.bin

mv ~/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/chromiumos_qemu_image.bin \
  ~/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/chromiumos_qemu_0-9-85.bin

PS: Reported image path is correct only inside chroot, correct host path is:
/home/chronocb/chromiumos/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/chromiumos_qemu_image.bin

Running Virtual Image in QEMU/KVM on Fedora 13

Running it on Quad-Core AMD machine with 4Gb am on Fedora 13 64bit in qemu-kvm 12.5 

sudo qemu-kvm -m 1024 -vga std -pidfile /tmp/kvm.pid -daemonize -net nic,model=e1000 -net user,hostfwd=tcp::922-:22 \
   -usbdevice tablet -hda ~/chromiumostest/chromiumos_qemu_0.9.85.bin 

Status OK: Start OK, X OK, Net OK, Login OK
– Graphics is un-accelerated and mouse is not ideal even with suggested -usbdevice tablet fix.
– Slow GUI responses to mouse and keyboard

Creating Virtual Image for VMware

Checking for needed qemu-img tool for conversion into VMware vmdk disk format

In chroot is installed qemu-usr, but there is not needed qemu-img tool.
qemu package is old, we need to emerge qemu-kvm one.

(cros-chroot)$ which qemu-img
 which: no qemu-img in (/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/i686-pc-linux-gnu/gcc-bin/4.4.3
  :/usr/x86_64-pc-linux-gnu/gcc-bin/4.3.4:/home/chronocb/depot_tools)

(cros-chroot)$ sudo emerge -sq qemu
  Searching...    
  [ Results for search key : qemu ]
  [ Applications found : 5 ]

  *  app-emulation/kqemu
  *  app-emulation/qemu
  *  app-emulation/qemu-kvm
  *  app-emulation/qemu-softmmu
  *  app-emulation/qemu-user

(cros-chroot)$ sudo emerge -s qemu
Searching...    
  [ Results for search key : qemu ]
  [ Applications found : 5 ]

*  app-emulation/qemu
      Latest version available: 0.9.1
      Latest version installed: [ Not Installed ]
      Description:   qemu emulator and abi wrapper meta ebuild

*  app-emulation/qemu-kvm
      Latest version available: 0.12.5
      Latest version installed: 0.12.5
      Description:   QEMU + Kernel-based Virtual Machine userland tools

*  app-emulation/qemu-softmmu
      Latest version available: 0.10.1
      Latest version installed: [ Not Installed ]
      Description:   Open source processor emulator

*  app-emulation/qemu-user
      Latest version available: 0.13.0_rc0
      Latest version installed: 0.13.0_rc0
      Description:   Open source dynamic translator

Note: To get latest qemu-img version 12.5  with VMDK and VDI support you can install app-emulation/qemu-kvm , 
but there will be (for now) harmless soft warnings about missing KVM kernel module support.  
Alternatively you can install app-emulation/qemu-softmmu , to get sufficient  qemu-img version 10.1  with just VMDK support.

- Variant 1: qemu-kvm 

(cros-chroot)$ sudo emerge -av app-emulation/qemu-kvm 

  These are the packages that would be merged, in order:
  Calculating dependencies... done!
  [ebuild  N    ] dev-libs/libaio-0.3.107  51 kB [0]
  [ebuild  N    ] media-libs/audiofile-0.2.6-r4  371 kB [0]
  [ebuild  N    ] media-libs/libsdl-1.2.13-r1  USE="X audio joystick video -aalib -alsa -custom-cflags -dga -directfb -esd -fbcon -ggi -libcaca -nas -opengl 
                 -oss -pulseaudio (-svga) -tslib -xinerama -xv" 3,295 kB [0]
  [ebuild  N    ] app-emulation/qemu-kvm-0.12.5  USE="aio hardened ncurses sdl -alsa -bluetooth -curl -esd -fdt -gnutls -kvm-trace -pulseaudio 
                 -qemu-ifup -sasl -static -vde" QEMU_SOFTMMU_TARGETS="arm i386 x86_64" 0 kB [1]

  Total: 4 packages (4 new), Size of downloads: 3,716 kB
   Portage tree and overlays:
    [0] /usr/portage
   [1] /usr/local/portage/chromiumos

   Would you like to merge these packages? [Yes/No] yes

 * Messages for package app-emulation/qemu-kvm-0.12.5:

 * Unable to find kernel sources at /usr/src/linux
 * Unable to calculate Linux Kernel version for build, attempting to use running version
 * Unable to check your kernel for KVM support
 * If you don't have kvm compiled into the kernel, make sure you have
 * the kernel module loaded before running kvm. The easiest way to
 * ensure that the kernel module is loaded is to load it on boot.
 * For AMD CPUs the module is called 'kvm-amd'
 * For Intel CPUs the module is called 'kvm-intel'
 * Please review /etc/conf.d/modules for how to load these

- Check qemu-img version

(cros-chroot)$ which qemu-img
  /usr/bin/qemu-img

(cros-chroot)$ qemu-img --version
  qemu-img version 0.12.5, Copyright (c) 2004-2008 Fabrice Bellard

 Supported formats: cow qcow vdi vmdk cloop dmg bochs vpc vvfat qcow2 parallels nbd host_cdrom host_floppy host_device raw

- Variant 2: qemu-softmmu

(cros-chroot)$ sudo emerge -av app-emulation/qemu-softmmu
sudo emerge -av app-emulation/qemu-softmmu

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N    ] dev-libs/libaio-0.3.107  51 kB [0]
[ebuild  N    ] media-libs/audiofile-0.2.6-r4  371 kB [0]
[ebuild  N    ] media-libs/libsdl-1.2.13-r1  USE="X audio joystick video -aalib -alsa -custom-cflags -dga -directfb -esd -fbcon -ggi -libcaca -nas -opengl 
                 -oss -pulseaudio (-svga) -tslib -xinerama -xv" 3,295 kB [0]
[ebuild  N    ] app-emulation/qemu-softmmu-0.10.1  USE="ncurses sdl -alsa -esd -gnutls -kqemu -kvm -pulseaudio -vde" 3,573 kB

Total: 1 package (1 new), Size of downloads: 3,573 kB

Would you like to merge these packages? [Yes/No] yes

>>> Emerging (1 of 1) app-emulation/qemu-softmmu-0.10.1
>>> Downloading 'http://build.chromium.org/mirror/chromiumos/mirror/distfiles/qemu-0.10.1.tar.gz'
--2010-10-19 12:51:33--  http://build.chromium.org/mirror/chromiumos/mirror/distfiles/qemu-0.10.1.tar.gz

...

 * Messages for package app-emulation/qemu-softmmu-0.10.1:

- Check qemu-img version

(cros-chroot)$ which qemu-img
  /usr/bin/qemu-img

(cros-chroot)$ qemu-img --version
  qemu-img version 0.10.1, Copyright (c) 2004-2008 Fabrice Bellard
  ....
  Supported formats: nbd parallels qcow2 vvfat vpc bochs dmg cloop vmdk qcow cow host_device raw

Generating Virtual Image for VMware

I will generate mean full manes, so I can have on my Virtualization HOST more versions.

(cros-chroot)$ ls -l ../build/images/x86-generic/latest
lrwxrwxrwx 1 chronocb eng 25 Oct 16 18:12 ../build/images/x86-generic/latest -> 0.9.85.2010_10_16_1739-a1

(cros-chroot)$ ./image_to_vm.sh --from=../build/images/x86-generic/latest/ --board=x86-generic --make_vmx --format vmware \
 --vmdk  chromiumos_vmware_0-9-85.vmdk --vmx chromiumos_vmware_0-9-85.vmx

+ dd if=/home/chronocb/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/chromiumos_image.bin of=part_1 bs=512 skip=1527808 count=2097152
...
...
...
Creating final image
Created image at /home/chronocb/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1
Wrote the following config to: /home/chronocb/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/chromiumos_vmware_0-9-85.vmx
#!/usr/bin/vmware
.encoding = "UTF-8"
config.version = "8"
virtualHW.version = "4"
memsize = "1024"
ide0:0.present = "TRUE"
ide0:0.fileName = "ide.vmdk"
ethernet0.present = "TRUE"
usb.present = "TRUE"
sound.present = "TRUE"
sound.virtualDev = "es1371"
displayName = "Chromium OS"
guestOS = "otherlinux"
ethernet0.addressType = "generated"
floppy0.present = "FALSE"

(cros-chroot)$  ls -l -h /home/chronocb/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/chromiumos_vmware_0-9-85.vmdk
-rw-r--r-- 1 chronocb eng 692M Oct 16 19:00 /home/chronocb/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/chromiumos_vmware_0-9-85.vmdk

Running Virtual Image in VMware Player on Fedora 13

Running it on Quad-Core AMD machine with 4GB am on Fedora 13 64bit in Vmware Player 3.1.2

Starting vmplayer and opening chromiumos_vmware_0-9-85.vmx

Status FAIL: Start OK, X OK, Net FAIL = No Ethernet

Reason is then VMware is selecting e1000 by default only for 64bit guests, so I need to add manually to chromiumos.vmx line ethernet0.virtualDev = "e1000"

Reported as: 7854 Need to add line 'ethernet0.virtualDev = "e1000"' to vmware config to get network ?

Starting vmplayer and opening updated chromiumos_vmware_0-9-85.vmx with e1000 line.

Status OK: Start OK, X OK, Net OK, Login OK
- Graphics is accelerated with vmware module - checked in log.
- Faster GUI responses to mouse and keyboard then in KVM

Creating Virtual Image for VirtualBox

Note: Latest VrtualBox 3.2.x have full support for Vmware vmdk format and technically you don't need to generate a vdi format. If you want to generate VirtualBox VDI native format you can or use a VBoxManage for VirtualBox installation or latest qemu-img with VDI support, see more about this option in Alternative 1 bellow.

Checking for needed VBoxManage tool for conversion into VirtualBox vdi disk format

(cros-chroot)$ which VBoxManage 
  which: no VBoxManage in (/usr/local/bin:/usr/bin:/bin:/opt/bin:/usr/x86_64-pc-linux-gnu/i686-pc-linux-gnu/gcc-bin/4.4.3
 :/usr/x86_64-pc-linux-gnu/gcc-bin/4.3.4:/home/chronocb/depot_tools)

(cros-chroot)$ sudo emerge -sq virtualbox
  Searching...    
  [ Results for search key : virtualbox ]
  [ Applications found : 7 ]

  *  app-emulation/virtualbox-bin [ Masked ]
  *  app-emulation/virtualbox-guest-additions
  *  app-emulation/virtualbox-modules
  *  app-emulation/virtualbox-ose
  *  app-emulation/virtualbox-ose-additions [ Masked ]
  *  x11-drivers/xf86-input-virtualbox
  *  x11-drivers/xf86-video-virtualbox

(cros-chroot)$ sudo emerge -s virtualbox-bin

*  app-emulation/virtualbox-bin [ Masked ]
      Latest version available: 3.1.4-r1
      Description:   Family of powerful x86 virtualization products for enterprise as well as home use
      License:       PUEL

PS: It's old , on http://gentoo-portage.com/app-emulation/virtualbox-bin  3.1.8 and masked latest 3.2.10

(cros-chroot)$ sudo emerge -s virtualbox-ose

*  app-emulation/virtualbox-ose
      Latest version available: 3.0.12
      Description:   Software family of powerful x86 virtualization

PS: It's old , on http://gentoo-portage.com/app-emulation/virtualbox-oes  is 3.1.8 and masked latest version 3.2.10

sudo ACCEPT_LICENSE="PUEL" emerge -p app-emulation/virtualbox-ose

These are the packages that would be merged, in order:

Calculating dependencies... done!
[ebuild  N    ] sys-devel/bin86-0.16.17 
[ebuild IN    ] app-emulation/virtualbox-ose-additions-3.0.12 
[ebuild  N    ] sys-apps/dmidecode-2.10 
[ebuild  N    ] sys-apps/eject-2.1.5-r2  USE="nls" 
[ebuild  N    ] x11-libs/qt-core-4.6.2-r1  USE="exceptions glib iconv ssl (-aqua) -debug -doc -optimized-qmake -pch -qt3support" 
[ebuild  N    ] virtual/opengl-7.0 
[ebuild  N    ] sys-power/iasl-20090123  USE="-test" 
[ebuild  N    ] dev-lang/yasm-0.8.0  USE="nls" 
[ebuild  N    ] app-emulation/virtualbox-modules-3.0.12 
[ebuild  N    ] sys-devel/dev86-0.16.17-r6 
[ebuild  N    ] sys-libs/libcap-2.17  USE="pam" 
[ebuild  N    ] dev-util/cvs-1.12.12-r6  USE="crypt nls pam -doc -kerberos -server" 
[ebuild  N    ] x11-proto/fontsproto-2.1.0 
[ebuild  N    ] sys-fs/lvm2-2.02.56-r2  USE="lvm1 readline static (-clvm) (-cman) (-selinux)" 
[ebuild  N    ] dev-libs/libusb-0.1.12-r6  USE="-debug -doc -nocxx" 
[ebuild  N    ] virtual/eject-0 
[ebuild  N    ] virtual/glu-7.0 
[ebuild  N    ] virtual/libusb-0 
[ebuild  N    ] dev-util/kbuild-0.1.5-r1 
[ebuild  N    ] sys-fs/cryptsetup-1.0.6-r2  USE="nls -dynamic (-selinux)" 
[ebuild  N    ] x11-libs/qt-script-4.6.2  USE="exceptions iconv (-aqua) -debug -pch" 
[ebuild  N    ] x11-libs/libXfont-1.4.1  USE="ipv6 -debug" 
[ebuild  N    ] media-libs/freeglut-2.4.0-r1 
[ebuild  N    ] x11-libs/qt-gui-4.6.2  USE="accessibility exceptions glib (-aqua) -cups -dbus -debug -gtk -mng -nas -nis -pch -qt3support -raster -tiff -xinerama" 
[ebuild  N    ] sys-apps/usbutils-0.86-r1  USE="zlib -network-cron" 
[ebuild  N    ] virtual/glut-1.0 
[ebuild  N    ] sys-apps/hal-0.5.13-r2  USE="crypt -X -acpi -apm -consolekit -debug -dell -disk-partition -doc -laptop -policykit (-selinux)" 
[ebuild  N    ] app-misc/hal-info-20090716 
[ebuild  N    ] app-emulation/virtualbox-ose-3.0.12  USE="additions hal opengl python qt4 -alsa -headless -pulseaudio -sdk -vboxwebsrv" 

Hmm, I am lazy to compile so many packages so I will emerge virtualbox-ose, but virtualbox-bin depend on virtualbox-modules package, which can't be build in chroot, so I force just installation of virtualbox-bin itself.

(cros-chroot)$ sudo ACCEPT_LICENSE="PUEL" emerge -kpO virtualbox-bin

These are the packages that would be merged, in order:

... done!
[ebuild IN ] app-emulation/virtualbox-bin-3.0.12 USE="additions chm python -headless -sdk -vboxwebsrv"

(cros-chroot)$ sudo ACCEPT_LICENSE="PUEL" emerge -O virtualbox-bin

>>> Emerging (1 of 1) app-emulation/virtualbox-bin-3.0.12
>> Installing (1 of 1) app-emulation/virtualbox-bin-3.0.12

(cros-chroot)$  ./image_to_vm.sh --format virtualbox --board=x86-generic \
   --vbox_disk chromiumos_vbox_0-9-85.vdi

 + dd if=/home/chronocb/trunk/src/build/images/x86-generic/0.9.79.2010_10_13_1423-a1/chromiumos_image.bin \
      of=part_1 bs=512 skip=1527808 count=2097152
....
Creating final image
./image_to_vm.sh: line 238: /opt/bin/VBoxManage: Permission denied

(cros-chroot)$ ls -l /opt/bin/VBoxManage
  lrwxrwxrwx 1 root root 23 Oct 15 19:44 /opt/bin/VBoxManage -> /opt/VirtualBox/VBox.sh
(cros-chroot)$ ls -l /opt/VirtualBox/VBox.sh
-rwxr-x--- 1 root root 2931 Oct 15 19:44 /opt/VirtualBox/VBox.sh

Adding "sudo" before VBoxManage line in  ./image_to_vm.sh script and rerunning script

(cros-chroot)$ ./image_to_vm.sh --format virtualbox --board=x86-generic \
   --vbox_disk chromiumos_vbox_0-9-85.vdi

+ dd if=/home/chronocb/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/chromiumos_image.bin of=part_1 bs=512 skip=1527808 count=2097152
 ...
 ...
 ...
Creating final image
VirtualBox Command Line Management Interface Version 3.0.12
(C) 2005-2009 Sun Microsystems, Inc.
All rights reserved.

Converting from raw image file="/home/chronocb/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/vm_temp_image.bin" to file="/home/chronocb/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/os.vdi"...
Creating dynamic image with size 3221225472 bytes (3072MB)...
Created image at /home/chronocb/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1

(cros-chroot)$ ls -l -h ~/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/os.vdi
-rw------- 1 root root 779M Oct 16 20:43 ~/trunk/src/build/images/x86-generic/0.9.85.2010_10_16_1739-a1/os.vdi

- Uninstall virtualbox-bin or chroot will be poisoned:

(cros-chroot)$ sudo  emerge --unmerge virtualbox-bin
Started app-emulation/virtualbox-modules-3.0.12 (logged in /tmp/virtualbox-modules-3.0.12-Dgz64G)
=== Start output for job virtualbox-modules-3.0.12 (0m5.0s) ===
virtualbox-modules-3.0.12: >>> Emerging (1 of 1) app-emulation/virtualbox-modules-3.0.12
virtualbox-modules-3.0.12: * vbox-kernel-module-src-3.0.12.tar.bz2 RMD160 SHA1 SHA256 size ;-) ... [ ok ]
virtualbox-modules-3.0.12: * CPV: app-emulation/virtualbox-modules-3.0.12
virtualbox-modules-3.0.12: * REPO: gentoo
virtualbox-modules-3.0.12: * USE: amd64 elibc_glibc kernel_linux multilib userland_GNU
virtualbox-modules-3.0.12: * Determining the location of the kernel source code
virtualbox-modules-3.0.12: * Found kernel source directory:
virtualbox-modules-3.0.12: * /usr/src/linux
virtualbox-modules-3.0.12: * Found sources for kernel version:
virtualbox-modules-3.0.12: * 2.6.31-gentoo-r6
virtualbox-modules-3.0.12: * Could not find a usable .config in the kernel source directory.
virtualbox-modules-3.0.12: * Please ensure that /usr/src/linux points to a configured set of Linux sources.
virtualbox-modules-3.0.12: * If you are using KBUILD_OUTPUT, please set the environment var so that
virtualbox-modules-3.0.12: * it points to the necessary object directory so that it might find .config.
virtualbox-modules-3.0.12: * ERROR: app-emulation/virtualbox-modules-3.0.12 failed:
virtualbox-modules-3.0.12: * Kernel not configured; no .config found in /usr/src/linux
virtualbox-modules-3.0.12: *
virtualbox-modules-3.0.12: * Call stack:
virtualbox-modules-3.0.12: * ebuild.sh, line 54: Called pkg_setup
virtualbox-modules-3.0.12: * virtualbox-modules-3.0.12.ebuild, line 31: Called linux-mod_pkg_setup
virtualbox-modules-3.0.12: * linux-mod.eclass, line 586: Called require_configured_kernel
virtualbox-modules-3.0.12: * linux-info.eclass, line 275: Called die
virtualbox-modules-3.0.12: * The specific snippet of code:
virtualbox-modules-3.0.12: * die "Kernel not configured; no .config found in ${KV_OUT_DIR}"
virtualbox-modules-3.0.12: *
virtualbox-modules-3.0.12: * If you need support, post the output of 'emerge --info =app-emulation/virtualbox-modules-3.0.12',
virtualbox-modules-3.0.12: * the complete build log and the output of 'emerge -pqv =app-emulation/virtualbox-modules-3.0.12'.
virtualbox-modules-3.0.12: * The complete build log is located at '/var/tmp/portage/app-emulation/virtualbox-modules-3.0.12/temp/build.log'.
virtualbox-modules-3.0.12: * The ebuild environment file is located at '/var/tmp/portage/app-emulation/virtualbox-modules-3.0.12/temp/die.env'.
virtualbox-modules-3.0.12: * S: '/var/tmp/portage/app-emulation/virtualbox-modules-3.0.12/work'
virtualbox-modules-3.0.12: >>> Failed to emerge app-emulation/virtualbox-modules-3.0.12, Log file:
virtualbox-modules-3.0.12: >>> '/var/tmp/portage/app-emulation/virtualbox-modules-3.0.12/temp/build.log'
virtualbox-modules-3.0.12:
virtualbox-modules-3.0.12: * Messages for package app-emulation/virtualbox-modules-3.0.12:
virtualbox-modules-3.0.12:
virtualbox-modules-3.0.12: * Could not find a usable .config in the kernel source directory.
virtualbox-modules-3.0.12: * Please ensure that /usr/src/linux points to a configured set of Linux sources.
virtualbox-modules-3.0.12: * If you are using KBUILD_OUTPUT, please set the environment var so that
virtualbox-modules-3.0.12: * it points to the necessary object directory so that it might find .config.
virtualbox-modules-3.0.12: * ERROR: app-emulation/virtualbox-modules-3.0.12 failed:
virtualbox-modules-3.0.12: * Kernel not configured; no .config found in /usr/src/linux
virtualbox-modules-3.0.12: *
virtualbox-modules-3.0.12: * Call stack:
virtualbox-modules-3.0.12: * ebuild.sh, line 54: Called pkg_setup
virtualbox-modules-3.0.12: * virtualbox-modules-3.0.12.ebuild, line 31: Called linux-mod_pkg_setup
virtualbox-modules-3.0.12: * linux-mod.eclass, line 586: Called require_configured_kernel
virtualbox-modules-3.0.12: * linux-info.eclass, line 275: Called die
virtualbox-modules-3.0.12: * The specific snippet of code:
virtualbox-modules-3.0.12: * die "Kernel not configured; no .config found in ${KV_OUT_DIR}"
virtualbox-modules-3.0.12: *
virtualbox-modules-3.0.12: * If you need support, post the output of 'emerge --info =app-emulation/virtualbox-modules-3.0.12',
virtualbox-modules-3.0.12: * the complete build log and the output of 'emerge -pqv =app-emulation/virtualbox-modules-3.0.12'.
virtualbox-modules-3.0.12: * The complete build log is located at '/var/tmp/portage/app-emulation/virtualbox-modules-3.0.12/temp/build.log'.
virtualbox-modules-3.0.12: * The ebuild environment file is located at '/var/tmp/portage/app-emulation/virtualbox-modules-3.0.12/temp/die.env'.
virtualbox-modules-3.0.12: * S: '/var/tmp/portage/app-emulation/virtualbox-modules-3.0.12/work'
=== Complete: job virtualbox-modules-3.0.12 (0m5.0s) ===
Failed app-emulation/virtualbox-modules-3.0.12 (in 0m5.0s). Your build has failed.
app-emulation/virtualbox-modules-3.0.12: (merge) needs
    no dependencies
Packages failed: app-emulation/virtualbox-modules-3.0.12

Running Virtual Image in VirtualBox on Ferora 13

Running it on Quad-Core AMD machine with 4GB am on Fedora 13 64bit  in VirtualBox 3.2.10

FAIL: X didn't come up, but I see login prompt on Alt-F2 and logging on Alt-F8.

In /var/log/Xorg.0.log is message "Couldn't open module vboxvideo"

Reported as: 7853 VirtualBox 3.2.10 show back screen, in Xlog is "Couldn't open module vboxvideo"

Alternative 1: Use a separate qemu-img tool with VMDK and VDI support

- There is allready long time support for VDI in qemu-img natively (with sources from Virtualbox OSE),
latests QEMU versions have this support build in and they can even boot from VDI (refer also to my VirtGuru xperiments):

qemu-img vdi support

- Some Linux disttributions like Fedora 13 already create for qemu-img separate package after QEMU-KVM merge.

yum search qemu-img
Loaded plugins: presto, refresh-packagekit
qemu-img.x86_64 : QEMU command line tool for manipulating disk images

sudo yum install qemu-img
[sudo] password for ruda: 
Loaded plugins: presto, refresh-packagekit
Setting up Install Process
Resolving Dependencies
--> Running transaction check
---> Package qemu-img.x86_64 2:0.12.5-1.fc13 set to be installed
--> Finished Dependency Resolution

Total download size: 146 k
Installed size: 470 k

qemu-img -?
  qemu-img version 0.12.5, Copyright (c) 2004-2008 Fabrice Bellard
  Supported formats: cow qcow vdi vmdk cloop dmg bochs vpc vvfat qcow2 parallels nbd host_cdrom host_floppy host_device raw

which qemu-img
   /usr/bin/qemu-img

ldd /usr/bin/qemu-img
	linux-vdso.so.1 =>  (0x00007fffafdff000)
	librt.so.1 => /lib64/librt.so.1 (0x0000003722200000)
	libpthread.so.0 => /lib64/libpthread.so.0 (0x0000003721200000)
	libaio.so.1 => /lib64/libaio.so.1 (0x0000003b24200000)
	libz.so.1 => /lib64/libz.so.1 (0x0000003721e00000)
	libc.so.6 => /lib64/libc.so.6 (0x0000003720e00000)
	/lib64/ld-linux-x86-64.so.2 (0x0000003720a00000)

- Looking, if qemu-kvm don't have parameter do disable KVM module.

equery --nocolor uses =qemu-kvm-0.12.5 -a
[ Legend : U - flag is set in make.conf       ]
[        : I - package is installed with flag ]
[ Colors : set, unset                         ]
 * Found these USE flags for app-emulation/qemu-kvm-0.12.5:
 U I
 - + aio                         : 
 - - alsa                        : Adds support for media-libs/alsa-lib (Advanced Linux Sound Architecture)
 - - bluetooth                   : Enables Bluetooth Support
 - - curl                        : Adds support for client-side URL transfer library
 - - esd                         : Adds support for media-sound/esound (Enlightened Sound Daemon)
 - - fdt                         : 
 - - gnutls                      : Adds support for net-libs/gnutls (TLS 1.0 and SSL 3.0 support)
 + + hardened                    : activate default security enhancements for toolchain (gcc, glibc, binutils)
 - - kvm-trace                   : 
 + + ncurses                     : Adds ncurses support (console display library)
 - - pulseaudio                  : Adds support for PulseAudio sound server
 - - qemu-ifup                   : 
 - + qemu_softmmu_targets_arm    : system emulation target
 - + qemu_softmmu_targets_i386   : system emulation target
 - + qemu_softmmu_targets_x86_64 : system emulation target
 - - sasl                        : Adds support for the Simple Authentication and Security Layer
 - + sdl                         : Adds support for Simple Direct Layer (media library)
 - - static                      : !!do not set this during bootstrap!! Causes binaries to be statically linked instead of dynamically
 - - vde                         : 

- Generating VDI image with latest qemu-img vdi support


Change VboxManage line to qemu-img one

cat ./image_to_vm.sh | grep VBox
      VBoxManage convertdd "${TEMP_IMG}" "${FLAGS_to}/${FLAGS_vbox_disk}"

cat ./image_to_vm.sh | grep vbox
      qemu-img convert -f raw "${TEMP_IMG}" -O vdi "${FLAGS_to}/${FLAGS_vbox_disk}"
#    VBoxManage convertdd "${TEMP_IMG}" "${FLAGS_to}/${FLAGS_vbox_disk}"

./image_to_vm.sh --format virtualbox --board=x86-generic \
   --vbox_disk chromiumos_vbox_0-9-85.vdi

Image created OK

Reported as: 8410 Create a separate qemu-img package with VMDk and VDI support and install in chroot

Alternative 2: Use a separate VMDK descriptor with FLAT type generated from shell script

cat qemu-flat.vmdk 
# Disk DescriptorFile
version=1
CID=2e43c060
parentCID=ffffffff
isNativeSnapshot="no"
createType="monolithicFlat"

# Extent description
RW 6291456 FLAT "chromiumos_qemu_image.bin" 0

# The Disk Data Base 
#DDB

ddb.longContentID = "169695e3872047f0dbabd5382e43c060"
ddb.encoding = "UTF-8"
ddb.geometry.cylinders = "6241"
ddb.geometry.heads = "16"
ddb.geometry.sectors = "63"
ddb.adapterType = "ide"

qemu-flat.vmdk boots in VMvare 3.1.2 OK
qemu-flat.vmdk boots in VirtualBox 3.2.10 OK

Maths is very simple:

In image_to_vm.sh is

DEFINE_integer vdisk_size 3072 \
"virtual disk size in MBs."

RW 6291456 FLAT "chromiumos_qemu_image.bin" 0

6291456 = 3072*1024*2

ddb.geometry.cylinders = "6241"
ddb.geometry.heads = "16"
ddb.geometry.sectors = "63"

Logical CHS to LBA Translation

LBA is a newer and better way of addressing the individual sectors on a hard drive. However, some older software, such as DOS, only knows how to use CHS addressing. So when a hard drive is addressed using LBA, L-CHS to LBA translation is also made available, to permit backward compatibility.

- The L-CHS created for an LBA drive should always use 63 Sectors.
- Depending on how large the drive is, 16, 32, 64, 128, or 255 Heads will be used. (See above for why 255 heads should be used instead of 256 heads.)
- The number of Cylinders is then calculated as the drive capacity divided by 63, divided again by the number of heads (rounded down to a whole number).

So L-CHS is 63x16x6241
echo 'scale=10;after63=6291456/63;scale=0;after63/16' | bc
6241

Hint: there is BC already in CHROOT

Note: For drives larger then 8GB we can simple return 1023,254,63 = ((1024 * 63) * 256) * 512 = 8,455,716,864 bytes (about 8.4 GB)

Reported as 7861 Switch to flat VMDK format with descriptor file to remove dependency on qemu-img,VboxManage

1 Comment »

  1. Thank you so much for this. That’s an incredible amount of work, which I found to be invaluable.

    Comment by midfingr — January 16, 2011 @ 10:24 pm


RSS feed for comments on this post.

Leave a comment

Blog at WordPress.com.