I figured trying to build linux-pinephone myself and apply the following changes:
diff --git a/PKGBUILD b/PKGBUILD
index 12e1c19..08e552d 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -8,7 +8,7 @@ _srcname=linux-${_tag}
_kernelname=${pkgbase#linux}
_desc="PinePhone Kernel (Megi)"
pkgver=5.16.14
-pkgrel=1
+pkgrel=2424
arch=('aarch64')
url="https://github.com/megous/linux/releases/tag/$_tag"
license=('GPL2')
@@ -56,7 +56,7 @@ sha256sums=('3dde81d1481c0397ae28894069eb76e65269cf9bfcccddab796eb340b5fab1ad'
'21114f32b1598491e6608ff8f93d2e5fa2c6bbca070d88f71ddfc5c7c77b084d'
'48c9955a5eac2a0893f9033bfa12684deb9422f0beb108c9b64a9a1aa4a21bab'
'8056bd780bc60635418e916aaf131d7585acbdfa22e237c60aa154d3a0012731'
- 'c76e7577ba40bdcb11fb9f7ce09970534ea35d02c04db201868e5af5a097bd70'
+ '3eba90210b7b05289de389ee11daa4ea243670db39a59d014badf265531cb007'
'f704a0e790a310f88b76bf5ae7200ef6f47fd6c68c0d2447de0f121cfc93c5ad'
'ae2e95db94ef7176207c690224169594d49445e04249d2499e9d2fbc117a0b21'
'71df1b18a3885b151a3b9d926a91936da2acc90d5e27f1ad326745779cd3759d'
diff --git a/config b/config
index 96bcffe..807292b 100644
--- a/config
+++ b/config
@@ -4355,7 +4355,7 @@ CONFIG_USB_SERIAL=m
CONFIG_USB_SERIAL_CH341=m
# CONFIG_USB_SERIAL_WHITEHEAT is not set
# CONFIG_USB_SERIAL_DIGI_ACCELEPORT is not set
-# CONFIG_USB_SERIAL_CP210X is not set
+CONFIG_USB_SERIAL_CP210X=m
# CONFIG_USB_SERIAL_CYPRESS_M8 is not set
# CONFIG_USB_SERIAL_EMPEG is not set
# CONFIG_USB_SERIAL_FTDI_SIO is not set
It built successfully in an Arch Linux ARM chroot on a beefy machine. Not advisable on the Pinephone itself, I guess . And now it also includes the driver apparently:
Okay simply extracting /usr/lib/modules/5.16.14-2424-MANJARO-ARM/kernel/drivers/usb/serial/cp210x.ko.xz from the built package to the Pinephone filesystem didn’t work.
➤ sudo modprobe cp210x
modprobe: FATAL: Module cp210x not found in directory /lib/modules/5.16.14-1-MANJARO-ARM
Reinstalling linux-pinephone from the repositories changed something, but it’s not quite there yet:
sudo modprobe cp210x
modprobe: ERROR: could not insert 'cp210x': Exec format error
Which is weird because when decompressing the new file and an existing driver file, both look the same to file:
➤ file ch341.ko usr/lib/modules/5.16.14-2424-MANJARO-ARM/kernel/drivers/usb/serial/cp210x.ko
ch341.ko: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), BuildID[sha1]=66ff2831ecdaa1323afea035576e1115992b1646, not stripped
usr/lib/modules/5.16.14-2424-MANJARO-ARM/kernel/drivers/usb/serial/cp210x.ko: ELF 64-bit LSB relocatable, ARM aarch64, version 1 (SYSV), BuildID[sha1]=10b33ea3ba6e0e87265183b07b46277aedf856a9, not stripped
I was brave and installed my built linux-pinephone and linux-pinephone-headers. Still, sudo modprobe cp210x would’t find the module. So I was even braver and rebooted.
Everything works now. The cp210x driver is loaded automatically when the ESP8266 is connected via the USB-C dock and can be flashed and monitored with PlatformIO for example.
Rebuild the linux-pinephone kernel with the cp210x driver enabled:
git clone https://gitlab.manjaro.org/manjaro-arm/packages/core/linux-pinephone
# bump the `pkgrel` in `PKGBUILD`
# add CONFIG_USB_SERIAL_CP210X=m to the `config` file
# update the checksum for the `config` file in the `PKGBUILD`
makepkg -sf
# this takes a while...
# Afterwards, copy the linux-pinephone{,-headers}*.pkg* files to the pinephone and install them with
sudo pacman -U linux-pinephone*.pkg*
sudo reboot