-
Locate target Disk
sudo fdisk -l
-
Format target Disk (Where X is your drive letter)
sudo fdisk /dev/sdX
Type the following letters and numbers to partition the drive
Command: n Partition number: 1 First sector: [ENTER] Last sector: +512M Remove signature: Y Command: n Partition number: 2 First sector: [ENTER] Last sector: [ENTER] Remove signature: Y Command: w
-
Format the new partitions
sudo mkfs.vfat /dev/sdX1 sudo mkfs.ext4 /dev/sdX2
-
Mount partitions
sudo mount /dev/sdX2 /mnt sudo mkdir /mnt/boot sudo mount /dev/sdX1 /mnt/boot cd /mnt
-
Install xz package if not already installed
-
Download and extract Gentoo tarball (Guide covers OpenRC)
Current stage3 tarballs here: http://distfiles.gentoo.org/releases/arm64/autobuilds/
wget http://distfiles.gentoo.org/releases/arm64/autobuilds/current-stage3-arm64-desktop-openrc/stage3-arm64-desktop-openrc-*date*.tar.xz sudo tar xvf stage3-arm64-desktop-openrc-*date*.tar.xz -C /mnt
-
Mount pseudo filesystems
sudo mount --rbind /sys /mnt/sys && sudo mount --make-rslave /mnt/sys sudo mount --rbind /dev /mnt/dev && sudo mount --make-rslave /mnt/dev sudo mount -t proc /proc /mnt/proc sudo mount --rbind /tmp /mnt/tmp
-
Copy DNS server settings from host
sudo cp /etc/resolv.conf /mnt/etc
-
Chroot into Gentoo mount
PS1="(gentoo chroot) # " sudo chroot /mnt /bin/bash
-
Configure Gentoo
mkdir /var/db/repos/gentoo env-update && . /etc/profile emerge-webrsync
-
Set root password
passwd
-
Create user account and setup sudo
useradd -m -G users,wheel,audio,video -s /bin/bash *username* passwd *username* emerge --ask --verbose app-admin/sudo visudo
Uncomment the following line:
# %wheel ALL=(ALL:ALL) ALL
-
Enable Networking
ln -s /etc/init.d/net.{lo,eth0} rc-update add net.eth0 default
-
Set Hostname
nano /etc/conf.d/hostname nano /etc/hosts
Add your hostname after ‘localhost’; example below:
127.0.0.1 localhost *hostname*
-
Configure DHCP
emerge --ask net-misc/dhcpcd rc-update add dhcpcd default nano /etc/conf.d/net
config_eth0=”dhcp”
Optionally, start the service now:
rc-service dhcpcd start
-
Configure Portage makefile
nano /etc/portage/make.conf
LLVM_TARGETS="ARM AMDGPU AArch64 BPF" L10N="en" LC_MESSAGES=C CPU_FLAGS_ARM64="neon" VIDEO_CARDS="amdgpu radeonsi" COMMON_FLAGS="-march=native -O2 -pipe" FCFLAGS="${COMMON_FLAGS}" FFLAGS="${COMMON_FLAGS}" CFLAGS="${COMMON_FLAGS}" CXXFLAGS="${COMMON_FLAGS}" CHOST="aarch64-unknown-linux-gnu" FEATURES="buildpkg parallel-fetch parallel-install" USE="${USE} X wayland vulkan elogind dbus opengl gnome gtk grub -systemd -tracker" EMERGE_DEFAULT_OPTS="--ask --jobs 12 --keep-going=y --autounmask=y --autounmask-continue" MAKEOPTS="-j12" ACCEPT_KEYWORDS="~arm64" ACCEPT_LICENSE="*" PORTAGE_NICENESS="16" GENTOO_MIRRORS=https://mirror.leaseweb.com/gentoo/ GRUB_PLATFORMS="efi-64"
-
Configure repositories
mkdir /etc/portage/repos.conf nano /etc/portage/repos.conf/gentoo.conf
[Default] main-repo = gentoo [gentoo] location = /var/db/repos/gentoo sync-type = rsync sync-url = rsync://namerica.gentoo.org/gentoo-portage auto-sync = yes
-
Cofigure Portage, system profile, and install packages
emerge --ask --oneshot sys-apps/portage emerge --sync eselect profile list
select the profile of your choice, example:
eselect profile set 5
-
Fully install and configure base system [May take a long time]
emerge --ask --verbose --update --deep --newuse @world
-
Get UUID of sdX1 and sdX2
blkid
-
Configure /etc/fstab, using the UUID’s found in the previous command
nano /etc/fstab
UUID=XXX-XXX /boot vfat rw,relatime,errors=remount-ro 0 2 UUID=YYY-YYY-YYY-YYY / ext4 rw,relatime 0 1 tmpfs /tmp tmpfs rw,relatime 0 0
-
Configure kernel system type
emerge --ask sys-kernel/installkernel-gentoo
-
Installing the Kernel
Pre-built kernel binary:
emerge --ask sys-kernel/gentoo-kernel-bin sys-kernel/linux-firmware emerge --depclean
Source-built kernel:
emerge --ask sys-kernel/gentoo-kernel emerge --depclean
-
Loading modules
Either find the modules you need to load here:
find /lib/modules/<kernel version>/ -type f -iname '*.o' -or -iname '*.ko' | less
Or alternatively, check loaded host modules for reference:
exit lsmod PS1="(gentoo chroot) # " sudo chroot /mnt /bin/bash
Then, run the following and add kernel modules to the conf file:
mkdir -p /etc/modules-load.d nano -w /etc/modules-load.d/modules.conf
-
Set Keymap
nano /etc/conf.d/keymaps
Change country code (Where XX is code; Example: us)
keymap=XX
-
Install and enable System Logger (sysklogd)
emerge --ask app-admin/sysklogd rc-update add sysklogd default
-
Set Time Syncronization
emerge --ask net-misc/chrony rc-update add chrony default
-
Install Filesystem tools
emerge --ask sys-fs/e2fsprogs sys-fs/dosfstools
-
Install and configure GRUB
emerge --ask --verbose sys-boot/grub grub-install --target=arm64-efi --efi-directory=/boot --bootloader-id=Gentoo grub-mkconfig -o /boot/grub/grub.cfg
-
Reboot and enjoy!
Optional: Installing GNOME (Can be done before reboot)
Update system:
emerge --sync emerge --deep --with-bdeps=y --changed-use --update --ask --verbose @world
Install and configure X11:
echo -e “media-libs/mesa xa” >> /etc/portage/package.use/mesa emerge --ask --verbose --oneshot x11-base/xorg-server x11-base/xorg-drivers usermod -a -G plugdev *username*
Install GNOME:
emerge --ask --verbose --keep-going gnome-base/gnome gnome-base/gdm
Change and configure Display Manager:
nano /etc/conf.d/display-manager
CHECKVT=7 DISPLAYMANAGER=”gdm”
emerge --ask --noreplace gui-libs/display-manager-init
Update OpenRC:
emerge --ask --verbose app-admin/openrc-settingsd rc-update add dbus default rc-update add display-manager default rc-update add openrc-settingsd default rc-update add elogind boot
Update GRUB with AMDGPU patch:
nano /etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="amdgpu.pcie_gen_cap=0x4"
grub-mkconfig -o /boot/grub/grub.cfg
Reboot!