PINE64 ROCKPro64/Installing Gentoo

The basic installation for the RockPro64 is VERY similar to the amd64 guide, so much so that I will just document the differences...

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 - I encourage you to read through it and become familiar before starting the RockPro64 installation, and pay close attention to the required changes outlined below.

Preparing your system:
I highly recommend attaching a serial console until you have your device fully configured.

You will need to have "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 here: https://wiki.pine64.org/wiki/ROCKPro64

Preparing the SDHC card with the prebuild aarch64 boot image
Follow the general guidelines of the "Obtain the media" section of the amd64 guide. The difference is that obviously you will need a aarch64 ARM image. these can be found at:

https://www.gentoo.org/downloads/ or a mirror site. 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...

'''You MUST partition your disk with an EFI partition as outlined in the amd64 guide. I have only tested with GPT, not MBR partitioning.'''

It is recommended that you define an 8GB swap partition

... you will 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 you have installed the stage 3 tarball
If you want to optimize the compiler flags for your RockPro64 system (at the expense of being POSSIBLY being able to mover your boot disk to a different arm system...) you can add the following edits to the /etc/portage/make.conf file:

MAKEOPTS="-j6"

CFLAGS="-O2 -pipe -march=armv8-a+crc+crypto -mtune=cortex-a72.cortex-a53 -mfix-cortex-a53-835769 -mfix-cortex-a53-843419"

Configuring the bootloader
NOTE: this is the most non-obvious step in the whole procedure... take note!

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

You MUST install the standalone version of GRUB, which is in fact an EFI module. This is why you MUST have partitioned your disk with an EFI 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.

GRUB configuration file: set timeout=5

set default=0

menuentry Gentoo {

insmod part_gpt

set root=hd0,gpt3

echo Loading kernel...

linux /boot/vmlinuz-5.10.78-gentoo-dist root=/dev/sda3 console=ttyS2,1500000

echo Loading ramdisk...

initrd /boot/initramfs-5.10.78-gentoo-dist.img

} 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
 * 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: mount /dev/sda1 /boot/efi

mkdir -p /boot/efi/EFI/BOOT The command to install the standalone GRUB image is: grub-mkstandalone -O arm64-efi \

-o /boot/efi/EFI/BOOT/BOOTAA64.EFI \

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

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