Difference between revisions of "PinePhone Pro Development"

From PINE64
Jump to navigation Jump to search
m
 
(21 intermediate revisions by 5 users not shown)
Line 16: Line 16:
| https://github.com/dreemurrs-embedded/Pine64-Arch/tree/master/PKGBUILDS/pine64/uboot-pinephonepro uses https://git.sr.ht/~martijnbraam/u-boot.
| https://github.com/dreemurrs-embedded/Pine64-Arch/tree/master/PKGBUILDS/pine64/uboot-pinephonepro uses https://git.sr.ht/~martijnbraam/u-boot.
|-
|-
! scope="row" | Sound
! scope="row" | Modem
| colspan="2" style="background:#F99; text-align:center;"|Unimplemented.
| colspan="2" style="background:#FF0; text-align:center;"|Working. Not upstreamed.
|
|  
| See https://github.com/alsa-project/alsa-ucm-conf/issues/125.
| Support in https://gitlab.com/mobian1/devices/eg25-manager and Megi's kernel.
|-
|}
|}


Line 28: Line 29:
=== Working ===
=== Working ===


TBD
==== Kernel ====


=== Linux kernel ===
There's no canonical location for Pinephone Pro Linux kernel development, because Pinephone Pro DT is not mainline, yet. [https://xff.cz/git/linux/log/?h=orange-pi-5.16 megi's kernel tree] is the most complete one, as of November 2021.
 
https://mainline.space/ tracks mainlining kernels for various phones.
 
==== Firmware ====


There's no canonical location for Pinephone Pro Linux kernel development, because Pinephone Pro DT is not mainline, yet. [https://xff.cz/git/linux/log/?h=orange-pi-5.16 megi's kernel tree] is the most complete one, as of November 2021.
ATF? Likely working due to reuse of Pinebook Pro SoC?
 
==== Display ====
 
Working.
 
==== Sound ====
 
Working.
 
==== Modem ====
 
Working.
* Megi's orange-pi branches: https://megous.com/git/linux.
* https://gitlab.com/mobian1/devices/eg25-manager
 
==== Sensors ====
 
Working.
 
==== Bluetooth ====
 
Working.
 
==== Suspend ====
 
Working.
 
=== Not working ===
 
=== Unknown ===
 
==== Front camera ====
 
OV8858 camera. Unknown.
 
Datasheet: https://cdn.datasheetspdf.com/pdf-down/O/V/8/OV8858-OmniVision.pdf
 
==== Back camera ====
 
Sony IMX258. Support unknown.


== Levinboot Based Kernel Development Image ==
== Levinboot Based Kernel Development Image ==
Line 54: Line 99:
name="sd-rootfs2"
name="sd-rootfs2"
</pre>
</pre>
This can either be done interactively, or by saving the above to a file, like <code>format.txt</code>, and running <code>sfdisk /dev/<sdcard> < format.txt</code>


2) Write Levinboot to <code>sd-lboot</code> partition using <code>dd</code>. You can get a pre-built and tested version [https://xff.cz/kernels/pinephone-pro/ here] There are two options <code>levinboot-sd.img</code> and <code>levinboot-emmc.img</code> you can use either one of them for your <code>sd-lboot</code> partition. They differ in where they load the payloads from (either from SD or eMMC) and not in where they can be flashed to. For uSD card only workflow, you'll want <code>levinboot-sd.img</code>.
2) Write Levinboot to <code>sd-lboot</code> partition using <code>dd</code>. You can get a pre-built and tested version [https://xff.cz/kernels/pinephone-pro/ here] There are two options <code>levinboot-sd.img</code> and <code>levinboot-emmc.img</code> you can use either one of them for your <code>sd-lboot</code> partition. They differ in where they load the payloads from (either from SD or eMMC) and not in where they can be flashed to. For uSD card only workflow, you'll want <code>levinboot-sd.img</code>.
Line 90: Line 137:
) > payload.img
) > payload.img


dd if=payload.img of=/dev/disk/by-partlabel/sd-payload1 bs=4M oflag=direct
dd if=payload.img of=/dev/disk/by-partlabel/sd-lpayload1 bs=4M oflag=direct
</pre>
</pre>


Line 99: Line 146:
== Development discussion ==
== Development discussion ==


Most of the discussion happens in #pinedev channel on [https://www.pine64.org/web-irc/ Pine64 IRC server]
Most of the discussion happens in #pinedev channel on [https://www.pine64.org/web-irc/ Pine64 IRC server].
 
See https://xnux.eu/log/ too.


[[Category:Pinephone Pro]][[Category:Rockchip RK3399]]
[[Category:PinePhone Pro]][[Category:Rockchip RK3399]]

Latest revision as of 00:12, 15 August 2022

This page documents the current status of software support for the PinePhone Pro, and provides links to resources to help prospective contributors get started.

Overview

Upstreaming Status

Function Status Component Notes
Bootloader (u-boot) Working. Not upstreamed. https://github.com/dreemurrs-embedded/Pine64-Arch/tree/master/PKGBUILDS/pine64/uboot-pinephonepro uses https://git.sr.ht/~martijnbraam/u-boot.
Modem Working. Not upstreamed. Support in https://gitlab.com/mobian1/devices/eg25-manager and Megi's kernel.

Current Status

The following sections give an overview over the current status of different parts of the phone. Some parts are waiting on a driver to be written or ported, others only need various adjustments.

Working

Kernel

There's no canonical location for Pinephone Pro Linux kernel development, because Pinephone Pro DT is not mainline, yet. megi's kernel tree is the most complete one, as of November 2021.

https://mainline.space/ tracks mainlining kernels for various phones.

Firmware

ATF? Likely working due to reuse of Pinebook Pro SoC?

Display

Working.

Sound

Working.

Modem

Working.

Sensors

Working.

Bluetooth

Working.

Suspend

Working.

Not working

Unknown

Front camera

OV8858 camera. Unknown.

Datasheet: https://cdn.datasheetspdf.com/pdf-down/O/V/8/OV8858-OmniVision.pdf

Back camera

Sony IMX258. Support unknown.

Levinboot Based Kernel Development Image

This guide will help you get a comfortable environment for testing your kernel builds on Pinephone Pro. It assumes you either already know how to build or cross-build a Linux kernel for arm64, or if you have a way to get a pre-built kernel from somewhere. For a quick test that your setup works, you can use megi's pre-built kernels.

Quick and easy way to get started with kernel development and testing is to use CrystalGamma's Levinboot patched with support for Pinephone Pro and 3-option boot selection using volume keys. You will be able to switch between kernels quickly without swapping uSD cards, which is necessary for painless kernel development experience.

1) Create a following partitioning scheme on a uSD card using sfdisk:

label: gpt
first-lba: 64
table-length: 8

start=64, size=8128, type=D7B1F817-AA75-2F4F-830D-84818A145370, name="sd-lboot"
size=60M, type=E5AB07A0-8E5E-46F6-9CE8-41A518929B7C, name="sd-lpayload1"
size=60M, type=5f04b556-c920-4b6d-bd77-804efe6fae01, name="sd-lpayload2"
size=60M, type=c195cc59-d766-4b78-813f-a0e1519099d8, name="sd-lpayload3"
size=14G name="sd-rootfs1"
name="sd-rootfs2"

This can either be done interactively, or by saving the above to a file, like format.txt, and running sfdisk /dev/<sdcard> < format.txt

2) Write Levinboot to sd-lboot partition using dd. You can get a pre-built and tested version here There are two options levinboot-sd.img and levinboot-emmc.img you can use either one of them for your sd-lboot partition. They differ in where they load the payloads from (either from SD or eMMC) and not in where they can be flashed to. For uSD card only workflow, you'll want levinboot-sd.img.

3) Prepare payloads for Levinboot and copy them to appropriate partitions. Partition sd-lpayload1 is used by default, sd-lpayload2 when you hold a volume down key during powerup, and sd-lpayload3 when you hold the volume up key.

Preparing a payload involves getting a TF-A bl31.elf build, kernel Image build, DTB file for Pinephone Pro, and optionally an initramfs archive, modifying DTB to include kernel boot arguments, and compressing these using lz4 in specific order, as shown below.

BOOTOPTS=(
        console=tty1

        earlycon=uart8250,mmio32,0xff1a0000
        console=ttyS2,1500000n8

        root=PARTLABEL=emmc-rootfs1
        rootfstype=f2fs
        rootflags=fastboot
        rootwait
        rw

        loglevel=7
)

BOOTOPTS="${BOOTOPTS[@]}"
ALGO="lz4 -zc"

cp -f rk3399-pinephone-pro.dtb board-cfg.dtb
fdtput -pt s board-cfg.dtb /chosen bootargs "$BOOTOPTS"

(
        $ALGO bl31.elf
        $ALGO board-cfg.dtb
        $ALGO Image
#       $ALGO initramfs.img
) > payload.img

dd if=payload.img of=/dev/disk/by-partlabel/sd-lpayload1 bs=4M oflag=direct

4) Prepare root filesystem. You can use any Linux distribution for aarch64 for development. For example if you want to use Arch Linux ARM, you would need to format the sd-rootfs1 partition with f2fs filesystem and extract the Arch Linux ARM rootfs tarball there. That will give you a bootable SD card image for Pinephone Pro.

5) Repeat steps 3 and 4 if you want either more kernel payloads, or more Linux distributions on the same uSD card. I recommend having at least some module-less working kernel in sd-payload3 and perhaps a small userspace in sd-rootfs1 with a pre-configured WiFi connection, that will allow you to always quickly recover if your development kernel fails to boot, just by pressing volume up key during boot and updating the the kernel in one of the primary payload partitions over WiFi.

Development discussion

Most of the discussion happens in #pinedev channel on Pine64 IRC server.

See https://xnux.eu/log/ too.