Recently, I got a new toy: a ClockworkPi uConsole. It is a really lovely Cyberdeck/Palmtop computer with a built-in keyboard. Another plus point is that it supports the Raspberry Pi CM3/4 brain, which opens up the way for upgrading it in the future.

However, it has some custom-made parts that require not-yet-mainlined drivers to boot up properly, and the DT overlay code is also not mainlined yet. So, it cannot run any distro without modification (board bring-up process). If the user wants to run something other than the vendor-patched Raspbian image, they have to patch and port the kernel for the device.

Fortunately, someone already did all the hassle for the Arch Linux ARM (though I’ll have to port Fedora someday; it will be another story). However, because of the hardware’s nature, it cannot correctly initialize uConsole hardware (especially display and USB subsystem) while in the ramdisk stage.

So, let’s investigate. What prevents our Linux image from showing shiny texts while in the ramdisk? We have to look at how the hardware is composed to find out. Let’s look at how the kernel should be modified to properly run on the uConsole: https://github.com/PotatoMania/uconsole-cm3/tree/dev/PKGBUILDs/linux-uconsole-rpi64.

Now, let’s inspect the patch, especially the device tree part. From the DT, we can spot which hardware drivers should be loaded.

  • OCP8178 backlight
  • CWU50 LCD panel
  • AXP221
    • Note: The PMIC driver governs the USB power rail, which the on-device keyboard is hooked to.

Also, the Raspberry Pi’s USB and I2C subsystem and some display-related drivers should be loaded to properly function.

From this information, we can deduce the following kernel modules should be included in initramfs to allow keyboard and display work and let the user enter the LUKS password through the Systemd LUKS prompt:

  • ocp8178_bl
  • panel_clockwork_cwu50
  • all the axp20x driver
  • all i2c drivers
  • dwc2 driver for USB

So, the final mkinitcpio.conf MODULE configuration should look like this: (Note: this is for Arch Linux with mkinitcpio setup. If you use another distro or opt to use an alternative initrd build system such as dracut, you have to adapt this appropriately)

MODULES=(ocp8178_bl panel_clockwork_cwu50 axp20x axp20x_regulator axp20x_i2c axp20x_battery axp20x_ac_power axp20x_pek axp20x_adc i2c_mux_pinctrl i2c_mux i2c_brcmstb i2c_bcm2835 i2c_dev dwc2)

After re-generating the initrd with proper encryption setup (please refer the Arch Wiki for this information), configuring cmdline, and encrypting the rootfs partition using LUKS (Note: xchacha12/20,aes-adiantum-plain64 cipher is strongly recommended because Raspberry Pi 4’s SoC BCM2711 lacks AES acceleration.), we can now finally see the password prompt which asks for the LUKS decryption password.

Happy hacking!