Flashing the FOSS modem firmware on the Pinephone

The pinephone contains amazingly few binary blobs. One of those is the modem firmware of the Quectel EG-25G. This modem is quite capable in terms of eg. LTE bands covered, but prone to crashes and other mysterious flaws. There is a firmware upgrade available (EG25GGBR07A08M2G_01.003.01.003), but people have reported instabilities with it.

Fortunately, biktorgj has created a (kind of) FOSS firmware that can be flashed on the modem, removing one more blob and making it easier debuggable. Kind of because the modem consists of two parts, a Linux userland (yes, it runs a full-fledged linux) and a binary firmware blob for the DSP inside (which does all the actual communication part). The DSP blob will not be replacible, but the userland is. So this is what I did:

The latest release at this point in time is 0.3.6 and is here (you might want to check the latest release version on the release page).

You need adb and fastboot (sudo apt install fastboot adb) installed on your pinephone,. The installation itself was just these commands on the pinephone :

wget https://github.com/Biktorgj/pinephone_modem_sdk/releases/download/0.3.6/package.tar.gz
  # any other temporary directory name/place will do below
mkdir firmware
tar xvzf package.tar.gz -C firmware
cd firmware
sudo ./flashall
  # took less than 30 seconds: last lines output was: "Finished, if everything went well, run fastboot reboot to restart the modem."
  # Do not reboot the modem before flashing the recommended DSP upgrade though)
wget https://github.com/Biktorgj/quectel_eg25_recovery/raw/EG25GGBR07A08M2G_01.003.01.003/update/NON-HLOS.ubi
  # you only need to flash the newer DSP blob once, not on every future upgrade...
sudo fastboot flash modem NON-HLOS.ubi
fastboot reboot

This FOSS Firmware does not do some loudness gain that the original one did, so the README (useful to read!) recommends to:

Call volume: May need some tweaking to the ALSA UCM configuration file. You can do this by editing /usr/share/alsa/ucm2/PinePhone/VoiceCall.conf. These values seem to work well:

cset "name='AIF1 DA0 Playback Volume' 90%"
cset "name='AIF2 DAC Playback Volume' 90%"
A reboot is required after changing this configuration file.

That was it!

Note1: After a fastboot reboot, mobile data did not immediately work. I powered the phone off, and took the battery out. After rebooting, data worked just fine. Not sure if it was necessary or even this, but it might be in case of trouble.

Note2: And before you ask: the modem cooperates better with ModemManager, resetting itself when it notices some inconsistencies, it makes HD audio possible, it makes routing the audio through USB possible, and it has no persistent data partition (meaning you cannot corrupt the modem if you cut power to it unexpectedly). We believe it is quite stable together with current mobian unstable/bookworm, but there is no guarantee, of course.