It uses Vagrant and Ansible to spin up a Virtualbox virtual machine that runs on Mac, Linux, or Windows(?). In no time at all, you’ll have an environment that:
Cross-compiles for the Raspberry Pi armv6l architecture.
NFS boots one or more Raspberry Pis. The root partition is loop-mounted from a .img file, so you can later dd it to an SD card for standalone operation.
Is ready to cross-compile OpenFrameworks applications and run them on a cluster of Raspberry Pis.
You won’t have to do any of the things on the Raspberry Pi Cross-Compiling Guide page. I have contributed to that guide to make the process more smooth, but it’s still a mess.
Here, Vagrant automates the process of setting up a Virtualbox virtual machine and Ansible automates the process of setting up the cross-compiler, the NFS server, and OpenFrameworks.
I’m really proud of it. Let me know if the setup-instructions are unclear, or if you encounter any problems!
Sounds cool! I get that you can edit and compile on a desktop machine but I am unclear on how the RPi OF apps are ran. Are they ran over a network or copied back locally to the RPi?
No copying necessary. The virtual machine owns the entire rpi filesystem and exports it via nfs. Any changes to that filesystem, for example by compiling, are immediately visible on all the rpis that are nfs booted.
I tend to execute the raspberry pi binaries using ssh over the network, a process I don’t detail in that readme. But that’s a feature of the show control system I’ve implemented on top of this base.
One of my first applications of this design pattern BTW was a specialized ofxomxplayer media player that shared media files located on the virtual machine.
just followed the tutorial, and i have projects compiling. as an example; i’ve been working on an rPi app that uses ofxUI and ofxTimeline. Previously it took >1 hour to compile on the Pi. It now takes a few seconds. Thanks.
Another question… what is the best way to directly access/edit files within /opt/openframeworks from OSX? I tried Samba on the rPi image using the samba config file from my CMU_rpi image, then SMB into 10.0.0.101. That didn’t work. Any other options here?
I’m going to keep reporting on my findings here… as I’d love to see this workflow become useful for everyone.
working with the wiringPi library is tricky, as Raspbian Wheezy doesn’t come with wiringPi already installed. From what I’m reading and experiencing, building wiringPi on this system is problematic.
So Far:
I’ve built wiringPi from the Pi (not from within the vagrant shell)
when I try to run any of the gpio commands (in particular i2cdetect) i get this error: /usr/local/bin/gpio: 1: /usr/local/bin/gpio: Syntax error: word unexpected (expecting ")")
If anyone has advice on building/using wiringPi from within this setup, please let me know. I’ll post what i find.
Download NFS Manager on your
Mac.
Open it, and manually mount 10.0.0.1:/opt/raspberrypi/root to (wherever)
You can now edit the files in the rpi root partition directly.
This about how weird this is for a sec, though. You’re editing files on
your Mac which are NFS exported from your VM. Which are in turn
loop-mounted from an SD card. Which is in a directory on your Mac and made
available to your VM through magical VirtualBox drivers. But it works!
To get wiringPi working, I downloaded and built wiringPi on the pi
directly, rather than through the cross compiler (as you did). WiringPi
works great in OpenFrameworks, with both GPIO and i2c. However, note that
i2cdetect is NOT a wiringPi program… its from the i2c-tools package. Do
make sure that the i2c kernel modules are loaded into the Pi kernel: https://learn.adafruit.com/adafruit-16-channel-servo-driver-with-raspberry-pi/configuring-your-pi-for-i2c
I’ve never used the wiringPi gpio utility. I jumped straight into
programming the GPIO with OpenFrameworks and it worked.
I’ll post an example when I get back in town Monday.
Thanks for the help… it turns out all of my problems were pretty much related not having an internet connection to the NFS mounted Pi. Just about everythign was resolved once i got that sorted. As for wiringPi, i’m currently compiling with a static version of the lib within the ofxWiringPi addon (per @jvcleave’s wiringPi example
I’ve just deployed my first project developed with this workflow on a standalone rPi. The project used slimmed down versions of ofxTimeline and ofxUI, which had previously taken 1-1.5 hours to compile on the pi. Using this workflow, each compile cycle took about 3 minutes.
@eric_gradman I’d like to help add to your read_me for this process. what’s the best way forward for that?
But I’m a newbie and have quite some difficulties to understand:
where to put your project in order to compile them and sync them to the PI
but especially how to turn the NFS boot “off” on the rpi SD to get a standalone image.
I don’t really get what do to when you say:
On the Raspberry Pi root partition, alter /etc/fstab and restore the mount point for /
On the Raspberry Pi boot partition, remove the stuff after “rootwait”
do you make a sudo nano on fstab?
where to remove the stuff rootwait ?