User:Brendlefly62/Radxa ROCK Pi 4C Plus/Assemble a Gentoo System

From Gentoo Wiki
Jump to:navigation Jump to:search

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

Lay out the Block Device(s)

(Simplest) Recommendation for this board and bootloader - use just one partition, ext4 for the rootfs (with /boot as an organic part of the filesystem). This is the layout used by the armbian-build system when building for this board. If starting from scratch with a larger microSD card, use this layout.

External mass storage can be added later for mountpoints such as /srv and so on.
Micro SD Card or eMMC basic layout
device/file start sector Sectors size type purpose, remarks
/dev/mmcblk0p1 32768 remaining space 83 Linux / -- rootfs
/var/cache/swap/swap1 (**) 3G swap augment board's meager 4G RAM
(*) Be sure to leave adequate room for the "idbloader.img" bootloader file installed with dd

starting at sector 64, and the "u-boot".itb" bootloader image to be installed with dd at sector 16384. Note that other SBC bootloaders may also need to install other files at much higher starting sectors. 32768 should be reasonably conservative for this system. (**) Using a swap file rather than swap partition provides a bit more flexibility, if resizing is necessary. Currently, significant swap space may be necessary to support memory-intensive compile jobs (gcc, rust, for example) if the use of binary packages and/or cross compiling is not available or desired.

Format and Populate Partitions

Mount the rootfs partitions to a folder structure on an Amd64 workstation (where components can be cross-compiled) or another Arm device (where it might be possible to continue the installation with a regular chroot transition as described in the Gentoo Handbook...

Root Filesystem

Mount the rootfs partition on (for example) /mnt/gentoo.

Follow the basic steps in a Gentoo Handbook such as for Amd64. Start with getting the appropriate stage 3, etc.

Note
(Backup) Again, the author used Win32 Disk Imager to copy an image of the Armbian system installed on the SD back the Windows PC, for safekeeping.

Move the contents of the Armbian root filesystem, install gentoo stage 3, and restore boot

root #cd /
root #mkdir armbian_rootfs
root #mv -v * /armbian_rootfs/
root #cat stage3-arm64-openrc-20230924T230144Z.tar.xz.DIGESTS
root #sha512sum stage3-arm64-openrc-20230924T230144Z.tar.xz
(compare to saved hash)
  • (continue, basically as outlined in Gentoo Handbook (amd64)
root #tar xpvf stage3-*.tar.xz --xattrs-include='*.*' --numeric-owner
root #<and so on...>

Boot Directory

Create and populate the boot directory, if it was over-written by extraction of stage 3. Populate the /boot/ directory with artifacts re-used from another distribution - e.g. armbian kernel, initrd, dtb files and overlays, or build these as described in the next section. The endstate should look something like

user $tree /boot/
/boot/
|-- System.map-6.1.55-current-rockchip64
|-- armbianEnv.txt
|-- armbian_first_run.txt.template.bak
|-- boot.bmp
|-- boot.cmd
|-- boot.scr
|-- config-6.1.55-current-rockchip64
|-- dtb -> dtb-6.1.55-current-rockchip64
|-- dtb-6.1.55-current-rockchip64
|   `-- rockchip
|       |-- overlay
|       |   |-- README.rockchip-overlays
|       |   |-- rk3308-bs.dtbo
            ...
|       |   |-- rockchip-rk3328-uart1.dtbo
|       |   |-- rockchip-rk3399-opp-2ghz.dtbo
|       |   |-- rockchip-rockpi4cplus-usb-host.dtbo
|       |   |-- rockchip-rockpro64-lcd.dtbo
|       |   |-- rockchip-spi-jedec-nor.dtbo
|       |   |-- rockchip-spi-spidev.dtbo
|       |   |-- rockchip-uart4.dtbo
|       |   `-- rockchip-w1-gpio.dtbo
|       |-- px30-engicam-px30-core-ctouch2-of10.dtb
|       |-- px30-engicam-px30-core-ctouch2.dtb
        ...
|       |-- rk3399-rock-4c-plus.dtb
|       |-- rk3399-rock-pi-4.dtb
|       |-- rk3399-rock-pi-4a-plus.dtb
|       |-- rk3399-rock-pi-4a.dtb
|       |-- rk3399-rock-pi-4b-plus.dtb
|       |-- rk3399-rock-pi-4b.dtb
|       |-- rk3399-rock-pi-4c-plus.dtb
|       |-- rk3399-rock-pi-4c.dtb
|       |-- rk3399-rock960.dtb
        ...
|       |-- rk3568-radxa-e25.dtb
|       `-- rk3568-rock-3a.dtb
|-- initrd.img -> initrd.img-6.1.55-current-rockchip64
|-- initrd.img-6.1.55-current-rockchip64
|-- initrd.img.old -> initrd.img-6.1.55-current-rockchip64
|-- uInitrd -> uInitrd-6.1.55-current-rockchip64
|-- uInitrd-6.1.55-current-rockchip64
|-- vmlinuz -> vmlinuz-6.1.55-current-rockchip64
|-- vmlinuz-6.1.55-current-rockchip64
`-- vmlinuz.old -> vmlinuz-6.1.55-current-rockchip64

Once the basic build steps described in the handbook are complete,

Boot and then fine-tune the installation

Observe u-boot output on serial console, and be patient; it can take 45 seconds for the Secondary Program Loader (SPL) to scan devices and do its thing before the HDMI console will starts up.

Return to User:Brendlefly62/Radxa ROCK Pi 4C Plus