View previous topic :: View next topic |
Author |
Message |
alamahant Advocate
Joined: 23 Mar 2019 Posts: 3918
|
Posted: Mon Aug 30, 2021 7:26 pm Post subject: arm64 Gentoo on RPI4 --the easy way |
|
|
Hi Guys
Recently I played around a bit with arm64 Gentoo on RPI4.
Here are some tips to make your life a little easier.
1.
Do not spend any time pondering about qemu-chroots or cross-compile headaches.
Just get the Devuan arm64 image https://arm-files.devuan.org/devuan_beowulf_3.1.0_arm64_rpi4.img.zip and write the image on a 16G mini sd card plugged into your computer.
Code: |
zcat <image> | dd of=/dev/<sd-card> bs=64k oflag=dsync status=progress
|
Then plug the sd card in RPI4 connect hdmi ethernet mouse and keyboard and boot into it.
That would suffice to enable you to chroot into the Gentoo system you are going to build BUT if you wish you could also install a full DE(preferable).
2.
Plug an sd card adaptor into the USB3 port of RPI4 and insert a second sd card into it.
Reboot
3.
Now it will be a normal by the book building of a Gentoo system.
Create inside Devuan a chroot-script to make chrooting into your arm64 Gentoo easier.
You need of course the aarch64 tarball.
Everything is like a normal install.
In make.conf I have
Code: |
# These settings were set by the catalyst build script that automatically
# built this stage.
# Please consult /usr/share/portage/config/make.conf.example for a more
# detailed example.
#COMMON_FLAGS="-O2 -pipe"
COMMON_FLAGS="-march=native -mtune=cortex-a72 -ftree-vectorize -O2 -pipe -fomit-frame-pointer"
CFLAGS="${COMMON_FLAGS}"
CXXFLAGS="${COMMON_FLAGS}"
FCFLAGS="${COMMON_FLAGS}"
FFLAGS="${COMMON_FLAGS}"
# WARNING: Changing your CHOST is not something that should be done lightly.
# Please consult https://wiki.gentoo.org/wiki/Changing_the_CHOST_variable before changing.
CHOST="aarch64-unknown-linux-gnu"
PORTDIR="/var/db/repos/gentoo"
DISTDIR="/var/cache/distfiles"
PKGDIR="/var/cache/binpkgs"
PORTAGE_TMPDIR=/var/tmp/portage
MAKEOPTS="-j4"
# NOTE: This stage was built with the bindist Use flag enabled
# This sets the language of build output to English.
# Please keep this setting intact when reporting bugs.
LC_MESSAGES=C
ACCEPT_LICENSE="*"
EMERGE_DEFAULT_OPTS="--ask --quiet-build=y"
VIDEO_CARDS="vc4 v3d"
INPUT_DEVICES="libinput"
USE="gtk3 egl gles1 gles2 opengl -systemd elogind policykit -consolekit -udisks openssl pulseaudio -gnome -gnome-keyring -clang -llvm -spidermonkey"
|
-j4 works just fine.
In 4Gig ram version I feel /var/tmp/portage on tmpfs is not realistic but I plan to try it in the 8Gig version soon.
4.
For web browser install flatpak.
Then install maybe chromium,midori or other.
Firefox is NOT available.
VLC flatpak works also well.
You will be unable to start chromiium UNLESS you rebuid
Code: |
USE="-suid" emerge -1av bubblewrap
|
Plz make it permanent via package.use.
5.
In
/etc/portage/package.use/00cpu-flags
insert
Code: |
*/* CPU_FLAGS_ARM: edsp neon thumb vfp vfpv3 vfpv4 vfp-d32 crc32 v4 v5 v6 v7 v8 thumb2
|
6.
I git-cloned
https://github.com/raspberrypi/firmware
and copied /boot/* and modules/* into the respective places in my install(/boot and /lib)
7.
I copied cmdline.txt and config.txt from Devuan to Gentoo.
my sample cmdline.txt
Code: |
console=serial0,115200 console=tty1 root=PARTUUID=d58e74a5-a8de-4c47-9916-1d86a3a3d575 rootfstype=ext4 elevator=deadline fsck.repair=yes logo.nologo net.ifnames=0 rootwai
|
...and config.txt
[url]
https://pastebin.com/sru3hh2S
[/url]
Plz use the ...l8 kernel.
8.
Install dracut,look at /lib/modules and run
Code: |
dracut --kver <kernel-version8-as-seen-in-/lib/modules>
|
Edit config.txt to add an initrd entry for your newly created initrd.
9.
In fstab i USE only PARTUUIDs for / /boot / swap and others.
10.
Plz follow Neddy's excellent tutorials on RPI and also for making any external ssd fs-trimable.
11.
rsync your / from sd to ssd and modify fstab and cmdline.txt.
12.
I suppose one could even install arm64 Gentoo from an amd64 Gentoo WITHOUT even chrooting.Just use the binary kernel provided by raspberrypi and add root password directly via /etc/shadow.I will do some testing on that soon.So this becomes a more generic question of "Can one install a Gentoo system without the need of chroot?"
_________________
|
|
Back to top |
|
|
NeddySeagoon Administrator
Joined: 05 Jul 2003 Posts: 54578 Location: 56N 3W
|
Posted: Tue Aug 31, 2021 3:12 pm Post subject: |
|
|
alamahant,
If you use the Foundation kernel, no initrd is required.
I've made one for root in LVM, just to see if it worked and tested root in LVM without an initrd.
The first works, second fails as the kernel tries to set up the root logical volume before the SD card is detected.
Flatpack is hardly the Gentoo way is it. :) _________________ Regards,
NeddySeagoon
Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail. |
|
Back to top |
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
|