logo du siteLe Site du Gnu-Bricoleur

/!\ Un blog plébiscité par Chuck Norris O_o

Pinephone - 2: A first Application

Rédigé par SuperGNU Aucun commentaire

The Linux ecosystem for smartphone is still a little bit confusing for me at the minute so I decided to start small before trying to make actual contributions to the core system or useful apps by just making a dummy example app.

I've decided to go with kirigami for building the app as it seems to me to be the best compromise at the moment. Kirigami is the KDE solution to make apps work on both desktop and phones. The apps are using Qt widgets and depending on the platform, alternate versions of the widget and layout are used. As it's developed by KDE it should integrate well with Plama on Postmarketos but it should also works on Ubuntu Touch (and even Android, Windows and Mac).

However, kirigami is still a rather new technology and there is few documentation on it. I also had some difficulties on getting all the kde5 dependencies installed on the pinephone using apk because of some issues with the latest mesa driver. This will probably be fixed soon but in the meantime, i used flatpak to get all the required dependencies on both my computer and the Pinephone and i think it actually proved easier and more versatile than building directly into the pmbootstrap chroot.

Here are the websites i relied on for documentation:

Part I : Compiling the hellokirigami example app

The idea is to code the app on the computer, cross-build it with flatpak for the pinephone, send it on the pinephone and install there. First, we need to install flatpak on the development computer, most likely.

 apt install flatpak

Then we need to add those two remotes to flatpak (flathub because it's generally useful for software and kde for the Qt5 libraries)

flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak remote-add --if-not-exists kdeapps --from https://distribute.kde.org/kdeapps.flatpakrepo

We can then install the Qt libraries for the computer in order to compile the app for desktop and be able to try it before sending to the phone.

flatpak install flathub org.kde.Platform//5.12 flatpak install flathub org.kde.Sdk//5.12

We also need to install flatpak those same libraries but for the phone architecture. Now, most tutorials for kirigamiu are installing the arm architecture version for mobile plateform but uname -m returns aarch64 on the pinephone so we need the aarch64 version.

apk add flatpak
flatpak install flathub org.kde.Platform/aarch64/5.12
flatpak install flathub org.kde.Sdk/aarch64/5.12

also to be able to cross compile later with flatpak builder, you will need the following packages installed on your system :

sudo apt install qemu binfmt-support qemu-user-static

We can then download the following example project and try to compile it :

git clone https://invent.kde.org/jbbgameich/plasma-mobile-app-template.git

Then, to build :

cd plasma-mobile-app-template
flatpak-builder flatpak-build-desktop --force-clean --ccache *.json

To make the app display as as on a smartphone on the computer


To then run the app on the computer

flatpak-builder --run flatpak-build-desktop *.json hellokirigami

The app should launch in a new window.

We can then compile for the phone arcchitecture :

flatpak-builder flatpak-build-phone --repo=arm-phone --arch=arm --force-clean --ccache *.json
flatpak build-bundle arm-phone hellokirigami.flatpak org.kde.hellokirigami --arch=arm

Send the app to the phone (with postmarketos, the phone is available on the IP as soon as it's connected to the computer via USB.

scp hellokirigami.flatpak phablet@

To test the app on the phone, we need to install it, as for now we just have the package copied to memory.

ssh phablet@

To install flatpak on the Pinephone:

sudo apk install flatpak
flatpak install flathub org.kde.Platform/aarch64/5.12
flatpak install flathub org.kde.Sdk/aarch64/5.12
flatpak install hellokirigami.flatpak

The application should appear on the launcher. Otherwise, it should be possible to launch it with :

flatpak run org.kde.hellokirigami

Then, to develop, it's just going to be iterations of : Building on the computer for the phone, bundling into a flatpak package, sending to the phone, installing, ... iterate!

On the computer :

flatpak-builder flatpak-build-desktop --repo=aarch64-phone --arch=aarch64 --force-clean --ccache *.json
flatpak build-bundle aarch64-phone hellokirigami.flatpak org.kde.hellokirigami --arch=aarch64
scp hellokirigami.flatpak sylvain@

On the phone SSH console:

sudo flatpak install hellokirigami.flatpak 
Classé dans : Non classé Mots clés : aucun

Pinephone - 1: The arrival !!

Rédigé par SuperGNU Aucun commentaire

This is, i hope, the first of a serie of Pinephone articles summing up for myself and others what i'm learning on the Pinephone, Linux on a smartphone and contributing to the different OSs in order to turn this phone into the perfect daily driver.

I'll be learning as i write so i don't expect these articles to always represent the best or the most elegant solution but i intend them to help me figure out exactly what was needed in the middle of all i tried and maybe it can help shorten the learning path for others. Right now only 3000 "Braveheart" Pinephones have been selled and i can assume most of them are in far more knowledgeable hand than mine but come April, the software should be in a better place and Pine64 will surely sella new batch to less linux-able people and this guide might just come handy.

Lire la suite de Pinephone - 1: The arrival !!

Fil RSS des articles