Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Architectures & Platforms Gentoo on ARM
  • Search

Native RPi4B 64bit Gentoo Install Instructions [old info]

Gentoo on all things ARM. Both 32 bit and 64 bit.
Tell about your hardware and CHOST.
Problems with crossdev targeting ARM hardware go here too.
Post Reply
  • Print view
Advanced search
5 posts • Page 1 of 1
Author
Message
flysideways
Guru
Guru
Posts: 526
Joined: Sat Jan 29, 2005 1:06 pm

Native RPi4B 64bit Gentoo Install Instructions [old info]

  • Quote

Post by flysideways » Thu Dec 17, 2020 6:12 pm

This is an attempt to provide guidance, using the currently available tools and resources, for natively installing 64 bit Gentoo on a Raspberry Pi 4. This is more appropriate for a new Gentoo user than the currently available documentation that uses a different architecture. The goal is a bootable minimal Gentoo as the Handbooks provide.

The available hardware will be a non-Gentoo computer, an sd card adapter, one sd card to run from during the install and an sd card, usb thumb drive, or usb ssd that gentoo will be installed to and later run from.

Documents used for guidance:
  • Raspberry Pi Imager
    USB mass storage boot
    Gentoo AMD64 Handbook
    Gentoo Wiki Chroot
    Raspberry Pi 3 64 bit Install
    Raspberry Pi4 64 Bit Install
    gentoo-on-rpi-64bit
Preparation
If your intended final configuration is booting the Pi from the sd card in its slot, skip the next step.

If your intended final configuration is booting the Pi from USB mass storage, power up the Pi without any drive to confirm the bootloader EEPROM version as described in the USB mass storage boot link. If it needs updating, use the Raspberry Pi Imager to create the Raspberry Pi 4 EEPROM boot recovery image, and use it as directed.

Download genpi64.img.xz and use the Raspberry Pi Imager to burn it to the sd card. Boot the Pi from this card for the environment used while creating the following install.

The Build Environment
After the Pi has booted, open a browser and a terminal. This page and the accompanying references can be cut and pasted from to the terminal when appropriate.

The user will be demouser, the password for root is raspberrypi64. This document uses an su - into root rather than sudo, consistent with the amd64 Handbook. Two keyboard layouts are included, they are selected with the GB - US icon at the top right of the main window. If you are not getting the characters you expect, toggle the setting.

About the Gentoo Linux Installation
This is good reading.

Choosing the right installation medium
This has already been accomplished. sshd is started.

Configuring the network
The network should be available. Any needed configuration is easily accomplished in the gui.

Preparing the disks
This is accomplished with Partition the microSD card. Follow that through Make filesystems.

Installing stage3
This is accomplished with Fetch the Gentoo bits of the install. Use the command lsblk to see the devices. genpi64 booted from mmcblk0p1, and its root is on mmcblk0p2. Notice the mountpoint column. That will provide usefull information about what is mounted at any time during this install.

Follow the link to the current-arm64-stage3, and copy link location. Back in the terminal use wget and paste the link location. Unpack it and do the same for the gentoo repository snapshot. That link is on the current page and does not need to be followed. STOP. Do not start Populating /boot.

CFLAGS for /mnt/gentoo/etc/portage/make.conf are found here. The MAKEOPTS setting is dependant upon the ram available on the Pi being used. -j4 or -j5 on the 8gb Pi seems to not swap during builds, or only rarely.

Installing the Gentoo base system
Don't select the mirrors.
Copy the DNS info.
Follow the chroot instructions.
When mounting /boot use the correct /dev/xxxn location for the /boot partition, probably /dev/sda1.
# emerge-webrsync
Read the news
Leave the profile at default/linux/arm64/17.0 (stable) for now. Later after this minimal install has been booted, if you want a desktop, then change the profile to desktop and #emerge -avuDN @world. That will take a while.

**At this time, you may want to Configure locales. glibc will be included in the @world update. Without first setting your locale, it will emerge for all 489, instead ot the 3 to 5 depending on your selections. glibc emerge time without first completing Configure Locales 1hr3m25s, with Config Locales completed prior to emerge @world 33m55s.

root #emerge --ask --verbose --update --deep --newuse @world , that will take a while to complete.Follow the Timezone and Configure Locales instructions.

Configuring the Linux kernel
cd into /boot

*Omit this step as per Ian's post below. "/boot # emerge --ask sys-boot/raspberrypi-firmware"
/boot # emerge --ask --autounmask=True --autounmask-write sys-kernel/raspberrypi-image

Both packages have a message when they start to emerge that it is assumed you have no separate /boot. I have not emerged them outside of /boot but suspect that they write to the directory from which they are called. sys-kernel/raspberrypi-image emerges a compiled kernel and its modules.

/boot # emerge --ask media-libs/raspberrypi-userland

Configuring the system
Go to Setup and follow the Root Passwowd and /etc/fstab instructions. If you are booting from a usb device expect /dev/sdax in place of /dev/mmcblk0px.
Go back to the Handbook Networking information.

Installing system tools
Choose as appropriate.
root # emerge --ask net-misc/dhcpcd

Configuring the bootloader
There is not a bootloader like the amd64 needs. The required files are read from the boot partiion.
/boot/config.txt, should be adequate. You may want to uncomment disable_overscan=1.
/boot/cmdline.txt will need root=/dev/mmcblk0px or root=/dev/sdax, as appropriate.

Rebooting the system

Exit the chrooted environment and unmount all mounted partitions. Then type in that one magical command that initiates the final, true test: reboot.
root #exit
~#cd
~#umount -l /mnt/gentoo/dev{/shm,/pts,}
~#umount -R /mnt/gentoo
~#shutdown -h now
unplug the Pi

Finalizing
Put the drive you just intalled to into the appropriate socket, sd card or usb. Power it up and watch it boot.
Log in as root with raspberry as the password and complete the finalizing tasks.

Enjoy.

If it does not boot, boot back up using the genpi64 sd card and re-follow the instructions to mount and chroot.

Remember the intent was to have a 64 bit minimal Gentoo install for a Pi4B.

Any corrections or other input are welcome. I will do another install from this post to find any omissions or typos.

edits:
added autounmask to sys-kernel/raspberrypi-image
added comment about glibc emerge time
added comment to skip step per Ian's post, I have not done a fresh arm install in a few months and have not re-verified this guide in a while - 01/22
Last edited by flysideways on Sun Jan 30, 2022 7:03 am, edited 2 times in total.
Top
ian.au
l33t
l33t
User avatar
Posts: 620
Joined: Thu Apr 07, 2011 3:39 am
Location: Australia

  • Quote

Post by ian.au » Tue Jan 11, 2022 6:04 am

hi flysideways,
Thanks for putting this recipe together. I decided to give your method a run for an install on a new rpi4 - I think all the jumping around from HB to HB etc might be a bit daunting for a new user, but it achieves the objective of getting a booting minimal system in the end, so congrats ;)

It seems a change was made since you wrote this, so just FYI the following section could use a revision:
Configuring the Linux kernel
cd into /boot

/boot # emerge --ask sys-boot/raspberrypi-firmware
/boot # emerge --ask --autounmask=True --autounmask-write sys-kernel/raspberrypi-image

Both packages have a message when they start to emerge that it is assumed you have no separate /boot. I have not emerged them outside of /boot but suspect that they write to the directory from which they are called. sys-kernel/raspberrypi-image emerges a compiled kernel and its modules.
Note: If emerged outside of /boot the files will install to /boot if mounted or tell you to mount it if not ;)

/boot # emerge --ask media-libs/raspberrypi-userland
sys-boot/raspberrypi-firmware is now a dependency of sys-kernel/raspberrypi-image, which will try to pull the firmware package in whether the files exist or not. So, if it is already installed, portage will refuse to continue to image installation due to file collisions with cmdline.txt and config.txt, so the user gets a couple of screens of file collisions and no raspberrypi-image is installed. Can be worked around by removing/renaming the cmdline & config files, then you just get the pages of collisions, but the image file installs anyway.

So best to remove

Code: Select all

/boot # emerge --ask sys-boot/raspberrypi-firmware 
step from your workflow.

Cheers,
Ian
Top
flysideways
Guru
Guru
Posts: 526
Joined: Sat Jan 29, 2005 1:06 pm

  • Quote

Post by flysideways » Tue Jan 11, 2022 1:17 pm

added 01-22 edit
Top
usta
n00b
n00b
Posts: 6
Joined: Tue Jun 02, 2020 5:54 pm

  • Quote

Post by usta » Mon Mar 07, 2022 4:45 am

There is a more recent step by step installation guide for Gentoo 64 bit on RaspberryPi 4.

https://github.com/mck-sbs/gentoo-rpi-64-bit
Top
flysideways
Guru
Guru
Posts: 526
Joined: Sat Jan 29, 2005 1:06 pm

  • Quote

Post by flysideways » Mon Mar 07, 2022 1:07 pm

usta wrote:There is a more recent step by step installation guide for Gentoo 64 bit on RaspberryPi 4.

https://github.com/mck-sbs/gentoo-rpi-64-bit
The guide you are linking to uses a different architecture to cross-build the Gentoo install.

This guide was using the Pi to natively build the install, which is significantly different and supporting a minimal hardware investment.
Top
Post Reply
  • Print view

5 posts • Page 1 of 1

Return to “Gentoo on ARM”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy