PINE64 ROCKPro64/Installing Gentoo

The basic installation for the RockPro64 is VERY similar to the amd64 guide, so much so that only the differences will be documented.

NOTE: Although other processes may be viable, this document only covers the procedure I follow and test with!

The main amd64 installation guide is Handbook:AMD64/Installation/Media - Readers are encouraged to review it and become familiar before starting the RockPro64 installation; be sure to pay close attention to the required changes outlined in the sections below.

Preparing the system
It is highly recommend to attach a serial console until the device is fully configured! It is necessary to have the "Das U-boot" firmware stored in the onboard SPI device. The documentation for attaching a serial console and for writing the U-boot firmware to the SPI device can be found on the upstream wiki: https://wiki.pine64.org/wiki/ROCKPro64

Preparing the SDHC card with the prebuilt aarch64 boot image
Follow the general guidelines of the "Obtain the media" section of the amd64 guide. The difference is that an aarch64 ARM image is required. These can be found at: https://www.gentoo.org/downloads/ or one of the many Gentoo mirrors. Make sure to download the arm64 minimal installation CD image and follow the amd64 guide to write it to a SDHC card.

Once this is done, you will be able to boot into the install image and the real fun begins...

Please note: When booting from the installation CD image, the screen will remain blank for about a minute before you get the login prompt.

If you have a serial console, the system will appear to hang for almost 45 seconds after "random:fast init done"... just be patient; this is normal.

See the following serial console output:

'''The disk MUST partitioned with an EFI partition as outlined in the amd64 guide. The author of this page has only tested with GPT, not MBR partitioning.'''

It is recommended an 8 GiB swap partition is defined.

... then follow the amd64 installation guide for several pages, with the only (obvious) difference being the selection of an arm64 stage3 tarball instead of the amd64 variant.

After installing the stage 3 tarball
To optimize the compiler flags for a RockPro64 system (at the expense of being POSSIBLY being able to mover the boot disk to a different arm system...), add the following edits to the CFLAGS variable in Portage's file:

Configuring the bootloader
NOTE: I have only tested using GRUB2 - if you want to try LILO and figure it out, please update this article!

You MUST install the standalone version of GRUB, which is in fact an EFI module. This is why you MUST have partitioned the disk with an EFI system partition...

I install on to an external SATA SSD, so that is what is outlined in the steps below. Once running on the SSD, I have used the same method to configure SDHC cards successfully, the only difference being the Linux device names and EFI device names used.

Notes on the GRUB configuration file above:


 * The serial port is configured - note the default baud rate and the fact that it is S2, not S0
 * On the "set root" line, the disk numbering is kind of wonky. The SDHC card is enumerated as hd1 on my system, even though it has boot priority
 * Note: if in doubt about your EFI device names or you guess incorrectly, you can type "c" during the 5 second GRUB delay to drop into the command line. The ls command can then be used to determine device naming.
 * On the linux line, change to "root=/dev/mmcblk1p3" if you are configuring a SDHC card
 * You need to change the kernel and initramfs version numbers to match your environment

Installing a standalone version of GRUB
NOTE: I create a /boot/efi directory on my disk, and I mount the EFI partition there:

The command to install the standalone GRUB image is

NOTE: my grub.cfg file is in the /root directory, change the path in the "boot/grub/grub.cfg=" to reflect where the grub.cfg file was created.

You may now shutdown, remove the install CD image, and boot your new Gentoo installation.

Big Endian Support
If you don't know what this means, you don't need it...

I have successfully created a big endian port. I am documenting the procedure to run big endian mode and submitting the patches over the next few weeks.

A Stage 3 tarball and bootable SDHC images for big endian can be found here:

https://github.com/rorybolt/Gentoo-aarch64_be

NOTE: video output is currently not available for the big endian port - a serial console is required.

After all the sources are cleaned up and published, I will fix the rockchip video driver, which is currently not endian clean...

The endian wars have ended. Little endian won. But writing code (specifically code that interacts with hardware) that is endian neutral is a "Good Thing", so I wanted a big endian system to test on. The RockPro64 is an affordable system that supports big endian operation AND has a PCIe x4 slot! Hurray!