Getting your Raspberry Pi 2 B ready for openFrameworks

Create SD Card - ArchLinux "ARMv7"

*This has to be done under a linux computer (you can use raspbian :D)


Replace sdX in the following instructions with the device name for the SD card as it appears on your computer.

  1. Start fdisk to partition the SD card:

    fdisk /dev/sdX
    
  2. At the fdisk prompt, delete old partitions and create a new one:

    Type o. This will clear out any partitions on the drive.

    Type p to list partitions. There should be no partitions left.

    Type n, then p for primary, 1 for the first partition on the drive, press ENTER to accept the default first sector, then type +100M for the last sector

    Type t, then c to set the first partition to type W95 AT32 (LBA)

    Type n, then p for primary, 2 for the second partition on the drive, and then press ENTER twice to accept the default first andast sect

  3. Write the partition table and exit by typing w.

  4. Create and mount the FAT filesystem:

    mkfs.vfat /dev/sdX1
    mkdir boot
    mount /dev/sdX1 boot
    
  5. Create and mount the ext4 filesystem:

    mkfs.ext4 /dev/sdX2
    mkdir root
    mount /dev/sdX2 root
    
  6. Download and extract the root filesystem (as root, not via sudo):

    wget http://archlinuxarm.org/os/ArchLinuxARM-rpi-2-latest.tar.gz
    bsdtar -xpf ArchLinuxARM-rpi-2-latest.tar.gz -C root
    sync
    
  7. Move boot files to the first partition:

    mv root/boot/* boot
    
  8. Unmount the two partitions:

    umount boot root
    

Insert the SD card into the Raspberry Pi, connect ethernet, and apply 5V power. Use the serial console or SSH to the IP address given to the board by your router. Login as root with the default password root. The default root password is root.


Accommodate

  1. Login as root

  2. Change password

    • passwd
  3. Install sudo

    • pacman -S sudo
  4. Delete alarm user

    • userdel alarm
  5. Create new pi user

    • useradd -m -G users -s /bin/bash pi
  6. Modify sudoers file

    • sudo nano /etc/sudoers

      ## Uncomment to allow members of group sudo to execute any command
      #%sudo ALL=(ALL) NOPASSWD: ALL
      
    • Uncomment the second of the above lines, so that it reads as follows:

      ## Uncomment to allow members of group sudo to execute any command
      %sudo ALL=(ALL) NOPASSWD: ALL
      
  7. Control-O + Control-X to save and exit

  8. Add superpowers to user pi

    • groupadd sudo
    • usermod -a -G sudo pi
  9. Modify you bash for ease of use

    • nano .bashrc

      # This reads .bash_aliases file for aliases
      if [ -f ~/.bash_aliases ]; then
      . ~/.bash_aliases
      fi
      
    • nano .bash_aliases

        #Enter openFrameworks folder just by typing "oF"
        alias oF='cd /home/pi/of_v0.9.2_linuxarmv7l'
        #Run project generator by typing projectgenerator
        alias projectgenerator='oF && ./apps/projectGenerator/commandLine/bin/projectGenerator'
        # Read temperature of rPi
        alias temp='/opt/vc/bin/vcgencmd measure_temp'
        # Read screen properties
        alias screen='/opt/vc/bin/tvservice -s'
      
    • nano .bash_profile

      #Setup openFrameworks variables
      export MAKEFLAGS=-j4 PLATFORM_ARCH=armv7l PLATFORM_VARIANT=raspberry2
      

Install rtAudio

Archlinux doesn't have an rtaudio package in their armv7 repositories. You can download it from the openFrameworks CI servers: * cd / * sudo wget http://ci.openframeworks.cc/rtaudio-armv7hf.tar.bz2 * sudo tar xjf rtaudio-armv7hf.tar.bz2 * sudo rm rtaudio-armv7hf.tar.bz2

  • Reboot and then you can delete the builds folder (packages have been already installed)

openFrameworks

  1. Get openframeworks from website:

    • curl -O https://openframeworks.cc/versions/v0.9.2/of_v0.9.2_linuxarmv7l_release.tar.gz
  2. Make oF directory

    • mkdir of_v0.9.2_linuxarmv7l
  3. Unpack tar

    • tar vxfz of_v0.9.2_linuxarmv7l_release.tar.gz -C of_v0.9.2_linuxarmv7l --strip-components 1
  4. Update

    • pacman -Syu
  5. Run scripts

    • cd of_v0.9.2_linuxarmv7l/scripts/linux/archlinux

    • sudo ./install_dependencies.sh

    [This usually takes some time and has some prompts (accept them)]

    • sudo install_codecs.sh
  6. Set makeflags (you can put this in your .bash_profile so you don't have to type it in every time)

    • export MAKEFLAGS=-j4 PLATFORM_ARCH=armv7l PLATFORM_VARIANT=raspberry2
  7. Compile oF

    • make Release -C /home/pi/of_v0.9.2_linuxarmv7l/libs/openFrameworksCompiled/project
  8. Run an example

    *cd /home/pi/of_v0.9.2_linuxarmv7l/examples/graphics/polygonExample

    *make && make run

Have lots of fun ! :)