§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

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

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:

[alexlai@n2Mnjaro gentoo]$ sudo mount -o bind /dev/ root/dev/
[alexlai@n2Mnjaro gentoo]$ sudo mount -t proc none root/proc
[alexlai@n2Mnjaro gentoo]$ sudo mount -o bind /sys root/sys

¶ 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:
- 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 (chroot) n2Mnjaro / # nano /etc/portage/make.conf (chroot) n2Mnjaro / # diff /etc/portage/make.conf /etc/portage/make.conf.ori 6,7c6,7 < CFLAGS="-O2 -march=native -pipe" < CXXFLAGS="${CFLAGS}"

CFLAGS="${COMMON_FLAGS}" CXXFLAGS="${COMMON_FLAGS}" 20,24d19 < < MAKEOPTS="-j4" # Use 4 CPU cores for compilation < TIMEZONE="Asia/Taipei" < L10N="en-US" <


&para;4. Update
- Update Portage:
    - Update Portage, the package manager:

(chroot) n2Mnjaro / # emerge --sync

Syncing repository 'gentoo' into '/var/db/repos/gentoo'...

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.

---

&para; 1. Preparation:

- Download the latest [Gentoo stage3 tarball for the ARM64 architecture](https://distfiles.gentoo.org/releases/arm64/autobuilds/20230813T234643Z/stage3-arm64-systemd-20230813T234643Z.tar.xz).

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

&para;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