https://wiki.gentoo.org/wiki/Raspberry_ ... it_Install
https://wiki.gentoo.org/wiki/Raspberry_Pi_VC4
Using a uSD card for the build process will wear it out pretty quickly. I just use the uSD
as a boot medium that specifies the real root device and the overlays to enable. You can
use multiple cards to have multiple boot configs. Note that this is not booting from USB,
that is about directly booting to a USB drive without a uSD card.
The following is what I would recommend based on my experience. I have recently
finished setting up an rpi 4b w/ 8G.
I've had issues using distcc and cross-compiling on x86 hosts. It probably works for a
lot of packages, but I had random crashes that went away when I used local building.
Just wasn't willing to spend the time to figure which packages are borked w/ distcc.
Package building can easily overheat the rpi, especially w/
MAKEOPTS="-j4".
Make sure to use a heat sink on the cpu and have fan cooling. There is an offical rpi
case fan for the offical rpi4 case. It can keep the cpu temp to about 65C. I think it
is moderately loud and not usable for a media center.
A good quality dc power supply and cable will also reduce the chances you will
have random behavior.
To get started use a kernel from sys-kernel/raspberrypi-sources. IIRC 5.10 kernels
are LTS so might not be too bleeding edge. Don't tweak the kernel or change use flags
from the stage3 until you can reliably boot your rpi. It will save you a lot of time.
With 4GB or less ram, use
MAKE_OPTS="-j2" or
MAKE_OPTS="-j1". You can add swap
to increase apparent memory size, but things will get really slow when you trigger a
lot of swapping. Even if the swap device is an ssd. So keep the parallelism down when
you don't have enough memory. You will still need to use -j1 for some large packages.
You don't say how much ram you have, but >= 4GB will be a much better experience.
If you can, exporting portage and distfiles from another machine via nfs can be useful. If
you have 8GB ram and have an intermediate knowledge of linux+portage, then use a tmpfs
for your temp dir. Otherwise export via nfs an area with a lot space for temp. IIRC the
default location for PORTAGE_TMPDIR is /var/tmp/portage.
With a 3.5G tmpfs I see the rpi4 is about 6-9 times slower than a Ryzen 5 3400G that
has a 16G tmpfs (out of 32G total ram). I still need to have libreoffice and some other large
packages use traditional storage for temp. Without a tmpfs for
/var/temp/portage, I
have seen rpi package builds that were >20 times slower. Especially if your portage temp
is on the same usb disk as / (even a usb3 disk). A tmpfs also speeds up compiling the kernel on
the pi. 4 hours vs 1:15 for some of the recent pi foundation kernels.
The following are some starters for using a tmpfs on an rpi w/ 8G. If it doesn't apply, or
doesn't look familiar then use an nfs export for
PORTAGE_TMPDIR.
Code: Select all
/etc/fstab:
tmpfs /var/tmp/portage tmpfs size=3500m,exec,suid,uid=root,gid=portage,mode=0770 0 0
<server>:/path/to/tempdir /mnt/disktmp nfs4 _netdev,proto=tcp6,async,rw,exec,soft 0 0
NOTE: drop the proto=tcp6 option if <server> doesn't have an ipv6 address.
/etc/portage/package.env/app-office:
app-office/libreoffice disktemp.conf
/etc/portage/env/disktemp.conf:
PORTAGE_TMPDIR="/mnt/disktemp"
/etc/portage/make.conf:
MAKE_OPTS="-j4"
VIDEO_CARDS="vc4 v3d"
If using a tmpfs amd you need to compile a kernel to handle special hardware, this will speed up kernel
builds:
Code: Select all
mkdir /var/tmp/portage/kbuild
cd /usr/src/<kernel-src-dir>
TMP=/var/tmp/portage/kbuild TMPDIR=/var/tmp/portage/kbuild make -j4