Making VirtualBox disk image, vdi, for Chrome OS

There are a few problems rises if you try to build and make images to deploy by following a guideline at this page. Then, this Chromium OS Developer Guide page will help to solve those problems.

However, those documents and actually tools are created for making a USB memory image for installation. But problem is that you can’t boot from a USB memory image into a VM of VirtualBox.

The image_to_vm.sh shell script was written for old version of VirtualBox.

So, this portion of script will fail.

echo Creating final image
# Convert image to output format
if [ "${FLAGS_format}" = "virtualbox" -o "${FLAGS_format}" = "qemu" ]; then
  if [ "${FLAGS_format}" = "virtualbox" ]; then
    sudo VBoxManage convertdd "${TEMP_IMG}" "${FLAGS_to}/${FLAGS_vbox_disk}"
  else
    mv ${TEMP_IMG} ${FLAGS_to}/${DEFAULT_QEMU_IMAGE} // for QEMU
  fi
elif [ "${FLAGS_format}" = "vmware" ]; then
  qemu-img convert -f raw "${TEMP_IMG}" \
    -O vmdk "${FLAGS_to}/${FLAGS_vmdk}"
else
  die_notrace "Invalid format: ${FLAGS_format}"
fi

But VirualBox’s utility program, VBoxManage doesn’t have convertedd. The new command which replaces that is convertfromraw. But either VirtualBox documentation or QEMU documentation doesn’t mention if the “raw” format is same to QEMU format.
However, fortunately, they are the same. So, you can just use this command format.

VBoxManage convertfromraw <filename> <outputfile>
[–format VDI|VMDK|VHD]
[–variant Standard,Fixed,Split2G,Stream,ESX]
[–uuid ]

So, you can issue

VBoxManage convertfromraw vm_temp_image.bin chrome_os_vbox.vdi

As you can see from the line for QEMU, you can see that ${TEMP_IMG} is in the format of QEMU. Each environment variable is set like as follows on my HDD.

TEMP_IMG : /home/jongampark/trunk/src/build/images/x86-generic/R25-3407.0.2012_12_25_1922-a1/vm_temp_image.bin
FLAGS_to : /home/jongampark/trunk/src/build/images/x86-generic/R25-3407.0.2012_12_25_1922-a1/

FLAGS_vbox_disk ; os.vdi

But if you issue the command in “chroot” environment, it will not be recognized even though you install the VirtualBox. The “chroot” environment invoked by “cros_sdk”, doesn’t look to read freshly from existing /usr/bin. So, instead of updating the script file,I issued the VBoxManage outside of the chroot.

Then it will create a VDI image. You can copy it to shared directory between a host OS and your VirtualBox. Then when you make a new VM to install ChromeOS, you can use the new VDI image as a main HDD to install the Chrome onto.

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: