Installing RockyLinux8 on Rockpi4c

Author: Ananda Kammampati

Dated : Sept 2021

radxa_rockpi4c
--------------------------------------------------------------------------------------------------------------------------------

Goal     : Boot rockpi4c board with rockylinux8 image built by @Markvnl

Credits  : All credits goes to @Markvnl. Can be reached in AltArch channel on Matttermost (RockyLinux)

Channel  : AltArch Chat Channel on Mattermost: https://chat.rockylinux.org/rocky-linux/channels/altarch 

Image : http://vps01.havak.nl/rocky/8/build-pass0/aarch64/Images/RockyLinux-8.4-Generic-rk3399-aarch64-BUILDPASS0-img.raw.xz 

Rockpi4c :  https://wiki.radxa.com/Rockpi4 

Note : I used CentOS7 running on a Dell machine to prepare bootble SD card for Rockpi4c board 

Caveat : My 1 TB NVME SSD did not get recognised 

Me : @Student in AltArch channel 

---------------------------------------------------------------------------------------------------------------------------------
Download the image built by @Markvnl

# pwd
/root

# wget http://vps01.havak.nl/rocky/8/build-pass0/aarch64/Images/RockyLinux-8.4-Generic-rk3399-aarch64-BUILDPASS0-img.raw.xz
Part 01: Prepare SD card
------------------------

WARNING !! My SD card showed up as /dev/sdb on my CentOS7 desktop. Yours might vary. 
           Please pay attention and use the right disk so that you don't end up wiping out another disk unintentionally. 

# uname -a
Linux dell.fieldday.local 3.10.0-1160.36.2.el7.x86_64 #1 SMP Wed Jul 21 11:57:15 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

# more /etc/*release
::::::::::::::
/etc/centos-release
::::::::::::::
CentOS Linux release 7.9.2009 (Core)

- Created 2 paritions on a 32GB SD card
- SD Card was recognized as /dev/sdb on my CentOS7 Desktop
- Wil vary based on your setup. So you need to change /dev/sdb accordingly in the commands you enter
- First parition is 1GB of type FAT32
- Second partition is linux partition with rest of storage

# fdisk -l
Disk /dev/sdb: 31.9 GB, 31914983424 bytes, 62333952 sectors <<------------ 32GB SD-Card with 2 empty partitions
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdb1 2048 2099199 1048576 c W95 FAT32 (LBA) <<----- Size: 1GB
/dev/sdb2 2099200 62333951 30117376 83 Linux <<----- Size: Rest of the capacity
Part 02: Extract and Copy @Markvnl's image to SD card
-----------------------------------------------------

# pwd
/root

# xz -d RockyLinux-8.4-Generic-rk3399-aarch64-BUILDPASS0-img.raw.xz

# ls -lh RockyLinux-8.4-Generic-rk3399-aarch64-BUILDPASS0-img.raw
-rw-r--r-- 1 root root 3.0G Aug 9 23:55 RockyLinux-8.4-Generic-rk3399-aarch64-BUILDPASS0-img.raw

# dd if=/root/RockyLinux-8.4-Generic-rk3399-aarch64-BUILDPASS0-img.raw of=/dev/sdb bs=4M status=progress
3212836864 bytes (3.2 GB) copied, 39.340518 s, 81.7 MB/s
768+0 records in
768+0 records out
3221225472 bytes (3.2 GB) copied, 251.641 s, 12.8 MB/s
Part 03: Copy u-boot-rockchip.bin from the newly copied image (residing in SD Card)
-----------------------------------------------------------------------------------

# pwd
/root

# mkdir rl8

# mount /dev/sdb2 /root/rl8

# ls -l /root/rl8/usr/share/uboot/rock-pi-4c-rk3399/u-boot-rockchip.bin
-rw-r--r--. 1 root root 9341804 Aug 9 13:19 /root/rl8/usr/share/uboot/rock-pi-4c-rk3399/u-boot-rockchip.bin

# dd if=/root/rl8/usr/share/uboot/rock-pi-4c-rk3399/u-boot-rockchip.bin of=/dev/sdb seek=64 && sync
18245+1 records in
18245+1 records out
9341804 bytes (9.3 MB) copied, 1.89005 s, 4.9 MB/s
Part 04: Unmount SD Card and eject
----------------------------------

# umount /root/rl8

---
tub: Using DTB from configuration table
tub: Exiting boot services and installing virtual address map...
---
Part 05: Transfer the SD card to Rockpi4c board
-----------------------------------------------

- Make sure the Rockpi4c board is connected to the network where you have a DHCP Server (home router in my case)

- Initially the Console does not show up. But the baord boots up fine

- For now, the only way to access it is via ssh

- Login to your DHCP Server and find out the IP address that was assigned to rockpi4c

- Credentials to ssh into rockpi4c are:

login : root
password : rocky
Part 06: Workaround to get the Console on micro HDMI
----------------------------------------------------

# uname -a
Linux rockpi4c 5.10.52-200.el8.aarch64 #1 SMP Mon Aug 9 23:04:44 CEST 2021 aarch64 aarch64 aarch64 GNU/Linux

# cat /proc/fb
0 EFI VGA
1 rockchipdrmfb

# vi /etc/default/grub
-----
GRUB_TIMEOUT=1
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="fbcon=map:1 console=tty1" ----> Modified with this value suggested by @Markvnl
-----

# grub2-mkconfig -o /boot/efi/EFI/rocky/grub.cfg
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.10.52-200.el8.aarch64
Found initrd image: /boot/initramfs-5.10.52-200.el8.aarch64.img
/etc/grub.d/30_uefi-firmware: line 34: warning: command substitution: ignored null byte in input done
# sync ; reboot ----> Console showed up when monitor is connected to micro HDMI interface
Part 07: Initial setup
----------------------

# uname -a
Linux rockpi4c 5.10.52-200.el8.aarch64 #1 SMP Mon Aug 9 23:04:44 CEST 2021 aarch64 aarch64 aarch64 GNU/Linux

# yum -y update 

# yum -y upgrade 

# vi /etc/selinux/config
-----
#SELINUX=enforcing
#SELINUXTYPE=targeted
-----

# setenforce 0 

# systemctl stop firewalld.service 

# systemctl disable firewalld.service 

# yum install -y epel-release bzip2 unzip lsof tcpdump 

# yum install -y net-tools bridge-utils iproute curl wget yum-utils 

# yum install -y htop 

# dnf module list php

# dnf module enable php:7.4

# dnf install php

# php -v

# rootfs-expand

# sync ; reboot
Part 08: Install webmin
-----------------------

Refer: https://www.digitalocean.com/community/tutorials/how-to-install-and-use-webmin-on-centos-7 

# dnf install -y perl ( Might need these commands - # dnf module switch-to perl:5.26 ; # dnf install -y perl ) 

# vi /etc/yum.repos.d/webmin.repo 
----- 
[Webmin] 
name=Webmin Distribution Neutral 
#baseurl=http://download.webmin.com/download/yum 
mirrorlist=http://download.webmin.com/download/yum/mirrorlist 
enabled=1 
----- 

# wget http://www.webmin.com/jcameron-key.asc 

# rpm --import jcameron-key.asc 

# yum install -y webmin
Part 09: Install Container technologies
---------------------------------------

Refer: https://blog.crowncloud.net/post/installing-docker-on-rocky-linux-8/

docker
------
# dnf config-manager --add-repo=https://download.docker.com/linux/centos/docker-ce.repo
# dnf install -y docker-ce 
# docker --version


podman
------
# dnf install -y podman --allowerasing --nobest
# podman --version
podman version 3.0.2-dev


buildah
-------
# dnf install -y buildah
# buildah --version
buildah version 1.19.8 (image-spec 1.0.1-dev, runtime-spec 1.0.2-dev)


skopeo
------
# dnf install -y skopeo
# skopeo --version
skopeo version 1.2.3-dev