Difference between revisions of "PineModems"

From PINE64
Jump to navigation Jump to search
(Fixes)
(→‎Quectel EG25-G Modem: template fix, typo)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
 
= Modems used in Pine64 boards and devices =
 
= Modems used in Pine64 boards and devices =
  
=== Quectel EG25-G Modem ===
+
== Quectel EG25-G Modem ==
  
* Specifications: https://www.quectel.com/UploadFile/Product/Quectel_EG25-G_LTE_Specification_V1.1.pdf
+
Quectel EG25-G is an LTE Cat 4 module optimized specially for M2M and IoT applications. It is used in the PinePhone.
* Hardware design: https://www.quectel.com/UploadImage/Downlad/Quectel_EG25-G_Hardware_Design_V1.2.pdf
+
 
* AT Interface reference manual: https://www.quectel.com/UploadImage/Downlad/Quectel_EC25&EC21_AT_Commands_Manual_V1.3.pdf
+
{{hint| Quectel had updated their WordPress website, and the links no longer works any more. You may try [https://web.archive.org/ Internet Archive] or ask for them in the communities.}}
* AT Interface file operations: https://www.quectel.com/UploadImage/Downlad/Quectel_EC2x&EG25-G&EG9x&EM05_FILE_AT_Commands_Manual_V1.0.pdf
+
 
 +
* Specifications:<br>https://www.quectel.com/UploadFile/Product/Quectel_EG25-G_LTE_Specification_V1.1.pdf
 +
* Hardware design:<br>https://www.quectel.com/UploadImage/Downlad/Quectel_EG25-G_Hardware_Design_V1.2.pdf
 +
* AT Interface reference manual:
 +
** 1.3 for EC25:<br>https://www.quectel.com/UploadImage/Downlad/Quectel_EC25&EC21_AT_Commands_Manual_V1.3.pdf
 +
** 2.0 for EC25 and EG25-G:<br>https://www.quectel.com/UploadImage/Downlad/Quectel_EC2x&EG9x&EG2x-G&EM05_Series_AT_Commands_Manual_V2.0.pdf
 +
* AT Interface file operations:<br>https://www.quectel.com/UploadImage/Downlad/Quectel_EC2x&EG25-G&EG9x&EM05_FILE_AT_Commands_Manual_V1.0.pdf
  
 
=== Specifications ===
 
=== Specifications ===
* Processor Family: Qualcomm MDM9607
+
 
* CPU: Qualcomm MDM9207
+
{| class="wikitable"
* Cores: 1 ACPU Core, Qualcomm Hexagon DSP
+
|          Processor Family || Qualcomm MDM9607
* Total RAM: 256Mb
+
|-
* Total flash space: 256Mb
+
|                        CPU || Qualcomm MDM9207
* Available RAM for the ACPU: 160Mb
+
|-
 +
|                      Cores || 1 ACPU Core, Qualcomm Hexagon DSP
 +
|-
 +
|                  Total RAM || 256Mb
 +
|-
 +
|          Total flash space || 256Mb
 +
|-
 +
| Available RAM for the ACPU || 160Mb
 +
|}
  
 
=== NAND Partition table layout ===
 
=== NAND Partition table layout ===
  
* MTD0: SBL (Secondary Bootloader), called from the BootROM. Used to start the TrustZone kernel and the Application Bootloader (LK). Also used to enter Quectel's recovery mode
+
{| class="wikitable"
* MTD1: mibib (Unknown, used by the DSP)
+
! Index
* MTD2: EFS2 (Unexplored, probably NVRAM data, Used by the DSP)
+
! Name
* MTD3: sys_rev: Unexplored
+
! Description
* MTD4: rawdata: This is where FOTA update data exists before being commited to system or recoveryfs partitions
+
|-
* MTD5: tz: TrustZone kernel
+
| MTD0 || <code>SBL</code>
* MTD6: rpm: Resource / Power Manager
+
| Secondary Bootloader, called from the BootROM. Used to start the TrustZone kernel and the Application Bootloader (LK). Also used to enter Quectel's recovery mode
* MTD7: cust_info: Unexplored
+
|-
* MTD8: aboot: Application Bootloader. Uses LK (LittleKernel) as the bootloader. By default it allows flashing unsigned images but won't allow booting them, soft-bricking the modem until you enter EDL mode
+
| MTD1 || <code>mibib</code>
* MTD9boot: OpenEmbedded boot kernel + DTB
+
| Unknown, used by the DSP
* MTD10: recovery: Recovery kernel (normally unused)
+
|-
* MTD11: modem: ADSP firmware blobs
+
| MTD2 || <code>EFS2</code>
* MTD12: misc: Unexplored
+
| Unexplored, probably NVRAM data, Used by the DSP
* MTD13: recoveryfs: Recovery filesystem image (FOTA updates)
+
|-
* MTD14: usr_data: User data partition (/data when mounted by OpenEmbedded)
+
| MTD3 || <code>sys_rev</code>
* MTD15: sec (Used to blow fuses in the mdm9207 from images generated by Qualcomm Sectools)
+
| Unexplored
* MTD16: system (Linux OpenEmbedded root image, formatted in Ubifs filesystem)
+
|-
 +
| MTD4 || <code>rawdata</code>
 +
| This is where FOTA update data exists before being commited to system or recoveryfs partitions
 +
|-
 +
| MTD5 || <code>tz</code>
 +
| TrustZone kernel
 +
|-
 +
| MTD6 || <code>rpm</code>
 +
| Resource / Power Manager
 +
|-
 +
| MTD7 || <code>cust_info</code>
 +
| Unexplored
 +
|-
 +
| MTD8 || <code>aboot</code>
 +
| Application Bootloader. Uses [https://github.com/littlekernel/lk LK] (LittleKernel, LK embedded kernel) as the bootloader. By default it allows flashing unsigned images but won't allow booting them, soft-bricking the modem until you enter EDL mode
 +
|-
 +
| MTD9 || <code>boot</code>
 +
| [https://www.openembedded.org/wiki/Main_Page OpenEmbedded] boot kernel + DTB
 +
|-
 +
| MTD10 || <code>recovery</code>
 +
| Recovery kernel (normally unused)
 +
|-
 +
| MTD11 || <code>modem</code>
 +
| ADSP firmware blobs
 +
|-
 +
| MTD12 || <code>misc</code>
 +
| Unexplored
 +
|-
 +
| MTD13 || <code>recoveryfs</code>
 +
| Recovery filesystem image (FOTA updates)
 +
|-
 +
| MTD14 || <code>usr_data</code>
 +
| User data partition (<code>/data</code> when mounted by OpenEmbedded)
 +
|-
 +
| MTD15 || <code>sec</code>
 +
| Used to blow fuses in the mdm9207 from images generated by Qualcomm Sectools
 +
|-
 +
| MTD16 || <code>system</code>
 +
| Linux OpenEmbedded root image, formatted in UBIFS (Unsorted Block Image File System, [https://en.wikipedia.org/wiki/UBIFS Wikipedia])
 +
|}
  
 
=== Firmware Recovery ===
 
=== Firmware Recovery ===
 +
 +
{{warning|1= The following instructions are directed towards expert-level users and developers!}}
 +
 
The System partition is mounted as read-only mode, but the data partition is writable. It might be possible, if there's an unexpected reset or power is lost while running, that the data partition gets corrupt and thus unable to boot.
 
The System partition is mounted as read-only mode, but the data partition is writable. It might be possible, if there's an unexpected reset or power is lost while running, that the data partition gets corrupt and thus unable to boot.
 +
 
[[File:Pinephone-EG25-Recovery.jpg|thumb|right|PinePhone USB_BOOT test points]]
 
[[File:Pinephone-EG25-Recovery.jpg|thumb|right|PinePhone USB_BOOT test points]]
 +
 
The modem has 4 different boot modes:
 
The modem has 4 different boot modes:
 
* Normal boot
 
* Normal boot
Line 45: Line 103:
 
* Qualcomm EDL Mode
 
* Qualcomm EDL Mode
  
If the modem is unable to boot, depending on the type of crash, it might not show anywhere (USB device missing), it might malfunction (no radio but USB working), or it might enter EDL mode if the entire flash is corrupt
+
If the modem is unable to boot, depending on the type of crash, it might:
 +
* not show anywhere (USB device missing)
 +
* or malfunction (no radio but USB working)
 +
* or enter EDL mode, if the entire flash is corrupt.
  
In any scenario, the modem can be triggered to enter EDL mode by shorting two test pins in the PinePhone Motherboard. Power off the phone, short the two test points and start it again while keeping the pads shorted at least until you hear the camera clicking twice (which is normally when the modem is powered)
+
'''Boot the device in EDL mode'''
  
Download the Firmware Recovery Package and copy it to the Pinephone: https://github.com/Biktorgj/quectel_eg25_recovery/
+
To check if the device is booted in EDL mode, run <code>lsusb</code> (a part of the <code>usbutils</code> package) in a terminal and inspect the output. You should see the following device listed:
To check if you're currently booted in EDL mode, run lsusb in a terminal and inspect the output.  
 
You should see the following device listed: Bus 003 Device 003: ID 05c6:9008 Qualcomm, Inc. Gobi Wireless Modem (QDL mode)
 
  
Once in EDL mode, open a terminal and go to the root directory of the recovery package, and run:
+
Bus 003 Device 003: ID 05c6:9008 Qualcomm, Inc. Gobi Wireless Modem (QDL mode)
  
If you use an ARM64 distribution (most likely): <code>./qfirehose_arm64 -f ./</code>
+
In any scenario, the modem can be triggered to enter EDL mode by shorting two test pins on the PinePhone motherboard.
  
If you use an ARMHF (32 bit) distribution: <code>./qfirehose_armhf -f ./</code>
+
# Power off the phone
 +
# short the two test points
 +
# boot the phone while keeping the test points shorted until fully booted up, at least until you hear the camera clicking twice (which is normally when the modem is powered).
  
After it finishes, it will reboot the modem and after about 30 seconds it will get back up and running
+
'''Get the Firmware Recovery Package'''
 +
 
 +
The Firmware Recovery Package is at: https://github.com/Biktorgj/quectel_eg25_recovery
 +
 
 +
Either clone its repo with git, or download its archive & unzip it.
 +
 
 +
As you should have no access to the Internet on PinePhone when its modem need a Recovery, you can fetch it on other devices and copy it to the Pinephone.
 +
 
 +
'''Execute the Quectel QFirehose utility'''
 +
 
 +
Once in EDL mode, open a terminal, navigate to the root directory of the recovery package, and run:
 +
 
 +
* If you use an ARM64 distribution (most likely): <code>sudo ./qfirehose -f ./</code> or <code>sudo ./qfirehose_arm64 -f ./</code>
 +
* If you use an ARMHF (32 bit) distribution: <code>sudo ./qfirehose_armhf -f ./</code>
 +
 
 +
It will reboot the modem after finished. After about 30 seconds, it will get back up and running.
  
 
=== Bootloader unlocking ===
 
=== Bootloader unlocking ===
 +
 +
{{warning|1= The following instructions are directed towards expert-level users and developers!}}
 +
 
The Modem has a locked bootloader. It won't allow to boot unsigned Kernel images, but will allow to flash them, making it easy to brick the modem. To fix this, you can flash an unlocked bootloader, which will then allow you to do as you please with the hardware.
 
The Modem has a locked bootloader. It won't allow to boot unsigned Kernel images, but will allow to flash them, making it easy to brick the modem. To fix this, you can flash an unlocked bootloader, which will then allow you to do as you please with the hardware.
  
The source code for the bootloader is here: https://github.com/Biktorgj/quectel_lk
+
Unlocked bootloader:
Prebuilt binary releases can be downloaded from here: https://github.com/Biktorgj/quectel_lk/releases
+
* Source code: https://github.com/Biktorgj/quectel_lk
 +
* Prebuilt binary releases: https://github.com/Biktorgj/quectel_lk/releases
  
 
=== Custom Kernels and system images ===
 
=== Custom Kernels and system images ===
  
Custom kernel builds and system images can be created for the modem, though they require a couple of things to be correctly built and be bootable. The source code release for the kernel provided by the manufacturer is incomplete and won't build, and common Android tools mkbootimg and dtbtool won't build a bootable image, even if the kernel is correctly compiled and all the DTBs attached. Further, there's no source for the OpenEmbedded parts, so building a new system image must be done from scratch, and retrieving the mandatory binary blobs to use the ADSP part of the modem.
+
{{warning|1= The following instructions are directed towards expert-level users and developers!}}
 +
 
 +
Custom kernel builds and system images can be created for the modem, though they require a couple of things to be correctly built and be bootable.
 +
 
 +
* The source code release for the kernel provided by the manufacturer is incomplete and won't build
 +
* Common Android tools like mkbootimg and dtbtool won't build a bootable image, even if the kernel is correctly compiled and all the DTBs attached.
 +
* Further, there's no source for the OpenEmbedded parts, so building a new system image must be done from scratch, and retrieving the mandatory binary blobs to use the ADSP part of the modem.
 +
 
 +
There's a '''work in progress''' SDK to allow creating custom kernels and system images, which can be downloaded from the following repository: https://github.com/Biktorgj/pinephone_modem_sdk
  
There's a **Work in progress** SDK to allow creating custom kernels and system images, which can be downloaded from the following repository: https://github.com/Biktorgj/pinephone_modem_sdk
+
See its readme for infomations and instructions. Once downloaded, you should run the <code>init.sh</code> script, which will create all the base directories and download all the different repositories required to build. After the initial setup is complete, run<code>make</code> without arguments to list the available options.
  
Once downloaded, you should run the 'init.sh' script, which will create all the base directories and download all the different repositories required to build. After the initial setup is complete, run 'make' without arguments to list the available options.
+
[[Category:PinePhone]]

Latest revision as of 13:16, 26 April 2021

Modems used in Pine64 boards and devices

Quectel EG25-G Modem

Quectel EG25-G is an LTE Cat 4 module optimized specially for M2M and IoT applications. It is used in the PinePhone.

Quectel had updated their WordPress website, and the links no longer works any more. You may try Internet Archive or ask for them in the communities.

Specifications

Processor Family Qualcomm MDM9607
CPU Qualcomm MDM9207
Cores 1 ACPU Core, Qualcomm Hexagon DSP
Total RAM 256Mb
Total flash space 256Mb
Available RAM for the ACPU 160Mb

NAND Partition table layout

Index Name Description
MTD0 SBL Secondary Bootloader, called from the BootROM. Used to start the TrustZone kernel and the Application Bootloader (LK). Also used to enter Quectel's recovery mode
MTD1 mibib Unknown, used by the DSP
MTD2 EFS2 Unexplored, probably NVRAM data, Used by the DSP
MTD3 sys_rev Unexplored
MTD4 rawdata This is where FOTA update data exists before being commited to system or recoveryfs partitions
MTD5 tz TrustZone kernel
MTD6 rpm Resource / Power Manager
MTD7 cust_info Unexplored
MTD8 aboot Application Bootloader. Uses LK (LittleKernel, LK embedded kernel) as the bootloader. By default it allows flashing unsigned images but won't allow booting them, soft-bricking the modem until you enter EDL mode
MTD9 boot OpenEmbedded boot kernel + DTB
MTD10 recovery Recovery kernel (normally unused)
MTD11 modem ADSP firmware blobs
MTD12 misc Unexplored
MTD13 recoveryfs Recovery filesystem image (FOTA updates)
MTD14 usr_data User data partition (/data when mounted by OpenEmbedded)
MTD15 sec Used to blow fuses in the mdm9207 from images generated by Qualcomm Sectools
MTD16 system Linux OpenEmbedded root image, formatted in UBIFS (Unsorted Block Image File System, Wikipedia)

Firmware Recovery

Warning: The following instructions are directed towards expert-level users and developers!

The System partition is mounted as read-only mode, but the data partition is writable. It might be possible, if there's an unexpected reset or power is lost while running, that the data partition gets corrupt and thus unable to boot.

PinePhone USB_BOOT test points

The modem has 4 different boot modes:

  • Normal boot
  • Recovery mode (used by the modem usually to install a FOTA update)
  • Fastboot mode
  • Qualcomm EDL Mode

If the modem is unable to boot, depending on the type of crash, it might:

  • not show anywhere (USB device missing)
  • or malfunction (no radio but USB working)
  • or enter EDL mode, if the entire flash is corrupt.

Boot the device in EDL mode

To check if the device is booted in EDL mode, run lsusb (a part of the usbutils package) in a terminal and inspect the output. You should see the following device listed:

Bus 003 Device 003: ID 05c6:9008 Qualcomm, Inc. Gobi Wireless Modem (QDL mode)

In any scenario, the modem can be triggered to enter EDL mode by shorting two test pins on the PinePhone motherboard.

  1. Power off the phone
  2. short the two test points
  3. boot the phone while keeping the test points shorted until fully booted up, at least until you hear the camera clicking twice (which is normally when the modem is powered).

Get the Firmware Recovery Package

The Firmware Recovery Package is at: https://github.com/Biktorgj/quectel_eg25_recovery

Either clone its repo with git, or download its archive & unzip it.

As you should have no access to the Internet on PinePhone when its modem need a Recovery, you can fetch it on other devices and copy it to the Pinephone.

Execute the Quectel QFirehose utility

Once in EDL mode, open a terminal, navigate to the root directory of the recovery package, and run:

  • If you use an ARM64 distribution (most likely): sudo ./qfirehose -f ./ or sudo ./qfirehose_arm64 -f ./
  • If you use an ARMHF (32 bit) distribution: sudo ./qfirehose_armhf -f ./

It will reboot the modem after finished. After about 30 seconds, it will get back up and running.

Bootloader unlocking

Warning: The following instructions are directed towards expert-level users and developers!

The Modem has a locked bootloader. It won't allow to boot unsigned Kernel images, but will allow to flash them, making it easy to brick the modem. To fix this, you can flash an unlocked bootloader, which will then allow you to do as you please with the hardware.

Unlocked bootloader:

Custom Kernels and system images

Warning: The following instructions are directed towards expert-level users and developers!

Custom kernel builds and system images can be created for the modem, though they require a couple of things to be correctly built and be bootable.

  • The source code release for the kernel provided by the manufacturer is incomplete and won't build
  • Common Android tools like mkbootimg and dtbtool won't build a bootable image, even if the kernel is correctly compiled and all the DTBs attached.
  • Further, there's no source for the OpenEmbedded parts, so building a new system image must be done from scratch, and retrieving the mandatory binary blobs to use the ADSP part of the modem.

There's a work in progress SDK to allow creating custom kernels and system images, which can be downloaded from the following repository: https://github.com/Biktorgj/pinephone_modem_sdk

See its readme for infomations and instructions. Once downloaded, you should run the init.sh script, which will create all the base directories and download all the different repositories required to build. After the initial setup is complete, runmake without arguments to list the available options.