Coder Social home page Coder Social logo

luejerry / raspberry-devbox Goto Github PK

View Code? Open in Web Editor NEW

This project forked from asquera/raspberry-devbox

3.0 3.0 0.0 33 KB

Updated to Raspbian 8: a vagrant devbox for development with raspberry pi

License: MIT License

Puppet 75.53% Shell 0.24% HTML 24.06% Pascal 0.16%

raspberry-devbox's Introduction

Raspberry Pi Devbox

A Vagrant recipe for an Ubuntu 12.04 virtual machine, intented to make C/C++ development for Raspberry Pi a less painful experience. Forked from https://github.com/nickhutchinson/raspberry-devbox, updated to use a Raspbian 8 Jessie chroot and the latest Raspberry Pi cross-compiler toolchain (gcc 4.8.3).

This VM includes a sandboxed installation ("chroot") of Raspbian, an ARM variant of the Debian Linux distribution optimized for Raspberry Pi. Use of the sandbox is mediated by a cross-compiling tool called ScratchBox2. ScratchBox2 craftily translates the ARM executables bundled with Raspbian such that they run on your Intel box.

Why is this so nice? Suppose you have C++ app that you want to build for the Raspberry Pi, but it requires a bunch of third-party libraries. Do you really want to hunt down these libraries, their dependencies, their dependencies dependencies, their dependencies dependencies dependencies and so on, until you're able to build your own app? It should be clear that that way lies madness. Perhaps you'll just copy the headers and libraries from your Raspberry to your Intel box, and point your compiler at those. That might work, but it'll be fragile and annoying.

How about we let the Raspbian folks do all the hard work? With ScratchBox2, you can simply apt-get to your heart's content. Just type:

    sb2 -eR apt-get install ...

This executes apt-get in the default ScratchBox2 container (in our case, we only have the one. It's called "raspberry".) The -e flag is for chroot (emulated) mode; -R runs the command as the equivalent of root in the sandboxed environment. For a slightly more thorough explanation of ScratchBox2, see these presentation slides: http://www.daimi.au.dk/~cvm/sb2.pdf.

Installation

  1. Install both VirtualBox and Vagrant.
  2. In a terminal, execute git clone git://github.com/nickhutchinson/raspberry-devbox.git && cd raspberry-devbox
  3. Execute vagrant up to launch and provision your Virtual Machine.

Vagrant will now download the basebox, bootstrap the environment and run the provisioner for the first time. Since the basebox and numerous packages must be downloaded, the first run may take some time depending on your network connection. No supervision should be required; running the install overnight should be just fine. Future runs will be much faster, and won't require network connectivity.

If like to see words dribble down your screen, you can monitor the bootstrap progress by running vagrant ssh to ssh into your VM, and then tail -F ~/raspberry-dev/rootfs/debootstrap/debootstrap.log

After installation has completed, you should find:

The default configuration allocates 4 CPU cores and 4 GB of RAM to the VM. This can be configured by editing the following lines in the Vagrantfile:

v.memory = 4096
v.cpus = 4

Example Usage

  • Starting the VM: in the program root directory, run vagrant up to start the VM, then vagrant ssh to enter it.
  • sb2 make make using host cross compiler toolchain.
  • sb2 -e make make using emulated target toolchain.
  • sb2 -eR make install install in emulation mode as root.

VirtualBox

The basic virtualization layer is VirtualBox. Any current version should do, however the guest additions are pinned to current version at the time the basebox was built (4.2.0). A mismatch between the guest additions and the VirtualBox version may result in strange behaviour, mostly affecting shared folders and networking. To update the guest, additions follow the instructions in the VirtualBox manual.

Vagrant

Vagrant is the scripting toolkit used to control all interaction with the devbox. A full guide on Vagrant can be found on the Vagrant site. As a short primer, the following commands should be sufficient:

  • vagrant up <boxname> start the given box. If the box has not been initialized and created, this will download the basebox as required, bootstrap it and run the provisioner. Running vagrant up when the box is already running is a NOOP and has no effect.
  • vagrant halt <boxname> stop the given box. Has no effect if the box is not running. May require an invocation using the --force flag (vagrant halt --force <boxname>) if the box crashed, locked up or cannot be accessed via vagrant ssh
  • vagrant reload <boxname> stop and start the given box. Runs the provisioner.
  • vagrant provision <boxname> Runs the provisioner.
  • vagrant destroy <boxname> destroys the given box. This is useful if for some reason the box has been damaged or to free disk space. Running vagrant up after running vagrant destroy bootstraps a new box.
  • vagrant ssh <boxname> open an ssh connection to the given box.

Puppet

Provisioning of the Virtual Machine is handled by Puppet. Take a look at the raspberry_dev module.

Bugs

  • Some programs such as aptitude crash with segfault when run in emulation mode. Updated qemu might fix this

raspberry-devbox's People

Contributors

luejerry avatar nickhutchinson avatar xylakant avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.