User:Brendlefly62/Rockchip RK3588S Rock 5c/Assemble a Gentoo System

From Gentoo Wiki
Jump to:navigation Jump to:search

"Re-use" your Armbian-built system to deploy Gentoo

Move the contents of the Armbian root filesystem, install gentoo stage 3, and restore boot directory. Start by mounting the boot media (SD Card) on another workstation that has internet connectivity. Note: if possible, use another arm64 system so subsequent chroot steps will be possible.

root #mount /dev/sdx1 /mnt/gentoo
root #cd /mnt/gentoo
root #mkdir armbian_rootfs
root #mv -v * /armbian_rootfs/ # ignore error about moving this directory into itself
root #cat stage3-*.DIGESTS
root #sha512sum stage3-arm64-openrc-20240505T234912Z.tar.xz
(compare to saved hash)
  • (continue, basically as outlined in Gentoo Handbook (amd64)
root #tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner

Assemble a Gentoo system from scratch

Layout media and install base system

  • Prepare media (microSD card for u-boot, kernel, initramfs; optional additional media for rootfs -- can be NVMe or other via USB stick, luks encrypted, with lvm volumes for Gentoo rootfs.)
  • Install u-boot, kernel, and initramfs to boot device; optionally use serial console to observe u-boot handoff to initramfs and kernel (consult User:Brendlefly62/Rockchip RK3588S Rock 5c/Build-Install-U-Boot )
  • Install Gentoo rootfs as stage3 (Consult Handbook:Main_Page)
  • See above; follow handbook install process all the way to boot and add local user.

Install joetoo repository

  • Install dev-vcs/git and eselect-repository and add joetoo repo
root #nano /etc/portage/repos.conf/eselect-repo.conf
# created by eselect-repo
[joetoo]
location = /var/db/repos/joetoo
sync-type = git
sync-uri = https://github.com/JosephBrendler/joetoo.git

Prepare to install software

  • Configure system USE flags
root #nano /etc/portage/package.use/joetoo
# This package.use file enables the tailored configuration of a joetoo system
#
#-----[ USE specific to joetoo-meta ]------------------------
# The main point of meta-package USE flags is to reduce
#   what you have to manually install/specify in your @world set (/var/lib/portage/world)
#
# headless ...................: Configure joetoo for use as a headless server
# plasma .....................: (to do) Configure joetoo for use with a plasma desktop
# gnome ......................: (to do) Configure joetoo for use with a gnome desktop
# innercore ..................: Pull in baseline packages required by the headless meta
# lamp .......................: Pull in packages required for a LAMP server
# mysql ......................: (default) Pull in the mysql database and required components
# mariadb ....................: Pull in the mariadb database and required components
# nextcloud ..................: Pull in the nextcloud package and its dependencies
# ntp ........................: Pull in ntp to sync with time source
# samba ......................: Pull in samba for wins, file service, etc.
# chrony .....................: Pull in chrony to sync with time source
# sysklogd ...................: Pull in sysklogd as system logger
# syslog-ng ..................: Pull in syslog-ng as system logger
# netifrc ....................: Pull in netifrc to manage network
# networkmanager .............: Pull in networkmanager to manage network
# mkinitramfs ................: Pull in joetoo's initramfs builder and required components
# jus ........................: Pull in the joetoo update sequence script and dependencies
# script_header_brendlefly ...: Pull in the joetoo script header
# compareConfigs .............: Pull in the joetoo's initramfs builder and required componen>
# Terminal ...................: Pull in the joetoo Terminal c++ shared obj library and test program
# cloudsync ..................: Cron script to sync content, scripts, binary packages across multiple servers
# domU........................: Pull in joetoo's sys-kernel/linux-joetoo-kernelimage with USE=domU
# sbc ........................: Tailor for single board computer (SBC) system, require board model sele>
# Note: with USE "sbc", you must also set USE for exactly one of the supported board model names
#   bcm2708-rpi-b ..............: Tailor for Raspberry Pi B  (armv7/32)
#   bcm2709-rpi-2-b ............: Tailor for Raspberry Pi 2 B  (armv7/32)
#   bcm2710-rpi-3-b ............: Tailor for Raspberry Pi 3 B v1.2 (armv7/32)
#   bcm2710-rpi-3-b-plus .......: Tailor for Raspberry Pi 3 B Plus (armv8/64)
#   bcm2711-rpi-4-b ............: Tailor for Raspberry Pi 4 B (armv8/64)
#   bcm2712-rpi-5-b ............: Tailor for Raspberry Pi 5 B (armv8/64)
#   rk3288-tinker-s ............: Tailor for Tinkerboard s (armv7/32)
#   rk3399-rock-pi-4c-plus .....: Tailor for Rock Pi 4c Plus (armv8/64)
#   rk3399-tinker-2 ............: Tailor for Tinkerboard 2/2s (armv8/64)
#   rk3588s-orangepi-5 .........: Tailor for OrangePi 5/5b (armv8/64)
#   rk3588s-rock-5c... .........: Tailor for Rock 5c (armv8/64)
#
# The default for >=joetoo-base/joetoo-meta-0.0.1::joeto (below) should be good for a new amd64 install
#   start point with no USE flags specified; add more later.  The default will currently resolve to --
#    +innercore
#    +headless -plasma -gnome
#    -lamp -nextcloud -mysql -mariadb
#    +cloudsync
#    +mkinitramfs +jus
#    +netifrc -networkmanager
#    -ntp +chrony
#    +sysklogd -syslog-ng
#    +script_header_brendlefly
#    -compareConfigs -Terminal
#    -domU
#    -samba
#    -sbc
#      -bcm2712-rpi-5-b -bcm2711-rpi-4-b -bcm2710-rpi-3-b
#      -bcm2710-rpi-3-b-plus -bcm2709-rpi-2-b bcm2708-rpi-b
#      -rk3288-tinker-s -rk3399-rock-pi-4c-plus -rk3399-tinker-2
#      -rk3588s-orangepi-5 -rk3588s-rock-5c
#
#>=joetoo-base/joetoo-meta-0.0.1::joetoo
>=joetoo-base/joetoo-meta-0.0.1::joetoo sbc rk3588s-rock-5c

#-----[ specific to joetoo system setup ]------------------------
# This section allows you to configure packages that exist only in the joetoo github overlay
app-portage/jus eix -distcc
dev-util/mkinitramfs -bogus
dev-util/compareConfigs scripts testdata
dev-util/script_header_brendlefly extended niopt
dev-util/Terminal examples

dev-util/joetoolkit iptools -xenvmfiles backup_utilities -utility_archive

# opt out of boot firmware and kernel image/modules/dtbs/overlays, for now
dev-sbc/sbc-headless-meta rk3588s-rock-5c joetoo -boot-fw -kernelimage
dev-sbc/sbc-status-leds rk3588s-rock-5c
sys-boot/sbc-boot-config rk3588s-rock-5c
sys-boot/rockchip-boot-firmware rk3588s-rock-5c dtbo armbian_kernel
sys-kernel/linux-joetoo-kernelimage rk3588s-rock-5c -dtb -dtbo rockchip-sources -symlink
sys-kernel/rockchip-sources symlink config

#-----[ standardized for baseline joetoo setup ]------------------------
# This section allows you to configure packages that joetoo developers have chosen as joetoo baseline
dev-libs/openssl tls-heartbeat zlib -bindist
net-misc/openssh pam pie ssl -bindist -hpn -security-key
sys-apps/busybox mdev math -static
sys-fs/cryptsetup openssl udev urandom
sys-fs/lvm2 lvm readline thin -udev
# use below instead for a xen pv domU
#sys-apps/busybox -pam -static -debug -ipv6 -livecd -make-symlinks -math -mdev -savedconfig -sep-usr -syslog -systemd

#-----[ standardized for additional joetoo setup ]------------------------
# This section establishes the defaults for joetoo and allows you to configure packages in ways that
# differ from those default choices that joetoo developers have made
app-emulation/qemu bzip2 lzo ncurses pin-upstream-blobs seccomp threads usb vhost-net vnc xattr xen -debug -pulseaudio -test
app-emulation/xen -custom-cflags -debug -efi -flask
app-emulation/xen-tools api -custom-cflags -debug -doc -flask hvm ocaml -ovmf pam -pygrub -python qemu qemu-traditional screen -sdl -static-libs -system-qemu -xend
>=app-eselect/eselect-php-0.9.5 apache2 fpm
app-portage/gemato blake2 bzip2 gpg lzma sha3
dev-lang/php acl apache2 bcmath bzip2 cgi cli crypt ctype curl enchant fileinfo filter flatfile fpm gd gdbm gmp hash iconv intl ipv6 jit json ldap mysql mysqli odbc opcache pdo phar posix readline session simplexml sockets spell sqlite ssl sysvipc threads tokenizer truetype unicode xml xmlreader xmlwriter xpm zip zlib -snmp
>=dev-lang/python-2.7.17-r1:2.7 sqlite
dev-libs/boost threads python tools
>=dev-libs/libpcre2-10.39-r1 jit pcre32
>=dev-libs/libxml2-2.9.9-r3 python
>=media-gfx/imagemagick-7.0.10.46 bzip2 cxx perl png svg tiff truetype xml zlib -openmp
media-libs/freetype harfbuzz
net-firewall/iptables conntrack netlink
net-fs/samba acl aio caps client examples fam gnutls netapi pam readline server smbclient smbsharemodes syslog winbind -cups
net-nds/openldap crypt cxx gnutls ipv6 odbc perl samba sasl sha2 ssl syslog
net-vpn/openvpn ssl
net-wireless/wpa_supplicant dbus gnutls readline ssl -qt5
sys-apps/kmod lzma tools zlib
sys-apps/portage gentoo-dev ipc native-extensions rsync-verify xattr
>=sys-block/parted-3.4 readline device-mapper
sys-boot/grub device-mapper efiemu fonts ncurses sdl themes truetype
sys-devel/binutils multitarget
sys-devel/distcc crossdev hardened
>=sys-devel/gcc-11.2.1_p20220115 fortran hardened go default-stack-clash-protection default-znow
sys-fs/eudev blkid efi hwdb introspection kmod rule-generator
sys-kernel/gentoo-sources symlink
virtual/linux-sources firmware
www-apache/mod_security fuzzyhash geoip
www-apps/nextcloud curl imagemagick mysql vhosts
www-servers/apache threads
sys-kernel/installkernel -dracut
sys-kernel/linux-firmware -initramfs

#-----[ standardized TARGETS for joetoo ]-------------------------------
# This section is self-explanatory.  Note that default CPU flags are set in the included file
# /etc/portage/package.use/00cpu_flags and are commented out by default because they depend on arch
# Note that many other standardized configuration choices are provided in the included default
# make.conf file
*/* PYTHON_TARGETS: -python2_7
*/* PHP_TARGETS: php8-3
*/* RUBY_TARGETS: ruby31
*/* LLVM_TARGETS: ARM X86
  • Verify CPU_FLAGS and COMMON_FLAGS with cpuid2cpuflags and resolve-march-native
root #nano /etc/portage/make.conf
COMMON_FLAGS="-O2 -pipe  -mcpu=cortex-a76.cortex-a55+crc+crypto"
root #nano /etc/portage/package.use/00cpu-flags
*/* CPU_FLAGS_ARM: edsp neon thumb vfp vfpv3 vfpv4 vfp-d32 aes sha1 sha2 crc32 asimddp v4 v5 v6 v7 v8 thumb2
  • Install dev-embedded/sbc-headless-meta::joetoo with USE including "joetoo rk3588s-rock-5c" (also opt out of getting kernel and boot firmware, for now)
root #emerge -av dev-embedded/sbc-headless-meta::joetoo
  • This will select joetoo-base/joetoo-meta::joetoo which installs standard software according to USE flags, and basic joetoo .conf files for these software packages. ==> configure those
root #dispatch-conf

Install tools

  • Install dev-util/joetoolkit::joetoo and use get_my_cflags.sh to double-check

Finalize

  • update with app-portage/jus::joetoo (joetoo update sequence)
  • rebuild the entire system with rus (rebuild update sequence) script from app-portage/jus


(to do) See also this similar work for a different board -- User:Brendlefly62/Rockchip_RK3288_Asus_Tinker_Board_S/Assemble_a_Gentoo_System