Linux, 工作, 生活, 家人

Gentoo, ARM

Gentoo ARM64 UEFI Install Guide

This is not a detail guide to describe how to full install system, just figure out some important point. Even not for Gentoo newbie.

Most important handbook is Gentoo AMD64 installation guide.
There is some different between ARM64 and AMD64

2021/08/31 Updated : No more need Ubuntu ISO image, ARM64 EFI minimal ISO can be download from official website:

Some ARM64 platform support UEFI bios system, like Ampere Computing Altea or Marvell ThunderX.
Recently Linux like CentOS or Ubuntu can support both system, but not for Gentoo ARM64 project,
if you want to install Gentoo on ARM64 bare system, it needs some trick skill.

Install System

Gentoo ARM64 install, it needs to relay on other OS’s installation software.
I were using Ubuntu/Debain net-inst to install system, below is my nvme driver partition table.

/dev/nvme0n1p1 (bootloader/efi) 500MB for EFI only
/dev/nvme0n1p2 / 800G for Gentoo system
/dev/nvme0n1p3 / 90G for Ubuntu system

Suggest to keep a ubuntu system for booting, it can be rescue system when fail to boot Gentoo system.

After Ubuntu/Debian installed system, it can go back to installation menu, there is a execute shell on menu, run it.

Decompress Gentoo Stage3 File.

Most challenge thing is, Ubuntu/Debian installation rootfs, there is no unbzip function, that’s means it needs to use installed disk and used the Ubuntu system’s bzip2. below is my command to untar it.

# use gentoo iso cdrom boot
# mount /dev/nvme0n1p3 /mnt/gentoo
# cd /mnt/gentoo
# wget
# tar xvf stage3-arm64-systemd-20210829T233646Z.tar.xz
# mount --bind /proc proc
# mount --bind /dev dev
# mount --bind /sys sys
# mount --bind /sys/firmware/efi/efivars/ ./sys/firmware/efi/efivars/
# cp /etc/resolv.conf /mnt/gentoo/etc/
# cd ..
# chroot gentoo 

>>>> chroot to ubuntu 
# mkdir  -p /mnt/gentoo
# mount /dev/nvme0n1p2 /mnt/gentoo 
# cd /mnt/gentoo 
# wget
# tar xvzf stage3-arm64-systemd-20190925.tar.bz2
# mount --bind /proc proc
# mount --bind /dev dev
# mount --bind /sys sys
# cp /etc/resolv.conf /mnt/gentoo/etc/
# cd ..
# chroot gentoo

Yaa.. We got Gentoo file system .

Gentoo Kernel

Suppose that reader know how to configure hostname , fstab, emerge –sync … etc.

Next step is to install Gentoo kernel, I will show how to use genkernel to generate workable kernel for ARM64 system

*Note: Some install command might need to unmask or add accept keyword, will ignore that, please try add “–autounmask-write” and run command “etc-update” to update it.

# mkdir -p /boot/efi
# mount /dev/nvme0n1p1 /boot/efi
# echo 'GRUB_PLATFORMS="efi-64"' >> /etc/portage/make.conf
# emerge --ask sys-boot/grub:2
# emerge efibootmgr
# grub-install --target=arm64-efi --efi-directory=/boot/efi --bootloader-id=Gentoo

If have problem on the stage, and it shows cannot find /dev/md0, it needs to emerge mdadm package.

Compile Linux Kernel

# emerge gentoo-sources 
# emerge genkernel
# genkernel --menuconfig all

genkernel will let you choice kernel configure before compile it. Please enable those options, Gentoo kernel didn’t enable ARM’s serial port by default.

Device Drivers  --->
	Character devices  --->
		Serial drivers  --->
			 <*> ARM AMBA PL010 serial port support
			[*]   Support for console on AMBA serial port
			 <*> ARM AMBA PL011 serial port support
			[*]   Support for console on AMBA serial port
                        [*] Early console using ARM semihosting

Save it and quit.

Next step is edit /etc/default/grub and add “console==ttyAMA0” to /etc/default/grub


Update grub.conf

grub-mkconfig -o /boot/grub/grub.cfg

Check UEFI Boot Priority

Run efibootmgr and get boot priority

# efibootmgr
BootCurrent: 0003
Timeout: 5 seconds
BootOrder: 0003,0001,0002,0004
Boot0001* ubuntu
Boot0002* UEFI: PXE IP4 Intel(R) Ethernet Server Adapter I210-T1
Boot0003* Gentoo
Boot0004* UEFI: Built-in EFI Shell

It can see current boot and boot order here , if Gentoo is not first priority, it can use option “-o” to update it.


if you choice systemd as your service manager, after install openssh, please run command below to activate it and as default service.

# systemctl enable sshd.service
# systemctl start sshd.service
# systemctl status sshd.service


I have write down my note here, good luck to you if you have the same question then get this webpage.