§2023-08-20
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 hc4lunar.yushei.net
¶ 1.0 Download stage 3 tarball, systemd
- Download the latest Gentoo stage3 tarball for the ARM64 architecture.
$ pwd
/home/alexlai/build/gentoo/src
$ 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.
$ sudo apt update && sudo apt install -y dosfstools e2fsprogs xfsprogs
- gdisk
Device Start End Sectors Size Type
/dev/sdb1 2048 1050623 1048576 512M Microsoft basic data
/dev/sdb2 1050624 62332927 61282304 29.2G Linux filesystem
$ sudo mkfs.vfat /dev/sdc1
$ sudo mkfs.ext4 /dev/sdc2
¶2.1. Mount the partition to a directory,
[alexlai@n2Mnjaro gentoo]$ pwd
/home/alexlai/build/gentoo/src
$ mkdir root boot
$ ls
boot root stage3-arm64-systemd-20230813T234643Z.tar.xz
$ 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
skip this part ¶2.3. Mount Required Filesystems:
in ubuntu, Debian skipMount Required Filesystems
then you could arch-chroot!!
-
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
$ mount |grep /home/alexlai/build/gentoo/
/dev/sdc2 on /home/alexlai/build/gentoo/src/root type ext4 (rw,relatime)
udev on /home/alexlai/build/gentoo/src/root/dev type devtmpfs (rw,nosuid,relatime,size=1454112k,nr_inodes=363528,mode=755)
none on /home/alexlai/build/gentoo/src/root/proc type proc (rw,relatime)
sysfs on /home/alexlai/build/gentoo/src/root/sys type sysfs (rw,nosuid,nodev,noexec,relatime)
¶ 3. Chroot into the New System:
sudo apt install -y arch-install-scripts
$ sudo arch-chroot root /bin/bash
mount: /home/alexlai/build/gentoo/src/root/sys: sys already mounted or mount point busy.
dmesg(1) may have more information after failed mount system call.
==> ERROR: failed to setup chroot root
Failed in arch-chroot, if the above moutings are not skipped
$ sudo arch-chroot root /bin/bash
hc4Bookworm / # source /etc/profile
hc4Bookworm / # export PS1="(chroot) ${PS1}"
(chroot) hc4Bookworm / #
(chroot) hc4Bookworm / # cat /etc/resolv.conf
cat: /etc/resolv.conf: No such file or directory
(chroot) hc4Bookworm / # nano (chroot) hc4Bookworm / # cat /etc/resolv.conf
cat: /etc/resolv.conf: No such file or directory
(chroot) hc4Bookworm / # nano /etc/resolv.conf
(chroot) hc4Bookworm / # cat /etc/resolv.conf
nameserver 8.8.8.8
nameserver 8.8.4.4
(chroot) hc4Bookworm / # ping google.com
PING google.com (172.217.163.46) 56(84) bytes of data.
64 bytes from tsa01s13-in-f14.1e100.net (172.217.163.46): icmp_seq=1 ttl=115 time=3.85 ms
64 bytes from maa05s01-in-f14.1e100.net (172.217.163.46): icmp_seq=2 ttl=115 time=3.66 ms
64 bytes from maa05s01-in-f14.1e100.net (172.217.163.46): icmp_seq=3 ttl=115 time=3.67 ms
64 bytes from maa05s01-in-f14.1e100.net (172.217.163.46): icmp_seq=4 ttl=115 time=3.58 ms
64 bytes from tsa01s13-in-f14.1e100.net (172.217.163.46): icmp_seq=5 ttl=115 time=3.81 ms
64 bytes from maa05s01-in-f14.1e100.net (172.217.163.46): icmp_seq=6 ttl=115 time=3.76 ms
- /etc/resolv.conf
¶ 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) hc4Bookworm /# cp -v /etc/portage/make.conf /etc/portage/make.conf.ori '/etc/portage/make.conf' -> '/etc/portage/make.conf.ori' (chroot) hc4Bookworm /# 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="Asia/Taipei"
# Set the desired locale (adjust as needed)
LINGUAS="en_US.UTF-8"
# Set the desired Python interpreter (adjust as needed)
# PYTHON_TARGETS="python3_7 python3_8"
PYTHON_TARGETS="python3_11"
# Set the desired Portage sync server (choose one that is geographically close)
# https://www.gentoo.org/downloads/mirrors/
SYNC=" http://ftp.twaren.net/Linux/Gentoo/"
# 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:
(chroot) hc4Bookworm / # emerge --info
!!! 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.2.0-odroid-arm64 aarch64)
=================================================================
System uname: Linux-6.2.0-odroid-arm64-aarch64-with-glibc2.37
KiB Mem: 3789628 total, 1310396 free
KiB Swap: 8388604 total, 8374684 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"
(chroot) hc4Bookworm / # 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 ... [ ok ]
>>> Starting rsync with rsync://89.238.71.6/gentoo-portage...
>>> Checking server timestamp ...
Welcome to turnstone.gentoo.org / rsync.gentoo.org
Server Address : 89.238.71.6, 2a00:1828:a00d:ffff::6
Contact Name : mirror-admin@gentoo.org
Hardware : 16 x Intel(R) Xeon(R) CPU E5530 @ 2.40GHz, 24152MB RAM
Sponsor : Manitu GmbH, St. Wendel, Germany
Please note: common gentoo-netiquette says you should not sync more
than once a day. Users who abuse the rsync.gentoo.org rotation
may be added to a temporary ban list.
MOTD autogenerated by update-rsync-motd on Tue Oct 11 08:08:51 PM UTC 2022
receiving incremental file list
timestamp.chk
Number of files: 1 (reg: 1)
Number of created files: 0
Number of deleted files: 0
Number of regular files transferred: 1
Total file size: 32 bytes
Total transferred file size: 32 bytes
Literal data: 32 bytes
Matched data: 0 bytes
File list size: 42
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 104
Total bytes received: 133
sent 104 bytes received 133 bytes 67.71 bytes/sec
total size is 32 speedup is 0.14
Welcome to turnstone.gentoo.org / rsync.gentoo.org
Server Address : 89.238.71.6, 2a00:1828:a00d:ffff::6
Contact Name : mirror-admin@gentoo.org
Hardware : 16 x Intel(R) Xeon(R) CPU E5530 @ 2.40GHz, 24152MB RAM
Sponsor : Manitu GmbH, St. Wendel, Germany
Please note: common gentoo-netiquette says you should not sync more
than once a day. Users who abuse the rsync.gentoo.org rotation
may be added to a temporary ban list.
MOTD autogenerated by update-rsync-motd on Tue Oct 11 08:08:51 PM UTC 2022
receiving incremental file list
Manifest
Manifest.files.gz
app-portage/Manifest.gz
app-portage/portage-utils/Manifest
app-portage/portage-utils/portage-utils-0.96.1.ebuild
dev-perl/Manifest.gz
dev-perl/Config-General/Config-General-2.650.0.ebuild
dev-perl/Config-General/Manifest
dev-python/Manifest.gz
dev-python/fonttools/Manifest
dev-python/fonttools/fonttools-4.42.0.ebuild
dev-python/pypy3_10/Manifest
dev-python/pypy3_10/pypy3_10-7.3.12_p1.ebuild
dev-ruby/Manifest.gz
dev-ruby/rails-dom-testing/Manifest
dev-ruby/rails-dom-testing/rails-dom-testing-2.1.1.ebuild
media-libs/Manifest.gz
media-libs/libpng/Manifest
media-libs/libpng/libpng-1.6.40-r1.ebuild
metadata/Manifest.gz
metadata/timestamp
metadata/timestamp.chk
metadata/timestamp.commit
metadata/timestamp.x
metadata/dtd/timestamp.chk
metadata/glsa/Manifest
metadata/glsa/timestamp.chk
metadata/md5-cache/Manifest.gz
metadata/md5-cache/app-portage/Manifest.gz
metadata/md5-cache/app-portage/portage-utils-0.96.1
metadata/md5-cache/dev-perl/Config-General-2.650.0
metadata/md5-cache/dev-perl/Manifest.gz
metadata/md5-cache/dev-python/Manifest.gz
metadata/md5-cache/dev-python/fonttools-4.42.0
metadata/md5-cache/dev-python/pypy3_10-7.3.12_p1
metadata/md5-cache/dev-ruby/Manifest.gz
metadata/md5-cache/dev-ruby/rails-dom-testing-2.1.1
metadata/md5-cache/media-libs/Manifest.gz
metadata/md5-cache/media-libs/libpng-1.6.40-r1
metadata/md5-cache/net-news/Manifest.gz
metadata/md5-cache/net-news/rssguard-4.4.0
metadata/news/Manifest
metadata/news/timestamp.chk
metadata/xml-schema/timestamp.chk
net-news/Manifest.gz
net-news/rssguard/Manifest
net-news/rssguard/rssguard-4.4.0.ebuild
Number of files: 145,716 (reg: 118,866, dir: 26,850)
Number of created files: 0
Number of deleted files: 0
Number of regular files transferred: 47
Total file size: 193.42M bytes
Total transferred file size: 1.88M bytes
Literal data: 1.88M bytes
Matched data: 0 bytes
File list size: 2.83M
File list generation time: 0.001 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 30.10K
Total bytes received: 5.66M
sent 30.10K bytes received 5.66M bytes 70.67K bytes/sec
total size is 193.42M speedup is 34.00
* Manifest timestamp: 2023-08-20 10:40:13 UTC
* Valid OpenPGP signature found:
* - primary key: DCD05B71EAB94199527F44ACDB6B8C1F96D8BF6D
* - subkey: E1D6ABB63BFCFB4BA02FDF1CEC590EEAC9189250
* - timestamp: 2023-08-20 10:40:13 UTC
* Verifying /usr/portage/.tmp-unverified-download-quarantine ...
¶ 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