Difference between revisions of "PinePhone Pro"

From PINE64
Jump to navigation Jump to search
Tag: Reverted
Tag: Reverted
Line 175: Line 175:
==== levinboot ====
==== levinboot ====
The levinboot bootloader is another option for the PinePhone Pro. The project repository can be found [https://gitlab.com/DeltaGem/levinboot/-/tree/master/ here]. (Pinephone Pro supporting fork is [https://xff.cz/git/levinboot/ here].)
The levinboot bootloader is another option for the PinePhone Pro. The project repository can be found [https://gitlab.com/DeltaGem/levinboot/-/tree/master/ here]. (Pinephone Pro supporting fork is [https://xff.cz/git/levinboot/ here].)




Line 499: Line 495:
  #      append root=UUID=dec2be75-3594-4078-b8c9-f3b215e6eac3 console=ttyS2,115200n8 consoleblank=0 loglevel=7 rw spl>
  #      append root=UUID=dec2be75-3594-4078-b8c9-f3b215e6eac3 console=ttyS2,115200n8 consoleblank=0 loglevel=7 rw spl>
  EOF
  EOF


Unmount all /dev
Unmount all /dev
  sudo umount /mnt/archlinuxsd /mnt/manjarosd /mnt/mobiansd /mnt/postmarketossd /mnt/ubuntutouchsd /mnt/*/boot /mnt/*/root
  sudo umount /mnt/archlinuxsd /mnt/manjarosd /mnt/mobiansd /mnt/postmarketossd /mnt/ubuntutouchsd /mnt/*/boot /mnt/*/root


=== Multi-Distro on eMMC ===
=== Multi-Distro on eMMC ===
Line 714: Line 709:
# On first boot neither Phosh nor sxmo resized their partition - ''sudo resize2fs'' sorted that.
# On first boot neither Phosh nor sxmo resized their partition - ''sudo resize2fs'' sorted that.
# Any time an update rebuilds the initramfs it is necessary to delete /boot/boot.scr again to keep the rk2aw menu clean.
# Any time an update rebuilds the initramfs it is necessary to delete /boot/boot.scr again to keep the rk2aw menu clean.





Revision as of 19:21, 9 September 2023

Rendering of the PinePhone Pro

The PinePhone Pro is PINE64's flagship smartphone announced on October 15, 2021. It features 4GB of RAM, an 128GB eMMC and is using an Rockchip RK3399S SoC, which is a specialized version of the RK3399 made specifically for the PinePhone Pro.

Introduction

The PinePhone Pro is PINE64’s second smartphone and a successor to the original PinePhone. It does not, however, replace the original PinePhone. It should also not be considered a second generation PinePhone; it is a higher-end device, with much better specs, aimed at those who wish to daily-drive a open system stack. Achieving this goal will, however, take time as the software and overall smartphone software ecosystem needs to mature.

State of the software

(view separately)

Presently the PinePhone Pro Explorer Edition is aimed at Linux developers with an extensive knowledge of embedded systems and/or experience with mobile Linux. It will take time for all the PinePhone Pro’s functionality to reach software parity with the original PinePhone and for mobile operating systems, in more general, to reach a higher degree of maturity.

Bear in mind that the software for these smartphones is still in a very early stage, with most of the software being in alpha or beta state. That's especially also the case for scalability of applications, their availability and practicability, any hardware function implementations and the firmware. The software is provided as is. There is no warranty for the software, not even for merchantability or fitness for a particular purpose.

The following table lists the feature functionality status of the unaltered pre-installed factory image of the current shipping batch and as comparison an up-to-date reference image (no responsibility is accepted for the accuracy of this information, the list is provided and updated by the community). If you have any questions regarding the current state of the software or of specific features working, please don't hesitate to ask in the community chat before buying the device:

The software is written by the community, any contributions towards the community projects are greatly appreciated! Please see "How to Contribute" to learn about how to contribute to the software projects and "Where to Report Bugs" to learn about where to report bugs.
Functionality Component Status (factory)¹ Status (updated)² Notes
Bootloader Bootloader Critical bugs Some critical software bugs currently not fixed yet: A drained battery causes U-Boot to bootloop (cause is known and currently being worked on);Workaround Occasionally the eMMC fails to initializeReport. Note: Tow-Boot is now pre-installed on the SPI from the factory - issues need verification to be issues with Tow-Boot.
SPI Implemented Devices bought after end of July 2022 come with Tow-Boot flashed to the SPI memory, making it considerably easier to flash the device and boot from microSD card.
Boot GUI Not implemented Currently there is no graphical boot selection implementedPossibly planned
Operating System Stability WIP
Suspend Experimental Audio is often higher pitched after waking up from suspend due to a bug, make sure to update your systemReportReport
Updates WIP The pre-flashed and outdated operating system on the eMMC often gets corrupted after updatingExample; Pacman database lock preventing updatesSolution; Keyring bug[Solution is to run "pinephonepro-post-install" script as root]
Modem General WIP Alternative firmware; Slow wakeupReport; Some carriers blocking specific TANs in their networkPinePhone Carrier Support; Note: Proprietary firmware
Phone WIP The modem connection crashes frequently, which can lead to missed callsReportAlternative firmware; Slow wakeupReport; bad call audio qualityReport; Audio is often higher pitched after waking up from suspend due to a bugReportReport
SMS Working SMS functionality is expected to work. In certain cases the functionality might be blocked by a clogged modemReport; Some bugs
MMS WIP MMS functionality is integrated into the application "Spacebar", some bugs remaining and expected
Push notifications Not implemented Receiving push notifications while the phone is suspended is not implemented
Components LCD WIP Hardware issueDetails
Touch Working
Rear camera Not working WIP Camera work-in-progress with DTS fix[Citation]; userspace still needs to do some catching updebugging article; Green image tint[Citation]
Front camera Not working WIP Camera work-in-progress with DTS fix[Citation]; userspace still needs to do some catching updebugging article; Green image tint[Citation]
Camera flash Critical issues Hardware issueDetails; Note: /sys/class/leds/white:flash
WiFi Working WiFi is expected to work. The firmware does not support monitor mode and package injection. Note: Proprietary firmware
Bluetooth WIP Bluetooth not necessarily working for calls yet due to missing audio routing[Citation]; Bluetooth in general dodgy under Pulseaudio.Info Note: Proprietary firmware
GNSS/GPS WIP aGPS to be implementedSee original PinePhone article; long loading times to get a GPS fix[Citation]; No preinstalled application[Citation]
Sensors WIP "Geo Magnetic Sensor" (af8133j): Status unknown (at /sys/bus/i2c/devices/4-001c/iio:device1)

"Accelerometer / Gyroscope" (mpu6500): Working (at /sys/bus/i2c/devices/4-0068/iio:device2)
"Ambient light / Proximity" (stk3311): Working after updating

Vibration motor Working
Notification LED Working
Buttons Working Power buttons and volume buttons are working.
Accessory compatibility, spare parts Keyboard Add-on WIP The keyboard add-on compatibility is work-in-progress.
LoRa Add-on Not implemented No software support implemented
Qi Wireless Charging Add-on WIP Wireless charging with the add-on case is expected to work to some degree. Certain software functionality and a driver is currently missing[Citation]
Fingerprint Reader Add-on Not implemented No software support implemented
Spare parts Partial Some spare parts now available in the store.Store
Software notes Waydroid Working Waydroid is an Android container used to run Android applications.

¹ Status of the features at the time of the last factory installation without updates

² Status of the features with an up-to-date reference image

Editions and revisions

Similarly to the original PinePhone, various PinePhone Pro editions are planned, the first of which is the Developer Edition (aimed at developers, as the name entails) followed by the Explorer Edition, which is aimed at early adopters.

Help and support

Still have any questions regarding software, shipping, or ordering after reading this Wiki? Please don't hesitate to contact the community in the bridged community channels for detailed answers or simply to chat with friendly people in the community! See Main Page#Community and Support.

Please keep in mind that PINE64 is not like a regular company (see the PINE64 philosophy) and that support resources are limited - the best way to get support quickly is to ask in the community chat! Please only contact the PINE64 support directly if questions couldn't be solved via the community chat or this wiki.

First time setup

A protection foil isolates the battery for the shipping.

When shipped the battery is isolated from the device using a protective plastic tab, which is required to be removed before using the phone. The battery will not charge or boot until it is removed and the battery is connected again.

Note: To remove the sticker after unboxing the phone: Carefully remove the back panel using the notch in the corner of the back cover without overbending it. Then remove the battery. Peel off the clear plastic sticker below it, which isolates the charging contacts and reinsert the battery.

The SIM card has to be placed in the lower slot, while the microSD has to be placed in the upper slot. Devices shipped after the end of July 2022 do only accept a nano-SIM, the SIM is inserted into a carriage released by slightly pulling on the handle in the lower slot (for information regarding devices shipped prior to end of July 2022 see below).

The microSD belongs in the upper slot, the SIM card in the lower slot.
Note: Information regarding devices shipped prior to end of July 2022: The PinePhone Pros shipped prior to the end of July 2022 come with a micro-SIM slot instead of a nano-SIM slot. Do not insert an empty micro-SIM adapter into the phone and do not release the nano-SIM inside the adapter, as it will get stuck on the contact pins.
If the nano-SIM got released inside the adapter inside the phone, carefully reinsert the nano-SIM card without moving the adapter. In that case do not pull on the empty adapter as it will get stuck on the contact pins and damage them!

Software

The software section explains how to install the available software releases for the PinePhone Pro to the internal eMMC or a microSD card, how to boot them and how to solve common booting issues.

Software releases

The PinePhone Pro Software Releases page has a complete list of currently supported phone-optimized operating system images that work with the PinePhone Pro.

Note: Images of the regular PinePhone are not compatible with the PinePhone Pro.

Boot order

The RK3399S processor in the PinePhone Pro searches for the bootloader (such as U-Boot or Tow-Boot) in the following order:

  1. SPI flash
  2. eMMC (the internal memory)
  3. MicroSD card

Boot from microSD card temporarily

To temporarily boot from an inserted microSD card do the following:

  • On the Explorer Edition ordered after July 2022 hold the volume down key while powering on the device. The batches bought after July 2022 come with Tow-Boot flashed to the SPI, which offers additional functionality over U-Boot as bootloader.
  • On the Explorer Edition ordered between January and July 2022 hold the RE button underneath the cover for a few seconds, while powering on the device. If the button is labeled RESET instead of RE please verify if the device is a regular PinePhone (or the Developer Edition). This is required because older batches don't ship with Tow-Boot on the SPI. Flashing Tow-Boot can be caught up by following this instruction. Note: If Tow-Boot is flashed later, the microSD card can be selected at boot with the volume down key as well.
  • On the Developer Edition (sold to selected developers only) the SPI and the eMMC can be bypassed by shorting the bypass test points while booting. The process is explained in the article PinePhone Pro Developer Edition. Please join the community chat for any questions regarding the process.

The RE button disables the SPI and the eMMC at the hardware level while the button is held and the PinePhone Pro will try to boot from the next available boot medium, which is the microSD card. Note: When holding the RE button (or when shorting the contact points in case of the Developer Edition) for a longer time at boot the operating system will not initialize the SPI and eMMC and it will not be possible to write to these storage mediums until the next reboot.

Note: The bootloader uses its own boot order for loading the kernel and other core operating system components at boot, which for example may result in the boot loader residing on the eMMC loading and booting the kernel from a microSD card.

Boot from microSD card permanently

The bootloader (such as U-Boot) resides in the free space in front of the first partition. Wiping the bootloader from the eMMC to make the PinePhone Pro boot from microSD card can be done using sudo dd if=/dev/zero of=/dev/mmcblk2 seek=64 count=400 conv=fsync. Formatting the drive or deleting the partition table is not sufficient to wipe the bootloader.

Notes

If you received your device after July of 2022, the bootloader (Tow-Boot) resides on the SPI. To boot to an SD card, place the SD card in your PinePhone Pro and turn it on. The phone will vibrate once. At this point, hold down the volume down button until you feel the device vibrate again then release the button. The LED color should change to blue and your display should remain black for a few seconds. In a few seconds you should see the SD card booting, the indications of which are dependent on what image you chose. If the LED is flashing instead, the boot from SD failed. Erasing the SPI can be achieved via the Tow-Boot installer image. Instructions are available here Tow-Boot PinePhone Pro Instructions.

See RK3399 boot sequence for further details regarding the boot sequence.

Installation instructions

The software releases can be installed (the process is being referred to as flashing) to the eMMC or to an microSD card.

Flashing to microSD card

To install an image to the microSD card:

  1. Download a compatible image from PinePhone Pro Software Releases.
  2. Important: Typically the image will be compressed in an archive file to reduce the download size (such as .gz or .xz). Extract the image from its archive file to get the file with the file extension .img.
  3. Write the image to your microSD card using your favorite method, examples:
    • Using dd: On the device you're flashing the microSD card from, find the correct device under lsblk and then flash the image to the microSD card using sudo dd if=IMAGE.img of=/dev/[DEVICE] bs=1M status=progress conv=fsync. Make sure the target is the whole microSD card and not its first partition (sdc1 or mmcblk0p1 are wrong!).
    • Using bmaptool: Make sure to select the correct device using lsblk. Then run bmaptool with the correct device: Download the IMAGE.xz and the IMAGE.bmap files, then run bmaptool copy --bmap IMAGE.bmap IMAGE.xz /dev/[DEVICE]. This takes around 2.5 minutes to flash a 4 GB file.
    • Using a graphical tool: A graphical tool such as Gnome Disks under Linux or Etcher under Windows may also be used.
  4. Insert the microSD card into the top slot of the PinePhone Pro. Make sure the microSD card is inserted all the way and that the notch of the right side of the microSD card is not visible anymore, see here.
  5. Boot the device using the following method:
    • On the Explorer Edition ordered after July 2022 hold the volume down key while booting.
    • On the Explorer Edition ordered between January and July 2022 hold the RE button underneath the back cover while booting (or use the volume down key if you flashed Tow-Boot).
    • On the Developer Edition (sold to selected developers only) apply the bypass by shorting the testing pads while booting according to the datasheet (or use the volume down key if you flashed Tow-Boot).

Details regarding the boot order can be found in the Boot order section.

Flashing to the eMMC

Flashing to the eMMC (the internal memory of the PinePhone Pro) can either be done using Tow-Boot's USB Mass Storage mode (see #Boot order if you are unsure if the device comes with Tow-Bot pre-installed) or by booting an operating system from the microSD card (see the section Flashing to microSD card) and by writing to the eMMC directly from there:

By using Tow-Boot:

  1. Power off the device
  2. Power on the device and hold the volume up key before and during the second vibration
  3. The LED will turn blue if done successfully. This will only work if Tow-Boot is installed
  4. When connecting the device to a computer via USB it will behave like an USB drive now
  5. Check if the eMMC appears under lsblk, the output might look like the following:
    mmcblk2 179:0 0 115.2G 0 disk
    ├─mmcblk2p1 179:1 0 122M 0 part /boot
    └─mmcblk2p2 179:2 0 115.1G 0 part /
    Note: In this example, /dev/mmcblk2 is the device, while mmcblk2p1 and mmcblk2p2 are partitions of the device. The downloaded images are images from full devices, which means that the full device (mmcblk2 in this example) needs to be flashed. Ignore the partitions!
  6. Important: Typically the image will be compressed in an archive file to reduce the download size (such as .gz or .xz). Extract the image from its archive file to get the file with the file extension .img
  7. Flash the image file using sudo dd if=IMAGE.img of=/dev/DEVICE bs=1M status=progress conv=fsync (replace IMAGE.img with the filename of the image you want to flash and make sure it has the file extension .img and replace DEVICE with the correct device from the lsblk command)
  8. Reboot the PinePhone Pro

By booting a microSD card:

  1. Boot an operating system from the microSD card. If there is already a bootloader on the eMMC installed see the section Boot order to bypass it.
  2. Download or copy the desired image to the microSD card as file
  3. Check if the eMMC appears under lsblk. If it doesn't appear in the output of the command, the eMMC wasn't initialized due to applying the above explained bypass method for a too long time during the boot
  4. Important: Typically the image will be compressed in an archive file to reduce the download size (such as .gz or .xz). Extract the image from its archive file to get the file with the file extension .img.
  5. Flash the image file using sudo dd if=IMAGE.img of=/dev/mmcblk2 bs=1M status=progress conv=fsync (replace IMAGE.img with the filename of the image you want to flash and make sure it has the file extension .img).
  6. Reboot the PinePhone Pro

Troubleshooting

If the PinePhone Pro is not booting (either booting incompletely into a boot splash or tty or if the PinePhone Pro is showing no signs of life) this will typically have the following two reasons:

The battery is fully drained

If the battery is drained then the board can reset during boot causing a boot loop because of undervoltage condition. It can happen on all stages of the boot including U-Boot bootloader, display initialization and USB (re-)configuration. In that case it is not possible to charge the phone. The battery can be charged by interrupting the boot loop by booting the PinePhone Pro into Maskrom mode or by charging the battery externally. It is possible to follow these instructions without a computer by using a wall charger, however it would not be possible to determine if Maskrom mode was started successfully. To boot the PinePhone Pro into Maskrom mode:

  • Remove any microSD card from the phone and keep it removed for the below procedure
  • Remove the battery, any USB cable and any serial cable
  • Reinsert the battery
  • Hold the RE button underneath the back cover of your Explorer Edition (or short the bypass contact points on the Developer Edition)
Note: Confirm that the label of the button says RE and not RESET! If the button label says RESET instead you probably have a regular PinePhone and you're reading the wrong page.
  • Connect the phone to an USB port of a computer, while still holding the button for some time
  • Confirm if the phone was booted in Maskrom mode:
    • On Linux check if the Maskrom mode appears as device in the output of the terminal command lsusb on the computer, the expected VID:PID of the device is 2207:330c.
    • On Windows this can be checked using the Device Manager and checking the VID "2207" and PID "330c" of an Unknown device appears.
    • On macOS this can be checked in /Applications/Utilities/System Information.app under USB and by checking if the VID "2207" and PID "330c" is appearing for a Composite Device.
  • Let the phone charge for multiple hours
Note: If the device doesn't appear under lsusb please try again with a different known good USB-C cable and make sure that there is no microSD card in the phone inserted.

The device should now be able to boot from the boot medium again. If that is not the case the installation got corrupted, as explained below.

The installation is corrupted

The PinePhone Pro won't be able to boot if the installation on the SPI flash, the eMMC or the microSD card got corrupted. To boot a working operating system:

  • Prepare a microSD card as explained in the section Flashing to microSD card
  • Remove any USB-C cable or device or add-on case from the PinePhone Pro
  • Make sure the device is powered off by shortly removing the battery for a second
  • Insert the microSD card into the top slot of the PinePhone Pro. Make sure the microSD card is inserted all the way and that the notch of the right side of the microSD card is not visible anymore.
  • Power on the device while bypassing the SPI and eMMC as explained under Boot order

The device should now boot from the microSD card. If the phone does not boot from the microSD card the microSD card was flashed with an incompatible image or the battery got drained as explained above.

Bootloaders

The following section contains notes regarding compatible bootloaders with the PinePhone Pro.

U-Boot

The pre-installed operating system on the PinePhone Pro Explorer Edition, if sold prior to the end of July of 2022, is using U-Boot as default bootloader. Batches sold after July of 2022 are using Tow-Boot

Tow-Boot

Current batches of the PinePhone Pro ship with Tow-Boot pre-installed to the SPI flash, which is an opinionated distribution of U-Boot and brings numerous advantages over stock U-Boot, such as the possibility to choose from booting the eMMC or microSD card using the volume buttons during boot, as well as a USB Mass Storage mode, where the device can be written to by connecting the device to a computer via USB.

The user can flash Tow-Boot to the PinePhone Pro using the instructions on the Tow-Boot website.

levinboot

The levinboot bootloader is another option for the PinePhone Pro. The project repository can be found here. (Pinephone Pro supporting fork is here.)


Multi-Distro on MicroSD Card

This section explains how to install megi's rk2aw loader, U-Boot to SPI and a multi-distribution image to the microSD card and eMMC of the PinePhone Pro. Further instructions regarding rk2aw can be found on megi's website under https://xff.cz/kernels/rk2aw/rk2aw-rk3399-pinephone-pro/INSTALL. Please note that loader and userspace utility to flash it are free, but not open-source.

Options to boot Arch Linux ARM, Manjaro and Mobian (kernel 6.1 and 6.3)


Flash Rk2Aw Loader to SPI

Connect PinePhone Pro to a Linux machine, start a ssh connection and download installer to flash pre-loader to the phone's SPI.

ssh <user>@<phoneip>
cd ~/Downloads
curl -O https://xff.cz/kernels/bootloaders/ppp.tar.gz
tar -xvzf ppp.tar.gz -C ~/Downloads
# scp -r ~/Downloads/ppp <user>@<phoneip>:~/Downloads # copy to phone, non needed
sudo ./spinor-flash-initial-setup.sh

Build Multi-Distro on SD Card

Get the compressed distribution images from PinePhone Pro Software Releases, decompress them and mount both partitions "/boot", "/root" from each distro.

lsblk # show /loop, /sd references
 ├─loop0p1	/media/xxx/BOOT_MNJRO
 └─loop0p2	/media/xxx/ROOT_MNJRO
 ├─loop1p1	/media/xxx/boot
 └─loop1p2	/media/xxx/rootfs
 ├─loop2p1 /media/xxx/52CA-6165  
 └─loop2p2	/media/xxx/3d99072c-9fd6-4316-8526-9192e192c441
 └─sdb	disk (after each dd command you'll see the partition id name to adjust into scripts.)
blkid # show UUID for the partition

If necessary erase SD card

sudo dd if=/dev/zero of=/dev/sdb count=945728 bs=32768 status=progress # quick way i.e. # 32GB SDcard (30989615104bytes/32768dim=945728volte)
sudo dd if=/dev/zero of=/dev/sdb count=1 bs=32768 status=progress # slow way i.e. # 32GB SDcard (30989615104bytes/32768dim=1volta)
Partition the MicroSD Card
Note: A minimum capacity of 64 GB for the microSD card is recommended for 5 distros.
sudo sfdisk /dev/sdb --wipe always <<EOF
 label: gpt
 first-lba: 64
 table-length: 8
 start=64, size=32704, type=D7B1F817-AA75-2F4F-830D-84818A145370, name="loader", attrs=RequiredPartition
 size=11G, name="ALARM", attrs="RequiredPartition,LegacyBIOSBootable"
 size=11G, name="MANJARO", attrs="RequiredPartition,LegacyBIOSBootable"
 size=11G, name="MOBIAN", attrs="RequiredPartition,LegacyBIOSBootable"
 size=11G, name="PMOS", attrs="RequiredPartition,LegacyBIOSBootable"
 size=11G, name="UT", attrs="RequiredPartition,LegacyBIOSBootable"
 size=+, name="extra", attrs="RequiredPartition,LegacyBIOSBootable"
EOF
Checking that no-one is using this disk right now ... OK
Disk /dev/sdb: 58.25 GiB, 62550179840 bytes, 122168320 sectors
Disk model: SD Card Reader  
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt
Disk identifier: C44BE2FC-34D6-4DD8-99FC-7FFB75602A79
Old situation:
>>> Script header accepted.
>>> Created a new GPT disklabel (GUID: F71BFBA6-D2C3-4C20-8079-1401B10C724C).
The maximal number of partitions is 8 (default is 128).
 /dev/sdb1: Created a new partition 1 of type 'unknown' and of size 16 MiB.
 /dev/sdb2: Created a new partition 2 of type 'Linux filesystem' and of size 11 GiB.
 /dev/sdb3: Created a new partition 3 of type 'Linux filesystem' and of size 11 GiB.
 /dev/sdb4: Created a new partition 4 of type 'Linux filesystem' and of size 11 GiB.
 /dev/sdb5: Created a new partition 5 of type 'Linux filesystem' and of size 11 GiB.
 /dev/sdb6: Created a new partition 6 of type 'Linux filesystem' and of size 11 GiB.
 /dev/sdb7: Created a new partition 7 of type 'Linux filesystem' and of size 3.2 GiB.
 /dev/sdb8: Done.
New situation:
Disklabel type: gpt
Disk identifier: F71BFBA6-D2C3-4C20-8079-1401B10C724C
Device         Start       End  Sectors  Size Type
 /dev/sdb1         64     32767    32704   16M unknown
 /dev/sdb2      32768  23101439 23068672   11G Linux filesystem
 /dev/sdb3   23101440  46170111 23068672   11G Linux filesystem
 /dev/sdb4   46170112  69238783 23068672   11G Linux filesystem
 /dev/sdb5   69238784  92307455 23068672   11G Linux filesystem
 /dev/sdb6   92307456 115376127 23068672   11G Linux filesystem
 /dev/sdb7  115376128 122167295  6791168  3.2G Linux filesystem
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
Get Image Files for the Distros

Enter to Directory

cd ~/Downloads

Download your chosen image from wiki.pine64.org/wiki/PinePhone_Pro_Software_Releases

wget https://github.com/dreemurrs-embedded/Pine64-Arch/releases/download/20230203/archlinux-pinephone-pro-sxmo-20230203.img.xz
wget https://github.com/manjaro-pinephone/plasma-mobile/releases/download/beta15-rc4/Manjaro-ARM-plasma-mobile-pinephonepro-beta15-rc4.img.xz
wget https://images.mobian.org/pinephonepro/weekly/mobian-pinephonepro-phosh-20230903.img.xz
wget https://images.postmarketos.org/bpo/v23.06/pine64-pinephonepro/phosh/20230904-0846/20230904-0846-postmarketOS-v23.06-phosh-22.2-pine64-pinephonepro.img.xz
# to do (postmarketOS-edge-phosh via BootStrap)
wget https://gitlab.com/ook37/pinephone-pro-debos/-/jobs/4961858606/artifacts/file/ubuntu-touch-pinephone-unified.img.xz

Extract the Compressed Files

xz -v -d -k archlinux-pinephone-pro-sxmo-20230203.img.xz
xz -v -d -k Manjaro-ARM-plasma-mobile-pinephonepro-beta15-rc4.img.xz
xz -v -d -k mobian-pinephonepro-phosh-20230903.img.xz
xz -v -d -k 20230904-0846-postmarketOS-v23.06-phosh-22.2-pine64-pinephonepro.img.xz
xz -v -d -k ubuntu-touch-pinephone-unified.img.xz

Mount the Images

sudo su # login with your psw
losetup -P /dev/loop1 archlinux-pinephone-pro-sxmo-20230203.img && losetup -P /dev/loop2 Manjaro-ARM-plasma-mobile-pinephonepro-beta15-rc4.img && losetup -P /dev/loop3 mobian-pinephonepro-phosh-20230903.img && losetup -P /dev/loop4 20230904-0846-postmarketOS-v23.06-phosh-22.2-pine64-pinephonepro.img && losetup -P /dev/loop5 ubuntu-touch-pinephone-unified.img
ls -l /mnt/
mkdir /mnt/archlinux /mnt/archlinux/boot /mnt/archlinux/root && mkdir /mnt/manjaro /mnt/manjaro/boot /mnt/manjaro/root && mkdir /mnt/mobian /mnt/mobian/boot /mnt/mobian/root && mkdir /mnt/postmarketos /mnt/postmarketos/boot /mnt/postmarketos/root && mkdir /mnt/ubuntutouch /mnt/ubuntutouch/boot /mnt/ubuntutouch/root
mkdir /mnt/archlinuxsd && mkdir /mnt/manjarosd && mkdir /mnt/mobiansd && mkdir /mnt/postmarketossd && mkdir /mnt/ubuntutouchsd
mount /dev/loop1p1 /mnt/archlinux/boot/ && mount /dev/loop1p2 /mnt/archlinux/root/ && mount /dev/loop2p1 /mnt/manjaro/boot/ && mount /dev/loop2p2 /mnt/manjaro/root/ && mount /dev/loop3p1 /mnt/mobian/boot/ && mount /dev/loop3p2 /mnt/mobian/root/ && mount /dev/loop4p1 /mnt/postmarketos/boot/ && mount /dev/loop4p2 /mnt/postmarketos/root/ && mount /dev/loop5p1 /mnt/ubuntutouch/boot/ && mount /dev/loop5p2 /mnt/ubuntutouch/root/


Check Mounted Images

lsblk
NAME      MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
 loop1       7:1    0   3.5G  0 loop 
 ├─loop1p1 259:0    0   122M  0 part /mnt/archlinux/boot
 └─loop1p2 259:1    0   3.4G  0 part /mnt/archlinux/root
 loop2       7:2    0   6.3G  0 loop 
 ├─loop2p1 259:2    0 457.8M  0 part /mnt/manjaro/boot
 └─loop2p2 259:3    0   5.8G  0 part /mnt/manjaro/root
 loop3       7:3    0   5.6G  0 loop 
├─loop3p1 259:4    0   511M  0 part /mnt/mobian/boot
└─loop3p2 259:5    0   5.1G  0 part /mnt/mobian/root
loop4       7:4    0   2.3G  0 loop 
├─loop4p1 259:6    0   243M  0 part /mnt/postmarketos/boot
└─loop4p2 259:7    0   2.1G  0 part /mnt/postmarketos/root
loop5       7:5    0   3.7G  0 loop 
├─loop5p1 259:10   0 380.5M  0 part /mnt/ubuntutouch/boot
└─loop5p2 259:11   0   3.4G  0 part /mnt/ubuntutouch/root
sdb         8:16   1  58.3G  0 disk 
├─sdb1      8:17   1    16M  0 part 
├─sdb2      8:18   1    11G  0 part 
├─sdb3      8:19   1    11G  0 part 
├─sdb4      8:20   1    11G  0 part 
├─sdb5      8:21   1    11G  0 part 
├─sdb6      8:22   1    11G  0 part 
└─sdb7      8:23   1   3.2G  0 part 
Build Archlinux Partition

Login as root, copy rootfs and bootfs to the partition. You need also to make some changes on some files.

sudo dd if=/dev/loop1p2 of=/dev/sdb2 bs=1M status=progress conv=fsync
sudo mount /dev/sdb2 /mnt/archlinuxsd/
sudo scp -r /mnt/archlinux/boot/* /mnt/archlinuxsd/boot
sudo mv /mnt/archlinuxsd/boot/boot.scr /mnt/archlinuxsd/boot/boot.scrORIG
sudo su
cat << EOF > /mnt/archlinuxsd/etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# UUID=fd049b8e-615f-4efd-bc96-622c4d40e6cb	/         	ext4      	rw,relatime	0 1
# UUID=841C-F9DD      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2
PARTLABEL=ALARM	/         	ext4      	rw,relatime	0 1
EOF
mkdir /mnt/archlinuxsd/boot/extlinux
sudo su
cat << EOF > /mnt/archlinuxsd/boot/extlinux/extlinux.conf
#/boot/extlinux/extlinux.conf
MENU TITLE Pinephone Pro Boot Menu
LABEL l0
MENU LABEL ALARM
FDT /boot/dtbs/rockchip/rk3399-pinephone-pro.dtb
KERNEL /boot/Image
INITRD /boot/initramfs-linux.img
APPEND root=PARTLABEL=ALARM console=ttyS2,115200 console=tty0 loglevel=4 rw rootwait
EOF
Build Manjaro Partition

As for previous step proceed for next partition.

sudo dd if=/dev/loop2p2 of=/dev/sdb3 bs=1M status=progress conv=fsync
sudo mount /dev/sdb3 /mnt/manjarosd/
sudo scp -r /mnt/manjaro/boot/* /mnt/manjarosd/boot
sudo mv /mnt/manjarosd/boot/boot.scr /mnt/manjarosd/boot/boot.scrORIG
sudo su
cat << EOF > /mnt/manjarosd/etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# PARTUUID=362866dc-95cf-4069-9bb8-623aa3cdcb5d   /   ext4     defaults    0   1
PARTLABEL=MANJARO   /   ext4     defaults    0   1
EOF
mkdir /mnt/manjarosd/boot/extlinux
sudo su
cat << EOF > /mnt/manjarosd/boot/extlinux/extlinux.conf
#/boot/extlinux/extlinux.conf
MENU TITLE Pinephone Pro Boot Menu
LABEL l0
MENU LABEL MANJARO
FDT /boot/dtbs/rockchip/rk3399-pinephone-pro.dtb
KERNEL /boot/Image
INITRD /boot/initramfs-linux.img
APPEND root=PARTLABEL=MANJARO console=ttyS2,115200 console=tty0 loglevel=4 rw rootwait
EOF
Build Mobian Partition

As for previous step proceed for next partition.

sudo dd if=/dev/loop3p2 of=/dev/sdb4 bs=1M status=progress conv=fsync
sudo mount /dev/sdb4 /mnt/mobiansd/
sudo scp -r /mnt/mobian/boot/* /mnt/mobiansd/boot
sudo su
cat << EOF > /mnt/mobiansd/etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# UUID=31e45541-2b52-413a-9217-060082ce2ce8	/	ext4	defaults,x-systemd.growfs	0	1
# UUID=05106761-0b87-4729-a7f5-5a5a055c5e69	/boot	ext4	defaults,x-systemd.growfs	0	2
PARTLABEL=MOBIAN	/	ext4	defaults,x-systemd.growfs	0	1
EOF
adjust ## /boot/extlinux/extlinux.conf file
 >MENU LABEL MOBIAN
 >linux /boot/vmlinuz-6.1-rockchip
 >initrd /boot/initrd.img-6.1-rockchip
 >fdtdir /boot/dtb-6.1-rockchip/
 >APPEND root=PARTLABEL=MOBIAN console=ttyS2,115200 console=tty0 loglevel=4 rw rootwait
Build PostmarketOS Partition
sudo dd if=/dev/loop4p2 of=/dev/sdb5 bs=1M status=progress conv=fsync
sudo mount /dev/sdb5 /mnt/postmarketossd/
sudo scp -r /mnt/postmarketos/boot/* /mnt/postmarketossd/boot
sudo su
cat << EOF > /mnt/postmarketossd/etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# <file system> <mount point> <type> <options> <dump> <pass>
#UUID=11f02090-b971-4739-a68d-c6e633b371f9 / ext4 defaults 0 0
#UUID=A84E-596C /boot fat32 defaults 0 0
PARTLABEL=PMOS / ext4 defaults 0 0
EOF
mkdir /mnt/postmarketossd/boot/extlinux
cat << EOF > /mnt/postmarketossd/boot/extlinux/extlinux.conf
## /boot/extlinux/extlinux.conf
## IMPORTANT WARNING
## The configuration of this file is generated automatically.
## Do not edit this file manually, use: u-boot-update
default l0
menu title U-Boot menu
prompt 0
timeout 10
label l0

menu label PMOS linux /boot/vmlinuz initrd /boot/initrdfs fdtdir /boot/dtbs-pine64-pinephonepro/

APPEND root=PARTLABEL=PMOS console=ttyS2,115200 console=tty0 loglevel=4 rw rootwait
EOF


Build UbuntuTouch Partition
sudo dd if=/dev/loop5p2 of=/dev/sdb6 bs=1M status=progress conv=fsync
sudo mount /dev/sdb6 /mnt/ubuntutouchsd/
sudo scp -r /mnt/ubuntutouch/boot/* /mnt/ubuntutouchsd/boot
sudo su
cat << EOF > /mnt/ubuntutouchsd/etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
#UUID=dec2be75-3594-4078-b8c9-f3b215e6eac3	/	ext4	defaults	0	1
#UUID=657dc3ea-dcfa-498b-a231-dbc29f6e1bfb	/boot	ext4	defaults	0	2
PARTLABEL=UT	/	ext4	defaults	0	1
EOF
sudo su
cat << EOF > /mnt/ubuntutouchsd/boot/extlinux/extlinux.conf
#/boot/extlinux/extlinux.conf
##
## IMPORTANT WARNING
##
## The configuration of this file is generated automatically.
## Do not edit this file manually, use: u-boot-update
default l0
menu title U-Boot menu
prompt 0
timeout 50
label l0
       menu label UT
       linux /boot/vmlinuz-6.5.0-okpine
       initrd /boot/initrd.img-6.5.0-okpine
       fdtdir /boot/dtb-6.5.0-okpine/
#       append root=UUID=dec2be75-3594-4078-b8c9-f3b215e6eac3 console=ttyS2,115200n8 consoleblank=0 loglevel=7 rw spl>
APPEND root=PARTLABEL=UT console=ttyS2,115200 console=tty0 loglevel=4 rw rootwait
#label l0r
#       menu label UT rescue
#       linux /boot/vmlinuz-6.5.0-okpine
#       initrd /boot/initrd.img-6.5.0-okpine
#       fdtdir /boot/dtb-6.5.0-okpine/
#       append root=UUID=dec2be75-3594-4078-b8c9-f3b215e6eac3 console=ttyS2,115200n8 consoleblank=0 loglevel=7 rw spl>
EOF

Unmount all /dev

sudo umount /mnt/archlinuxsd /mnt/manjarosd /mnt/mobiansd /mnt/postmarketossd /mnt/ubuntutouchsd /mnt/*/boot /mnt/*/root


Multi-Distro on eMMC

Options to boot Phosh or sxmo

Make sure you boot from the microSD card in your PinePhone Pro as we are going to overwrite the eMMC. Note that below, Arch is booted from the microSD card and the microSD card is listed as the device /dev/mmcblk1.

Flash Rk2Aw Loader to SPI

Same as above. Note this installs rk2aw and a bootloader to SPI NOR flash. Resulting SPI status is as follows:

# ./rk2aw-spi-flasher 
Machine: Pine64 PinePhonePro (pine64,pinephone-pro)
SPI NOR Flash:
- Total size: 16384 KiB
- Erase block size: 4 KiB
- Write size: 1
- Manufacturer: gigadevice
- Part name: gd25lq128e
- JEDEC ID: 257018
Bootable images currently present in SPI NOR flash:
Idx Header     Off 1      Size 1     Off 2      Size 2     Notes/content
-------------------------------------------------------------------------------
0   0          2048       6144       0          0          (padded) 0='rk2aw'
5   131072     133120     67584      200704     124928     0='U-Boot TPL' 1='U-Boot SPL'
7   524288     526336     147456     673792     124928     0='ddrbin' 1='U-Boot SPL'
Auto-calculated layout for rk2aw dual bootloader scheme:
Area                 Offset     Size      
---------------------------------------------------
rk2aw primary        0          65536     
rk2aw backup         65536      65536     
spl fallback         131072     393216    
spl primary          524288     389120    
itb fallback         913408     2097152   
itb primary          3010560    2097152

Build Multi-Distro eMMC

In this example we are going to build 2 partitions on the eMMC, the first with Arch/Phosh and the second with Arch/sxmo. We have already downloaded the images from Danct12 and decompressed them.

Mount the Images
cd ~/Downloads # enter to directory
sudo su # login with your psw
losetup -P /dev/loop0 archlinux-pinephone-pro-phosh-20230203.img 
losetup -P /dev/loop1 archlinux-pinephone-pro-sxmo-20230203.img 
ls -l /mnt/
mkdir /mnt/phosh
mkdir /mnt/sxmo
mkdir /mnt/phosh/boot
mkdir /mnt/phosh/root
mkdir /mnt/sxmo/boot
mkdir /mnt/sxmo/root
mkdir /mnt/ephosh # e for the partition on the eMMC
mkdir /mnt/esxmo  # e for the partition on the eMMC
mount /dev/loop0p1 /mnt/phosh/boot/
mount /dev/loop0p2 /mnt/phosh/root/
mount /dev/loop1p1 /mnt/sxmo/boot/
mount /dev/loop1p2 /mnt/sxmo/root/
lsblk
NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
loop0          7:0    0     5G  0 loop 
├─loop0p1    259:0    0   122M  0 part /mnt/phosh/boot
└─loop0p2    259:1    0   4.9G  0 part /mnt/phosh/root
loop1          7:1    0   3.5G  0 loop 
├─loop1p1    259:2    0   122M  0 part /mnt/sxmo/boot
└─loop1p2    259:3    0   3.4G  0 part /mnt/sxmo/root
mmcblk2      179:0    0 115.2G  0 disk 
├─mmcblk2p1  179:1    0   122M  0 part 
└─mmcblk2p2  179:2    0 115.1G  0 part 
mmcblk2boot0 179:32   0     4M  1 disk 
mmcblk2boot1 179:64   0     4M  1 disk 
mmcblk1      179:96   0  59.6G  0 disk 
├─mmcblk1p1  179:97   0   122M  0 part /boot
└─mmcblk1p2  179:98   0  59.5G  0 part /
zram0        254:0    0   1.5G  0 disk [SWAP]
Prepare eMMC
dd if=/dev/zero of=/dev/mmcblk2 count=32768 bs=32768 status=progress # overwrite the front to clear any bootloaders
sfdisk /dev/mmcblk2 << EOF
label: gpt
first-lba: 64
table-length: 8
size=32G, name="PHOSH", attrs="RequiredPartition,LegacyBIOSBootable"
size=+, name="SXMO", attrs="RequiredPartition,LegacyBIOSBootable"
EOF
Checking that no-one is using this disk right now ... OK
Disk /dev/mmcblk2: 115.23 GiB, 123731968000 bytes, 241664000 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
>>> Script header accepted.
>>> Created a new GPT disklabel (GUID: 7EB4B1E0-5F49-4F30-9F1E-E9E1F305D461).
The maximal number of partitions is 8 (default is 128).
/dev/mmcblk2p1: Created a new partition 1 of type 'Linux filesystem' and of size 32 GiB.
/dev/mmcblk2p2: Created a new partition 2 of type 'Linux filesystem' and of size 83.2 GiB.
/dev/mmcblk2p3: Done.
New situation:
Disklabel type: gpt
Disk identifier: 7EB4B1E0-5F49-4F30-9F1E-E9E1F305D461
Device            Start       End   Sectors  Size Type
/dev/mmcblk2p1     2048  67110911  67108864   32G Linux filesystem
/dev/mmcblk2p2 67110912 241661951 174551040 83.2G Linux filesystem
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
lsblk
 NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
 loop0          7:0    0     5G  0 loop 
 ├─loop0p1    259:0    0   122M  0 part /mnt/phosh/boot
 └─loop0p2    259:1    0   4.9G  0 part /mnt/phosh/root
 loop1          7:1    0   3.5G  0 loop 
 ├─loop1p1    259:2    0   122M  0 part /mnt/sxmo/boot
 └─loop1p2    259:3    0   3.4G  0 part /mnt/sxmo/root
 mmcblk2      179:0    0 115.2G  0 disk 
 ├─mmcblk2p1  179:1    0    32G  0 part 
 └─mmcblk2p2  179:2    0  83.2G  0 part 
 mmcblk2boot0 179:32   0     4M  1 disk 
 mmcblk2boot1 179:64   0     4M  1 disk 
 mmcblk1      179:96   0  59.6G  0 disk 
 ├─mmcblk1p1  179:97   0   122M  0 part /boot
 └─mmcblk1p2  179:98   0  59.5G  0 part /
 zram0        254:0    0   1.5G  0 disk [SWAP]
Build Phosh Partition
dd if=/dev/loop0p2 of=/dev/mmcblk2p1 bs=1M status=progress conv=fsync
mount /dev/mmcblk2p1 /mnt/ephosh/
scp -r /mnt/phosh/boot/* /mnt/ephosh/boot
mv /mnt/ephosh/boot/boot.scr /mnt/ephosh/boot/boot.scrORIG

cat << EOF > /mnt/ephosh/etc/fstab
 #/boot/extlinux/extlinux.conf
 #Static information about the filesystems.
 #See fstab(5) for details.
 #<file system> <dir> <type> <options> <dump> <pass>
 PARTLABEL=PHOSH 	/   ext4   rw,relatime	0 1
 # UUID=52CA-6165  /boot vf rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2

mkdir /mnt/ephosh/boot/extlinux

cat << EOF > /mnt/ephosh/boot/extlinux/extlinux.conf
 #/boot/extlinux/extlinux.conf
 MENU TITLE Pinephone Pro Boot Menu
 LABEL l0
 MENU LABEL phosh
 FDT /boot/dtbs/rockchip/rk3399-pinephone-pro.dtb
 KERNEL /boot/Image
 INITRD /boot/initramfs-linux.img
 APPEND root=PARTLABEL=PHOSH console=ttyS2,115200 console=tty0 loglevel=4 rw rootwait
 EOF
Build SXMO Partition

We have unmounted all the Phosh devices, so

lsblk
 NAME         MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
 loop0          7:0    0     5G  0 loop 
 ├─loop0p1    259:0    0   122M  0 part 
 └─loop0p2    259:1    0   4.9G  0 part 
 loop1          7:1    0   3.5G  0 loop 
 ├─loop1p1    259:2    0   122M  0 part /mnt/sxmo/boot
 └─loop1p2    259:3    0   3.4G  0 part /mnt/sxmo/root
 mmcblk2      179:0    0 115.2G  0 disk 
 ├─mmcblk2p1  179:1    0    32G  0 part 
 └─mmcblk2p2  179:2    0  83.2G  0 part 
 mmcblk2boot0 179:32   0     4M  1 disk 
 mmcblk2boot1 179:64   0     4M  1 disk 
 mmcblk1      179:96   0  59.6G  0 disk 
 ├─mmcblk1p1  179:97   0   122M  0 part /boot
 └─mmcblk1p2  179:98   0  59.5G  0 part /
 zram0        254:0    0   1.5G  0 disk [SWAP]

dd if=/dev/loop1p2 of=/dev/mmcblk2p2 bs=1M status=progress conv=fsync
mount /dev/mmcblk2p2 /mnt/esxmo/
scp -r /mnt/sxmo/boot/* /mnt/esxmo/boot
mv /mnt/esxmo/boot/boot.scr /mnt/esxmo/boot/boot.scrORIG

cat << EOF > /mnt/esxmo/etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
PARTLABEL=SXMO /     ext4      	rw,relatime	0 1
# UUID=841C-F9DD      	/boot     	vfat      	rw,relatime,fmask=0022,dmask=0022,codepage=437,iocharset=ascii,shortname=mixed,utf8,errors=remount-ro	0 2
EOF

mkdir /mnt/esxmo/boot/extlinux

cat << EOF > /mnt/esxmo/boot/extlinux/extlinux.conf
 #/boot/extlinux/extlinux.conf
 MENU TITLE Pinephone Pro Boot Menu
 LABEL l0
 MENU LABEL sxmo
 FDT /boot/dtbs/rockchip/rk3399-pinephone-pro.dtb
 KERNEL /boot/Image
 INITRD /boot/initramfs-linux.img
 APPEND root=PARTLABEL=SXMO console=ttyS2,115200 console=tty0 loglevel=4 rw rootwait
EOF

Follow-Up Comments

  1. On first boot neither Phosh nor sxmo resized their partition - sudo resize2fs sorted that.
  2. Any time an update rebuilds the initramfs it is necessary to delete /boot/boot.scr again to keep the rk2aw menu clean.


Privacy switch configuration

Picture of the privacy switches

The PinePhone features six switches that can be used to configure its hardware. They are numbered 1-6, with switch 1 located nearest to the modem. Their "on" position is toward the top of the phone.

Number Name Description
1 Modem "On" enables 2G/3G/4G communication and GNSS hardware, "off" disables it.
2 WiFi / Bluetooth "On" enables WiFi and Bluetooth communication hardware, "off" disables it.
3 Microphone "On" enables audio input from on-board microphones (not 3.5 mm jack), "off" disables it.
4 Rear camera "On" enables the rear camera, "off" disables it.
5 Front camera "On" enables the front camera, "off" disables it.
6 Headphone "On" enables audio input and output via the 3.5 mm audio jack, "off" switches the jack to hardware UART¹ mode.

¹ Note: The baud rate may be 1500000 instead of 115200.

Modem

The PinePhone uses Quectel EG25-G as modem. AT commands are used to communicate with the modem.

AT commands

A list of documented AT commands can be found for example in this AT commands documentation from Quectel. Further undocumented AT commands found by the developer megi, who reverse-engineered parts of the modem and its firmware, can be found on megi's website here.

To send AT commands to the modem under Linux, minicom or the often-preinstalled atinout utility can be used.

atinout example:

echo "AT+<command here>" | sudo atinout - /dev/ttyUSB2 -

minicom example:

minicom -D /dev/ttyUSB2

VoLTE

The PinePhone and PinePhone Pro modem supports VoLTE and comes with a few VoLTE profiles preloaded. Most operating systems try to set the correct profile automatically.

To list the available VoLTE profiles:

AT+QMBNCFG="list"

+QMBNCFG: "List",0,1,1,"ROW_Generic_3GPP",0x0501081F,201901141
+QMBNCFG: "List",1,0,0,"VoLTE-ATT",0x0501033C,201909271
+QMBNCFG: "List",2,0,0,"hVoLTE-Verizon",0x05010141,201911251
+QMBNCFG: "List",3,0,0,"Sprint-VoLTE",0x05010205,201908141
+QMBNCFG: "List",4,0,0,"Commercial-TMO_VoLTE",0x05010505,201811231
+QMBNCFG: "List",5,0,0,"Telus-Commercial_VoLTE",0x05800C43,201912031
+QMBNCFG: "List",6,0,0,"Commercial-SBM",0x05011C18,201904021
+QMBNCFG: "List",7,0,0,"Commercial-DT",0x05011F1C,201905311
+QMBNCFG: "List",8,0,0,"Reliance_OpnMkt",0x05011B38,201910161
+QMBNCFG: "List",9,0,0,"TF_Germany_VoLTE",0x05010C1B,201909201
+QMBNCFG: "List",10,0,0,"TF_Spain_VoLTE",0x05010CFA,201909261
+QMBNCFG: "List",11,0,0,"Volte_OpenMkt-Commercial-CMCC",0x05012071,201904281
+QMBNCFG: "List",12,0,0,"OpenMkt-Commercial-CT",0x05011322,201911081
+QMBNCFG: "List",13,0,0,"OpenMkt-Commercial-CU",0x05011505,201807052

To select a profile manually, select the best fitting one or a generic one if none fits:

AT+QMBNCFG="select","ROW_Generic_3GPP"

Then enable Voice over LTE using:

AT+QCFG="ims",1

And reboot the modem to apply the settings:

AT+CFUN=1,1

To check the status of VoLTE during a call, the AT command CLCC can be used:

AT+CLCC

+CLCC: 1,1,0,1,0,"",128
+CLCC: 2,1,0,1,0,"",128

In the fourth item of the list, "0" means voice and and "1" means data. If both rows have "1" then the voice call is being carried over VoLTE.

APN settings

The APN setting is only required for a public Internet connection ("data") on the phone. For tested APN settings and how to apply them see PinePhone APN Settings.

Carrier support

The page PinePhone Carrier Support contains information about the frequency support of different carriers and hints on setting up cellular network connectivity.

Documents

Detailed information about the modem can be found on the page of the developer megi, including reverse-engineered parts of the firmware and its functions. There is also a document about using the modem from January 18th 2020 by megi here. A script at the end of the document showcases a way to power off the modem before powering off the phone, which is integrated into most of the available operating systems.

Firmware update

There is a (nearly) free custom firmware and the stock firmware available for the PinePhone Pro. Both can be updated to a newer version with new features and bug fixes.

Custom firmware

There is a (nearly) free custom firmware for the PinePhone and PinePhone Pro modem by the developer biktorgj, which can be found here.

The custom firmware has various advantages (and zero disadvantages) over the stock firmware, including:

  • Signal tracking support with checks against the OpenCelliD database
  • Persistent storage is optional and unexpected shutdowns don't mess up the modem
  • A lower energy consumption due to the lower minimum clock frequency
  • And many more, see Features not available on stock firmware

The custom firmware can be flashed using fwupd or a flashing script.

Stock firmware

The following instructions are directed towards professional users. It is highly recommend to make sure the update process is not interrupted to prevent the modem from bricking.

The stock modem firmware can be updated to a newer version if it is outdated. The firmware version can be checked using the following AT command (at the example of atinout, alternatively minicom can be used to communicate with the modem too):

echo 'AT+QGMR' | sudo atinout - /dev/ttyUSB2 -

Pre-update checklist:

Please make sure all requirements of the checklist are fulfilled. If the update process is interrupted it will lead to a corrupted firmware of the modem, causing it to brick. Recovering a bricked modem is exponentially more complicated and requires the user to boot a special mode by physically bridging test points on the modem.

  • The battery needs to be charged sufficiently
  • The phone needs to be plugged into a charger
  • Deep sleep is recommended to be disabled as it can interrupt the update process
  • It is recommended to close all other running applications
  • Use common sense while doing the update, don't do the update while being impaired in any way

To get the latest firmware, clone the repository of user Biktorgj on the phone:

git clone https://github.com/Biktorgj/quectel_eg25_recovery

After cloning the directory, open it with cd:

cd quectel_eg25_recovery

Then run qfirehose, which starts the flashing process:

sudo ./qfirehose -f ./

The modem will automatically reboot after the update process is done. The boot process takes around 30 to 60 seconds. After that it is highly recommended to reboot the device.

Firmware modifications

See PineModems for more information regarding modem bootloader unlocking, building a custom modem firmware and modem recovery.

GPS / GNSS

The GPS engine in the modem supports mutli-GNSS reception from GPS, GLONASS, BeiDou, Galileo and QZSS independent of a cellular connection. The operation of the GNSS subsystem can be controlled via a separate set of AT commands, or via qmi. The A-GPS data upload uses the file management AT commands, which also have their own manual. These are linked in the documentation section.

As with most smartphones, the PinePhone Pro has a small antenna and has difficulty getting a first fix without assistance data, a cold start can take 15 minutes under good conditions. The eg25-mananger is configured to upload A-GPS data by default (see here).

Basic testing of GNSS reception can be done by using the AT command interface (/dev/ttyUSB2) from a terminal program like minicom and the data output interface (/dev/ttyUSB1) to feed NMEA data into gpsmon or some other program that can parse standard NMEA sentences.

gpsmon decoding GPS data from /dev/ttyUSB1

To check if GNSS data output is enabled, you can

cat /dev/ttyUSB1

this should display a stream of NMEA sentences

$GPVTG,,T,,M,,N,,K,N*2C
$GPGSA,A,1,,,,,,,,,,,,,,,,*32
$GPGGA,,,,,,0,,,,,,,,*66

Further details can be found under PinePhone Sensors and Navigation.

Voice mail

The operating systems of the PinePhone Pro may not have support for accessing your voicemail by holding down the 1-key. Carriers might support accessing the voice mail via an external number however.

Specifications

  • Dimensions: 160.8 x 76.6 x 11.1mm
  • Weight: Approx. 220g
  • SIM Card: Nano-SIM (Micro-SIM before 07/2022)
  • Display:
    • Size: 6 inches (151mm) diagonal
    • Type: 1440 x 720 in-cell IPS with Gorilla Glass 4™
    • Resolution: 1440x720, 18:9 ratio
  • System on Chip: Rockchip RK3399S 64bit SoC – 2x A72 and 4x A53 CPU cores @ 1.5GHz
  • RAM: 4GB LPDDR4 @ 800MHz
  • Internal Storage: 128GB eMMC, extendable up to 2TB via microSD, supports SDHC and SDXC
  • NOR Flash: Listed as [GigaDevices] GD25LQ128EWIGR, but physical inspection found a SiliconKaiser SK25LP128.
  • Back Camera: 13MP Sony IMX258 with Gorilla Glass 4™ protective layer, LED Flash
  • Front Camera: 8MP, OmniVision OV8858 front-facing camera
  • Sound: Loudspeaker, 3.5mm jack & mic (jack doubles as hardware UART if hardware switch 6 is deactivated)
  • Communication:
    • Modem: Quectel EG25-G
    • LTE-FDD: B1, B2, B3, B4, B5, B7, B8, B12, B13, B18, B19, B20, B25, B26, B28
    • LTE-TDD: B38, B39, B40, B41
    • WCDMA: B1, B2, B4, B5, B6, B8, B19
    • GSM: B2, B3, B5, B8 (850, 900, 1800, 1900 MHz)
    • WLAN & Bluetooth: Wi-Fi 802.11AC, hotspot capable + Bluetooth V5.0
    • GNSS: GPS/GLONASS/BeiDou/Galileo/QZSS, with A-GPS
  • Sensors: Accelerometer, gyroscope, proximity, ambient light, compass
  • Privacy switches: Modem, WiFi & Bluetooth, Microphone, Cameras
  • Battery: Lithium-ion, rated capacity 2800mAh (10.64Wh), typical capacity 3000mAh (11.40Wh) (nominally replaceable with any Samsung J7 form-factor battery; unglue bottom black plastic with your nail from Samsung battery before installation in order to match the dimensions)
  • I/O: USB Type-C, USB Host, DisplayPort Alternate Mode output, 15W 5V 3A Quick Charge, follows USB PD specification

Modifications and repairs

Most parts are available from the Pine store. Take care to use this link to avoid unintentionally ordering parts for the original PinePhone instead.

Replacing the mainboard

The mainboard can be replaced if it is faulty. The replacement board does not have an operating system pre-installed, to test if everything is working after swapping the mainboard a flashed SD card is required.

Replacement boards come with an empty eMMC, which means that trying to boot from them looks like the board is faulty (no LEDs, no screen, no reaction of the phone). Please boot an operating system from a microSD card.

Prior to replacing your PinePhone Pro’s mainboard please read the steps outlined in bullet points below and watch the attached video.

  1. You’ll need a small Phillips screwdriver and a prying tool to swap out the mainboard.
  2. Remove the phone's back cover. See your quick start guide for details.
  3. Remove the battery as well as any inserted SD and SIM cards.
  4. Unscrew all 15 Phillips head screws around the midframe of the phone, including the screw under the warranty sticker.
  5. Gently pry up the midframe using a guitar pick or credit card corner. It is easiest to separate the midframe at one of the bottom edges. Work your way around all the sides of the phone until the midframe separates from the phone’s body.
  6. Detach all ribbon cables and “Lego” connectors. List of things to detach: 1) two “Lego” connects at the bottom of the mainboard. 2) u.FL antenna connect and touchscreen digitizer on PCD left side. 3) LCD ribbon cable top of mainboard, next to audio and UART jack.
  7. Pry the mainboard up gently from the left-hand side.
  8. Remove front and main cameras and reset them into the new mainboard.
  9. Place the new mainboard in the chassis, hooking in on the plastic tabs on left side and pressing down firmly on opposite side, and follow the steps (7-2) in reverse. When reattaching the midframe take care that no cables are out of place or trapped, as they may be damaged when tightening screws.

After swapping the mainboard the phone won't boot as there is no OS on the replacement board's eMMC preinstalled. To boot an OS insert a flashed SD card.

A video tutorial by Martijn Braam for the regular PinePhone can be found here or alternatively a video tutorial by user brigadan with additional notes about the camera swap and proximity sensor isolator here.

Replacing the screen

Before attempting to replace the screen be sure to review the section on replacing the mainboard since that will get you most of the way there. Be aware that the replacement screen is actually the entire front frame of the phone and there are components that will need to be swapped from your old screen.

  • Make sure you have a precision screwdriver set that has the correct size Philips tip. The screws are very small and the heads can easily be stripped if the screwdriver is not correct - if you feel your screwdriver slipping, stop what you are doing and try one that is a better fit. A magnetized screwdriver will help in not losing screws, as will a magnetic parts holder to keep them in while working.
  • There are a number of components and cables as well as the insulator sheet under the battery that are glued in place. A hair dryer will loosen the glue and make them much easier to remove. You may want to order extra cables along with the screen just in case.
  • The vibration motor, which is part of the USB-C board assembly and glued into place, will come apart easily and be damaged if you pry it up in the wrong place. Make sure you pry from underneath the complete part, not midway on its housing. The ribbon cable attaching this to the USB-C board is small, thin, and fragile so be careful with that as well.
  • The new screen comes with new side switches and insulator sheet but there are a number of parts that need to be transferred from the old screen, like the thin coax cable running up the side, the phone ear speaker, proximity sensor gasket, and a silver-colored mesh glued in place that needs to be transferred to a flexible circuit included on the new screen. If you don't swap over the proximity sensor rubber gasket the screen will immediately turn off after logging in. Be careful when routing the coax cable that it goes around the screw holes or you may drive a screw right through the cable.

Take your time, use the right tools, be careful and you should be rewarded with success.

Spare parts not available in the Pine Store

The following parts are not available on the Pine Store for the regular PinePhone. The replacements are listed below and have not been validated for the PinePhone Pro.

Components

Component Model
Touchscreen Goodix GT917S
LCD Himax HX8394 compatible
Rear camera IMX258
Front camera OV8858
Camera flash AW3641EDNR
WiFi + Bluetooth AzureWave AW-CM256SM
Modem Quectel EG25-G
GNSS/GPS Quectel EG25-G
3 Axis Magnetometer ST LIS3MDL Note: The AF8133J is used instead.
Geo Magnetic Sensor Voltafield AF8133J
Ambient light / Proximity STK3311-A
Accelerometer / Gyroscope TDK MPU-6500
Vibration motor
Notification LED LED0603RGB
Audio Codec ALC5616 and ALC5640
Volume buttons Buttons connected to the KEYADC
Power button
Battery fuel gauge RK818

Datasheets, schematics and certifications

PinePhone Pro mainboard schematic:

PinePhone Pro USB-C small board schematic:

  • TBD

Certifications:

Factory Test Build for Hardware Checking

PPP Abdroid Test Utility-5.jpg

Please note that this Android build solely for PinePhone Pro hardware checking purpose and solely used by the support team. This is NOT a general release build.

Download:

  • Direct download from pine64.org (722MB, for 8GB microSD cards or bigger, MD5 of the GZip file 214e063c8205c1a98d44b2015a21bb5d)

Instructions:

  • Download the build, extract the image and dd it to a 8 GB or larger microSD card, take out the PinePhone Pro Explorer Edition, then insert it into microSD slot (upper slot).
  • Insert battery, press the RE button (bypass SPI and eMMC boot) underneath the back cover while plugging in the USB-C power. After 3 seconds release the RE button.
  • When powering up, a battery icon screen will show up blow, press power key for two seconds, then the Rockchip logo screen shows up.
  • Wait for the home screen, double tap on the test app icon (mark red circuit) and this will bring up the factory test screen. Please note that the SD test is disabled due in this is SD boot build.
  • After running a particular test function, please snapshot the test result and pass it back to support team

Notes:

  • Please insert a functional SIM card when performing the SIM test
  • When perform GPS test, the first result may fail and please ignore this false message.
  • For light sensing test, please have a light shine to the PinePhone Pro when performing the test.

Using Factory Test Build for Battery charging

PPP Abdroid Test Utility-1.jpg

Please note that this Android build solely for PinePhone Pro hardware checking purpose and solely used by support team. This is NOT a general release build.

Download:

  • Direct download from pine64.org (722MB, for 8GB microSD cards or bigger, MD5 of the GZip file 214e063c8205c1a98d44b2015a21bb5d)

Instructions:

  • Download the build, extract the image and dd it to a 8 GB or larger microSD card, takes out the PinePhone Pro Explorer Edition then insert it into microSD slot (upper slot).
  • Insert battery, press RE button (bypass SPI and eMMC boot) while plug in USB-C power. After 3 seconds release RE button.
  • When power up, below battery icon screen show up and battery will start charging.
  • The battery icon display for few seconds and then LCD panel turn off while charging. To check charging status, just quick press power button (about 0.5 second) and battery icon will display progress.

Press

For an overview about media of the PinePhone Pro you can use for the news, blogs, or similar see PinePhone Press.

External links