Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Native RPi4B 64bit Gentoo Install Instructions [old info]
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM
View previous topic :: View next topic  
Author Message
flysideways
Guru
Guru


Joined: 29 Jan 2005
Posts: 437

PostPosted: Thu Dec 17, 2020 6:12 pm    Post subject: Native RPi4B 64bit Gentoo Install Instructions [old info] Reply with quote

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:


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
Back to top
View user's profile Send private message
ian.au
Guru
Guru


Joined: 07 Apr 2011
Posts: 591
Location: Australia

PostPosted: Tue Jan 11, 2022 6:04 am    Post subject: Reply with quote

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:
Quote:

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:
/boot # emerge --ask sys-boot/raspberrypi-firmware
step from your workflow.

Cheers,
Ian
Back to top
View user's profile Send private message
flysideways
Guru
Guru


Joined: 29 Jan 2005
Posts: 437

PostPosted: Tue Jan 11, 2022 1:17 pm    Post subject: Reply with quote

added 01-22 edit
Back to top
View user's profile Send private message
usta
n00b
n00b


Joined: 02 Jun 2020
Posts: 6

PostPosted: Mon Mar 07, 2022 4:45 am    Post subject: Reply with quote

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
Back to top
View user's profile Send private message
flysideways
Guru
Guru


Joined: 29 Jan 2005
Posts: 437

PostPosted: Mon Mar 07, 2022 1:07 pm    Post subject: Reply with quote

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.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo on ARM All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum