Raspberry Pi/Installation

The Raspberry Pi is an ARM device (BCM2835, ARMv6) with 256 MB RAM and uses an SD(HC) card for storage. This document describes how to install Gentoo on the Raspberry Pi.



Partitioning
Check that your SD card is compatible. 

Create at least two partitions on the card. One FAT32 for the boot partition, and one (with your preferred filesystem) for the root partition.

For optimal compatibility, it is recommended to use 255H/63S geometry. 

boot
The /boot partition needs the following proprietary firmware files, provided by the Raspberry Pi foundation.

Create a file called cmdline.txt containing the necessary kernel parameters. Example:

stage3
Download the appropriate stage3:

Extract to the root filesystem on the SD card:

Don't forget to adjust /etc/fstab and /etc/shadow root password.

stage4
If you'd prefer a self-booting Gentoo tarball (Stage 4), it can be downloaded from here with install instructions here

portage
Download the latest portage:

Ensure you have enough inode blocks free on the root partition. Portage takes up approximately 154K.

Untar portage on the SD card:

crossdev
Install crossdev:

Create a cross toolchain for ARM: (drop -S if you plan to run an unstable system)

Kernel and modules
Download kernel sources for Raspberry Pi from github then configure, compile and install:

Create a kernel.img file using the Raspberry Pi mkimage tool from github:

That's it! You should all be set now.

Tips and Tricks

 * Storage is rather slow, even with the couple of compatible SDHC class 10 cards. If you want to run emerge on the Raspberry Pi, putting /usr/portage on squashfs will speed up things dramatically.
 * There is no hardware RTC on the Raspberry Pi. Use the /etc/init.d/ntp-client init script to set correct time at boot. A fallback incremental clock can be archived by /etc/init.d/swclock (replaces hwclock).
 * If you require more RAM for Linux, use one of the alternative GPU firmware files that reduce the amount reserved for video memory.
 * More recent, unofficial kernel releases for the Raspberry Pi might be found at Chris Boot's repository:
 * Be sure to test the performance - if your numbers don't match up (for instance in the LINPACK benchmark), something is very wrong.
 * For instructions on how to build binary packages for the Raspberry Pi on an Android phone see this blog post:
 * If you cannot create a working ARM cross-toolchain, a precompiled kernel image is available from the firmware repository. You need to place boot/kernel.img in your boot partition and copy the contents of the modules directory to /lib/modules/ on the SD card.

Troubleshooting

 * Problem: dmesg is full of smsc95xx 1-1.1:1.0: eth0: kevent 2 may have been dropped and/or page allocation failure messages
 * Solution: add smsc95xx.turbo_mode=N to kernel parameters, or vm.min_free_kbytes = 4096 to /etc/sysctl.conf

External resources

 * Gentoo Embedded Handbook with more information about embedded hardware, cross compiling and other related topics.


 * Raspberry Pi Hub at eLinux wiki, with more advanced tutorials to get the most out of your Raspberry Pi