Development environment

From : http://web.archive.org/web/20140413175450/http://superpiadventures.com/2012/07/development-environment/

It became clear to me after playing around with Raspbian that I would need to compile my own software and/or Debian packages. Raspbian is new project and is still getting its feet off the ground.

Compiling on the R Pi itself is slow, it takes an hour to compile Quake3 and about 12 hours to compile XBMC, so I decided to compile on my desktop PC. The problem is that my desktop is running Ubuntu 12.04 i386 and my Pi is running Raspbian for armhf.

I’ve never created a Debian chroot before and I’ve never created one that runs on a different architecture to the native PC. So after some googling I found this wiki page.

I used that as a base to create my own chroot that can cross-compile for armhf. Here are instructions for Ubuntu 12.04 i386:

Installing QEMU

In order to compile for a different architecture then we are currently running on we need an emulator. We will use QEMU for this:

apt-get install qemu-user-static

Creating the chroot

Create the chroot (using qemu-debootstrap) and mount some needed filesystems:

sudo apt-get install debootstrap
sudo qemu-debootstrap --arch armhf wheezy chroot-raspbian-armhf http://archive.raspbian.org/raspbian
sudo mount -t proc proc chroot-raspbian-armhf/proc
sudo mount -t sysfs sysfs chroot-raspbian-armhf/sys
sudo mount -o bind /dev chroot-raspbian-armhf/dev

Remember that is as minimal as a distro can get, you need to set up everything yourself from here, including adding a user and the applications you need.

Edit: Updated this section to use qemu-debootstrap. This handles the qemu binary and debootstrap –second-stage all for you.

Changing to the chroot

Now that you have everything setup, you can change to your chroot with:

sudo LC_ALL=C chroot chroot-raspbian-armhf

Some setting up

Now that you have the environment, you may need to do some house cleaning to get things running smoothly.

Adding a user

useradd -m -s /bin/bash <username>

Setting up reposatory and adding Raspbian GPG key

In order to install packages from the Raspbian repo, you need to add the repo to sources.list and grab the GPG key:

echo "deb http://archive.raspbian.org/raspbian wheezy main" >> /etc/apt/sources.list
wget http://archive.raspbian.org/raspbian.public.key -O - | apt-key add -
apt-get update

VideCoreIV userspace libs

You may need to fetch the libraries for VideoCoreIV for hf, these live here: https://github.com/raspberrypi/firmware/tree/master/hardfp

Reboot

Note that some of these changes won’t survive a reboot. You will need to run the following should you reboot your desktop:

sudo mount -t proc proc chroot-raspbian-armhf/proc
sudo mount -t sysfs sysfs chroot-raspbian-armhf/sys
sudo mount -o bind /dev chroot-raspbian-armhf/dev

Using USB flash

Its possible to switch your system to an usb flash system. You always need a sdcard to booting your pi but you can copy all data to an usb key from your sdcard except the /boot. You need to keep the /boot on the sdcard.

Don’t forget to change the /etc/cmdline.txt to adapt your change and the /etc/fstab on the usb key.

The performance is a little better because the load average is less. We need to working hard to made an acceptable performance on a raspberry pi for the web interface.

The cti server need to be improved at the initialisation because it’s very long …

The information from raspbian for switching to an usb key.

Installing to USB disk

It is also possible to use the installer to install Raspbian to external USB flash/hard drive. The external drive should be detected correctly by installer, but in this case you will have to prepare partitions manually. It is absolutely neccessary to keep RasPi boot partition on SD card, it has to be the first partition there, primary, bootable, FAT32 format. The installer will not allow you to mount this partition as /boot, though. Mount the FAT32 partition as /rpiboot instead, post-install script will rename it to /boot after installation automatically. Any other partitions can be placed to external drive. Remember the name of the root partition block device, you will need to edit cmdline.txt kernel options to point rootfs to this device after installation.

Debian archive for XiVO

The debian archive packages for XiVO on raspberry pi is now online. Please be patient because there is some problems and it’s a very young project. Add in your raspbian source list the repository.

deb http://archive.raspberry-xivo.org/apt/ wheezy main

The repository is not sign for the moment. We are working for supporting packaging farm.

Raspberry pi freeze fixes

After some seconds on a phone, i have a freeze of my ethernet card because there is so many errors :

kevent 2 may have been dropped

I found the solution on the raspberry pi forum :

http://www.raspberrypi.org/phpBB3/viewtopic.php?t=7581&p=100459

Please update your /boot/cmdline.txt with this information. You need to reboot for apply the changes.

smsc95xx.turbo_mode=N dwc_otg.dma_enable=1 dwc_otg.dma_burst_size=256 
dwc_otg.lpm_enable=0 console=ttyAMA0,115200 kgdboc=ttyAMA0,115200 
console=tty1 root=/dev/mmcblk0p2 rootfstype=ext4 
elevator=deadline rootwait

How to building packages for XiVO raspberry

XiVO for raspberry is based on the official XiVO debian packaging. The first step is building all xivo repository. The image will be on the top of raspbian project who is the wheezy version. I found an excellent document for cross compiling XiVO on armhf. Please follow this guide before.

http://www.raspberry-xivo.org/?p=72

When your environment is created you need to add the packages sources from XiVO.

Add and edit your /etc/apt/sources.list.d/xivo-skaro-src.list in your chroot and put :

deb-src http://mirror.xivo.fr/debian/ xivo-five main

You need to add the XiVO repository key :

wget http://mirror.xivo.fr/xivo_current.key -O - | apt-key add -

Time to update :

apt-get update

Now you need some tools for the packaging

apt-get install build-essential devscripts

Now you’re ready for the packaging.