alarm-clockworkpi-uconsole/INSTALLATION.md

5 KiB

This is a breif guide to setting up Arch Linux ARM on your uConsole with RaspberryPi CM5, vaguely based on https://github.com/PotatoMania/uconsole-cm3/blob/dev/doc/how-to-install-archlinux-from-scratch.md for the CM3.

This guide assumes that you have a host Arch Linux system, either with an aarch64 SoC natively or with qemu-user-static, qemu-user-static-binfmt and arch-install-scripts installed in order to chroot during the install process. You are also assumed to be in general familiar with Arch Linux, as this guide does not lay out every single command to run.

1. Partitioning

Use whatever tool you prefer (fdisk/parted/...), create a MBR partition table on your SD card. The first partition will be used as the boot partition, and must be primary and marked as type 0c (W95 FAT32 (LBA)). The first partition must then be formatted as FAT32 (mkfs.vfat). I used a 1 GB partition for this.

At least one second partition is required for the rootfs. You can use whatever filesystem supported by the upstream Linux kernel.

2. Mounting the Partitions

Mount the rootfs partition at some mountpoint (assuming /mnt for the rest of the guide). Then, create a boot directory inside and mount the boot partition (the FAT32 one) there.

If you added any additional partitions, create their respective mountpoints inside the rootfs mountpoint and mount them there.

3. Extracting Rootfs

Download the latest rootfs tarball from http://os.archlinuxarm.org/os/ArchLinuxARM-aarch64-latest.tar.gz.

Extract the tarball under root:

bsdtar -xpf ArchLinuxARM-aarch64-latest.tar.gz -C /mnt

Note that /mnt is path to your rootfs mountpoint.

4. Creating fstab

Avoid using genfstab on the host. Write /mnt/etc/fstab (again, assuming /mnt is the rootfs mountpoint) manually. Partitions on the SD card will be /dev/mmcblk0pX where X is the partition number starting from 1. Or, use labels or UUIDs instead of absolute paths.

5. Add the Binary Repo

Add the binary repo corresponding to packages in this git repo to /mnt/etc/pacman.conf. Or, build your own binary packages and copy them somewhere in the new rootfs for installation later.

[petercxy]
SigLevel = Optional
Server = https://s3-cdn.angry.im/alarm-repo/$arch

6. Chroot!

Now we can chroot into the new rootfs

arch-chroot /mnt

pacman-key --init
pacman-key --populate archlinuxarm
pacman -Syu

7. Bootloader and Kernel

pacman -R linux-aarch64
pacman -S raspberrypi-bootloader firmware-raspberrypi linux-clockworkpi-git

Note that if you did not add the binary package repo, you'll have to supply your own kernel package.

8. Networking

pacman -S networkmanager wpa_supplicant-raspberrypi-git
systemctl enable NetworkManager

wpa_supplicant-raspberrypi-git is important because the upstream package is currently broken on RPIs.

9. Bootloader Config

Here's the /boot/config.txt I am using, mostly stolen from Rex's Debian image:

[pi5]
dtoverlay=clockworkpi-uconsole-cm5
dtoverlay=vc4-kms-v3d-pi5,cma-384
dtparam=pciex1=off
enable_uart=0
arm_freq_min=400

[all]
arm_64bit=1
ignore_lcd=1
max_framebuffers=2
disable_overscan=1
dtparam=audio=on
dtoverlay=audremap,pins_12_13
dtoverlay=dwc2,dr_mode=host
dtparam=ant2
kernel=vmlinuz-linux-clockworkpi-git
initramfs initramfs-linux-clockworkpi-git.img followkernel

For CM3 and CM4 (untested):

[pi3]
dtoverlay=clockworkpi-uconsole-cm3
dtoverlay=vc4-kms-v3d
dtparam=spi=on
dtoverlay=spi-gpio35-39
gpio=11=op,dh
enable_uart=1

[pi4]
dtoverlay=clockworkpi-uconsole
dtoverlay=vc4-kms-v3d-pi4,cma-384
dtparam=spi=on
enable_uart=1

You'll also need to set up your /boot/cmdline.txt with at least reference to your rootfs device:

console=serial0,115200 console=tty1 root=/dev/mmcblk0p2 rootfstype=<your_root_fs_type> rootwait

10. Speaker Amplifier Workaround

This is NOT required on CM5 with the latest kernel.

On CM4 and CM3, the kernel does not automatically switch the speaker amplifier off when the headphone is inserted into the 3.5mm jack.

There is a workaround package called clockworkpi-speaker-auto-switch in this repo which does everything through pinctrl in userspace. Install that, and systemctl enable clockworkpi-speaker-auto-switch.

11. Ready!

The initial image should now be ready to boot. There is no desktop environment installed, but you should be able to log in as alarm, use nmcli to connect to network and then do the rest of your setup from there.

Unmount all the partitions, and insert your SD card into your ClockworkPi uConsole.


Here are some quirks you might run into.

Blank Display on Boot

With the CM5, the display seems to fail to power up sometimes while booting, and only the backlight gets turned on. This happens quite rarely but can be somewhat annoying.

There is no force-reboot button on the uConsole. What I did to work around this is to use greetd with tuigreet as my display manager, which supports a quick shutdown action accessible via F12 + Enter. Usually the PI will come up completely fine for the next boot.