Sailfish

= Introduction =

Introduction

= Credits =

This guide has been compiled from numerous previous sources and credits are due to lots of individuals for their original work, methods and support to the community, including: rzr, souran, Martin Brook, vgrade, coderus, Nad, mikecomputing, TMavica, krnlyng/liar, max83, flotron, juiceme, contributors to piratepad, Nemo contributors and anyone else trying to make Sailfish run on the Nokia N9/N950.

Please help by contributing any information or methods you have to help make Nemo and Sailfish run better on the Nokia N9/N950.

=Installation environment=

The guide assumes some basic Linux knowledge although help can be obtained in this thread should the need arise.

A tested environment has been as follows:
 * Windows 7 Host
 * Debian v7.2 x64 as a Virtual Machine Running on VMware. Virtualbox is free-ware and should work fine too. Any Linux distribution shall work but the instructions that follow have been used on Debian with Root Terminal. Live ISO's are also an option however files may not be retained on following reboot therefore it is advised to store everything on a local hard disk or removable drive.

It is strongly recommended to do everything on the Linux installation as it can easily read the EXT3/4 partitions presented by the MOSLO and Ubiboot maintenance modes.

There can be a loss of Internet connectivity (until reboot) on the Linux machine when in MOSLO/Ubiboot maintenance mode therefore a second device with internet capabilities is recommended.

For a Windows only installation, please follow the guide then proceed to Step W when prompted.

= Notes =

If your handset is factory SIM-locked, it may not be possible to install unsigned kernels, thus Sailfish. There is currently no known work-around and unlocking the handset after purchase does not seem to alleviate this issue.

To completely turn off the handset manually, hold the power button for ~8 seconds.

When extracting a tarball ending with .tar, use "tar -xvf --numeric-owner". If you get a message stating "invalid tar magic", it is probably .tar.bz2 therefore use "tar -xvjf --numeric-owner".

Lack of the package jolla-xt9 means there is no text correction engine in Sailfish. This also manifests as no Pīnyīn to Hanzi conversion for input of the Chinese language. This issue is addressed in itviewer's image.

If you have any installation questions or issues, please ask them in this thread on talk.maemo.org. Please refrain from asking Ubiboot related questions in this thread. Ubiboot related questions should be posted in this thread.

=Downloadable Resources=

These resources are required to get Sailfish working on your Nokia N9/N950.

Firmwares
Obtain Nokia N9 firmwares from skeiron.org or mrcrab.net

Flasher
This enables you to Flash your Nokia N9. Obtain v3.12.1 from skeiron.org.

Kernels
Obtain the OpenMode kernel from swagman.org

Obtain the MOSLO kernel from: nemomobile.org or multiupload.nl (zip file; Windows only users use this file)

Ubiboot
Obtain SailfishOS-preconfigured ubiboot from swagman.org

'''The above version is specially tailored to boot ONLY Harmattan and Sailfish. If you want to use other operating systems (Nitdroid, Nemo, Firefox OS), you should use the version below. However, please note that you need to configure it manually (advanced users only). '''

Obtain the un-configured Ubiboot from swagman.org

Download the latest version available. For more information on Ubiboot, please visit the Maemo Community Wiki article

Sailfish Images
There are numerous images available for download.

SourenAraya's Sailfish images
Available for download from: araya.su. Has Terminal pre-installed on Sailfish v1.0.1.12.

vgrade's Kickstarter
Available from https://github.com/martinbrook/jolla-n950-kickstart

This script allows compositions of an image using the MerSDK kit.

Please see Mer Project Platform SDK and Martin Brook's blog for more information about creating your own image.

itviewer's image
Based on vgrade's Kickstarter. these images contain jolla-xt9 thus provide the text correction engine and enable Pīnyīn to Hanzi conversion for input of the Chinese language.

Available from: jolladev.net. Has Terminal pre-installed on Sailfish v1.0.1.12

=Additional Reading Material=

These are not required to be read for installation but many of the latest developments are highlighted here.

rzr's n950club PiratePad IRC - IRC Chat for support and discussion. Monthly meetings on the first Sunday of month at 19:00 UTC.

=Installation Guide=

Step 1 - Backup your N9

 * Backup your Nokia N9 using Nokia Suite for PC or the phone's built-in utility in Setting. Also backup you EMMC (MyDocs) by connecting your Nokia N9 to your PC in "USB Mass Storage Mode".
 * If you have used the built-in tool, connect your phone as "USB Mass Storage Mode" and ensure you have backed up the .backup folder on your PC.
 * Close all your open applications on your Nokia N9. It is recommended that you backup up /home/.config, /home/.local and /home/.whatsup (or/home/.wazapp) too so you have the configurations and settings for your installed applications. This can easily be achieved by using N9QuickTweak. Install it, choose Option "H", and select "Enable SSH for root". Now, use WinSCP or Filezilla to access you phone and copy these folders to your PC.
 * Backup your backups.

Step 2 - Re-flash your Nokia N9 to factory firmware

 * Note: Flashing can permanently damage or brick your Nokia N9. Do so at your own risk.
 * If you have not already, download the Flasher for your system and install it. You want v3.12.1 from here
 * Download the firmware you wish to use Harmattan with from skeiron.org or mrcrab.net. Your factory product code is printed on your SIM tray e.g. 059J245. You want the two files containing "DFL _61" e.g. A6D5F456_DFL61_HARMATTAN_40.2012.21-3_PR_LEGACY_005-OEM1-958_ARM.bin and 59BEC3BC_DFL61_HARMATTAN_40.2012.13-7.SEAP_EMMC_SEAP.bin.
 * Rename your firmware to "main.bin" and "emmc.bin" respectively and copy them to the directory where the flasher program is installed (e.g. "C:\Program Files\Nokia\Flasher"). Check the Maemo Community Wiki Nokia N9 Flashing Guide for further information.
 * Ensure your handset is fully charged. Disconnect from all cables from it and turn off.

cd /d "C:\Program Files\Nokia\Flasher" (for Windows)
 * Open up a Root Terminal (Or Terminal and gain root/use sudo) or an elevated cmd.exe (by running it as Administrator on Windows Vista onwards) and set the directory to where flasher is located:


 * By connecting the USB cable to the computer and the turned off phone, you will initialise the Flashing Mode.
 * This status can be checked with the command: flasher -i


 * Flash your firmware with the command: flasher -F main.bin -F emmc.bin -f

This should flash the handset but takes a few hours to complete therefore is best left to run overnight.
 * On Linux, if flashing fails with message Error claiming USB interface: Device or resource busy, the problem is the cdc_phonet, phonet and cdc_acm modules. Add the lines blacklist cdc_phonet, blacklist phonet and blacklist cdc_acm to /etc/modprobe.d/modprobe.conf to blacklist these modules.
 * If flashing fails e.g. due to a Partition Mismatch, Security Code On Status or No Reply from Ping, you can try the following. There is a risk of bricking your phone and no warranty is provided by anyone!
 * Completely turn off the handset.
 * Start flasher with the following command: flasher -f -F main.bin --erase-user-data=secure -F emmc.bin --erase-mmc=secure

If you do not wish to wait, you can stop the zeroising task and pull out the USB cable from the handset. This is a risky manoeuvre and could permanently brick your handset. The task can be stopped by: Pressing CTRL + Z in a Linux Terminal Opening Task Manager (CTRL+ALT+DEL) and Ending the tasks cmd.exe and flasher.exe in Windows
 * Now completely turn off the phone.
 * Turn it on and you will get a message asking you to "Install and Authorised Operating System"
 * Turn the phone back off.
 * In flasher, run: flasher -F main.bin -F emmc.bin -f
 * The phone should proceed to flash normally.

Step 3 - Flash the OpenMode!
flasher -a main.bin -k zImage_2.6.32.54-openmode_l2fix --flash-only=kernel -f -R
 * Download the OpenMode kernel from swagman.org and place it in the same directory as flasher and your firmware files.
 * Flash the OpenMode kernel and reboot your phone with:

Step 4 - Prepare Harmattan

 * Let Harmattan load up and run for a few minutes so you have date and time set correctly and the handset is fully functional.
 * Install Developer Mode on Harmattan so Terminal is made available as it is useful later on and required if are do not Linux.
 * (Optional) Install N9QT from here and choose Option "H", and select "Enable SSH for root". This will allow you to run commands on Harmattan from your PC and enables copying and pasting of commands and files to and from your PC easily.

Step 5 - Re-partition your handset

 * Turn off your handset. If you have not already, start up a Linux computer/virtual machine.
 * Download the MOSLO kernel from nemomobile.org or multiupload.nl. Windows users must download from multiupload.nl as it is a .zip file. Extract the files using "Archive Manager" or an unzipping utility and copy them to where flasher and your firmware files are.


 * Flash the MOSLO kernel using:
 * flasher -k zImage-moslo -n initrd-moslo -l -b
 * Allow MOSLO to repartition your handset.


 * If you are a Linux user, MOSLO will now connect the "Alt_OS" partition to your PC.
 * Disconnect the phone and turn it off completely.

If you use the pre-configured Ubiboot for SailfishOS

 * Download and extract the pre-configured Ubiboot from swagman.org into the directory where flasher, main.bin and emmc.bin reside.
 * Unpack the archive: tar -xvf ubiboot-02_0.3.5_131213_SFOS.tar
 * Copy the extracted ubiboot_035_sailfishos.tar to your device e.g into the "MyDocs" folder by connecting it in Mass Storage Mode.
 * Go to Terminal on your device, and obtain root access, then extract the archive: devel-su cd /home/user/MyDocs/ tar -xvf ubiboot_035_sailfishos.tar -C /
 * Power off your device and flash it in the usual way: flasher -a main.bin -k zImage_2.6.32.54-ubiboot-02_301013 --flash-only=kernel -f -R

If you use the non-configured Ubiboot

 * This method also allows Nitdroid and Firefox OS installation.
 * Download and extract the latest Ubiboot release from swagman.org into the directory where flasher, main.bin and emmc.bin reside.
 * Install the ubiboot kernel with: flasher -a main.bin -k zImage_2.6.32.54-ubiboot-02_301013 --flash-only=kernel -f -R


 * If you are a Windows user, please now proceed to Step W - Install Sailfish (Windows only Users). If you get a prompt asking you to format the newly mounted partition, DO NOT FORMAT THE PARTITION.


 * If you are a Linux user: Leave the cable plugged in and allow Ubiboot to enter maintenance mode.

4 Removable Partitions will be visible in Computer. These are "rootfs" (Harmattan root filesystem, mmcblk0p2), "Alt_OS" (where nemo/sailfish lives, mmcblk0p4) "x767x676x7c6" (a random string of letters +/- numbers. This is where you can install Nitdroid and Firefox OS if you wish. It is also the "/home/" directory in Harmattan (mmcblk0p3)(but NOT "/home/user/MyDocs"). "Nokia N9" (mmcblk0p1) is "/home/user/MyDocs" directory on Harmattan [EMMC/USB Mass Storage Mode]).

NB: If you format Alt_OS, it will get a random string of letters and numbers, like the "/home/" partition. Alt_OS is the 4.2GB partition. You can reset the disk label to "Alt_OS" by formatting it: df #Get the disk ID of the 4.2GB partition mkfs.ext4 /dev/sdXY -L "Alt_OS" # Where X and Y are your disk ID e.g. /dev/sdb2


 * Go to "/media/Nokia N9" on your PC (Harmattan's Mass Storage). Make a directory called "boot".
 * Copy "ubiboot.conf" and "ubiboot-02.menus.cpio" from the extracted ubiboot-02_310513.tar into "/media/Nokia N9"/boot".
 * Go to "/media/rootfs" on your PC to access Harmattan's root file system. Go to the "boot" directory ("/media/rootfs/boot"). Copy "zImage_2.6.32.54-openmode_l2fix" (which was flashed earlier) into "/media/rootfs/boot".


 * If you have boot issues, please consult for help in the Ubiboot thread on talk.maemo.org so the Sailfish thread remains for Sailfish issues!

Step 7 - Install Sailfish
tar --numeric-owner -xvjf sailfish.tar.bz2 -C /media/Alt_OS/
 * Now download the Sailfish image of choice, or compile your own using the Mer SDK. Rename it to sailfish.tar.bz2
 * Extract the Sailfish archive to "/media/Alt_OS" on your PC with:

Enable Root Access
After the extraction has finished, this is a good time to enable root access in Sailfish and root login via SSH. This will allow you to remotely access your device after WLAN has been set up and avoid all the chrooting hassle! To reset root's password (MAX9's method), enter the following into your PC terminal: nano /media/Alt_OS/etc/shadow # Open the shadow file where Alt_OS is mounted

On the first line, you will have (where XXXXX are 5 numbers): root:34.random.letters.numbers.and.symbols:XXXXX:0:99999:7:::

Now, delete the all letters, numbers and symbols after "root:" and before :XXXXX:0:99999:7:::

For example, change: root:$1$00Z6Bfjc$vlIKUOMHIavIABL1gNuy6/:16049:0:99999:7::: into: root::16049:0:99999:7:::

Save and exit the file (CTRL+X, Y to save).

Now, when you boot into Sailfish, you will not have a password for root. Depending on your SSH configuration, you will not be able to SSH into your handset until root has a password. To set a root password, open Terminal in Sailfish and enter: su passwd root nemo # Enter your password for root nemo # Repeat your password for root

Enable Root SSH Access
This is also a good time to enable root SSH access. In your PC's root terminal, enter the following: nano /media/Alt_OS/etc/ssh/sshd_config

Now, go to an empty line in the file and type in the following: PermitRootLogin yes

Again, save and exit the file (CTRL+X, Y to save).

Step W - Install Sailfish (Windows only Users)

 * Download Sailfish image of choice. Rename it to sailfish.tar.bz2
 * In Harmattan, install Developer Mode if you haven't already. Connect the phone to Windows in "USB Mass Storage Mode ".
 * Copy sailfish.tar.bz2' to the root of your MMC (X:\, where X is the letter of your removable drive).
 * Disconnect the phone from the PC and remove the USB cable.
 * Launch Terminal on Harmattan (or SSH in) any type the following commands:
 * devel-su
 * rootme # Or your root password
 * cd /home/user/MyDocs/
 * ls # Here, you should see all your MyDocs and sailfish.tar.bz2


 * mkdir /sailfish # Mount Alt_OS in Harmattan
 * mount /dev/mmcblk0p4 /sailfish


 * tar --numeric-owner -xvjf sailfish.tar.bz2 -C /sailfish/ # This will take a while as it extracts Sailfish onto the handset
 * sync

You can now exit Terminal and reboot into Sailfish or Enable root SSH access on Sailfish.

To upgrade to a new image, simply delete everything in /media/Alt_OS ("rm -frv /media/Alt_OS/*") when on a Linux PC or "rm -frv /sailfish/'''*" when you have mounted Alt_OS in Harmattan. You will loose ALL your Sailfish data! To preserve user data, delete everything in "Alt_OS" apart from "/home/nemo/"'''. In "/home/nemo/", delete the ".cache" directory.

Step 8 - Boot into Sailfish
Disconnect your USB cable and turn off the handset completely. Turn it back on. If done correctly, this should present you Ubiboot boot-manager and 6 available operating system logos. Sailfish and Harmattan shall work.

If you do not select an OS, Harmattan will boot by default.

To boot into Sailfish, tap the Nemo icon (3rd one down on the left, looks like a blue padlock) and tap either "latest 2.6.32" or "vmlinuz-2.6.63.20120129.1-n950". For Harmattan, it is "openmode+l2 fix".

On your first boot, select your input and display languages. Next, select a theme colour. After going forward, you may have to go back and select your theme colour again and go forward again before the page that allows you to set the date and time appears.

You can then connect to the Internet if you wish to login or sign up for a Jolla account.

On Step 1 of the tutorial, you will be asked to do a edge left-right or edge right-left swipe to minimise the application. Due to an accelerometer bug, you have to swipe from the edge bottom upwards to minimise. You can then press and hold on the minimised Tutorial application view to close it.

To close an application, swipe from edge right to left. To view Notifications, swipe edge left to right. The phone cannot be turned off when the lock-screen is active.

=Bugs and Known Issues=
 * No text correction engine therefore also no Pīnyīn to Hanzi conversion. Some users have managed to install jolla-xt9 from the repositories to fix this issue.
 * No Android capability as of present.
 * Camera does not work.
 * Accelerometer does not work.

Full list on GitHub

=Additional Guidance=

Date/Time Fix
The date/time may not set correctly in Sailfish. To fix this, boot into Harmattan and fire up terminal:

'''devel-su rootme # Or you root password date --set "2013-12-07 22:59"

Enable Root Access (Windows Users)
If you are using Windows or did not enable root access earlier, the following instruction will show you how. The procedure is the same as that which was explained previously in Step 7 but takes place in Harmattan as opposed to on a Linux computer.

Load Harmattan and open Terminal. Type the following: '''devel-su '''cd / '''mkdir sailfish '''mount /dev/mmcblk0p4 /sailfish nano /sailfish/etc/shadow # Open the shadow file where Sailfish is mounted

On the first line, you will have (where XXXXX are 5 numbers): root:34.random.letters.numbers.and.symbols:XXXXX:0:99999:7:::

Now, delete the all letters, numbers and symbols after "root:" and before :XXXXX:0:99999:7:::

For example, change: root:$1$00Z6Bfjc$vlIKUOMHIavIABL1gNuy6/:16049:0:99999:7::: into: root::16049:0:99999:7:::

Save and exit the file (CTRL+X, Y to save).

Now, when you boot into Sailfish, you will not have a password for root. To set a root password, open Terminal in Sailfish and enter: su passwd root nemo # Enter your password for root nemo # Repeat your password for root

Enable Root SSH Access
This is also a good time to enable root SSH access. In Harmattan's terminal, enter the following: nano /sailfish/etc/ssh/sshd_config

Now, go to an empty line in the file and type in the following: PermitRootLogin yes

Again, save and exit the file (CTRL+X, Y to save).

Chroot into Sailfish from Harmattan
This is based on krnlyng's (liar) method. It is useful for access to Sailfish to run terminal commands such as updating the OS.

Open terminal in Harmattan and type: '''devel-su '''cd / '''mkdir sailfish '''mount /dev/mmcblk0p4 /sailfish '''mount -o bind /proc /sailfish/proc '''mount -o bind /sys /sailfish/sys '''mount -o bind /dev /sailfish/dev '''/usr/sbin/chroot /sailfish

When you have finished in Sailfish, exit and unmount with the following commands:

exit

'''umount /sailfish/dev '''umount /sailfish/proc '''umount /sailfish/sys umount /sailfish exit # Exit out of devl-su exit # Exit out of Terminal

Developer Mode frame rate issue
When in developer mode, do not enable "Display Framerate". It causes random colour drawings on the screen, making it impossible to disable without SSH access. To fix (credits to liar), SSH into your handset and type: nano /home/nemo/.gconf/desktop/jolla/%gconf.xml Ensure that that there is nothing between the stringvalue option, as below:  

Save and exit (CTRL + X, Y to save). Reboot the handset and it should display everything correctly again.

Proximity sensor Fix
To fix the proximity sensor (this must be done at every boot), in Sailfish terminal type: su nemo # Your root password '''echo 1 > /sys/devices/platform/i2c_omap.2/i2c-2/2-0039/prox_enable

Repository Replacement
You cannot use the repositories provided by default in the Sailfish images. You must remove them and replace them with custom ones.

This is done by editing the /etc/ssu/ssu.ini file, without using "zypper ar".

This post by csdozi has a working ssu.ini file attached.

This repository section is very important.

[repository-urls] aliendalvik=https://store-repository.jolla.com/releases/latest/aliendalvik/SbJ limited-nemo-mw=http://repo.merproject.org/obs/home:/vgrade:/branches:/nemo:/devel:/mw/latest_armv7hl/ nemoadaptation0=http://repo.merproject.org/obs/nemo:/devel:/hw:/ti:/omap3:/n9xx-common/latest_armv7hl/ nemoadaptation1=http://repo.merproject.org/obs/nemo:/devel:/hw:/ti:/omap3:/n950-n9/latest_armv7hl/ store=https://store-repository.jolla.com/SbJ/armv7hl/

Also, under [General] this line is important: disabled-repos=adaptation1, thirdparty, adaptation0

Access Harmattan's MyDocs
To access your EMMC (Harmattan's MyDocs, type the following into Sailfish's Terminal. Credit to max83. mkdir /home/nemo/MyDocs chown -R nemo:nemo /home/nemo/MyDocs/ chmod +w /home/nemo/MyDocs/

nano /etc/fstab /dev/mmcblk0p1 /home/nemo/MyDocs vfat auto,users,rw,umask=000 0 0 Now Save (CTRL+X, Y) and reboot Sailfish reboot

You can also link your directories in Sailfish to those in Harmattan after rebooting by deleting the respective directory (and contents!) and using symbolic links to the corresponding Harmattan files e.g.:
 * For Documents: cd /home/nemo rm -frv ./Documents ln -s ./MyDocs/Documents ./Documents


 * For Downloads: cd /home/nemo rm -frv ./Downloads ln -s ./MyDocs/Downloads ./Downloads


 * For Music: cd /home/nemo rm -frv ./Music ln -s ./MyDocs/Music ./Music


 * For Images: cd /home/nemo/Pictures rm -frv ./* ln -s ../MyDocs/DCIM/ ./Camera ln -s ../MyDocs/Pictures/ ./Pictures If you want to include your Whatsup images in Jolla's Media application: ln -s ../MyDocs/Whatsup/images/ ./Whatsup.images


 * For Videos: cd /home/nemo/Videos rm -frv ./* ln -s ../MyDocs/DCIM/ ./Camera ln -s ../MyDocs/Movies/ ./Movies ln -s ../MyDocs/Videos/ ./Videos If you want to include your Whatsup videos in Jolla's Media application: ln -s ../MyDocs/Whatsup/video/ ./Whatsup.video

There is an issue with Images and Videos not showing in the Gallery application following reboot. They show after symlink creation. This may be a permission/tracker issue.

bme workaround
right now the battery status / power management isn't handled by sailfish. as workaround use:

systemctl start bme-rm-680-bin.service # starts it right now bmestat # shows bat stat

the service has to be started after each reboot of Sailfish OS.

statefs Workaround (with GUI!)
Coderus has put together a statefs provider, which enables the SailfishOS battery level indicator.

The pull request has been merged into the master Nemo Mobile branch. https://github.com/nemomobile/statefs-providers/pull/6

If your image uses an older Nemo image, you can use this RPM that coderus has provided to fix the issue.

To install it, cd in the location you downloaded this file and run as root in xterm:

zypper install statefs-provider-bme-1.0.0-3.armv7hl.rpm

It will offer you two choices. Type 1 to uninstall the other packet and install this. You now have correct battery indicator thanks to Coderus:)