Updating Firmware on the Librem 5

I am creating this post in response to @FrankyFlawless an his most recent firmware update responses and list.

Ok. That is all I am good for. I would love to have an “official” firmware post identifying what can be updated and how.

Thank you ahead of time!

4 Likes

So here would be my updated (not official) list:

  1. Smartcard Reader
  2. USB PD controller
  3. SparkLAN card (/ alternatively maybe the Redpine card if certain conditions are met)
  4. Touchscreen controller
  5. GNSS module

I have only tackled the first two on my phone. I can probably rustle up some instructions for the first two if someone is desperate to update and can’t fish the information that I myself used from this forum.


  1. Starting point … check what you currently have.

sudo cat /sys/kernel/debug/tps6598x/0-003f/customer_use

If it ends 00000101 then it is definitely not current.

If it ends 00000200 then that’s what I have.

But it looks like the latest is 00000201

Firmware file and instructions come from: Files · master · Librem5 / firmware-tps6598x-nonfree · GitLab

I can confirm that the instructions worked for me when I upgraded from 0.1.1 to 0.2.0 (which admittedly was a couple of years ago).

6 Likes

Increase the default brightness after an update. (So I don’t have to go into a darkroom to see the screen and raise it.) I think the default must be the developer’s dark sense of humor.

5 Likes

These instructions assume you are using at least PureOS 10.3 ‘Byzantium’ on your computer and Librem 5.

  1. Das U-Boot (bootloader)
  • Librem 5:
wget https://source.puri.sm/Librem5/uboot-imx/-/jobs/399069/artifacts/raw/debian/output/u-boot-librem5_2022.10-librem5.1_arm64.deb
sudo apt install ~/u-boot-librem5_2022.10-librem5.1_arm64.deb
sudo u-boot-install-librem5 /dev/mmcblk0
systemctl reboot -i
  1. Tian Tian Xiang Shang (smartcard reader)
  • Librem 5:
sudo apt install git stm32flash
git clone https://source.puri.sm/firmware/ttxs-firmware.git && cd ttxs-firmware
./scripts/stm_reflash.sh
  1. TPS65982 (USB PD controller)
  • Desktop:
sudo apt install git uuu
git clone https://source.puri.sm/Librem5/librem5-devkit-tools && cd librem5-devkit-tools
wget https://source.puri.sm/Librem5/firmware-tps6598x-nonfree/-/raw/master/tps65982-librem5-dp-alt-mode.bin
./scripts/write_flash.sh tps65982-librem5-dp-alt-mode.bin

After executing the script, put your Librem 5 into serial download mode by holding the volume up button first, then simultaneously hold the power button for one second.

  1. WLAN (Firmware Jail)
  • Desktop:
sudo apt install git uuu
git clone https://source.puri.sm/Librem5/librem5-devkit-tools && cd librem5-devkit-tools
mkdir -p files && wget https://source.puri.sm/Librem5/firmware-librem5-nonfree/-/jobs/389262/artifacts/raw/firmware.sqsh -O files/firmware.sqsh
./scripts/write_flash.sh files/firmware.sqsh 0x30000

After executing the script, put your Librem 5 in serial download mode by holding the volume up button first, then simultaneously hold the power button for one second.

  • Librem 5:
sudo apt install librem5-fw-jail
systemctl reboot -i
  1. Broadmobi BM818 (cellular modem)
  • Librem 5:
sudo apt install bm818-tools unzip
wget https://cloud.puri.sm/s/25cTx88eQA6scXD/download -O BM818-reflash.zip
unzip BM818-reflash.zip && cd BM818-reflash
sudo apt install ./firmware-bm818-nonfree_0.6pureos1+librem5ci83034.2dcae67_arm64.deb ./qdl_0.2pureos1+librem5ci77119.0103259_arm64.deb

Afterwards, ensure the cellular modem is on, open Flash BM818 in the App Drawer, then provide your user password in the Terminal when prompted.

YAD will display and provide a dropdown menu for you to select a cellular modem firmware region variant. You may need to use Phosh Mobile Settings’ Compositor to scale the application to display properly.

  • North America: YCSN0_M100E_1ACD_B325_ V1.0.0.2_20220930_BM818-A1
  • Europe: YCSN0_M100E_1BAD_3117_V1.0.0.2_20220930_BM818-E1
  • Asia: YCSN0_M100E_1CMD_B227_V1.0.0.2_20220930_BM818-T1

After selecting an option, tap OK. The next dialog will prompt you to select a backup from the dropdown menu. Select the backup and tap OK.

  1. FT8006P (touchscreen controller)

Ask @dos.

  1. Teseo-LIV3F (GPS module)

Ask @dos.

There are more unlisted firmware, but there are no clear documentation nor instructions for updating them.

4 Likes

Why me? :stuck_out_tongue:

The regular touchscreen driver (edt_ft5x06) in Purism’s kernel tree implements the update procedure so you can look at the sources there, but you’d still have to get the blob from somewhere. There’s a repo on Purism’s GitLab with it, but apparently it’s private. I don’t know whether it’s an oversight or whether there’s a reason for it.

Ask Purism.

There are no firmware updates available for LIV3F, all phones shipped with the latest one; but in one case when I managed to brick my module I just downloaded the firmware package from STMicro website and ran their Java firmware updater on the phone to reflash the module and it worked.

There’s SDMA firmware that’s part of linux-firmware (the driver fallbacks to ROM firmware when it’s not installed, like in PureOS).

I’m not aware of anything else. If some other components (eMMC perhaps?) could have their firmware updated, then I’ve never seen those blobs nor the update procedures. ATF, DDR training blob and DP firmware are included within u-boot, so you’ve already covered that.

6 Likes

I assume your various claims are backed up by experience. Here is another one directed at Librem 5 firmware updates:

I would appreciate knowing how the TPS65982 USB PD controller and firmware jail instructions can be optimized to perform only on the Librem 5.

I will email Purism support about this edt_ft5x06 GitLab repository and follow up in this topic once I receive a response.

Right, but each individual firmware has its own version that is behind upstream.

ATF:

DDR + DP:

Librem5 — Das U-Boot unknown version documentation

The latest DDR + DP firmware is 8.23, which is eight point releases ahead of the u-boot documentation.

https://www.nxp.com/lgfiles/NMG/MAD/YOCTO/firmware-imx-8.23.bin
1 Like

Both of those are stored on the SPI NOR flash which is seen by Linux as /dev/mtd* devices. By default the device tree marks its partitions as read-only, but nothing prevents you from removing that restriction. It’s more of a “don’t let people break things accidentally” thing than anything else, especially when on older revisions unbricking the device with bad USB-C controller firmware can be quite challenging.

        nor_flash: flash@0 {
                compatible = "jedec,spi-nor";
                reg = <0>;
                spi-max-frequency = <1000000>;
                #address-cells = <1>;
                #size-cells = <1>;

                partition@0 {
                        label = "protected0";
                        reg = <0x0 0x30000>;
                        read-only;
                };

                partition@30000 {
                        label = "firmware";
                        reg = <0x30000 0x1d0000>;
                        read-only;
                };
        };
Sep 14 15:31:28 evergreen kernel: 2 fixed-partitions partitions found on MTD device spi0.0
Sep 14 15:31:28 evergreen kernel: Creating 2 MTD partitions on "spi0.0":
Sep 14 15:31:28 evergreen kernel: 0x000000000000-0x000000030000 : "protected0"
Sep 14 15:31:28 evergreen kernel: 0x000000030000-0x000000200000 : "firmware"

The first partition contains TPS65982 firmware, the second one is the jail.

I’m not going to write any copy-paste’able instructions here to not burden the support team with people trying unsupported procedures and screwing things up in the process, but if you’re capable to do things your own way then what I already said will be more than enough to proceed :wink:

I think you meant the firmware repository. edt-ft5x06 is the Linux driver you’re already using on your phone.

4 Likes

Okay, I have converted my post containing the list of firmware and their respective instructions to a wiki. I will add instructions for updating the Teseo-LIV3F module once I have time to manually verify your instructions. Once I figure out how to update the USB PD controller and firmware jail using your hints, I will update it again with simplified instructions.

Right, I do not have access to this GitLab repository, so the most I can do is reference it with a placeholder name until Purism makes the repository public. Once Purism has provided instructions for updating the FT8006P firmware, I will update the wiki post. Instructions for updating the ATF firmware to reach upstream parity remains unclear, so I may have to create GitLab issues and/or contact Purism about it separately.

1 Like

What for? The officially supported instructions are the simpler ones, that’s why they’re the official ones. Accessing the NOR flash from the phone is possible and not really complicated, but there are more opportunities to screw things up in the process. There’s no reason to point users who wouldn’t be able to figure it out on their own to that procedure (and those who can figure it out can be expected to also be able to fix things they screw up on their own :stuck_out_tongue: )

ATF (and NXP firmware) is part of u-boot image, so you’ll have to build it by yourself. And that’s pretty much it, there’s nothing more to it. Of course, since I don’t think anybody has tested the latest upstream releases on the L5 you’ll have to test it and deal with possible regressions on your own, should there be any.

Note that the used ATF is NXP’s fork. I don’t remember whether mainline ATF is supposed to be fully operational.

1 Like

This. @FranklyFlawless

I have done the USB PD firmware update using Purism’s instructions. It is basically no more complicated than a reflash i.e. put Librem 5 in serial download mode and run a script on the host computer.

What are your specific goals in wanting to avoid a host computer?

It is obvious that if you need to reflash, it is guaranteed that there are scenarios where you will need a host computer - and if you want to backup and/or restore using Jumpdrive then you will need a host computer. So users should become familiar with the basic procedure of putting the Librem 5 in serial download mode and running a script on the host computer. The difference is which particular script gets run.

There are dangers in blindly upgrading though. If noone has done any integration testing to see whether the higher version works correctly in the Librem 5 and/or works correctly with other software components … you might be the one doing the testing - and fixing up the mess if the test is FAIL.

1 Like