Add New Page: You are not allowed to add pages Select section/namespace. New page title.
 

VirtualBox Testing

This section explains how to run Commotion as a guest VM under VirtualBox. As of this writing, the author has tested VirtualBox v4.2.4 under Windows 7, v4.2.4 under Ubuntu, and v4.1.23 under Mac OS X 10.6.

See VMware-Player for info about running Commotion as a guest VM under VMware.

Do note that VirtualBox only supports guests compiled for the x86 platform.

Install VirtualBox

The author downloaded his copy of VirtualBox directly from https://www.virtualbox.org/ , which is recommended. If you happen to already have a copy of VirtualBox installed by your OS (e.g. the Ubuntu version of VirtualBox), and you don't want to use that copy, make sure to un-install it first.

Furthermore, connecting USB peripherals like wifi adapters to a guest VM requires installing the VirtualBox Extension Pack too.

Simulating Commotion-OpenWRT

Simulating a single node as a VirtualBox VM

This section explains how to run a “Commotion-OpenWRT”:/projects/commotion-openwrt as a stand-alone node under VirtualBox.

Besides the steps described below, note that compatible images and VirtualBox appliances files may be downloaded from https://code.commotionwireless.net/projects/commotion/files

Compile Your Own Image

This section assumes that you have a build environment suitable for compiling custom OpenWRT images. If you don't, “this page”:http://wiki.openwrt.org/doc/howto/buildroot.exigence is a good starting point for establishing that environment. Likewise, this section assumes you have a working knowledge of git usage.

See Custom-Compile-OpenWRT subsection for x86 architecture.

-* Clone the “commotion-openwrt project”:/projects/commotion-openwrt/repository repo with git.- -* Switch to the “x86” branch of the git repo.- -* Run the setup.sh script in the root directory of commotion-openwrt.- -* Do “cp x86.config openwrt/.config” to copy over the suggested x86 platform configuration file.- -* Enter the openwrt directory and do a “make menuconfig” to further customize your build options.- -* Now build OpenWRT with “make V=99”. This took me roughly 1.5 hours on my Ubuntu Linode instance (make sure you have enough disk space).-

Convert OpenWRT Image to VDI Format

Once you’ve completed your OpenWRT build, locate relevant image file at openwrt/bin/x86/openwrt-x86-generic-combined-jffs2-128k.img. Although the OpenWRT build process does support generating a VDI file (using the EXT4 filesystem) for use under VirtualBox, we want to use the JFFS filesystem image to preserve compatibility with the Freifunk sysupgrade tool.

The 2 commands below will convert the img file to VDI format, and then expand that VDI file to 17MBytes. This should provide a rough approximation of the 16MByte embedded flash disk typical to target hardware.

VBoxManage convertfromraw --format VDI openwrt-x86-generic-combined-jffs2-128k.img openwrt-x86-generic-combined-jffs2-128k.img.vdi
VBoxManage modifyhd --resize 17 openwrt-x86-generic-combined-jffs2-128k.img.vdi

Create/Configure the Commotion-OpenWRT VM guest

The “OpenWRT VirtualBox guide”:http://wiki.openwrt.org/doc/howto/virtualbox is useful background reading for creating the VirtualBox VM that runs Commotion-OpenWRT. Besides that, the screenshots below illustrate the VM config used by the author to simulate a node.

General settings for Commotion-OpenWRT node under VirtualBox

System settings for Commotion-OpenWRT node under VirtualBox

Display settings for Commotion-OpenWRT node under VirtualBox

Serial port settings for Commotion-OpenWRT node under VirtualBox

Storage settings for Commotion-OpenWRT node under VirtualBox (JFFS image)

Net Adapter 1 settings for Commotion-OpenWRT node under VirtualBox

Running the Commotion-OpenWRT VM guest

You should now be ready to start the Commotion-OpenWRT VM. Be aware the VM may take a few minutes to boot up fully, noticeably longer than on ath9k target hardware. Likewise, the “/sbin/reboot” command under OpenWRT may not work fully, with the VM hanging on “machine restart.” In that case, just force a Power-Off via VirtualBox host. Sometimes the Power-Off might take a minute or two; be patient.

A nagging limitation of the VirtualBox console window is the lack of copy/paste, and likewise the inability to SSH/SCP directly into the Commotion-OpenWRT node from the host machine. The latter can be circumvented by having the node forward its local port 22 to a high-number port on the host, e.g. run this on node's console window …

ssh -f -N -R 19922:localhost:22 user@10.0.2.2

… where 'user' is a login account on the host machine running VirtualBox. This will allow the user on the host machine (hey, that's you!) to connect directly to the Commotion-OpenWRT via SSH/SCP at root@localhost port 19922.

Upgrading the Commotion-OpenWRT VM guest

A benefit to having painstakingly followed the instructions above is that you can use the built-in sysupgrade tool to 'reflash' your virtual Commotion-OpenWRT node in place, while preserving all of its configuration. To do this, download or SCP the updated image file openwrt-x86-generic-combined-jffs2-128k.img to the /tmp directory on the node's local filesystem, and then run this command on the node's console:

/sbin/sysupgrade -i /tmp/openwrt-x86-generic-combined-jffs2-128k.img

sysupgrade will first ask if you want to preserve the node's configuration files or edit the list of files to preserve (usual answers being YES then NO). Then, it will overwrite the node's kernel and filesystem system with those from the updated image file. Upon completion, the sysupgrade tool will trigger a reboot.

Simulating nodes with real USB Wifi Radios

Please see *Virtual-Box-Real-Mesh* for information about simulating a Commotion node under VirtualBox, but with a real USB wifi radio to connect to a live mesh and/or real wifi clients.

Simulating multiple nodes as VMs under the same VirtualBox host

Simulating multiple nodes under VirtualBox is very similar to simulating a single node. The simulated nodes may mesh together via a virtual network provided by the VirtualBox application.

Please see *Virtual-Box-Virtual-Mesh* for information about simulating multiple Commotion nodes (and user clients) under the same VirtualBox host, connected together by a virtual mesh.

Simulating Commotion-Linux

TBA

Simulating Commotion-Android

TBA

Simulating Commotion-Windows

TBA

development_resources/testing/virtualization/virtualbox_testing.txt · Last modified: 2014/05/12 20:35 (external edit)
 
Except where otherwise noted, content on this wiki is licensed under the following license: CC Attribution-Share Alike 3.0 Unported