Raspberry Pi/Installation



The Raspberry Pi is series of single-board computers based on ARM devices. Raspberry Pi 1 is based on BCM2835 SoC and features a single core CPU (ARMv6), with 512 MB RAM. Earlier models had 256 MB RAM.

Raspberry Pi 2 is based on BCM2836 SoC and features a quad-core CPU (ARMv7) and 1 GB RAM. The model 1 uses an SD card for storage but the model 2 uses a microSD. All versions have a VideoCore IV GPU.

This document describes how to install Gentoo on the Raspberry Pi 1 and 2.

Partitioning
Check that SD card is compatible.

Create at least two partitions on the SD card - boot partition should be FAT32, and root partition can be any preferred filesystem.

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

Boot partition
The partition needs the following proprietary firmware files, provided by the Raspberry Pi foundation:

To boot the Raspberry Pi with  setting in, following files are required:

Create a file called to specify necessary kernel parameters. Example:

These are available as:

Stage 3
Download appropriate Stage 3.

For Raspberry Pi A, A+, B, B+:

For Raspberry Pi 2:

Extract root filesystem to SD card:

For Raspberry Pi A, A+, B, B+:

For Raspberry Pi 2:

Adjust make.conf:

Do not forget to adjust fstab. The SD card is recognized as ).

Generate the root password hash by:

Add this hash to.

Stage 4
There is also an option of a self-booting Gentoo tarball (Stage 4), it can be downloaded from here. Please note this image is outdated and unmaintained however

NOOBS image. The NOOBS image will be created on a daily basis. I'd be pleased to get feedback...

NOOBS images can be downloaded from here: https://github.com/raspberrypi/noobs, then untar the NOOBS image from above in the OS directory.

Portage tree
Download the latest portage tree:

Ensure there are enough inode blocks free on the root partition. Portage takes up approximately 181K.

Untar portage on the SD card:

crossdev
Install :

Create a cross toolchain for ARM: (drop  if it's planned to run an unstable system) (make sure PORTDIR_OVERLAY is defined in the  first):

For Raspberry Pi A, A+, B, B+:

For Raspberry Pi 2:

For Raspberry Pi 3 B:

If there are any errors or portage warnings here, please fix them. It takes a while until the cross toolchain is successfully set up, so go grab a coffee. :-)

Kernel and modules
Download kernel sources for Raspberry Pi from GitHub

Alternatively:

Manual compilation
Configure and install kernel manually:

For Raspberry Pi A, A+, B, B+:

For Raspberry Pi 2:

Using genkernel
Genkernel can be used to crosscompile kernel for Raspberry Pi. With genkernel all the preferences can be saved in file for later use. The values of these variables need to be changed in :

After saving the configuration file (for example to ), mount the RaspberryPi SD card to the INSTALL_MOD_PATH configured above. Assuming the Raspberry Pi root partition device is, run:

Now execute genkernel. For Raspberry Pi A, A+, B, B+:

For Raspberry Pi 2:

Save the above command to the custom script:

Now simply create kernel for the Raspberry Pi by executing:

Installing kernel image
For Raspberry Pi A, B, B+ (Not 2 B) create a file by:

or using the Raspberry Pi mkimage tool from GitHub:

Raspberry Pi 2 B just copy to

It may be necessary to copy updated dtb files into the boot partition, too:

That's it!

Tips and tricks

 * Storage is rather slow, even with the couple of compatible SDHC class 10 cards. If emerge will be running on the Raspberry Pi, putting on squashfs will speed up things dramatically.


 * There is no hardware RTC on the Raspberry Pi. Use the service to set the correct system time on boot. A fallback incremental clock can be archived by the  service (replaces the  service).


 * If more RAM is required for Linux, set the option gpu_mem in . The smallest amount that can be set is 16 MB, default is 64 MB


 * More recent, unofficial kernel releases for the Raspberry Pi might be found at Chris Boot's repository:


 * Be sure to test the performance - if the 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 it is not possible to create a working ARM cross-toolchain, a precompiled kernel image is available from the firmware repository. The needs to be places in the boot partition and the contents of the modules directory copied to  on the SD card.


 * Put the root-fs on a NFS share and put only the kernel image on SD card (PXE boot client).

Troubleshooting

 * Problem: dmesg is full of  and/or page allocation failure messages:
 * Solution: Try to update all firmware files in, especially fixup.dat.
 * Solution: If the former fails, add  to kernel parameters, or   to


 * Problem: The following error shows up when running the command:
 * Solution: Try the following command instead :

External resources

 * Raspberry Pi Hub at eLinux wiki, with more advanced tutorials to get the most out of the Raspberry Pi
 * grbd@github: Putting Gentoo onto a RPI2 How-To install Gentoo Linux from Raspbian/NOOBS in an external USB disk in a Raspberry Pi 2.
 * genBerry Sort of Gentoo stage 4 for RaspberryPi with several tools.
 * gentoobs Gentoo on NOOBS.

Books

 * Heitz, Ryan. Hello! Raspberry Pi. Manning Publications (2015). pp. 225. ISBN 9781617292453