Getting a raspberry pi set up to cross-compile and NFS boot using the method described here: github.com/twobitcircus/rpi-build-and-boot


#1

Was the SAIC Raspberry Pi image that was discussed in this OLab post ever finalized / created? If so, is it available for download? If not, what RPI image would people recommend to get started with for somebody who wants to run OF on the pi, and eventually connect to SAIC’s wifi network?

Will simply following the getting started on RPI for OF guides on the OF site get me to where I need to be?


DePaul Physical Computing Site
#2

Check out https://github.com/twobitcircus/rpi-build-and-boot as a way to get started. I always start with the latest raw image from RPI, rather than using a specific custom distro.


#3

I’m following the excellent guide you recommended, @bakercp, but am running into some problems at step 1 of the “Create the Virtual Machine” section:

Configure a wired ethernet network. I use a USB Ethernet adapter on my Macbook. Set the IP/netmask of the wired connection to 10.0.0.2/255.0.0.0. The IP address of the virtual machine is hard-coded to 10.0.0.1.

I’m using an ethernet to thunderbolt adapter on my macbook. I don’t have a ton of network configuration experience, and can’t figure out how to customize my IP and netmask addresses without causing the ethernet connection to no longer connect to the internet (which I assume is a problem). Under the System Preferences -> Network settings, which of the options seen in the attached screenshot should I select under “configure IPv4”?


#4

Manually.

10.0.0.2 for IP
255.0.0.0 for mask.


#5

UPDATE: I’ve gone ahead and configured IPv4 manually with the IP/netmask that twobitcircus instructs to use in their guide. I’ve reordered the “service order” to make WIFI used before ethernet, so this way when I type vagrant up, the provisioning process can have the internet access it needs.

It’s still unclear to me whether I need to have internet access on the ethernet connection, but I guess I’ll find out soon enough…


#6

Alright. Seem to have fixed the IP/mask issue, but have been struggling with the Make a bootable card section of the tutorial. I’ve tried formatting my SD card using the SD Association’s Formatting tool, as recommended in this post. I’ve done this several times, and have tried selecting both the “yes” and “no” option under “logical address adjustment.”

After formatting the card, I use df -h on the command line before and after inserting the SD card, in order to figure out its device name (mine is rdisk3s1).

Then, I unmount my device using sudo diskutil unmount /dev/disk3s1
Finally, I attempt to dd my image.img using sudo dd if=image.img of=/dev/rdisk3s1 ibs=512 obs=1m count=122880 (I was getting permission errors, so added sudo though twobitcircus doesn’t say to use sudo.)

I get this in terminal:

122880+0 records in
60+0 records out
62914560 bytes transferred in 10.934743 secs (5753639 bytes/sec)

Seems promising, but when I reinsert my SD card I get a `The disk you inserted was not readable by this computer’ error (see screenshot.)

Please help! What on earth am I doing wrong?!

I’ve also got a followup question on the next section of the tutorial which reads as follows:

NFS boot your Pi

  • Put the card in a Pi, connect it to the hard-wired network, and turn it on.
  • If this is a fresh card, you’ll be dropped into raspi-config.
  • Enable ssh in the advanced options
  • Do not “expand the filesystem.”
  • Finish raspi-config and reboot.

I’m trying to get a conceptual handle on what’s actually going on here, and my question is whether the virtual machine I’ve set up, which is running via vagrant after typing vagrant ssh on the command line, is going to be the one that the pi is hooked into when it NFS boots. What exactly is that virtual machine for, and is it required for the pi to boot at all? In other words, for this next section of the tutorial to work, does my macbook ALSO need to be hard wired via ethernet into the router, and does my vagrant virtual machine have to be up and running before the pi will boot? OR is the virtual machine just a way for me to access the pi and cross compile?


#7

The disk won’t be readable by your computer b/c it uses a format that mac can’t read natively. Once you format it and write the image using dd, it should be ejected and inserted into your RPI … then your local vagrant-based virtual machine will loop mount it as an NFS disk. I think you’re closer than you think.


#8

Thanks, @bakercp :slight_smile: That’s great news! Makes a lot of sense. I’m going to try it and will let you know.

I had a fleeting thought that the card might not be formatted to be read on my mac, but what threw me was the second part of the Make a bootable card section of the walk through reads:

Examine the cmdline.txt file in the newly minted SD card. It assigns the static IP address 10.0.0.101 (which you can change for subsequent cards) and designates 10.0.0.1 as the NFS server

…which led me to incorrectly assume I would be looking up cmdline.txt on my mac, not on my pi.


#9

Unfortunately, I am unable to get the pi to boot with my “newly minted SD card.” :frowning:

(Nothing happens when I power the pi with the SD card inserted.) I’m reformatting and am going to try again, but I have a feeling that’s not going to fix the problem…

If I somehow configured my virtual machine incorrectly, could that be causing the problem? I’m wondering if I should start over from the top…


#10

Well, you are … kind of.

You can view that file on the pi after you ssh into the virtual machine server and then ssh into the pi or just look at the file on the mounted disk …

This strategy really needs a diagram :smile: You should draw one once you get your brain around it … !


#11

hmmmmmm a diagram would be nice!

So I just reformatted the card and tried again, and still get nothing when I turn on the pi (both the pi and my mac are connected via ethernet to my router). Any thoughts? Re-clone twobitcircus’ github repo and start fresh from the very top?

I noticed after launching my virtual machine using ssh vagrant this message:

New release ‘14.04.1 LTS’ available.
Run ‘do-release-upgrade’ to upgrade to it.

Seems unlikely that this would be causing my problem, right?


#12

There’s nothing like sleeping on a problem. I dreamt of RPi’s all night long, woke up, made a cup of coffee and looked at my issue with fresh eyes. Twobitcircus’ tutorial is good but quite compressed for beginners. The problem I was having had to do with not understanding the disk architecture / partitions.

To solve it, I very carefully mapped the instructions laid out on this elinux page (scroll down to the Flashing the SD card using Mac OSX section and scroll further to find the Using command line tools (2) subsection) onto the Make a bootable card section of twobitcircus’ tutorial.


#13

I’m happy to report that I’ve gotten my pi up and running using twobitcircus’ tutorial :blush:!

I can compile and run an OF example on the pi itself, but when I try to do it via my virtual machine shell with rmake followed by make run, I’m getting the following error:

…/…/…/libs/openFrameworksCompiled/project/makefileCommon/config.shared.mk:185: *** This package doesn’t support your platform, probably you downloaded the wrong package?. Stop.

I assume that I need to edit the config.shared.mk file, but I’m not quite sure what to do with it. Any thoughts?

One of the problems I’m having in trying to debug this is: I don’t completely understand what I’ve set up and how it works:

  • Where is the directory ../../../libs/openFrameworksCompiled/project/makefileCommon/ physcially located, and how to I access it?

  • is it located on the Pi’s SD card?

  • or is it actually located on my macbook, and being accessed by the Pi through the network?

  • Does it still make sense to set up something like Samba in order to easily mount the Pi as a hard drive or does twobitcircus’ tutorial make this obsolete? (I actually tried installing samba and ran into an error.)


#14

Did you try rmake then rmake run?


#15

I had not. But of course that makes sense. When I did do that, I got a new error:

armv6l
checking pkg-config libraries: cairo zlib gstreamer-app-1.0 gstreamer-1.0 gstreamer-video-1.0 gstreamer-base-1.0 libudev freetype2 fontconfig sndfile openal openssl libpulse-simple alsa gtk±2.0 libmpg123
./advanced3dExample: 1: ./advanced3dExample: Syntax error: word unexpected (expecting “)”)
make: *** [run] Error 2

What file is this error in?


#16

Actually, I think to run it you just need to ssh into the pi and cd into your project’s bin directory and execute the application './myapplication` …

Right now it seems that you are trying to launch an arm binary inside of a 386 virtual machine. Again, this is where a diagram would really help … :slight_smile:


#17

Works! Thanks, @bakercp :smile:

So now I just need to figure out how to load new openFrameworks projects onto the pi.

  • With this setup, where is the openFrameworks directory physically located, and what’s the best way to add new projects to it?

  • Is the pi accessing my rpi-build-and-boot directory via the network?

  • Does it still make sense to set up something like Samba or is that redundant with this set up?


#18

I believe that the vagrant instance should expose directory in your mac’s /Volumes/* folder somewhere.

Alternatively you could use scp to copy files over …


#19

I’m just going to recycle this thread. As you might have expected, I ran into problems as well while going through the tutorial. And to quote @abrahamavnisan:

One of the problems I’m having in trying to debug this is: I don’t completely understand what I’ve set up and how it works

I’m stuck at the Create the virtual machine part of the tutorial. When I ran vagrant provision I get this error at the end of it:

TASK: [mount src="image.img" name="/opt/raspberrypi/boot" fstype="auto"  opts="loop,offset={{offset_boot}},noauto" state="mounted"] *** 
failed: [default] => {"failed": true}
msg: Error mounting /opt/raspberrypi/boot: image.img: No such file or directory
FATAL: all hosts have already failed -- aborting

Seems it can’t find the image.img. I have it in the main directory, which looks like this:

Thought I followed the tutorial pretty closely so far. Regarding the network, I assume it’s normal that it says the ethernet device is not yet responding as the raspberry hasn’t got any system to run yet…?


#20

here’s a picture i made for you that attempts to quickly diagram what is going on …

here’s a picture of my directory …

Run command-I (get info) on the image file and make sure it looks something like this …

You won’t see any network connection until you hook up the pi to your ethernet dongle.