PostmarketOS on the Mozilla Flame (t2m-flame)

One of my friends was fortunate enough to get his hands on two Mozilla Flame devices some years ago and gifted one to me just recently. These were devices originally intended for developers and early adopters of the now obsolete Firefox OS (codenamed b2g, or boot to gecko), an operating system using base android tools such as ADB and Fastboot, but instead of booting to Android, booted to an interface on top of Gecko, Firefox’s web engine. Although Firefox OS has been discontinued, the source code live on in the emerging KaiOS, which is an OS for non-touchscreen mobile phones aimed at providing internet and mobile phone access to millions of people who wouldn’t otherwise have it.

PostmarketOS is an Alpine Linux based operating system for phones which aims to achieve a whopping 10 years of updates to every phone it supports once it is stable (at the time of writing it is in pre-alpha). As luck has it, the Mozilla Flame is supported by PostmarketOS! however, as I found out it is not as straightforward as that. The port for the Flame is quite old, from before PmOS supported Armv7, so it is designed around ArmHF. The problem with this is that modern interfaces like KDE’s Plasma Mobile and Purism’s Phosh don’t support ArmHF, so I had to make some modifications to the port. As this is a tutorial, I will show you how to set up the environment and make these changes, although I will warn you that most things don’t work and all it does is boot and allow SSH access in its current state. Please refer to https://wiki.postmarketos.org/wiki/Mozilla_Flame_(t2m-flame) as well, as there is a lot of useful information there.

What you’ll need

  • Root access to a GNU/Linux machine
  • A MicroSD card larger than 4GB
  • A Mozilla Flame
  • Fastboot installed on your computer

How to do it

The first thing you’ll want to do it grab PMBoostrap, PostmarketOS’s bootstrap tool’s source code.

git clone https://gitlab.com/postmarketos/pmbootstrap
cd pmbootstrap

Now you’ll want to run the init script, just to download the device configs and stuff

./pmbootstrap.py init

However, once it asks you to select a device exit it by pressing ctrl+c, because we don’t want it to set everything up with armhf instead of armv7.

Now what we want to do is edit some files to tell the build scripts to compile for armv7 instead of armhf.

nano aports/device/device-t2m-flame/APKBUILD

This will open a text edior (nano) which will allow you to edit the APKBUILD instructions for the device. What you’ll want to do is change line 6 from arch="armhf" to arch="armv7" . Next we will change the device info.

nano aports/device/device-t2m-flame/deviceinfo

Navigate your way to line number 16, and change deviceinfo_arch="armhf" to deviceinfo_arch="armv7". We are not done yet though, as we still have to change the APKBUILDs for the kernel and the firmware.

nano aports/device/linux-t2m-flame/APKBUILD

On line 25, once again change arch="armhf" to arch="armv7"

nano aports/firmware/firmware-t2m-flame/APKBUILD

And on line 6, change arch="armhf" to arch="armv7"

Now we’ve finished all the changes we need to make, we can run pmboostrap init once again, but for real this time. I would recommend not choosing to include the WiFi firmware during this, as I have had problems with it before.

Now we build the image, and flash it on to your SD card. Insert your SD into your computer and type in:

./pmbootstrap.py install --sdcard /dev/mmcblkX

but replacing the mmcblkX with the path of your sdcard. You can list the paths by typing sudo fdisk -l and looking for your SD card.

To get the phone to boot our image, we first need to flash on the postmarketos kernel we just built. Boot the device to fastboot (by holding down vol - and power at the same time) and use this command:

./pmbootstrap.py flasher flash_kernel

Now insert your SD card into your phone, reboot and you’re off. Have fun!

Leave a Reply

Your email address will not be published.