Raspberry Pi/Quick Install Guide

Installing Gentoo onto a Raspberry Pi is relatively straight forward and in some ways easier because a kernel image is provided by the Raspberry Pi Foundation. This means you can get Gentoo installed quickly onto you Raspberry Pi.

Preparing the SD Card
The Raspberry Pi boots off a FAT32 /boot partition, you will also require a root and swap partition.

Create the Partitions
Use the fdisk command to create the partitions.

Install kernel and modules
The Raspberry Pi Foundation maintain a branch of the Linux kernel that will run on the Raspberry Pi, including a compiled version which we use here.

Edit fstab
Edit the fstab to match your partition scheme.

Set boot options
You need to create a file cmdline.txt in /boot to pass options to the kernel.

Edit make.conf
The default make.conf includes basic CFLAGS. If you would like to change the settings to something more 'optimal' for the Pi look at the details on the relevant wiki page.

Configure timezone
Find your time zone using this command.

(Suppose you want to use Europe/London)

(Next set the timezone)

Clear root password
As we do not chroot before we boot, you will need to unset the root password. Allowing you to login with a blank password for the root user.

Edit the line for root so it looks like the example below.

Unmount SD and then boot your Raspberry Pi
Unmount the SD card.

Plugin the SD card to your Raspberry Pi, make sure you have a keyboard and monitor also plugged in then connect the power. Hopefully Gentoo will boot giving you a login prompt, login as root and no password. During the first boot you will see a few warnings and errors which we will fix in the next section.

Set root password
Immediately set a root password.

Enabling networking on boot
Assuming you are using DHCP on the eth0.

Select profile
List the available profiles.

Select the desired profile, for example 25 (23 is a good generic one)

Configuring inittab and rc.conf
Uncomment the linux specific rc.conf rc_sys value, to stop warning in boot up.

Comment out the s0 Serial console to stop "INIT: Id "s0" respawning too fast" messages on the console.

Enable software clock
The Raspberry Pi does not have a hardware clock, so you need to disable the hwclock daemon and enable swclock.

To set the time correctly use ntp to set the clock at boot up.

Overclocking
It is very easy to overclock a Raspberry Pi up to 1000MHz without affecting your warranty

Enabling Overclocking
To enable overclocking select one of the suggest modes from the list above, "Medium" is generally a good starting point. Edit the /boot/config.txt, add the appropriate values and reboot the Raspberry Pi for changes to take effect.

Optional cpufrequtils
To manage the CPU frequency scaling you can use the cpufrequtils.

The default scaling governor can be changed in the /etc/conf.d/cpufrequtils file

Confirm the current scaling and CPU using the cpufreq-info command

Force Turbo Option
The force turbo option turns off the dynamic clocks and runs the Raspberry Pi constantly at the highest arm_freq.  Edit the /boot/config.txt, add force_turbo=1 then reboot the Raspberry Pi for changes to take effect.

Changing memory split
Not strictly speaking speaking overclocking, but the memory used by the GPU can be changed. To change the memory used by the GPU down to a minimum of 16MB add the gpu_mem value to /boot/config.txt, then reboot the Raspberry Pi for changes to take effect.

Cross building
Building almost anything on the Raspberry Pi takes a very, very long time - especially when there are a lot of dependencies involved.

Fortunately, you can offload much of the heavy lifting work to a more powerful system (such as your main gentoo desktop/server) using crossdev and distcc.

It is suggested that the first package you build on the Raspberry Pi should be distcc, as this will dramatically speed up subsequent packages.

distcc
On all distcc build servers and on the Raspberry Pi, you will need to install distcc:

Edit the distcc config file to ensure it is on the right subnet for your network configuration, for example:

Then register and start the distcc daemon:

On the Raspberry Pi
Tell portage to use distcc:

(Optional) Also add to FEATURE "buildpkg" to tell the Raspberry Pi to build package files for everything it builds (if you want to use the same setup on multiple Raspberry Pis without recompiling):

Edit the distcc host file to tell your Raspberry Pi to submit compile jobs to your server:

Now you will need to tell distcc the specific compiler name to use instead of just "gcc":

We need to replace those symlinks with the following script:

crossdev
This will setup crossdev on your beefy server, so that it can compile binaries compatible with the Raspberry Pi.

Install :

You will need to maintain separate portage profiles for the Raspberry Pi and your server's default, so you must convert your existing profile files to folders. Copy the following file to ~/convert-profile-to-files.sh, and then run it as root:

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

Install Video Core Userland tools and libraries
The ARM side libraries for interfacing to Raspberry Pi GPU are included in a package raspberrypi-userland. Which includes the Video Core tools, GLES2, EGL, openmax and openVG libs that support the Raspberry Pi GPU.

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