How to extract files from a FP2 system image

As I’m currently migrating my FP2 to the LineageOS fork including microG (also see this thread) I was wondering how to get some FP OS specifics (like the background images or the Fairphone ringtone) to LineageOS.

I found this how to article giving some valuable hints where to find e.g. the wallpaper files, but of course you’ll need a rooted device (still) containing the respective files, which means that you would have known you’ll miss them before having flashed the new OS. :confused:
If you didn’t, you can use the full binary images Fairphone provides on the support page and extract them from there.

Some remarks regarding prerequisites I found during my experiments and web searches:

  • The files I wanted to extract are located in the system partition.
  • The /system/framework/framework-res.apk file mentioned in the blog post above only contains Android (i.e. AOSP) stock wallpapers. The FP2 wallpapers are contained in the Fairphone launcher app.
  • The partition image files contained in the zip’s provided by Fairphone “are dumped partitions in “Android sparse image” format… you will need to convert them with simg2img before mounting them to extract any content.” (citing @Roboe).
  • On my machine running Ubuntu 16.04 LTS I needed to install android-tools-fsutils (apt install android-tools-fsutils) first to be able to use simg2img.

Now here’s the step-by-step procedure:

  1. Download the image of choice, e.g. FP OS 17.11.02 image, to your machine.
  2. Open the zip file using the archive manager and unzip the system partition image file system.img to some folder, e.g. to /home/bemigro/FP2/system.img.
  3. Now use a terminal window to convert the file from Android sparse image format to raw ext4 image format by typing simg2img system.img sys-raw.img.
  4. Mount the image sys-raw.img using the file manager and navigate to the desired apk file; the Fairphone wallpapers are packaged in the Fairphone launcher /system/priv-app/FairphoneLauncher3/FairphoneLauncher3.apk.
  5. Open the apk file with the archive manager; extracting the apk’s contents (e.g. subfolder FP2/FairphoneLauncher3/) makes searching easier. As an example, the wallpapers are (depending on the resolution) .jpg (or .png) files in one of the res/drawable* folders (e.g. res/drawable_nodpi_v4/wallpaper_press.jpg).
  6. Copy the desired files to an appropriate folder on your FP2, e.g. wallpaper files to the Pictures folder.

Two more side remarks:

  • Since I mentioned it above: the Fairphone ringtone is not packaged in an apk, but can be found as a separate file in the system image as /system/media/audio/ringtones/Fairphone.mp3.
  • Of course you could also go ahead and integrate those files into your own (flashable) system image, but that’s just a bit too far beyond my horizon.
2 Likes

For ringtone and wallpapers you can just inspect the source:

An OTA-survival flashable ZIP is not a difficult thing. I can help with it once we collect all Fairphone media thingies, if there’s interest, :slight_smile:

4 Likes

Apparently there’s also an easy way, if you know where to search. :smile:

Thanks for the offer, I might come back to it.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.