Doing something usefull with the Pinephone

(or writing my first app)

Martijn Braam wrote a good article about the Linux phone. ( I think he has a point, but a lot of Linux phone owners are not necessarily software engineers. Neither am I. But as an electronics design engineer I do have some basic coding skills. So why not give it a try?


I installed Linux on a spare x86 PC. Normally, I would choose openSUSE for its user friendliness. But this time I choose Debian because it suits my development needs. I will still develop the application on my openSUSE workstation, but the Debian machine will be used for compiling, as Debian offers all the tools I need.

Installing the tool chain

In order to cross compile the code I have to install a cross compiler on the Debian machine. The Pinephone has a 64 bit Arm processor and therefore I need the aarch64 cross compiler. How do I know? Well, that's what the internet says. And everything you read on the interwebs is true, right? Let's check it by running the command 'uname -m' in a terminal. You can do it on the phone itself, which is very cool. But you can also ssh into the phone and do it that way, which is even cooler!

I now know for sure that I need the aarch64 cross compiler. So let's install it:

sudo apt install gcc make gcc-aarch64-linux-gnu binutils-aarch64-linux-gnu

I also install the armv7l cross compiler. This is not needed for the Pinephone, but I own a bunch of Raspberry Pi's, which need this cross compiler:

sudo apt install gcc make gcc-arm-linux-gnueabi binutils-arm-linux-gnueabi

Start programming

Now I can write a simple program. What about "hello world"? Seems appropriate:

nano helloworld.c

And start typing:

#include<stdio.h >
int main()
printf("Hello World!\n");
return 0;

Save the file and exit the editor. Now let's compile the program for the host, which is an x86 machine:

gcc helloworld.c -o helloworld-x86_64

I can now run this program on the Debian PC:


Now let's compile it for the Pinephone:

aarch64-linux-gnu-gcc helloworld.c -o helloworld-aarch64 -static

If I want to run this program, I have to transfer the file to the Pinephone:

sftp linux-phone-marcel
put ./helloworld-aarch64

Let's go to the phone and test the program:

That's it. I can write programs for the Pinephone. But on the Pinephone it is better to have a gui than to fiddle with the command line. So, to be continued...

Next: my second program