megi's PinePhone Development Log RSS

+972

2022–08–14: USB recovery/hacking tool for Pinephone Pro

I noticed in Pine64 chat that some people lack uSD card or uSD card reader when they receive the phone, and are thus prevented from flashing an OS to eMMC until they buy it. It's kinda wasteful to buy these things when you may only need them for such a specific one-time use case.

I decided to write a tool that works somewhat like https://github.com/dreemurrs-embedded/Jumpdrive but does not require a uSD card. The tool itself and more infromation can be found here: https://xff.cz/kernels/pinephone-pro-recovery/

It's a simple to use binary executable with no options and no extra files to keep around that boots my Linux kernel build using Levinboot over USB and runs a program (from initramfs) that exports eMMC and SD block devices over USB.

Everything that is necessary to achieve this is included in the binary itself. The tool itself does not rely on any modifiable code that may be present on the phone, to function.

There's a space for a recovery tool that does not rely on any modifiable software located on the phone itself and thus works on all Pinehone Pros regardless of what is flashed on them.

Tow-Boot may have JumpDrive like functionality integrated, but that's kinda useless if you don't have Tow-Boot flashed, yet, or if you want to use a different bootloader, like Levinboot for example. This tool also relies on Linux, so the phone will have the Type-C port's functions properly managed during flashing, and in the future some UI may be easily added to perform various HW testing tasks, or to support direct installation of images from the internet over WiFi.

I also hope this will be a useful tool for distributing experimental kernel builds that can be quickly tested on anyone's Pinephone Pro without affecting their normal OS installation at all, to get a predicatble environment for distributed kernel testing and development. :)