I’ve had a lot of problems trying to update the OpenROV software from the default image. I keep on getting npm errors and install script errors.  I’ve tried all the suggestions from the wiki and also forum.

So I decided to try and build my own image from Source after noticing on Github a recent change to using Vagrant with instructions on building your own image. I already had a copy of Virtual box and so decided to give it a try. I’m on Mac OSX system but it should work on other systems.

I had some problems with the build and after speaking to Bryan A on the OpenROV  downgraded my copy of VirtualBox to version 4.2.10.

  1. Download and install a copy of Vagrant from http://www.vagrantup.com/
  2. I already had a recent copy of Virtual box, but this can be downloaded from http://www.oracle.com/technetwork/server-storage/virtualbox/downloads/index.html
  3. Clone the github file from https://github.com/OpenROV/openrov-image locally I used GitHUB desktop to do this.
  4. Using Terminal chang into the directory where cloned the repository openrov-image
  5. Type the command “vagrant up” On my system this started a number of commands but hung at “Waiting for VM to boot. This can take a few minutes.” A quick trip to Google revealed that others have experienced the same problem. First I had to stop the running image this can be done by typing the command “VBoxManage list runningvms” followed by BoxManage controlvm <id of running image> poweroff
  6. I fixed it by running up the Virtual box and starting the image manually. I closed the image then tried the Vagrant up command again this time the image seemed to spin up and download a number of different files before exiting back to the command prompt
    vagrant_up
  7. Type the command “vagrant ssh” to ssh into the image, Windows users will probably need to use putty to do this.
    vagrant_ssh
  8. change to the vagrant directory cd /vagrant
  9. and run the build “./build.sh”
  10. This will take sometime so go and have a cup of tea, at the end hopefully we should have a completed build ready for installation to the SDCard
  11. One problem was getting the system to recognise the SDCard the following instructions from http://superuser.com/questions/373463/how-to-access-an-sd-card-from-a-virtual-machine/#45808  was one solution and these instructions are repeated below:

On newer MacBook Pro’s the SD card slot is no longer exposed as a USB device. Because of this you’ll need to attach the raw device to the VM in order to gain raw access to the whole card. Full documentation is in the Advanced Storage Configuration section of the VirtualBox documentation.

As clearly stated in the docs:

Warning – Raw hard disk access is for expert users only. Incorrect use or use of an outdated configuration can lead to total loss of data on the physical disk. Most importantly, do not attempt to boot the partition with the currently running host operating system in a guest. This will lead to severe data corruption.

As a quick guide these are the steps to attach the device to a linux VM:

  1. Identify the raw disk block device on your host system
    1. Insert the SD card into the slot
    2. Open a Terminal and type “mount”. You’ll see output identifying the mounted volume from your SD card. On my system I get the following
      <code>$ mount
      /dev/disk1 on / (hfs, local, journaled)
      devfs on /dev (devfs, local, nobrowse)
      map -hosts on /net (autofs, nosuid, automounted, nobrowse)
      map auto_home on /home (autofs, automounted, nobrowse)
      /dev/disk2s1 on /Volumes/NO NAME (msdos, local, nodev, nosuid, noowners)`
      </code>
    3. In my case the “NO NAME” volume is the SD card, so I take note of the /dev/disk2s1 part. In this particular case the s1 part represents a partition (slice) on the raw device, so the part we’ll use later is just the /dev/disk2 part.
  2. Open Disk Utility and “Unmount” the volume. Do not “Eject” it. Note that you may need to unmount the volume once in a while during the next steps as I found OSX would automatically remount it at random.
  3. Now we set up VirtualBox to be aware of the raw device with the following command in the Terminal.
    1. Note that the /path/to/file.vmdk can be put anywhere, though it’s a good idea to store this in the guest VM folder such as ~/VirtualBox VMs/guest-vm/sdcard.vmdk
    2. Note that the -rawdisk we use doesn’t reference the partition (slice) but only the block device as a whole.
      <code>$ VBoxManage internalcommands createrawvmdk -filename /path/to/file.vmdk -rawdisk /dev/disk2
      </code>
  4. Next we attach the raw disk to a guest VM within the VirtualBox UI
    1. Ensure the guest VM is not running.
    2. Open the settings area for the guest VM
    3. Click on “Storage” in the toolbar
    4. Next to the controller click on the icon to “Add Hard Disk”
    5. Select “Choose existing disk”
    6. Navigate to the /path/to/file.vmdk you used in step 3 and select it
    7. You should now be returned to the Storage tab and see your file.vmdk in the list.
  5. Start the VM
  6. Depending on whether you have a GUI or not the SD card may or may not automatically mount. If you need to mount is manually it is simply exposed as another standard block device, so on my guest this was exposed as /dev/sdb.

With the system now recognising the SDCard we could move onto installing the image to it

  1. Change to the build directory  cd  /vagrant/work/omap-image-builder/deploy/2013-07-20/ubuntu-12.04-r8-minimal-armhf-2013-07-20/
  2. Probe to get the SDCard “sudo ./setup_sdcard.sh --probe-mmc" 2013-07-20_22-31-52 Note /dev/sdb
  3. I also needed to install some extra dependencies to get the install to run “sudo apt-get install wget pv dosfstools parted git-core”
  4. Finally we could install the image to the SD Card by issuing the command “sudo ./setup_sdcard.sh --mmc /dev/sdb --uboot "bone""
  5. When finished you can log out of the VirtualBox and then call “vagrant halt” to stop the virtual system

 

Posted in ROV.

Leave a reply

<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong> 

required