Gentoo on a PinePhone making it a usable phone 
This is part two of the Gentoo on a PinePhone blog.
In part one you installed the base system and getting it bootable, this blog we are going into making it a usable phone.
Phosh
Phosh can be installed using:
Now start and enabled phosh and other services
What is missing now is a onscreen keyboard.
I am using x11-misc/squeekboard but you can choose your own.
To install squeekboard just run
I have found some trouble intalling squeekboard so I've just build it myself.
First you need the emoticons package
Then pull the git repo and compile the source.
To make sure it shows up enable gnome onscreen keyboard
afterwards make sure its configured for phosh.
Add the keyboard layout to the user (https://source.puri.sm/Li...ree/master/data/keyboards)
for the US version
Phone apps
There are some pinephone applications that now needs installing you can just run:
Ive installed these extra applications to make it more usable
Browser
Finding a good browser is crusial for a workable (smart)phone. There are two good options beside the default gnome webbrowser. You can try and compile Firefox or Chromium but they are very hefty compilations even with distcc on. I'm still trying to find a way to compile firefox without an error.
In the mean time I did find a good solution, a binary version of Chromium for arm64. It's part of the stha09 overlay, but I've also included it in my own overlay.
So what you can now do is simply run
This installs the binary version of Chromium, from what I can tell this is still a very fast browser but without a very hefty compile time.
For Firefox a working compile I did was using the following
Flatpak
Some applications are not really available so im using flatpak for those applications then you can install applications from flathub aswell.
then run
XMPP Client (Dino)
I myself use XMPP for some people so I can work around Facebook.
My prefered Linux client is Dino, wich at this moment is not native phone ready but there is a branch that is. So we need to build it ourself.
You can just download the zip file for the branch and then build it
Anbox
In order to make the phone Daily useable alot of users will need andriod apps. We can use anbox for this but its not natively avalible for Gentoo so we need to build this ourself.
My experience is that anbox is very unstable, craches alot and apps dont always start. Its better to find alternative applications for the android apps then use anbox at the moment. But to give it a try I've included it in this blog.
If you followed part one you should have networkmanager installed, we can add the anbox network using that:
Edit two files to make sure lxc will work correctly
Then run
Afterwards install the following depencies
Now download and build anbox
I found that with GCC 10+ the tests break so what you can do is after step 2 is do
And then Comment line 141
Everythings once agian installs in /usr/local you can just move it to /usr yourself.
After you build anbox you need an android image and the startup scripts.
Download the image to /var/lib/anbox
Under dev create the binderfs directory
You can add the followig to your fstab
Next we need to create the services
Start and enable the service
Create a second service
and enable this service for the user
In part one you installed the base system and getting it bootable, this blog we are going into making it a usable phone.
Phosh
Phosh can be installed using:
code:
1
| emerge --ask gui-wm/phosh-meta |
Now start and enabled phosh and other services
code:
1
2
3
4
5
| systemctl --now enable seatd systemctl --now enable phosh systemctl --now enable eg25-manager systemctl --now enable NetworkManager #if not done before systemctl --now enable ModemManager |
What is missing now is a onscreen keyboard.
I am using x11-misc/squeekboard but you can choose your own.
To install squeekboard just run
code:
1
| emerge --ask x11-misc/squeekboard |
I have found some trouble intalling squeekboard so I've just build it myself.
First you need the emoticons package
code:
1
| emerge --ask media-fonts/noto-emoji |
Then pull the git repo and compile the source.
code:
1
2
3
4
5
6
7
| $ git clone https://source.puri.sm/Librem5/squeekboard.git $ cd squeekboard $ mkdir _build $ meson _build/ --prefix=/usr/ $ cd _build $ ninja $ ninja install |
To make sure it shows up enable gnome onscreen keyboard
code:
1
| gsettings set org.gnome.desktop.a11y.applications screen-keyboard-enabled true |
afterwards make sure its configured for phosh.
Add the keyboard layout to the user (https://source.puri.sm/Li...ree/master/data/keyboards)
for the US version
code:
1
2
3
| cd $HOME/.local/share/squeekboard/keyboards #create if its not there yet wget https://source.puri.sm/Librem5/squeekboard/-/raw/master/data/keyboards/us.yaml wget https://source.puri.sm/mozzwald/squeekboard/-/raw/c1737c763f295e2a71f574d3d436ec7899adf9f1/data/keyboards/terminal.yaml |
code:
1
| nano -w /etc/xdg/autostart/sm.puri.Squeekboard.desktop |
code:
1
2
3
4
5
6
7
8
9
| [Desktop Entry] Name=Squeekboard GenericName=Squeekboard Virtual Keyboard Comment=Virtual Keyboard Exec=/usr/bin/squeekboard Terminal=false Type=Application NoDisplay=true Categories=GTK;Utility; |
Phone apps
There are some pinephone applications that now needs installing you can just run:
code:
1
| emerge --ask app-mobilephone/pinephone |
Ive installed these extra applications to make it more usable
code:
1
| emerge --ask media-sound/lollypop mail-client/geary media-plugins/gst-plugins-x264 |
Browser
Finding a good browser is crusial for a workable (smart)phone. There are two good options beside the default gnome webbrowser. You can try and compile Firefox or Chromium but they are very hefty compilations even with distcc on. I'm still trying to find a way to compile firefox without an error.
In the mean time I did find a good solution, a binary version of Chromium for arm64. It's part of the stha09 overlay, but I've also included it in my own overlay.
So what you can now do is simply run
code:
1
| emerge --ask www-client/chromium-bin |
This installs the binary version of Chromium, from what I can tell this is still a very fast browser but without a very hefty compile time.
For Firefox a working compile I did was using the following
code:
1
| nano -w /etc/portage/package.use/firefox |
code:
1
| www-client/firefox -clang hwaccel openh264 -screencast system-av1 system-harfbuzz system-icu system-jpeg system-libevent system-libvpx system-web |
Flatpak
Some applications are not really available so im using flatpak for those applications then you can install applications from flathub aswell.
code:
1
| emerge --ask sys-apps/flatpak |
then run
code:
1
| flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo |
XMPP Client (Dino)
I myself use XMPP for some people so I can work around Facebook.
My prefered Linux client is Dino, wich at this moment is not native phone ready but there is a branch that is. So we need to build it ourself.
You can just download the zip file for the branch and then build it
code:
1
2
3
4
5
6
7
8
| pinephone /var/tmp # emerge --ask media-gfx/qrencode net-libs/libsignal-protocol-c pinephone /var/tmp # wget https://github.com/dino/dino/archive/refs/heads/feature/handy.zip pinephone /var/tmp # unzip handy.zip pinephone /var/tmp # cd dino-feature-handy/ pinephone /var/tmp # ln -s /usr/bin/valac-0.48 /usr/bin/valac pinephone /var/tmp/dino-feature-handy # ./configure --prefix=/usr/ pinephone /var/tmp/dino-feature-handy # make pinephone /var/tmp/dino-feature-handy # make install |
Anbox
In order to make the phone Daily useable alot of users will need andriod apps. We can use anbox for this but its not natively avalible for Gentoo so we need to build this ourself.
My experience is that anbox is very unstable, craches alot and apps dont always start. Its better to find alternative applications for the android apps then use anbox at the moment. But to give it a try I've included it in this blog.
If you followed part one you should have networkmanager installed, we can add the anbox network using that:
code:
1
| nmcli con add type bridge ifname anbox0 -- connection.id anbox-net ipv4.method shared ipv4.addresses 10.0.2.1/24 |
Edit two files to make sure lxc will work correctly
code:
1
| nano -w /etc/portage/env/remove-newsuidmap |
code:
1
| EXTRA_ECONF="--enable-subordinate-ids=no" |
code:
1
| nano -w /etc/portage/package.env/sys-apps_shadow-remove-newsuidmap |
code:
1
| sys-apps/shadow remove-newsuidmap |
Then run
code:
1
| emerge -1 sys-apps/shadow |
Afterwards install the following depencies
code:
1
| emerge --ask media-libs/sdl2-image app-emulation/lxc dev-libs/properties-cpp media-libs/glm dev-util/android-tools |
Now download and build anbox
code:
1
2
3
4
5
6
7
| $ git clone https://github.com/anbox/anbox.git --recurse-submodules $ cd anbox $ mkdir build $ cd build $ cmake .. -DENABLE_WAYLAND="$(usex wayland)" $ make $ make install |
I found that with GCC 10+ the tests break so what you can do is after step 2 is do
code:
1
| nano -w CMakeLists.txt |
And then Comment line 141
code:
1
| #add_subdirectory(tests) |
Everythings once agian installs in /usr/local you can just move it to /usr yourself.
After you build anbox you need an android image and the startup scripts.
Download the image to /var/lib/anbox
code:
1
| wget http://alexmitter.org/downloads/anbox/anbox_image_builder_image/android.img |
Under dev create the binderfs directory
code:
1
2
3
| pinephone / # cd /dev/ pinephone /dev # mkdir binderfs pinephone /dev # mount -t binder none /dev/binderfs |
You can add the followig to your fstab
code:
1
| none /dev/binderfs binder nofail 0 0 |
Next we need to create the services
code:
1
| nano -w /lib/systemd/system/anbox-container-manager.service |
code:
1
2
3
4
5
6
7
8
9
| [Unit] Description=Anbox Container Manager Documentation=man:anbox(1) [Service] ExecStart=/usr/bin/anbox container-manager --daemon --data-path=/var/lib/anbox --container-network-gateway=10.0.2.1 [Install] WantedBy=multi-user.target |
Start and enable the service
code:
1
2
3
| systemctl --now enable dnsmasq systemctl --now enable lxc systemctl --now enable anbox-container-manager |
Create a second service
code:
1
| nano -w /etc/systemd/user/anbox-session-manager.service |
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
| [Unit] Description=Anbox Session Manager Documentation=man:anbox(1) After=basic.target Wants=basic.target [Service] ExecStart=/usr/bin/anbox session-manager --gles-driver=host Restart=on-failure RestartSec=5s [Install] WantedBy=graphical-session.target |
and enable this service for the user
code:
1
| systemctl --user enable --now anbox-session-manager.service |
31-01 Gentoo on a PinePhone Pro
02-'21 Gentoo on a PinePhone
Comments
En wat kan die telefoon dan doen?
Dat ligt er aan wat je er mee wilt, met gentoo kan je natuurlijk geheel kiezen wat je wilt. Maar de installatie zoals ik die hier heb beschreven heb je op andriod apps na bijna alles, calender, contacten je kan bellen smsen en xmpp messenger gebruiken. Je hebt een Camera app, Kaart applicatie. Dus opzich een werkende telefoon.falconhunter wrote on Saturday 27 March 2021 @ 21:12:
En wat kan die telefoon dan doen?
Klinkt briljant, dank voor het hele proces. Zoek al tijden naar een non-google non-apple telefoon. Heb niet zo veel ervaring met linux, maar misschien durf ik het hiermee aan.
Gentoo is opzich niet gelijk voor een beginner, maar je leer wel veel van hoe Linux werkt. Er zijn heel veel Linux Distro's die op de PinePhone werken, je kan ze allemaal vinden op de PineWiki.XfXf4 wrote on Monday 29 March 2021 @ 14:07:
Klinkt briljant, dank voor het hele proces. Zoek al tijden naar een non-google non-apple telefoon. Heb niet zo veel ervaring met linux, maar misschien durf ik het hiermee aan.
Comments are closed