Jump to content

Purism Librem5 (purism-librem5): Difference between revisions

From postmarketOS Wiki
m Reverted edits by I Hate Niggers (talk) to last revision by Jenneron
Tag: Rollback
moved to community: https://gitlab.postmarketos.org/postmarketOS/pmaports/-/merge_requests/5911
 
(27 intermediate revisions by 13 users not shown)
Line 5: Line 5:
| image = File:Librem5 pmos phosh main.jpg
| image = File:Librem5 pmos phosh main.jpg
| imagecaption =  
| imagecaption =  
| releaseyear = 2019
| releaseyear = 2020
| category = main
| prereleaseyear = 2019
| category = community
| originalsoftware = PureOS
| originalsoftware = PureOS
| chipset = NXP i.MX8MQ
| chipset = NXP i.MX8MQ
Line 15: Line 16:
| memory = 3 GB
| memory = 3 GB
| architecture = aarch64
| architecture = aarch64
| type = handset
<!-- the following status_* questions should be answered with Y - yes, P - partial, N - no, or left blank (for untested or unknown) -->
<!-- the following status_* questions should be answered with Y - yes, P - partial, N - no, or left blank (for untested or unknown) -->
| status_usbnet = Y
| status_usbnet = Y
Line 26: Line 28:
| status_battery = Y
| status_battery = Y
| status_3d = Y
| status_3d = Y
| status_accel = Y
| status_audio = Y
| status_audio = Y
| status_bluetooth = Y
| status_bluetooth = Y
| status_camera = Y
| status_camera = P
| status_gps = Y
| status_gps = Y
| status_mobiledata = Y
| status_mobiledata = Y
| status_emmc = Y
| status_sms = Y
| status_sms = Y
| status_calls = Y
| status_calls = Y
| status_otg = Y
| status_otg = Y
| status_nfc = -
| status_nfc = -
| status_accel = Y
| status_magnet =
| status_light =
| status_proximity =
| status_hall =
| status_barometer =
| status_powersensor =
| status_usba = -
| status_usba = -
| status_hdmidp = -
| status_hdmidp = -
Line 41: Line 50:
| status_touchpad = -
| status_touchpad = -
| status_irtx = -
| status_irtx = -
| status_irrx = -
| status_stylus =
| status_haptics = Y
| status_ethernet = -
| status_cameraflash = Y
| status_fossbootloader = Y
| booting = Y
| booting = Y
| n-android = ✔
| whet_dhry = 1381.7
| whet_dhry = 1381.7
}}
}}
Line 48: Line 62:
== Contributors ==
== Contributors ==
* ''[https://gitlab.com/craftyguy craftyguy]''
* ''[https://gitlab.com/craftyguy craftyguy]''
== Users owning this device ==
{{Device owners}}


== Installation ==
== Installation ==
 
Use [[pmbootstrap]] to build your own image.
=== From pre-built image (easy method) ===
Official images of postmarketOS for the Librem 5 are built at least every week. Currently the device is only supported on the <code>edge</code> branch of postmarketOS.
 
This method requires the <code>uuu</code> application is installed on the host computer. <code>uuu</code> is NXP's image deploy tool, and may be found in some distros in a package named <code>mfgtools</code>. Additionally, the following udev rules may be required for <code>uuu</code> to be able to find/access your phone in flash mode:


<syntaxhighlight lang="shell-session">
<syntaxhighlight lang="shell-session">
SUBSYSTEM!="usb", GOTO="librem5_devkit_rules_end"
$ pmbootstrap init  # vendor: purism, device: librem5
ATTR{idVendor}=="1fc9", ATTR{idProduct}=="012b", GROUP+="plugdev", TAG+="uaccess"
$ pmbootstrap install --fde  # using --fde for full disk encryption
ATTR{idVendor}=="0525", ATTR{idProduct}=="a4a5", GROUP+="plugdev", TAG+="uaccess"
ATTR{idVendor}=="0525", ATTR{idProduct}=="b4a4", GROUP+="plugdev", TAG+="uaccess"
LABEL="librem5_devkit_rules_end"
</syntaxhighlight>
</syntaxhighlight>


The rules above assume your user is in the <code>plugdev</code> group, adjust accordingly. You may need to reboot for changes to take effect.
Place the device into [[#Flash Mode]], then flash it with:
 
==== Download the right image ====
* Choose an image for your device from the [https://postmarketos.org/download/ download] page.
* User interface
** Phosh: Purism's GTK based phone interface ([[Phosh|more]])
** Plasma Mobile: KDE's Plasma based phone interface ([https://www.plasma-mobile.org/ more])
** Sxmo: Simple X Mobile interface, a tiling WM based interface ([https://sr.ht/~mil/Sxmo/ more])
** (Note that [[:Category:Interface|more interfaces]] are available, build your own image with pmbootstrap if interested)
* Pick the latest image by its date
* Choose the regular image, or the installer image
** Graphical Installer:
*** Ends in <code>-installer.img.xz</code>
*** Recommended for a proper installation.
*** Encrypting your installation is possible
*** Passwords for user and SSH are set during installation (and SSH can be disabled)
** Regular image:
*** Ends in <code>.img.xz</code>
*** An installation of postmarketOS with defaults for passwords and no full disk encryption
*** The login is <code>user</code> with password <code>147147</code>
*** '''Not recommended''', unless looking for a quick way to try out postmarketOS
 
==== Download JumpDrive ====
 
Grab the latest <code>purism-librem5.tar.xz</code> image from the '''[https://github.com/dreemurrs-embedded/Jumpdrive/releases JumpDrive release page]'''
{{note|JumpDrive 0.7 is the first version to support the Librem 5}}
 
Extract it, and you should see something similar:
 
<syntaxhighlight lang="shell-session">
<syntaxhighlight lang="shell-session">
$ tar xf purism-librem5.tar.xz
$ pmbootstrap flasher flash_rootfs
$ ls
boot-purism-librem5.sh  dtbs  initramfs-purism-librem5.gz  kernel-librem5.gz  purism-librem5.lst  purism-librem5.tar.xz  u-boot-librem5.bin
</syntaxhighlight>
</syntaxhighlight>


==== Run JumpDrive ====
{{note|If <i>pmbootstrap flasher flash_rootfs</i> fails, try pulling the latest codes of pmbootstrap V3.0.0-alpha from git.}}


Place the Librem 5 into [[#Flash Mode]].
Alternatively you can flash a pre-built image with [[JumpDrive]], but this is more effort.
 
Use the helper script from the JumpDrive release to flash the Librem 5:
<syntaxhighlight lang="shell-session">
$ ./boot-purism-librem5.sh
uuu (Universal Update Utility) for nxp imx chips -- libuuu_1.4.72-0-g8e9e189
 
Success 1    Failure 0
 
3:2    10/10 [Done                                  ] FB: Done
</syntaxhighlight>
 
==== Flash to EMMC ====
 
In order to flash the postmarketOS image to the Librem 5, locate the block device exposed to the host computer via JumpDrive:
<syntaxhighlight lang="shell-session">
$ lsblk -o name,size,model,vendor |grep JumpDriv
sdc        29.1G e_eMMC                    JumpDri
</syntaxhighlight>
 
In the example above, the <code>/dev/sdc</code> is the EMMC device on the Librem 5.
 
{{Warning| Triple check you have selected the right block device when performing the next step!! }}
 
<syntaxhighlight lang="shell-session">
$ xzcat 20210217-0609-postmarketOS-edge-phosh-6-purism-librem5-installer.img.xz | sudo dd of=/dev/DRIVE status=progress bs=1M oflag=direct iflag=fullblock
4277141504 bytes (4.3 GB, 4.0 GiB) copied, 194 s, 22.0 MB/s
4093+0 records in
4093+0 records out
4291821568 bytes (4.3 GB, 4.0 GiB) copied, 200.427 s, 21.4 MB/s
</syntaxhighlight>
 
Remove the usb cable and power cycle the phone to boot into the postmarketOS installer.
 
=== With pmbootstrap (Advanced) ===
 
Use [[pmbootstrap]] to build a customized image. Consult the [[Installation guide|installation guide]] for details.
 
<syntaxhighlight lang="shell-session">
$ pmbootstrap init # vendor: purism, device: librem5
$ pmbootstrap install... # add --fde for full disk encryption
</syntaxhighlight>
 
Place the device into [[#Flash Mode]], then flash it with:
<syntaxhighlight lang="shell-session">
$ pmbootstrap flasher flash_rootfs
</syntaxhighlight>


== Flash Mode ==
== Flash Mode ==
Line 164: Line 98:


These directions were gathered from '''[https://developer.puri.sm/Librem5/Development_Environment/Phone/Troubleshooting/Reflashing_the_Phone.html#flash-the-image Purism's documentation]''', refer to it for additional details/troubleshooting.
These directions were gathered from '''[https://developer.puri.sm/Librem5/Development_Environment/Phone/Troubleshooting/Reflashing_the_Phone.html#flash-the-image Purism's documentation]''', refer to it for additional details/troubleshooting.
== SD Card booting ==
The Librem 5's version of u-boot now supports SD Card booting!
To use pmbootstrap to prepare an SD Card, issue the following command:
<syntaxhighlight lang="shell-session">
$ pmbootstrap install --sdcard=/dev/sdX
</syntaxhighlight>
where /dev/sdX represents the block device your SD Card is mounted at.
You can now boot the SD Card by inserting it into your Librem 5 and holding volume down as you power it on.
Unfortunately, some Librem 5's have an issue with the SD Card being mounted as read-only after waking from suspend. If your Librem 5 has this issue and you attempt to suspend it while booted from an SD Card, on resume tinydm and phosh will crash.
== Troubleshooting ==
=== LED colours and flashing patterns ===
The meaning of various LED colours and flashing patterns are documented in [https://docs.puri.sm/Librem_5/Troubleshooting/LEDs.html Purism's documentation].


== OpenPGP Smartcard ==
== OpenPGP Smartcard ==


In order to use the OpenPGP smartcard reader, most Librem 5 phones will need to have the reader firmware upgraded. The firmware can be built from source, but Purism has created a helper script to download/flash the firmware. In order to run this script on Alpine Linux / postmarketOS, these patches should be applied: https://source.puri.sm/angus.ainslie/ttxs-firmware/-/merge_requests/3/diffs
Devices shipped after April 2021 already have the OpenPGP smartcard reader firmware flashed. For those devices these instructions should not be necessary. '''But you still need to check the end of this section on the other tools needed to use the smartcard'''.
 
Older Librem 5 phones will need to have the reader firmware upgraded. The firmware can be built from source, but Purism has created a helper script to download/flash the firmware. In order to run this script on Alpine Linux / postmarketOS, these patches should be applied: https://source.puri.sm/angus.ainslie/ttxs-firmware/-/merge_requests/3/diffs


Running the script should result in the following if it is successful:
Running the script should result in the following if it is successful:
Line 175: Line 130:
Connecting to source.puri.sm (178.63.173.204:443)
Connecting to source.puri.sm (178.63.173.204:443)
saving to '/tmp/tmp.FLFPGo/ttxs.bin'
saving to '/tmp/tmp.FLFPGo/ttxs.bin'
ttxs.bin            100% |********************************************************************************************************************************************************************|  9096  0:00:00 ETA
ttxs.bin            100% |*********************************|  9096  0:00:00 ETA
'/tmp/tmp.FLFPGo/ttxs.bin' saved
'/tmp/tmp.FLFPGo/ttxs.bin' saved
2a5f7172591d76ae3177b0ccd94f70d67597e4a7  /tmp/tmp.FLFPGo/ttxs.bin
2a5f7172591d76ae3177b0ccd94f70d67597e4a7  /tmp/tmp.FLFPGo/ttxs.bin
Line 257: Line 212:


== Known Issues ==
== Known Issues ==
For an ever-up-to-date list of issues, see [https://gitlab.com/postmarketOS/pmaports/-/issues?label_name=device-purism-librem5 issues in gitlab with the device-purism-librem5 label]
For an ever-up-to-date list of issues, see [https://gitlab.postmarketos.org/postmarketOS/pmaports/-/issues?label_name=device-purism-librem5 issues in gitlab with the device-purism-librem5 label]
 
* The Librem 5 ships with the <code>megapixels</code> app by default, but to use the camera for taking pictures you must manually run <code>$sudo apk add megapixels-purism</code> in a terminal to install a forked version of the application.


* Suspend/resume is not supported on the Librem 5, this is an upstream issue and not specific to postmarketOS.
* Suspend/resume is not supported on the Librem 5, this is an upstream issue and not specific to postmarketOS.

Latest revision as of 23:26, 16 December 2024

Purism Librem 5
Manufacturer Purism
Name Librem 5
Codename purism-librem5
Released 2020
Pre-released 2019
Type handset
Hardware
Chipset NXP i.MX8MQ
CPU 4x 1.5 GHz Cortex-A53
GPU Vivante GC7000Lite
Display 1440x720
Storage 32 GB eMMC
Memory 3 GB
Architecture aarch64
Software
Original software PureOS
FOSS bootloader yes
postmarketOS
Category community
Pre-built images yes
Unixbench Whet/Dhry score 1381.7
Features
Flashing
Works
USB Networking
Works
Internal storage
Works
SD card
No data
Battery
Works
Screen
Works
Touchscreen
Works
Stylus
No data
Multimedia
3D Acceleration
Works
Audio
Works
Camera
Partial
Camera Flash
Works
Connectivity
WiFi
Works
Bluetooth
Works
GPS
Works
Modem
Calls
Works
SMS
Works
Mobile data
Works
Miscellaneous
FDE
Works
USB OTG
Works
Sensors
Accelerometer
Works
Magnetometer
No data
Ambient Light
No data
Proximity
No data
Hall Effect
No data
Haptics
Works
Barometer
No data
Power Sensor
No data


Contributors

Users owning this device


Installation

Use pmbootstrap to build your own image.

$ pmbootstrap init  # vendor: purism, device: librem5
$ pmbootstrap install --fde  # using --fde for full disk encryption

Place the device into #Flash Mode, then flash it with:

$ pmbootstrap flasher flash_rootfs
Note If pmbootstrap flasher flash_rootfs fails, try pulling the latest codes of pmbootstrap V3.0.0-alpha from git.

Alternatively you can flash a pre-built image with JumpDrive, but this is more effort.

Flash Mode

To place the Librem 5 info flashing mode, perform the following:

  1. Ensure that the phone is switched off.
  2. Turn all Hardware-Kill-Switches off
  3. Remove battery
  4. Hold volume-up
  5. Insert the USB-c cable: (red light blinks, no green light)
  6. Reinsert the battery: (red light is constantly on, the script will continue)
  7. Release volume-up
Note Some USB-C cables may need to be plugged into the phone with a particular orientation. If the instructions above do not appear to work, try flipping the USB-C end of the cable over and replugging it into the phone.

These directions were gathered from Purism's documentation, refer to it for additional details/troubleshooting.

SD Card booting

The Librem 5's version of u-boot now supports SD Card booting!

To use pmbootstrap to prepare an SD Card, issue the following command:

$ pmbootstrap install --sdcard=/dev/sdX

where /dev/sdX represents the block device your SD Card is mounted at.

You can now boot the SD Card by inserting it into your Librem 5 and holding volume down as you power it on.

Unfortunately, some Librem 5's have an issue with the SD Card being mounted as read-only after waking from suspend. If your Librem 5 has this issue and you attempt to suspend it while booted from an SD Card, on resume tinydm and phosh will crash.

Troubleshooting

LED colours and flashing patterns

The meaning of various LED colours and flashing patterns are documented in Purism's documentation.

OpenPGP Smartcard

Devices shipped after April 2021 already have the OpenPGP smartcard reader firmware flashed. For those devices these instructions should not be necessary. But you still need to check the end of this section on the other tools needed to use the smartcard.

Older Librem 5 phones will need to have the reader firmware upgraded. The firmware can be built from source, but Purism has created a helper script to download/flash the firmware. In order to run this script on Alpine Linux / postmarketOS, these patches should be applied: https://source.puri.sm/angus.ainslie/ttxs-firmware/-/merge_requests/3/diffs

Running the script should result in the following if it is successful:

$ ./scripts/stm_reflash.sh
Connecting to source.puri.sm (178.63.173.204:443)
saving to '/tmp/tmp.FLFPGo/ttxs.bin'
ttxs.bin             100% |*********************************|  9096  0:00:00 ETA
'/tmp/tmp.FLFPGo/ttxs.bin' saved
2a5f7172591d76ae3177b0ccd94f70d67597e4a7  /tmp/tmp.FLFPGo/ttxs.bin
...
Option 2     : 0x00
Device ID    : 0x0435 (STM32L43xxx/44xxx)
- RAM        : Up to 48KiB  (12544b reserved by bootloader)
- Flash      : Up to 256KiB (size first sector: 1x2048)
- Option RAM : 16b
- System RAM : 28KiB
Write to memory
Erasing memory
Wrote address 0x08002388 (100.00%) Done.
...

Reboot the phone after upgrading the firmware.

There's a package in the postmarketOS aports repo that enables/installs everything required to use a smartcard on this device: sudo apk add device-purism-librem5-smartcard

Reboot after installing this package for the first time.

For more information, including some examples of how to generate keys and push existing keys to the smart card using gpg, see Purism's Librem Key manual: https://docs.puri.sm/Librem_Key/Getting_Started/User_Manual.html

eMMC Backup / Restore

This section describes one method of backing up the eMMC and restoring that backup. postmarketOS, like many other Linux distros, can work with any number of backup/restore solutions (e.g. rsnapshot, and so on). This particular method uses JumpDrive and ddrescue, and therefore is out-of-band from postmarketOS (or any distro) on the eMMC. An entire copy of the eMMC will be produced, with full disk encryption preserved if it is enabled.

The steps to prepare the Librem 5 are the same for backing up and restoring a disk backup:

  1. #Download JumpDrive
  2. Place the device into #Flash Mode
  3. #Boot JumpDrive

ddrescure is needed on the host PC. See the ddrescue manpage for information on additional parameters you might want to use.

Identify the Librem 5 eMMC disk using lsblk. The following options make it relatively easy to identify the correct disk, but check multiple times that you have the correct drive!

$ lsblk -o name,size,model,vendor |grep JumpDriv
sdb        29.1G e_eMMC                    JumpDri

Backup

Run ddrescue. Specifying a map file is recommended so that the process can be resumed if it is interrupted.

# ddrescue -v -d -r3 /dev/sdb L5_pmOS_20210210.disk L5_pmOS_20210210.disk.map
...

Restore

Note Make sure you have the correct target drive before proceeding. ddrescure will overwrite the drive! You have been warned!

The backup image can be restored with ddrescue:

# ddrescue -f ~/L5_pmOS_20210210.disk /dev/sdb ddrescue_restore.log
...


U-boot Updates

Warning WARNING: This process might result in a device that will not boot postmarketOS, make sure you understand how you might recover from this situation before proceeding!!

Purism is still somewhat actively improving u-boot support on this device, and some components required for booting (DDR training firmware) still see periodic updates. As a result, the u-boot-librem5 package might be upgraded on a device with an existing postmarketOS installation. Package upgrades will not upgrade the u-boot used for booting the device. In order to upgrade the u-boot used for booting the device, the update-u-boot script can be used.

Run with -n to confirm the input file and device are correct:

$ update-u-boot -n
dd if=/usr/share/u-boot/librem5/phone-boot.img of=/dev/mmcblk0 bs=1k seek=2 status=none
sync

Then perform the actual update:

$ sudo update-u-boot
Updating librem5 u-boot in /dev/mmcblk0 in 3 seconds...
Completed successfully.

Known Issues

For an ever-up-to-date list of issues, see issues in gitlab with the device-purism-librem5 label

  • Suspend/resume is not supported on the Librem 5, this is an upstream issue and not specific to postmarketOS.