User:NeddySeagoon/Pi3

Background
Its been 4 years since the Raspberry Pi B was launched' with 256Mb RAM and a single core, 700MHz, armv6j CPU.

Installing Gentoo was pretty much a matter of following the handbook and adding in cross distcc to speed things up.

The Pi3 is provided with 32 bit software. Its a four core armv7a CPU on the surface. The tried and tested install methods should still work.

If you just want to drive your Ferrari to the corner shop, that's well documented on this wiki

The article is about running Gentoo on the Pi 3 in 64 bit mode, as an armv8-a. That's what the CPU is capable of. There is no handbook nor any stage files for that yet.

The Raspberry Pi 3 is a bit of a dog on the I/O front. The four USB ports and the Ethernet port are all on a singe USB2 interface from the CPU. That's unchanged is the last four years. The new WiFi and Bluetooth are grafted onto the SD card interface, so they contend for the available bandwidth too.

Overview
As there is no stage files, the conventional chroot install is out of the question. There is nothing to chroot into. The workaround for that is to build some armv8-a code on some other system in a process known as cross compiling.

Cross compiling is the process of building packages on one architecture, (the build host) that are intended to run an another architecture (the target). I will be building an amd64 for armv8a

That's a little bit of an exaggeration. If your 64 bit cross compiled kernel can get as far as a console, you may get kernel error messages.

Getting Started
On your main Gentoo system. There are other parameters you can pass to crossdev too.

This will create a cross toolchain that builds things into /usr/aarch64-armv8a-linux-gnueabi/ This is the build root.

cross make.profile
The cross make.profile (by hand)

Or use another arm64 profile that's more to your liking. Don't use eselect profile.

Cross Building Packages
Execute

This sets up some symlinks so that

uses emerge, with the cross toolchain to install armv8a packages into /usr/aarch64-armv8a-linux-gnueabi

emerge-wrapper needs to run every time you open a new shell to cross compile in.

Random Warnings And Caveats
emerge sys-boot/raspberrypi-mkimage

/usr/aarch64-armv8a-linux-gnueabi/ is empty when you start to cross compile. In theory will cross compile the system set. It will have a good go but it will fail for a number of reasons. * To avoid circular dependencies the @system set is assumed to always be present. * Some build systems don't support cross compiling * arm64 is not well tested - don't even think of using ACCEPT_KEYWORDS=arm64 * expect to use the keyword ** on a number of packages

USE=-cxx aarch64-armv8-linux-gnueabi-emerge @system -uDNav almost works.

Missing deps - fix by hand

gcc - uses wrong linker /usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/../../../../x86_64-pc-linux-gnu/bin/ld sys-apps/util-linux fails configure: error: udev selected but libudev not found even when libudev built sys-devel/llvm needs dev-util/ninja which fails using x86_64 tools

groff

checking whether g++ accepts -g... yes checking that header files support C++... no configure: error: header files do not support C++

udev builds eudev fails.

@system is enough to boot ... but you need a 64 bit kernel too.

armv8a is not well tested - be prepared keyword things you want to try

Optional Additions to @system USE="-cxx -fortran" aarch64-armv8a-linux-gnueabi-emerge dcron metalog ntpd dhcpcd wpa_supplicant

USE="-cxx -fortran" aarch64-armv8a-linux-gnueabi-emerge sudo hexedit leafpad app-misc/screen orage eix genlop gentoolkit layman mirrorselect ufed mupdf wgetpaste strace fortune-mod-all alsa-utils x11-ssh-askpass acl iproute2 usbutils distcc dosfstools linux-firmware xorg-server xfce4-terminal xfwm4-themes thunar xfce4-meta xfce4-mixer xfce4-mount-plugin xfce4-taskmanager xfce4-verve-plugin Gets 301 packages to cross compile. Fails

libepoxy

graphite2 -- Check for working CXX compiler: /usr/bin/g++ -- Check for working CXX compiler: /usr/bin/g++ -- broken CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:54 (message): The C++ compiler "/usr/bin/g++" is not able to compile a simple test program.

libical -- Check for working CXX compiler: /usr/bin/g++ -- Check for working CXX compiler: /usr/bin/g++ -- broken CMake Error at /usr/share/cmake/Modules/CMakeTestCXXCompiler.cmake:54 (message): The C++ compiler "/usr/bin/g++" is not able to compile a simple test program.

fortune-mod /bin/sh: line 6: ../util/strfile: cannot execute binary file: Exec format error

libgpg

gnome-icon-theme checking icon-naming-utils >= 0.8.7... no configure: error: icon-naming-utils >= 0.8.7 is required to build and install gnome-icon-theme

everything that needs C++

mupdf

perl I used the command:

aarch64-armv8a-linux-gnueabi-gcc -o try -march=armv8-a -O2 -pipe -fomit-frame-pointer -DOVR_DBL_DIG=14 -Wl,-O1 -Wl,--as-needed try.c -lpthread -lnsl -ldb -ldl -lm -lcrypt -lutil -lc ./try

and I got the following output:

/bin/sh: ./try: cannot execute binary file: Exec format error The program compiled OK, but exited with status 126.

dialog /usr/lib/gcc/x86_64-pc-linux-gnu/5.3.0/../../../../x86_64-pc-linux-gnu/bin/ld: .libs/trace.o: Relocations in generic ELF (EM: 183) .libs/trace.o: error adding symbols: File in wrong format collect2: error: ld returned 1 exit status

screen configure: error: in `/usr/aarch64-armv8a-linux-gnueabi/tmp/portage/app-misc/screen-4.3.1-r1/work/screen-4.3.1': configure: error: cannot run test program while cross compiling See `config.log' for more details

dbus-glib

Copy /usr/aarch64-armv8a-linux-gnueabi/ to the root partition on your microSD card.

Configuring the system
Follow Configuring the system in the handbook. Adjust the paths given. Root is now.

Follow the handbook to set up services ... almost because you can't chroot in Populate

boot default  shutdown  sysinit

with symlinks in lieu of rc-update.

edit fstab.

Boot

https://www.raspberrypi.org/forums/viewtopic.php?f=72&t=137963 There is a config.txt entry to make the ARM start in 64-mode. arm_control=0x200

Kernel https://github.com/raspberrypi/linux/ rpi-4.1.y has been updated fo the Pi3 but only 32 bit mode.

Booting In 64 Bit Mode
Best test your serial console in 32 bit mode first. Its all you will have so you want to know it works You will need to add force_turbo=1 in config.txt to get the right baud rate.

Its 115200n1 for setting up minicom.