• Introducing XDA Computing: Discussion zones for Hardware, Software, and more!    Check it out!

Sailfish OS for the Samsung Galaxy S2 (i9100)

Search This thread

edp17

Senior Member
Dec 9, 2019
117
63
Code:
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!                W A R N I N G                !!
!!                                             !!
!!(Although I am using this on my backup phone)!!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!            Everything you do,               !!
!!      you do at your own peril and risk.     !!
!!                                             !!
!!      I do not bear any responsibility       !!
!!          for your faulty devices.           !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
!!                                             !!
!!      ROM IS NOT SUITABLE FOR DAILY DRIVE    !!
!!        ONLY FOR EXPERIMENTAL PURPOSES       !!
!!                                             !!
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

Making this port was challenging because Sailfish OS, from version 3, doesn't support kernel version 3.0 which is apparently the kernel on the S2. :)
Fortunately, the SailfishOS-porter guys do very seriously know their business and they are extremely helpful.
From here I would like to emphasize my gratitude towards them for helping me in this project! Thank you!

Requirements:
Before you start to download anything, please read it carefully.
The first requirement is your device must be rooted and you should be able to install a custom recovery (preferably TWRP) onto it.

For this ROM you can either use the stock partitions or you can re-partition to give more space to /system and /data. It doesn't matter which one you chose, I tried and both worked well.
Or if you scroll down to the New partition layout, you can use a completely unique partition layout which gives the most of the internal storage to Sailfish OS. (I currently use my device with this setup.)

Installation instructions:
1. Download all files, CM12.1 zip, Sailfish OS zip, twrp2.8.7.img and kernel*.img to the external SD card on the phone
2. Reboot into TWRP (hold buttons: Power on + Home + Volume up)
3. Do a factory reset

At this point if you want you can repartition the S2 internal storage. (Later you can put the stock layout back if you want to go back to Android.)

The steps for repartitioning are:

    • Download the 'Repartition: System=1GB, Data=14GB, eMMC=8MB, /preload=7MB' or the 'Repartition: System=1GB, Data=4GB, eMMC=7GB, /preload=0.5GB' .zip file and put into the external SD card. (The difference between these two is explained down at the New partition layout section
    • Then boot into TWRP and flash the zip as any other zip file. The script first will warn you that it cannot do the partitioning with mounted partitions and it also copies the script itself into /tmp. You just simply need to flash the copied version from /tmp and that will do the trick. The script will format the new partitions accordingly, so once it is completed you can go ahead with the next step.

4. Still in recovery, flash the CM12.1 image
5. Still in recovery, flash Sailfish Os image
6. Still in recovery, flash twrp2.8.7.img to recovery partition
7. Still in recovery, flash kernel*.img to boot partition
8. Reboot
9. Enjoy the latest (3.4.0.24) Sailfish OS on your i9100. :)
You will need patience as the first boot will take for a while. Then you can go through the initial Sailfish OS set up.

This Sailfish OS Android HAL based on CM 12.1.


Downloads:


Some useful patches:

Apps from Openrepos
Apart from the Jolla store there are plenty of other, community-made apps in Openrepos. There is a user-friendly app to install/remove apps from this source called Storeman. It can be downloaded and install from this location: Storeman

Debug/login/troubleshooting:
In Ubuntu, connect USB cable. telnet 192.168.2.15 2323 or SSH [email protected]


Notes:
  • On Sailfish OS, as it is a Linux system, you cannot install/run any android apps.

How to make a backup/restore with TWRP:
Now the old clunky method is no longer needed. Once you flashed the twrp2.8.7.img to the recovery partition you can boot into TWRP with the usual button combination (Hold buttons: Power on + Home + Volume up) and can make backup/restore.

Instructions for bluetooth

BT works however turning it on/off is not as user friendly as I hoped. Here is a little instruction/troubleshooting.
Turn BT on (It only works from Settings/Bluetooth!!!!! DON'T try from TOP MENU!!):
If BT hasn't turned on since last boot:
  1. go to Settings/Bluetooth
  2. tap on the dot next to the Bluetooth option

If BT has turned on at least once since last boot:
  1. go to Settings/Bluetooth and tap on the dot next to the Bluetooth option
  2. go back to Settings
  3. go to into Settings/Bluetooth again
  4. tap on the dot next to the Bluetooth option (if it is not turned on repeat from Step 2! Eventually, BT should turn on.)

Turning BT off: Go to Settings/Bluetooth and tap on the white dot next to the Bluetooth option.

Notice: Never try to tap on the white dot twice without going back to the main menu of Settings.
Never try to turn BT on from Top Menu.
However, if you accidentally did any of these BT cannot be turned on again unless you:
  • reboot the device (this is the easiest) or
  • in a command line as root issue the following command 'systemctl restart bluetooth-rfkill-event.service' (this will restart the bluetooth-rfkill-event service)
I am not sure how pairing works with different devices.

New partition layout

I mentioned that I tried this Sailfish OS installation with the stock partitions and with another what created for Android 7.1.2. With the stock partitions however was a bit more sluggish than the other one. No wonder as in the stock partitions the /system has only 0.5GB and the /data has only 2GB storage and the rest 12GB is the separate internal storage (eMMC). In Sailfish the entire os (rootfs) including all directories (like /home) live on the /data partition so the 2GB was a bit tight. (The OS itself consumes about 1GB so not much left for apps and other stuff.)

With the other partition layout, the picture was a bit better as the /system had 1GB, the /data got 4GB and the rest 9GB remained for the internal storage. But the partition where the OS lives was separated from the 9GB partition. When I installed a few apps and copied some big files into the /home, I felt the limitation very soon.

Although this layout was sufficient for android but not good enough for Sailfish. :)
Therefore I have created my own partition table where I restructured the sizes accordingly to my need. (The lanchon repit zip file is available in the download section.)

In this new layout I gave 1GB for the /system (the prior 0.5GB was also fine as the CM12.1 base consumed only 400MB which let a 100MB free space, but I thought that might be not enough in the future so I have chosen 1GB here), I gave only 8MB for the internal storage (eMMC which is mounted into /android directory in this rom), and this made me possible to gave all the rest 14GB to the /data partition. So basically the Sailfish apps and /home can utilize the entire internal storage. :cool:

As an extra, on the S2 there is a 0.5GB /preload partition which is hidden and unused by default. In my partition setup I set 7MB to this and the rest almost 0.5GB is also added to the /data.


Go back to stock partitions

In case you would like to do this, you can download the stock partition pit file from the download section.
For this use Odin v1.83 which is also in the download section.
The steps are:
  • Boot the device into download mode and connect to the PC.
  • Open Odin v1.83 and tick the 'Re-partition' checkbox at the Option.
  • Then click on the PIT button and select the downloaded stock pit file.
  • Then click on the PDA button and select the downloaded TWRP (AOSP kernel) file.
  • Then click on start.
  • Done. You need to boot into TWRP and wipe all partitions (system, data, emmc) then you can install the stock rom back. (or if you select the stock rom at PDA instead of the AOSP kernel, it will do the repartition and install the stock rom as well. In this case, you don't need to wipe anything and the device will reboot into the stock Android at the end.)


Changelog:
03.09.2021
=========
Work:
Same as previously
Bluetooth does work, but once it is off, needs to be toggled a few times in Settings to make it turn on again.

14.06.2020
=========
Work:
Same as previously + Mobile data is fixed! (To make it work: change Protocol to IP in Settings/Mobile network/Data access point.)
Bluetooth doesn't work, it is still WIP

Do not work:
Same as previously


06.05.2020
=========
The latest version of Sailfish OS 3.3.0.16 is available to download. This requires a different kernel. Both of these can be found in the download section.
Note: With the new version the patch that displays the provider logo at the bottom on the lock screen stopped working. This issue is not related to the OS. The owner of the app should fix it.
Update: In openrepos Kodi is fixed for SFOS 3.3.0.16!

29.04.2020
=========
Work:
  • Screen
  • Touch
  • IMEI number is detected
  • Sensors (GPS, Rotation, Acceleration, Gyroscope, Magnetometer, Light & Proximity)
  • Wifi
  • MTP
  • Bluetooth (instruction is above)
  • Calls incoming/outgoing
  • Messages incoming/outgoing
  • External SD card detected and mounted to /run/media/nemo/_sdcard_name_ (where _sdcard_name_ is name of the sd card when it was formatted like 7C97-785B)
  • Internal SD card is mounted to /android
  • Pixel ratio and icons set to 1.00 (Can be changed to 0.82 which is more appropriate for the device's screen. to do this as root run the 'kimmoli-diyicons.sh 0.82' command. It will fail to install imagemagick but will set the ratio to 0.82 and as we have all icons in place it will work.)
  • Audio is routed to headphone if that presents
  • Camera front/rear (only for taking pictures)
  • Jolla store
  • findutils is installed by default (updatedb and locate commands work out of the box)
  • Torch
  • the charging icon does work properly, however, there is a little delay
  • can boot into TWRP recovery with the usual button combination (hold buttons: Power on + Home + Volume up)
  • kernel and recovery .img can be flashed from TWRP (no need for PC to flash Sailfish OS, kernel and recovery)
  • Low Power Mode (AKA "sneak peek" or "ambient display") works (install instruction is in this post)
  • The softkeys (each side of the home button) work as notification leds

Do not work:
  • Mobile data (WIP)
  • Video recording (It doesn't really work in other 3.x versions either. See my test results here.)

There is an extra little issue that is a delay in screen refresh which is related to how vsync is handled in v10 backend in qt5-qpa-hwcomposer-plugin. I managed to improve this but there is a little delay still. Probably this is the reason why we need to jump back to Settings every time before trying to turn BT on, but I am not sure.


04.04.2020
=========
Work:
Same as previously + Softkeys are used as notification leds
Bluetooth doesn't work, it is still WIP

Do not work:
Same as previously



23.03.2020
=========
Work:
Same as previously + with 'kernel12_mtp' the MTP works! :D
Bluetooth partially works (to switch on BT requires a reboot or issue a command manually, it is still WIP)

Do not work:
Same as previously


25.02.2020
=========
Work:
Same as previously + with 'kernel07_flatpak' the Low Power Mode (AKA "sneak peek" or "ambient display") works! :D (install instruction is in this post)

Do not work:
Same as previously

23.02.2020
=========
Work:
Same as previously + but from now on you don't need PC and heimdall to flash kernel and twrp

Do not work:
Same as previously

19.02.2020
=========
Work:
The same as listed earlier + with the new kernel (kernel06) I attached you can boot into TWRP with the usual button combination (hold buttons: Power on + Home + Volume up)

Do not work:
Same as previously except the TWRP/Sailfish OS boot which has fixed.

08.02.2020
=========
Work:
  • Screen
  • Touch
  • IMEI number is detected
  • Sensors (GPS, Rotation, Acceleration, Gyroscope, Magnetometer, Light & Proximity)
  • Wifi
  • Calls incoming/outgoing
  • Messages incoming/outgoing
  • External SD card detected and mounted to /run/media/nemo/_sdcard_name_
    (where _sdcard_name_ is the name of the sd card when it was formatted like 7C97-785B)
  • Internal SD card is mounted to /android
  • Pixel ratio and icons set to 1.00 (can be changed, I set 0.82 which is more appropriate for the device's screen resolution see the download section)
  • Audio is routed to headphone if that presents
  • Camera front/rear (only for taking pictures)
  • Jolla store
  • findutils is installed by default (updatedb and locate commands work out of the box)
  • Torch

Do not work:
  • Mobile data
  • Bluetooth (the bt driver is in the kernel, so in theory, with some config file changes on the device it can work)
  • MTP
  • Video recording (It doesn't really work in other devices with CM12.1 base.)
  • Screen delay in refresh (related to how vsync is handled in v10 backend in qt5-qpa-hwcomposer-plugin)
  • the charging icon doesn't work properly: when the device is not on charger still shows it's charging (when I unplug the cable the message appears: "Charging..."
  • cannot boot into TWRP recovery (See Notes above)
Battery life:
In my experience the battery life is good. On standby, it can survive 10 days. (Almost 11.) I have checked once or twice daily during this period.
i9100_uptime_360x600.jpg
 
Last edited:

edp17

Senior Member
Dec 9, 2019
117
63
In case somebody missed these I would like to highlight some improvements since day 1:
  • Now both the kernel and twrp can be flashed as an .img from twrp (no need for PC and heimdall anymore)
  • Plus I uploaded a kernel with Flatpak support
 
Last edited:
  • Like
Reactions: ze7zez

edp17

Senior Member
Dec 9, 2019
117
63
With kernel07_flatpak, I have installed Flatpak and Angelfish but got an error when started Angelfish.

It looks like this is a limitation of the old kernel, but there might be a workaround. :D
I'll keep you posted.
 
Last edited:
  • Like
Reactions: ze7zez

edp17

Senior Member
Dec 9, 2019
117
63
The soft keys each side of the home button are used as notification leds. As this device doesn't have leds, the softkeys can be re-used as "leds". They do blink if the device is fully charged or there is an unread incoming text message. When the device is on charger they are on, otherwise both of them are off.
 
Last edited:
  • Like
Reactions: ze7zez

Galaxyninja66

Senior Member
Jan 25, 2015
441
112
Milton
Can you post your sources? I'm interested in getting an I9100 as my new phone, and was considering a port and I'm happy to see you've already done all the leg work and then some!

Also about the kernel on this phone, I've been trying to port to a tablet with weird kernel images, can you run "file (path to android base kernel image)" - if it says ForPro FPT or similar I will be very very interested in how you got this phone to boot into rootfs. Very interested in the progress you've made though :3 Thanks for the awesome rom!
 
  • Like
Reactions: ze7zez

edp17

Senior Member
Dec 9, 2019
117
63
Can you post your sources? I'm interested in getting an I9100 as my new phone, and was considering a port and I'm happy to see you've already done all the leg work and then some!

Also about the kernel on this phone, I've been trying to port to a tablet with weird kernel images, can you run "file (path to android base kernel image)" - if it says ForPro FPT or similar I will be very very interested in how you got this phone to boot into rootfs. Very interested in the progress you've made though :3 Thanks for the awesome rom!

Sorry for delay in my reply.
The necessary repos in github are:

The file (path to android base kernel image) command gives me: "Linux kernel ARM boot executable zImage (little-endian)"

A new image has been generated and can be downloaded. This one includes the patch of reusing the two softkeys (each side of the home button) and they do work as a notification leds! ;)
Currently I am working on the mobile data and bluetooth (this latter partially works but is not reliable yet).
 
Last edited:
  • Like
Reactions: S2UserRU and ze7zez

Galaxyninja66

Senior Member
Jan 25, 2015
441
112
Milton
You're a g! I just bought an i9100M (different radio :rolleyes:).

I do recall ofono being unfriendly towards older RIL versions, galaxy nexus afaik is unfixable in 2.0+. However, if you have any service that is exciting! I can't wait to setup my environment and play around with this! If i9100M has a different partition layout/mount points (you know how samsung is) I will blow my brains out. How is camera working? Does this image include gstreamer/droidmedia?

You've probably got this sorted way better than I could hope to sort it! I'm shocked this doesn't have more replies.

EDIT: I noticed you have a complex patch for the pixel ratio. Have you tried just setting it in your patterns?
 
Last edited:

edp17

Senior Member
Dec 9, 2019
117
63
You're a g! I just bought an i9100M (different radio :rolleyes:).

I do recall ofono being unfriendly towards older RIL versions, galaxy nexus afaik is unfixable in 2.0+. However, if you have any service that is exciting! I can't wait to setup my environment and play around with this! If i9100M has a different partition layout/mount points (you know how samsung is) I will blow my brains out. How is camera working? Does this image include gstreamer/droidmedia?

You've probably got this sorted way better than I could hope to sort it! I'm shocked this doesn't have more replies.

EDIT: I noticed you have a complex patch for the pixel ratio. Have you tried just setting it in your patterns?

I am not sure what you d understand under 'any service' but except the mobile data, everything else works fine (calls in/out, texts in/out).
I don't know the difference between the i9100 and i9100m but on the internet you probably can find something about it.
One suggestion, before you start porting, install an android onto and boot into that and note the mounting points. This can save a little time when you need to set the fixup_mountpoints in hybris-boot.

The camera works but only for pictures. The video recording doesn't work. I think this is down to the cm12.1 base what I used for my port. I think gstreamer/droidmedia are there but am not sure.

I think the reason why this doesn't get more hype because this is a very old device and except some old fashioned folks like us, not many are using anymore. :) I don't mind it because this is my hobby. I am going through a to-do list until all I wanted works.

Currently, as the new version 3.3.0.14 is out) I am working on to update my port to 3.3.0.14. Unfortunately currently there is no OTA but hope eventually it will be sorted.

Changing the pixel ratio is not essential as the default 1.0 is ok-ish. I have found the 0.82 better so I included the icons into my image. As the script (kimmoli-diyicons.sh) is also included, we just need to run one command as root. I may try to set the 0.82 out of the box but currently it is not my to priority. As I will need to re-build everything for 3.3.0.14, I will try to set 0.82 in the pattern file.
Please keep me posted with your progress.
 
  • Like
Reactions: ze7zez

Galaxyninja66

Senior Member
Jan 25, 2015
441
112
Milton
The camera works but only for pictures. The video recording doesn't work. I think this is down to the cm12.1 base what I used for my port. I think gstreamer/droidmedia are there but am not sure.

You'd 100% know if you built gstreamer, it's specified in the middleware section iirc and you have to uncomment it from your patterns. I hope it's easier to build nowadays. Also I noticed your port wasn't on the mer-wiki, if I remember my login is it okay if I add it :3 ?

EDIT: https://wiki.merproject.org/wiki/Adaptations/libhybris#Samsung - I added it to the bottom. creditted you in the edit note. you can create an account on the mer bug wiki and use it to edit the tables. I'll also be closely following this and editting it to match your progress. Tell me if you'd like any values changed!
 
Last edited:
  • Like
Reactions: ze7zez

edp17

Senior Member
Dec 9, 2019
117
63
You'd 100% know if you built gstreamer, it's specified in the middleware section iirc and you have to uncomment it from your patterns. I hope it's easier to build nowadays. Also I noticed your port wasn't on the mer-wiki, if I remember my login is it okay if I add it :3 ?

EDIT: https://wiki.merproject.org/wiki/Adaptations/libhybris#Samsung - I added it to the bottom. creditted you in the edit note. you can create an account on the mer bug wiki and use it to edit the tables. I'll also be closely following this and editting it to match your progress. Tell me if you'd like any values changed!

I remember that I built gstreamer and un-commented the related stuff in the pattern file. I don't know whether easier to build now because I don't know how difficult it was before. :D I only can compare this project against my hammerhead one a few months earlier. For the hammerhead I needed to build the image with MIC, now the rpm/dhd/helpers/build_packages.sh command does everything for you. (For this you need to export the RELEASE, EXTRA_NAME values in your .hadk.env)

Unfortunately I still don't have OBS account so I couldn't add this device into the wiki. Thank you for doing that! Unfortunately new account creation on the mer bug wiki is restricted at the moment.
I have checked the wiki you have added and if you don't mind I would like you to amend a few things:
  • LED works (the two softkeys have repurposed as notification leds)
  • GPS works
  • Sensors Gyro and Magnetometer both work
(I need to double check the RTC alarm and USB net.)
 
  • Like
Reactions: ze7zez

Galaxyninja66

Senior Member
Jan 25, 2015
441
112
Milton
I updated the page. I was going to set up my build env but seeing your row in the adaptations page made me realise you're so far along, and there isn't anything I could really do to push things forward by much. Once you get data and camera working this is pretty much one of 2 daily driver stable samsung sfos ports. Congrats :3 !
 
  • Like
Reactions: ze7zez

edp17

Senior Member
Dec 9, 2019
117
63
I updated the page. I was going to set up my build env but seeing your row in the adaptations page made me realise you're so far along, and there isn't anything I could really do to push things forward by much. Once you get data and camera working this is pretty much one of 2 daily driver stable samsung sfos ports. Congrats :3 !

Thank you for the update and for the congrats but I think it is only partially my merits. I probably couldn't done this without the help of sailfishos-porter guys.
As I mentioned in the main comment, I am using my S2 with this image on it as a secondary phone already. Mobile data is not crucial as my main phone can be a hotspot and with my S2 I can connect to it via wifi. Of course this doesn't stop me trying to make that work. (The BT was almost done but I then broke something.)
The camera is a different story. Afaik the video recording generally is broken in the CM12.1 base that I chosen for this device. (That doesn't work on my hammerhead which is also using CM12.1 base.) So I think that will remain outstanding unless I try to port with a different android base.

I think will stop with this for while because the new version (3.3) is out soon and would like to upgrade to it first, then continue working on the missing bits.
 
  • Like
Reactions: linusdan and ze7zez

Galaxyninja66

Senior Member
Jan 25, 2015
441
112
Milton
Video recording works in the latest scm12.1 snapshot (YOG7D). I wish they hadn't tanked the old etherpad faq, I swear I saw something about hybris 12.1 specific video recording stuff.

If I can find another sub 20 USD i9100 I am definitely working on this, but since my i9100m is my daily driver and dualbooting isn't as easy as with other devices (espescially since YOG7D doesn't have isorec committed :mad:). Thanks for getting so much done though, You have no idea how much it means to me that Sailfish OS is available for our device, and so stable too! :laugh:
 
  • Like
Reactions: ze7zez

edp17

Senior Member
Dec 9, 2019
117
63
Video recording works in the latest scm12.1 snapshot (YOG7D). I wish they hadn't tanked the old etherpad faq, I swear I saw something about hybris 12.1 specific video recording stuff.

If I can find another sub 20 USD i9100 I am definitely working on this, but since my i9100m is my daily driver and dualbooting isn't as easy as with other devices (espescially since YOG7D doesn't have isorec committed :mad:). Thanks for getting so much done though, You have no idea how much it means to me that Sailfish OS is available for our device, and so stable too! :laugh:

I think the video recording also works in cm12.1 on the android side, but the problem is a, between the android and Sailfish or b, on the Sailfish side. I am not sure but when I tried to fix it on the hammerhead (same cm12.1 base) I was told the recording was broken in general with cm12.1 base. I'll see how it works (what I can do about it) after Sailfish 3.3 is out.

Have you thought about to purchase a cheap android phone to use as daily driver and using the i9100m for your Sailfish project? (You probably can get a decent second hand android phone for sub 20 maybe with better spec than the i900.)
Thanks again for the kind words. This phone (the S2) is my favorite old friend. It is indestructible :). I have soft bricked so many times and managed to install many other OS but as couldn't find Sailfish OS, so I though worth a try to port. And with support of the Sailfishos-porters guys, my dream became real :good: :cowboy:.
 
  • Like
Reactions: ze7zez

S2UserRU

Member
Apr 3, 2020
7
2
Sailfish

Wow, great. I installed and the system works! Bluetooth does not work after installing the packages, but bluetooth-rfkill-event- * are not installed (error). There are few programs in the system, however. Especially browsers, the standard one hangs up (maybe there is a third-party?). Slightly slows down, but bearable.

By the way, are you not working with @linusdan? It also seems to be working on the port github com /sailfish-i9100 (link)

Sorry no link rights.

P/s By the way, I saw on the postmarket wiki site for i9100 about working kernels for our device. Available: kernel version 4.2 or mainline kernel
 
Last edited:
  • Like
Reactions: ze7zez

edp17

Senior Member
Dec 9, 2019
117
63
Wow, great. I installed and the system works! Bluetooth does not work after installing the packages, but bluetooth-rfkill-event- * are not installed (error). There are few programs in the system, however. Especially browsers, the standard one hangs up (maybe there is a third-party?). Slightly slows down, but bearable.

By the way, are you not working with @linusdan? It also seems to be working on the port github com /sailfish-i9100 (link)

Sorry no link rights.

P/s By the way, I saw on the postmarket wiki site for i9100 about working kernels for our device. Available: kernel version 4.2 or mainline kernel

I am glad you managed to install it. Have you tried to re-partition the internal memory as I advised?
Yeah, the bt and mobile data is still WIP status. Hopefully will have some time to complete them soon.
For the browser, the native one doesn't hang for me. You can try to look for and install one from the openrepos. (I suggest to install the Storeman as you will find more useful apps for Sailfish OS.)

I don't know linusdan but have seen he has checked this post already. :) Hope he also found it useful.

I am aware of the postmarketos for the S2 and tested it on my S2. At that time (about a year ago) there was no mainline linux kernel option for the S2. Unfortunately the mainline kernel doesn't help with Sailfish because the Samsung proprietary blobs are missing from there. This means Sailfish wouldn't work. It needs the drivers from the Android layer.
 
Last edited:

edp17

Senior Member
Dec 9, 2019
117
63
Wow, great. I installed and the system works! Bluetooth does not work after installing the packages, but bluetooth-rfkill-event- * are not installed (error). There are few programs in the system, however. Especially browsers, the standard one hangs up (maybe there is a third-party?). Slightly slows down, but bearable.

By the way, are you not working with @linusdan? It also seems to be working on the port github com /sailfish-i9100 (link)

Sorry no link rights.

P/s By the way, I saw on the postmarket wiki site for i9100 about working kernels for our device. Available: kernel version 4.2 or mainline kernel

I forgot to mention that there should be a folder '/edp17packages/bluetooth' where you can find the missing packages for the bt. Once you installed it, probably only need to tweak some config files and need to create some scripts. I currently started working on it. :)
 
  • Like
Reactions: S2UserRU and ze7zez

Top Liked Posts

  • There are no posts matching your filters.
  • 1
    Thanks a lot for your effort and help porting Sailfish to this phone. Very much appreciated.
    No problem. I love this small device. It is indestructible. :)
  • 4
    Code:
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    !!                W A R N I N G                !!
    !!                                             !!
    !!(Although I am using this on my backup phone)!!
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    !!            Everything you do,               !!
    !!      you do at your own peril and risk.     !!
    !!                                             !!
    !!      I do not bear any responsibility       !!
    !!          for your faulty devices.           !!
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
    !!                                             !!
    !!      ROM IS NOT SUITABLE FOR DAILY DRIVE    !!
    !!        ONLY FOR EXPERIMENTAL PURPOSES       !!
    !!                                             !!
    !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    Making this port was challenging because Sailfish OS, from version 3, doesn't support kernel version 3.0 which is apparently the kernel on the S2. :)
    Fortunately, the SailfishOS-porter guys do very seriously know their business and they are extremely helpful.
    From here I would like to emphasize my gratitude towards them for helping me in this project! Thank you!

    Requirements:
    Before you start to download anything, please read it carefully.
    The first requirement is your device must be rooted and you should be able to install a custom recovery (preferably TWRP) onto it.

    For this ROM you can either use the stock partitions or you can re-partition to give more space to /system and /data. It doesn't matter which one you chose, I tried and both worked well.
    Or if you scroll down to the New partition layout, you can use a completely unique partition layout which gives the most of the internal storage to Sailfish OS. (I currently use my device with this setup.)

    Installation instructions:
    1. Download all files, CM12.1 zip, Sailfish OS zip, twrp2.8.7.img and kernel*.img to the external SD card on the phone
    2. Reboot into TWRP (hold buttons: Power on + Home + Volume up)
    3. Do a factory reset

    At this point if you want you can repartition the S2 internal storage. (Later you can put the stock layout back if you want to go back to Android.)

    The steps for repartitioning are:

      • Download the 'Repartition: System=1GB, Data=14GB, eMMC=8MB, /preload=7MB' or the 'Repartition: System=1GB, Data=4GB, eMMC=7GB, /preload=0.5GB' .zip file and put into the external SD card. (The difference between these two is explained down at the New partition layout section
      • Then boot into TWRP and flash the zip as any other zip file. The script first will warn you that it cannot do the partitioning with mounted partitions and it also copies the script itself into /tmp. You just simply need to flash the copied version from /tmp and that will do the trick. The script will format the new partitions accordingly, so once it is completed you can go ahead with the next step.

    4. Still in recovery, flash the CM12.1 image
    5. Still in recovery, flash Sailfish Os image
    6. Still in recovery, flash twrp2.8.7.img to recovery partition
    7. Still in recovery, flash kernel*.img to boot partition
    8. Reboot
    9. Enjoy the latest (3.4.0.24) Sailfish OS on your i9100. :)
    You will need patience as the first boot will take for a while. Then you can go through the initial Sailfish OS set up.

    This Sailfish OS Android HAL based on CM 12.1.


    Downloads:


    Some useful patches:

    Apps from Openrepos
    Apart from the Jolla store there are plenty of other, community-made apps in Openrepos. There is a user-friendly app to install/remove apps from this source called Storeman. It can be downloaded and install from this location: Storeman

    Debug/login/troubleshooting:
    In Ubuntu, connect USB cable. telnet 192.168.2.15 2323 or SSH [email protected]


    Notes:
    • On Sailfish OS, as it is a Linux system, you cannot install/run any android apps.

    How to make a backup/restore with TWRP:
    Now the old clunky method is no longer needed. Once you flashed the twrp2.8.7.img to the recovery partition you can boot into TWRP with the usual button combination (Hold buttons: Power on + Home + Volume up) and can make backup/restore.

    Instructions for bluetooth

    BT works however turning it on/off is not as user friendly as I hoped. Here is a little instruction/troubleshooting.
    Turn BT on (It only works from Settings/Bluetooth!!!!! DON'T try from TOP MENU!!):
    If BT hasn't turned on since last boot:
    1. go to Settings/Bluetooth
    2. tap on the dot next to the Bluetooth option

    If BT has turned on at least once since last boot:
    1. go to Settings/Bluetooth and tap on the dot next to the Bluetooth option
    2. go back to Settings
    3. go to into Settings/Bluetooth again
    4. tap on the dot next to the Bluetooth option (if it is not turned on repeat from Step 2! Eventually, BT should turn on.)

    Turning BT off: Go to Settings/Bluetooth and tap on the white dot next to the Bluetooth option.

    Notice: Never try to tap on the white dot twice without going back to the main menu of Settings.
    Never try to turn BT on from Top Menu.
    However, if you accidentally did any of these BT cannot be turned on again unless you:
    • reboot the device (this is the easiest) or
    • in a command line as root issue the following command 'systemctl restart bluetooth-rfkill-event.service' (this will restart the bluetooth-rfkill-event service)
    I am not sure how pairing works with different devices.

    New partition layout

    I mentioned that I tried this Sailfish OS installation with the stock partitions and with another what created for Android 7.1.2. With the stock partitions however was a bit more sluggish than the other one. No wonder as in the stock partitions the /system has only 0.5GB and the /data has only 2GB storage and the rest 12GB is the separate internal storage (eMMC). In Sailfish the entire os (rootfs) including all directories (like /home) live on the /data partition so the 2GB was a bit tight. (The OS itself consumes about 1GB so not much left for apps and other stuff.)

    With the other partition layout, the picture was a bit better as the /system had 1GB, the /data got 4GB and the rest 9GB remained for the internal storage. But the partition where the OS lives was separated from the 9GB partition. When I installed a few apps and copied some big files into the /home, I felt the limitation very soon.

    Although this layout was sufficient for android but not good enough for Sailfish. :)
    Therefore I have created my own partition table where I restructured the sizes accordingly to my need. (The lanchon repit zip file is available in the download section.)

    In this new layout I gave 1GB for the /system (the prior 0.5GB was also fine as the CM12.1 base consumed only 400MB which let a 100MB free space, but I thought that might be not enough in the future so I have chosen 1GB here), I gave only 8MB for the internal storage (eMMC which is mounted into /android directory in this rom), and this made me possible to gave all the rest 14GB to the /data partition. So basically the Sailfish apps and /home can utilize the entire internal storage. :cool:

    As an extra, on the S2 there is a 0.5GB /preload partition which is hidden and unused by default. In my partition setup I set 7MB to this and the rest almost 0.5GB is also added to the /data.


    Go back to stock partitions

    In case you would like to do this, you can download the stock partition pit file from the download section.
    For this use Odin v1.83 which is also in the download section.
    The steps are:
    • Boot the device into download mode and connect to the PC.
    • Open Odin v1.83 and tick the 'Re-partition' checkbox at the Option.
    • Then click on the PIT button and select the downloaded stock pit file.
    • Then click on the PDA button and select the downloaded TWRP (AOSP kernel) file.
    • Then click on start.
    • Done. You need to boot into TWRP and wipe all partitions (system, data, emmc) then you can install the stock rom back. (or if you select the stock rom at PDA instead of the AOSP kernel, it will do the repartition and install the stock rom as well. In this case, you don't need to wipe anything and the device will reboot into the stock Android at the end.)


    Changelog:
    03.09.2021
    =========
    Work:
    Same as previously
    Bluetooth does work, but once it is off, needs to be toggled a few times in Settings to make it turn on again.

    14.06.2020
    =========
    Work:
    Same as previously + Mobile data is fixed! (To make it work: change Protocol to IP in Settings/Mobile network/Data access point.)
    Bluetooth doesn't work, it is still WIP

    Do not work:
    Same as previously


    06.05.2020
    =========
    The latest version of Sailfish OS 3.3.0.16 is available to download. This requires a different kernel. Both of these can be found in the download section.
    Note: With the new version the patch that displays the provider logo at the bottom on the lock screen stopped working. This issue is not related to the OS. The owner of the app should fix it.
    Update: In openrepos Kodi is fixed for SFOS 3.3.0.16!

    29.04.2020
    =========
    Work:
    • Screen
    • Touch
    • IMEI number is detected
    • Sensors (GPS, Rotation, Acceleration, Gyroscope, Magnetometer, Light & Proximity)
    • Wifi
    • MTP
    • Bluetooth (instruction is above)
    • Calls incoming/outgoing
    • Messages incoming/outgoing
    • External SD card detected and mounted to /run/media/nemo/_sdcard_name_ (where _sdcard_name_ is name of the sd card when it was formatted like 7C97-785B)
    • Internal SD card is mounted to /android
    • Pixel ratio and icons set to 1.00 (Can be changed to 0.82 which is more appropriate for the device's screen. to do this as root run the 'kimmoli-diyicons.sh 0.82' command. It will fail to install imagemagick but will set the ratio to 0.82 and as we have all icons in place it will work.)
    • Audio is routed to headphone if that presents
    • Camera front/rear (only for taking pictures)
    • Jolla store
    • findutils is installed by default (updatedb and locate commands work out of the box)
    • Torch
    • the charging icon does work properly, however, there is a little delay
    • can boot into TWRP recovery with the usual button combination (hold buttons: Power on + Home + Volume up)
    • kernel and recovery .img can be flashed from TWRP (no need for PC to flash Sailfish OS, kernel and recovery)
    • Low Power Mode (AKA "sneak peek" or "ambient display") works (install instruction is in this post)
    • The softkeys (each side of the home button) work as notification leds

    Do not work:
    • Mobile data (WIP)
    • Video recording (It doesn't really work in other 3.x versions either. See my test results here.)

    There is an extra little issue that is a delay in screen refresh which is related to how vsync is handled in v10 backend in qt5-qpa-hwcomposer-plugin. I managed to improve this but there is a little delay still. Probably this is the reason why we need to jump back to Settings every time before trying to turn BT on, but I am not sure.


    04.04.2020
    =========
    Work:
    Same as previously + Softkeys are used as notification leds
    Bluetooth doesn't work, it is still WIP

    Do not work:
    Same as previously



    23.03.2020
    =========
    Work:
    Same as previously + with 'kernel12_mtp' the MTP works! :D
    Bluetooth partially works (to switch on BT requires a reboot or issue a command manually, it is still WIP)

    Do not work:
    Same as previously


    25.02.2020
    =========
    Work:
    Same as previously + with 'kernel07_flatpak' the Low Power Mode (AKA "sneak peek" or "ambient display") works! :D (install instruction is in this post)

    Do not work:
    Same as previously

    23.02.2020
    =========
    Work:
    Same as previously + but from now on you don't need PC and heimdall to flash kernel and twrp

    Do not work:
    Same as previously

    19.02.2020
    =========
    Work:
    The same as listed earlier + with the new kernel (kernel06) I attached you can boot into TWRP with the usual button combination (hold buttons: Power on + Home + Volume up)

    Do not work:
    Same as previously except the TWRP/Sailfish OS boot which has fixed.

    08.02.2020
    =========
    Work:
    • Screen
    • Touch
    • IMEI number is detected
    • Sensors (GPS, Rotation, Acceleration, Gyroscope, Magnetometer, Light & Proximity)
    • Wifi
    • Calls incoming/outgoing
    • Messages incoming/outgoing
    • External SD card detected and mounted to /run/media/nemo/_sdcard_name_
      (where _sdcard_name_ is the name of the sd card when it was formatted like 7C97-785B)
    • Internal SD card is mounted to /android
    • Pixel ratio and icons set to 1.00 (can be changed, I set 0.82 which is more appropriate for the device's screen resolution see the download section)
    • Audio is routed to headphone if that presents
    • Camera front/rear (only for taking pictures)
    • Jolla store
    • findutils is installed by default (updatedb and locate commands work out of the box)
    • Torch

    Do not work:
    • Mobile data
    • Bluetooth (the bt driver is in the kernel, so in theory, with some config file changes on the device it can work)
    • MTP
    • Video recording (It doesn't really work in other devices with CM12.1 base.)
    • Screen delay in refresh (related to how vsync is handled in v10 backend in qt5-qpa-hwcomposer-plugin)
    • the charging icon doesn't work properly: when the device is not on charger still shows it's charging (when I unplug the cable the message appears: "Charging..."
    • cannot boot into TWRP recovery (See Notes above)
    Battery life:
    In my experience the battery life is good. On standby, it can survive 10 days. (Almost 11.) I have checked once or twice daily during this period.
    i9100_uptime_360x600.jpg
    3
    Initial post for Sailfish Os for the Samsung Galaxy S2 (i9100) device.
    3
    Wow, great. I installed and the system works! Bluetooth does not work after installing the packages, but bluetooth-rfkill-event- * are not installed (error). There are few programs in the system, however. Especially browsers, the standard one hangs up (maybe there is a third-party?). Slightly slows down, but bearable.

    By the way, are you not working with @linusdan? It also seems to be working on the port github com /sailfish-i9100 (link)

    Sorry no link rights.

    P/s By the way, I saw on the postmarket wiki site for i9100 about working kernels for our device. Available: kernel version 4.2 or mainline kernel

    I am glad you managed to install it. Have you tried to re-partition the internal memory as I advised?
    Yeah, the bt and mobile data is still WIP status. Hopefully will have some time to complete them soon.
    For the browser, the native one doesn't hang for me. You can try to look for and install one from the openrepos. (I suggest to install the Storeman as you will find more useful apps for Sailfish OS.)

    I don't know linusdan but have seen he has checked this post already. :) Hope he also found it useful.

    I am aware of the postmarketos for the S2 and tested it on my S2. At that time (about a year ago) there was no mainline linux kernel option for the S2. Unfortunately the mainline kernel doesn't help with Sailfish because the Samsung proprietary blobs are missing from there. This means Sailfish wouldn't work. It needs the drivers from the Android layer.
    3
    Sailfish OS 4.1.0.24 is available to download. This requires a different kernel. Both of these can be found in the download section in the main post.
    2
    Can you post your sources? I'm interested in getting an I9100 as my new phone, and was considering a port and I'm happy to see you've already done all the leg work and then some!

    Also about the kernel on this phone, I've been trying to port to a tablet with weird kernel images, can you run "file (path to android base kernel image)" - if it says ForPro FPT or similar I will be very very interested in how you got this phone to boot into rootfs. Very interested in the progress you've made though :3 Thanks for the awesome rom!

    Sorry for delay in my reply.
    The necessary repos in github are:

    The file (path to android base kernel image) command gives me: "Linux kernel ARM boot executable zImage (little-endian)"

    A new image has been generated and can be downloaded. This one includes the patch of reusing the two softkeys (each side of the home button) and they do work as a notification leds! ;)
    Currently I am working on the mobile data and bluetooth (this latter partially works but is not reliable yet).