§2023-08-19
By chatGPT
Installing Gentoo Linux on an Orange Pi 5 Plus involves a complex set of steps, and the process may require some Linux knowledge and experience with command-line operations. Here's a general guide to get you started, but keep in mind that the exact steps might vary based on hardware specifics and Gentoo's updates beyond my last training data in September 2021.
Using n2MnJaro.yushei.net
¶ 1.0 Download stage 3 tarball
- Download the latest Gentoo stage3 tarball for the ARM64 architecture.
$ pwd
/opt/xfs/home/alexlai/build/gentoo
$ wget https://distfiles.gentoo.org/releases/arm64/autobuilds/20230813T234643Z/stage3-arm64-systemd-20230813T234643Z.tar.xz
¶2. Pratition and Format the microSD Card:
- Use tools like gparted, parted, or fdisk to create a partition on the microSD card and format it as EXT4.
Device Boot Start End Sectors Size Id Type
/dev/sdb1 2048 1050623 1048576 512M c W95 FAT32 (LBA)
/dev/sdb2 1050624 59406335 58355712 27.8G 83 Linux
$ sudo mkfs.vhat /dev/sdb1
$ sudo mkfs.ext4 /dev/sdb2
¶2.1. Mount the partition to a directory,
[alexlai@n2Mnjaro gentoo]$ pwd
/opt/xfs/home/alexlai/build/gentoo
[alexlai@n2Mnjaro gentoo]$ ls
root stage3-arm64-systemd-20230813T234643Z.tar.xz
[alexlai@n2Mnjaro gentoo]$ sudo mount /dev/sdb2 root
¶2.2 Extract Stage3 Tarball:
[alexlai@n2Mnjaro gentoo]$ ls -al
total 239880
drwxr-xr-x 3 alexlai alexlai 70 Aug 19 20:32 .
drwxr-xr-x 8 alexlai alexlai 151 Aug 19 20:14 ..
drwxr-xr-x 3 root root 4096 Aug 19 20:31 root
-rw-r--r-- 1 alexlai alexlai 245630232 Aug 14 16:44 stage3-arm64-systemd-20230813T234643Z.tar.xz
[alexlai@n2Mnjaro gentoo]$ sudo tar xvf stage3-arm64-systemd-20230813T234643Z.tar.xz -C root
[alexlai@n2Mnjaro gentoo]$ ls -l root
total 88
drwxr-xr-x 2 root root 4096 Aug 14 16:42 bin
drwxr-xr-x 2 root root 4096 Aug 14 15:48 boot
drwxr-xr-x 3 root root 4096 Aug 14 15:59 dev
drwxr-xr-x 35 root root 4096 Aug 14 16:44 etc
drwxr-xr-x 2 root root 4096 Aug 14 15:48 home
drwxr-xr-x 7 root root 4096 Aug 14 16:35 lib
drwxr-xr-x 4 root root 4096 Aug 14 16:42 lib64
drwx------ 2 root root 16384 Aug 19 20:31 lost+found
drwxr-xr-x 2 root root 4096 Aug 14 15:48 media
drwxr-xr-x 2 root root 4096 Aug 14 15:48 mnt
drwxr-xr-x 2 root root 4096 Aug 14 15:48 opt
drwxr-xr-x 2 root root 4096 Aug 14 15:48 proc
drwx------ 2 root root 4096 Aug 14 15:55 root
drwxr-xr-x 2 root root 4096 Aug 14 15:48 run
drwxr-xr-x 2 root root 4096 Aug 14 16:44 sbin
drwxr-xr-x 2 root root 4096 Aug 14 15:48 sys
drwxrwxrwt 2 root root 4096 Aug 14 16:44 tmp
drwxr-xr-x 12 root root 4096 Aug 14 15:59 usr
drwxr-xr-x 9 root root 4096 Aug 14 16:11 var
¶2.3. Mount Required Filesystems:
-
Mount /dev, /proc, and /sys to the new system:
- create a bind mount od /dev, linking an existing directory to a new location.
$ sudo mount -o bind /dev/ root/dev/
$ sudo mount -t proc none root/proc
$ sudo mount -o bind /sys root/sys
- The mount -t option in the mount command is used to specify the type of filesystem to be mounted. It is used along with the -o option to provide additional mount options and parameters. The basic syntax for using the -t option is:
$ sudo mount --types proc /proc root/proc
$ sudo mount --rbind /sys root/sys
$ sudo mount --make-rslave root/sys
$ sudo mount --rbind /dev root/dev
$ sudo mount --make-rslave root/dev
$ sudo mount --bind /run root/run
$ sudo mount --make-slave root/run
¶ 2.4. check
[alexlai@n2Mnjaro gentoo]$ mount |grep /opt/xfs/home/alexlai/build/gentoo/
/dev/sdb2 on /opt/xfs/home/alexlai/build/gentoo/root type ext4 (rw,relatime)
dev on /opt/xfs/home/alexlai/build/gentoo/root/dev type devtmpfs (rw,nosuid,relatime,size=1741472k,nr_inodes=435368,mode=755)
none on /opt/xfs/home/alexlai/build/gentoo/root/proc type proc (rw,relatime)
sys on /opt/xfs/home/alexlai/build/gentoo/root/sys type sysfs (rw,nosuid,nodev,noexec,relatime)
¶ 3. Chroot into the New System:
[alexlai@n2Mnjaro gentoo]$ sudo arch-chroot root /bin/bash
[sudo] password for alexlai:
n2Mnjaro / #
n2Mnjaro / # source /etc/profile
n2Mnjaro / # export PS1="(chroot) ${PS1}"
(chroot) n2Mnjaro / #
n2Mnjaro / # source /etc/profile n2Mnjaro / # export PS1="(chroot) ${PS1}" (chroot) n2Mnjaro / #
¶ 4. Continue with Configuration:
- Configuring compile options
- orange pi5 plus
- SoC Rockchip RK3588 (8nm LP process)
- CPU 8-core 64-bit processor; 4 x Cortex-A76(2.4GHz), 4 x Cortex-A55(1.8GHz) and separate NEON co-processors
- GPU Arm Mali-G610; Built-in 3D GPU; Compatible with OpenGL ES1.1/2.0/3.2, OpenCL 2.2 and Vulkan 1.2
- Edit /etc/portage/make.conf to set your preferred compiler flags and other system options.
(chroot) n2Mnjaro / # cp -v /etc/portage/make.conf /etc/portage/make.conf.ori '/etc/portage/make.conf' -> '/etc/portage/make.conf.ori' (chroot) n2Mnjaro / # nano /etc/portage/make.conf # as suggested by chatGPT
- /etc/portage/make.conf
```toml
# Set the target architecture
CHOST="aarch64-unknown-linux-gnu"
# Set the number of CPU cores for parallel compilation (adjust as needed)
MAKEOPTS="-j4"
# Set the CPU flags based on the Cortex-A76 and Cortex-A55 architecture
COMMON_FLAGS="-march=armv8-a+crc -mtune=cortex-a76.cortex-a55 -mfpu=neon-fp-armv8 -mfloat-abi=hard"
# Set any additional flags or optimizations you want
CFLAGS="${COMMON_FLAGS} -O2 -pipe"
CXXFLAGS="${COMMON_FLAGS} -O2 -pipe"
# GPU-related variables (if applicable)
VIDEO_CARDS="mali"
INPUT_DEVICES="evdev"
# Set the desired USE flags (customize as needed)
USE="X opengl vulkan"
# Set the system timezone (adjust as needed)
TIMEZONE="Your/Timezone"
# Set the desired locale (adjust as needed)
LINGUAS="en_US"
# Set the desired Python interpreter (adjust as needed)
PYTHON_TARGETS="python3_7 python3_8"
# Set the desired Portage sync server (choose one that is geographically close)
SYNC="https://your-mirror-server/gentoo-portage"
# Set the portage file and directory locations (adjust as needed)
PORTDIR="/usr/portage"
DISTDIR="/usr/portage/distfiles"
PKGDIR="/usr/portage/packages"
¶4. Update Portage Configuration:
After modifying make.conf, you should update the Portage configuration to apply the changes:
!!! Section 'gentoo' in repos.conf has location attribute set to nonexistent directory: '/usr/portage'
!!! SYNC setting found in make.conf.
This setting is Deprecated and no longer used. Please ensure your 'sync-type' and 'sync-uri' are set correctly in /etc/portage/repos.conf/gentoo.conf
!!! Invalid Repository Location (not a dir): '/usr/portage'
WARNING: One or more repositories have missing repo_name entries:
/usr/portage/profiles/repo_name
NOTE: Each repo_name entry should be a plain text file containing a
unique name for the repository on the first line.
Portage 3.0.49 (python 3.11.4-final-0, unavailable, gcc-12, glibc-2.37-r3, 6.3.9-1-MANJARO-ARM aarch64)
=================================================================
System uname: Linux-6.3.9-1-MANJARO-ARM-aarch64-with-glibc2.37
KiB Mem: 3757180 total, 3399648 free
KiB Swap: 14024372 total, 14024372 free
sh bash 5.1_p16-r6
ld GNU ld (Gentoo 2.40 p5) 2.40.0
dev-lang/python: 3.11.4::gentoo
sys-devel/autoconf: 2.71-r6::gentoo
sys-devel/automake: 1.16.5::gentoo
sys-devel/binutils: 2.40-r5::gentoo
sys-devel/libtool: 2.4.7-r1::gentoo
sys-kernel/linux-headers: 6.1::gentoo (virtual/os-headers)
Repositories:
ACCEPT_LICENSE="* -@EULA"
CFLAGS="-march=armv8-a+crc -mtune=cortex-a76.cortex-a55 -mfpu=neon-fp-armv8 -mfloat-abi=hard -O2 -pipe"
CHOST="aarch64-unknown-linux-gnu"
CONFIG_PROTECT="/etc /usr/share/gnupg/qualified.txt"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gentoo-release /etc/sandbox.d /etc/terminfo"
CXXFLAGS="-march=armv8-a+crc -mtune=cortex-a76.cortex-a55 -mfpu=neon-fp-armv8 -mfloat-abi=hard -O2 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="assume-digests binpkg-docompress binpkg-dostrip binpkg-logs binpkg-multi-instance buildpkg-live config-protect-if-modified distlocks ebuild-locks fixlafiles ipc-sandbox merge-sync multilib-strict network-sandbox news parallel-fetch pid-sandbox preserve-libs protect-owned qa-unresolved-soname-deps sandbox sfperms strict unknown-features-warn unmerge-logs unmerge-orphans userfetch userpriv usersandbox usersync xattr"
GENTOO_MIRRORS="http://distfiles.gentoo.org"
PKGDIR="/usr/portage/packages"
PORTAGE_TMPDIR="/var/tmp"
USE="X opengl vulkan"
Unset: ACCEPT_KEYWORDS, EMERGE_DEFAULT_OPTS, ENV_UNSET, PORTAGE_BINHOST, PORTAGE_BUNZIP2_COMMAND
(chroot) n2Mnjaro /etc/portage # emerge --sync
!!! SYNC setting found in make.conf.
This setting is Deprecated and no longer used. Please ensure your 'sync-type' and 'sync-uri' are set correctly in /etc/portage/repos.conf/gentoo.conf
>>> Syncing repository 'gentoo' into '/usr/portage'...
* Using keys from /usr/share/openpgp-keys/gentoo-release.asc
* Refreshing keys via WKD ... [ !! ]
* Refreshing keys from keyserver hkps://keys.gentoo.org ...OpenPGP keyring refresh failed:
gpg: refreshing 4 keys from hkps://keys.gentoo.org
gpg: keyserver refresh failed: Try again later
OpenPGP keyring refresh failed:
gpg: refreshing 4 keys from hkps://keys.gentoo.org
gpg: keyserver refresh failed: Try again later
OpenPGP keyring refresh failed:
gpg: refreshing 4 keys from hkps://keys.gentoo.org
gpg: keyserver refresh failed: Try again later
....
chroot) n2Mnjaro / # ping keys.gentoo.org
ping: keys.gentoo.org: Temporary failure in name resolution
(chroot) n2Mnjaro / # nano /etc/resolve.conf
(chroot) n2Mnjaro / #
(chroot) n2Mnjaro / # cat /etc/resolve.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
(chroot) n2Mnjaro / # dig keys.gentoo.org
bash: dig: command not found
(chroot) n2Mnjaro / # ping keys.gentoo.org
ping: keys.gentoo.org: Temporary failure in name resolution
emerge --sync
Proceed with the configuration steps mentioned in the previous response, such as configuring the system, updating Portage, setting up the kernel, installing the bootloader, configuring networking, creating user accounts, setting timezone and locale, and finalizing the configuration.
Exit Chroot and Reboot:
Once you've finished configuring the system, exit the chroot environment:
bash
exit umount -l /mnt/gentoo/dev{/shm,/pts,} umount -R /mnt/gentoo
Reboot your Orange Pi 5 Plus:
reboot
Remember, while the process remains conceptually the same, certain Arch Linux-specific tools and package names might differ. Always refer to the official Gentoo documentation and adapt the steps as needed based on your specific Linux distribution.
¶ 1. Preparation:
- Download the latest Gentoo stage3 tarball for the ARM64 architecture.
n2Mnjaro.yushei.net
$ pwd
/opt/xfs/home/alexlai/build/gentoo
$ wget https://distfiles.gentoo.org/releases/arm64/autobuilds/20230813T234643Z/stage3-arm64-systemd-20230813T234643Z.tar.xz
¶2. Prepare the microSD
-
Ensure you have a microSD card with sufficient capacity (16GB or more is recommended).
-
Have a computer with a card reader and an internet connection.
-
Format the microSD Card: Use a tool like gparted or fdisk to create a partition on the microSD card. Format it as EXT4. Mount the partition to a directory (e.g., /mnt/gentoo).
Extract Stage3 Tarball: Download the stage3 tarball and extract it to the mounted partition:
bash
tar xpvf stage3-*.tar.xz -C /mnt/gentoo
Chroot into the New System:
Mount required filesystems:
bash
mount -t proc none /mnt/gentoo/proc mount -o bind /dev /mnt/gentoo/dev mount -o bind /sys /mnt/gentoo/sys
Chroot into the new system:
bash
chroot /mnt/gentoo /bin/bash
source /etc/profile
export PS1="(chroot) ${PS1}"
Configure System:
Edit /etc/portage/make.conf to set your preferred compiler flags and other system options.
Update Portage:
Update Portage, the package manager:
bash
emerge --sync
Kernel Configuration:
Configure and compile the kernel for your Orange Pi 5 Plus hardware. You can use the kernel sources provided by Orange Pi or use the mainline ARM64 kernel sources.
Install Kernel and Bootloader:
Install the kernel and bootloader (such as U-Boot):
bash
emerge sys-kernel/linux-firmware
emerge sys-boot/uboot-tools
emerge sys-boot/uboot-orangepi5plus
Configure Networking:
Set up network configuration in /etc/conf.d/net or use tools like net-setup or systemctl.
User Accounts:
Create user accounts and set passwords.
Timezone and Locale:
Set the timezone and locale in /etc/locale.gen.
Finalize Configuration:
Install additional software packages as needed.
Configure services to start at boot using rc-update.
Exit Chroot and Reboot:
Exit the chroot environment:
bash
exit
umount -l /mnt/gentoo/dev{/shm,/pts,}
umount -R /mnt/gentoo
Reboot your Orange Pi 5 Plus:
reboot
Remember that this is just a high-level guide, and the process might involve additional steps or troubleshooting depending on your specific hardware and Gentoo's updates. Always refer to the official Gentoo documentation and any Orange Pi-specific resources for the most accurate and up-to-date instructions. User but I am doing the preparation of this SDram on an archlinux though ChatGPT