Install via Raspberry os first

Install Raspberry PI OS and then move to Gentoo.

Original instructions

Rewrite of the original instructions with some bugs in the first section (emerge is not available for debian)

and finally something recently from the forum

The following are just some clarifications, corrections and options.

Since it compiles everything using the Raspberry RAM can be an issue and a reason for crash. Taking a model with much memory is a wise option. To reduce required RAM just one CPU can be enabled. To get more memory an old USB stick can be prepared to get swap.

Install Raspberry OS Desktop Version 64bit onto a SDcard following the normal procedure. Then boot and make the system happy.

Open the website and follow the AMD64 handbook (unfortunately there is no arm64 handbook). Open a console where then commands can be copy from the handbook and pasted in the console.

Enter a 2nd at least 32GByte empty SDcard in the Raspberry where Gentoo will be installed.

Don't mount it, since it has to be partitioned first and then manually mounted according the handbook.

The 2nd SDcard will probably appear as /dev/sda verify it with sudo fdisk -l and then do the partitioning and formating

/dev/sdx1 128M c W95 FAT32 (LBA)

/dev/sdx2 2G 82 Linux swap / Solaris

/dev/sdx3 27G 83 Linux

mkfs.vfat -F 32 /dev/sd<x>1

mkfs.ext4 -T small /dev/sd<x>3

mkswap /dev/sd<x>2

swapon /dev/sd<x>2

When it comes to downloading the stage, then obviously arm64 as OpenRC has to be taken.

The following Raspberry packages need to be installed


emerge sys-fs/dosfstools to deal with the /boot partition

emerge -vDa Raspberrypi-firmware gets files for /boot as bootcode.bin. It requires the Raspberry-videocore-bin license as to be added on /etc/portage/make.conf or a license group that covers it

emerge -vDa Raspberrypi-image gets the compiled kernel and modules

Set CPU_FLAGS_ARM: emerge -av cpuid2cpuflags

echo "*/* $(cpuid2cpuflags)" > /etc/portage/package.use/00cpuflags

emerge gentoolkit

emerge elogv to see in the consoler the elogs of the emerge process

emerge portpeek

emerge smart-live-rebuild

emerge htop

emerge syslog-ng to get log messages and emerge logrotate to limit the size the logs take

emerge Raspberrypi-userland Raspberry Pi userspace tools and libraries


Usually preprepared kernels are included and installed via emerge -vDa Raspberrypi-image

To get a more actual and better optimized get the kernel sources

emerge -vDa Raspberrypi-sources gets one of then many kernel sources

If it comes to the kernel compilation make help shows the options make bcm2711_defconfig creates the .config file for the Raspberry4 (make bcmrpi3_defconfig does it for the Raspberry 3)

make install adds a kernel as /boot/vmlinuz-5.15.84_p20230106-Raspberrypi-v8 to have this kernel started add to /boot/config.txt


Realtime clock

The Raspberry has no hardware battery operated real time clock so rc-update add swclock boot and rc-update del hwclock boot. Check the date using date.


To have WLAN support:

emerge iw

emerge wpa_supplicant

emerge Raspberrypi-wifi-ucode

rc-update add wpa_supplicant default and create a configuration file named /etc/wpa_supplicant/wpa_supplicant.conf. An example configuration file is available for reference in /usr/share/doc/wpa_supplicant-<xxx>/


  ssid="<The name of the Accesspoint>"
  psk="<the password>"
  # The higher the priority the sooner we are matched

Hardware Random generator

emerge -av rng-tools

cat /lib/modules/$(uname -r)/modules.builtin | grep rng to see if the module has been compiles and added in the kernel

If the module is not in the kernel do:

mkdir /etc/modules-load.d/

echo 'bcm2835-rng' > /etc/modules-load.d/random.conf

Start it during boot

rc-update add rngd boot


There is the kernel module bcm2835_wdt and if the kernel has loaded it then the file /dev/watchdog exist.

sudo cat > /dev/watchdog wakes up the watchdog and since it will not be kicked a reset occurs after the timeout.

There is the watchdog daemon sudo apt-get install watchdog with its configuration file /etc/watchdog.conf

There are settings as when a file (hopefully in RAM) is not written for a time, then it triggers.

Linurs startpage