Skip to content

Raspberry Pi Getting Started

danthemellowman edited this page Jan 6, 2013 · 64 revisions
  1. Install the latest Raspbian image, according to the instructions in the Official Quickstart Guide.

    • Make sure you are working with the the "hard float" version of wheezy (aka "Raspbian"), not the soft-float version (aka "Soft-float Debian “wheezy”).
  2. Please note if you are booting for the first time you will need to have a USB keyboard and either a HDMI Monitor or a HDMI to DVI||VGA adapter depending on your setup. Please read this guide as it contains a lot of useful information about bringing up your pi for the first time. Please select the following options from the configuration screen described in this this guide.

    • expand_rootfs, this expands the root file-system to your full SD card.
    • ssh, enable sshd at boot (if you wish to ssh into your pi instead of using a USB keyboard)
    • memory_split, you should configure the GPU/CPU memory split to be 50/50 between the GPU and CPU
    • if you already have a working pi you should do the following
    • run sudo wget http://goo.gl/1BOfJ -O /usr/bin/rpi-update && sudo chmod +x /usr/bin/rpi-update
    • then execute the rpi-update
    • edit /boot/config.txt and set gpu_mem option to gpu_mem=128 for the 256mb pi and gpu_mem=256 for the 512mb pi
    • you will need to reboot your pi after this step sudo shutdown now -r || sudo reboot
  3. Once you are logged in to the RPI on the command line (via SSH or plugged into a screen) make sure your system is up-to-date.

    • sudo apt-get clean
    • sudo apt-get update
    • sudo apt-get upgrade
    • Note: The above steps may take a little while.
    • If you are still having issues updating apt-get run the following command then repeat the steps from above: sudo rm /var/lib/apt/lists/* -vf
    • install git: sudo apt-get install git
    • install and enable Multicast DNS (mDNS) for board to be reachable at raspberrypi.local. from machines on the same network: sudo apt-get install libnss-mdns
  4. Then clone this repo:

    • git clone https://github.com/openFrameworks-RaspberryPi/openFrameworks/
    • Note: If you want to contribute code to the this project, create your own branch and submit a pull request to the develop-raspberrypi branch of this repo.
    • Note: For purposes of discussion below, $(OF_ROOT) is will be the location of the openFrameworks root folder you created during this cloning process. (suggested root dir ~\src\openframeworks)
  5. Then move into your newly created directory ...

    • cd openFrameworks
  6. ... and checkout the master-raspberrypi branch:

    • git checkout master-raspberrypi
    • or if you want to live in the dangerzone
    • git checkout develop-raspberrypi
    • Note: The master-raspberrypi branch is our best effort at a "it was working the last time we checked" branch. master-raspberrypi is almost always a little bit behind the develop-raspberrypi branch, which usually working, but is currently being developed at a rapid pace, so don't be surprised if you get odd errors. Either one you choose, if you find errors, please leave bug reports in our issue tracker. To use the develop branch, git checkout develop-raspberrypi.
  • Installing the Dependencies and Compiling my first raspberrypi+openFrameworks app
  1. First, you will need to install the dependencies using the following command:

    • cd $(OF_ROOT)/scripts/linux/debian_armv6l
    • sudo ./install_codecs.sh
    • sudo ./install_dependencies.sh
  2. Next you need to build the core openFrameworks libraries. To do so, navigate to the $(OF_ROOT)/libs/openFrameworksCompiled/project folder on your RPI and run: _Note:this is going to take a (while)[http://xkcd.com/303/]

    • make to build the Release library.
    • or
    • make Debug to build the debug library.
    • or
    • make -j2 aka make^2, Note:this could do bad things if code is compiled in the wrong order (which is highly unlikely) but generally speeds things up. if you are running on a pandaboard it should reduce your compile time significantly as you have two cores. google: make -j option to learn more.
    • Note: This will use the new makefile system to automatically detect your system and will load the platform specific configurations found in the linuxarmv6l subfolder. This platform specific makefile is used for compiling BOTH core libraries AND compiling specific oF projects. If you are experimenting with missing features, you may need to modify that file at some point. It is very well documented (in fact all of the new makefile system is heavily commented, so feel free to look around and make suggestions!).
    • Note: If you have the need for speed and have an Ubuntu desktop machine to spare (or VM!), see the Raspberry Pi Cross Compiling Guide.
  3. Building Your App

    • branch master-raspberrypi :You can now navigate to the $(OF_ROOT)/apps/devApps folder and try out a few simple RPI apps. To try the simplest one, go to the raspberrypi_hello_world folder and run:
      • make
      • Note: This may take a few minutes to run the first time. Then navigate into bin and run the app as instructed.
    • branch develop-raspberrypi : Welcome to the wonderful world of of the new makefile system! Currently the base makefiles are located in $(OF_ROOT)/scripts/linux/template/linuxarmv6l but now we are going to copy the following files to your home directory for easy access.
      * cp Makefile ~/ * cp config.make ~/
      • Now we are going to navigate to $(OF_ROOT)/apps/devApps folder and try out a few simple RPI apps. You'll find the following apps:
        • raspberrypi_hello_world
        • raspberrypi_hello_world_gles2
        • lets copy our Makefiles into these projects and compile them:
          • cp ~/Makefile ./PROJECT_DIRECTORY
          • cp ~/config.make ./raspberrypi_hello_world _Note: you should do this for any RPI apps you want to build.
        • type make and follow the instructions on the screen after the successful builds.

Note: if you find any errors at this step compiling either raspberrypi_hello_world_gles2 or raspberrypi_hello_world please file them on github.

  1. To run other examples or try out your own program, for the moment we recommend copying the raspberrypi_hello_world example. In the future, projectGenerator will make this easier.
    • Note: If you are a developer, please take a look at the config.make file and the addons.make files in the project directory.
  2. Notes:
    • For doing development on your pi from OS X via SSH you should perform the following steps:
      • From OSX select System Preferences>Sharing>Internet Sharing
      • Check Internet with 'Share Your Connection from: WiFi' and 'To Computers Using: Ethernet'
      • Plug an ethernet cable from your Raspberry Pi into your Mac
      • OSX uses the range 192.168.2.2-254 as its DHCP range for devices connected via the ethernet jack your pi will probably be 192.168.2.2 but it could be 192.168.2.7
        • You might have to run (nmap)[http://nmap.org/] to find the IP of your pi if you do not have a USB keyboard handy
        • nmap -v -sP 192.168.2.2-254 should do the trick
      • If you have enabled mDNS (see above) or are using an earlier version of Raspbian with mDNS pre-enabled, the board will be reachable at raspberrypi.local. (or raspberry.local.) and you can SSH with the username pi: ssh [email protected].
      • Now open terminal and run the SSH command ssh [email protected]
      • if everything went well you should be presented with a password prompt.
Clone this wiki locally