Sailfish X install: flash-on-Linux
asked 2017-10-12 09:24:59 +0200
This post is a wiki. Anyone with karma >75 is welcome to improve it.
Official instructions: https://jolla.com/sailfishx-linux-instructions/
This guide will only work if you have the latest OTA update (build number is 34.3.A.0.228 or higher) on your Xperia X and you have purchased a device with unlockable bootloader. Verify bootloader by calling to *#*#7378423#*#*
> tap Service Info > Configurations > Rooting Status, that has to have Bootloader unlock allowed = Yes.
Before starting, use the Android to test your hardware. For example, record a video (stereo audio) and use headphones to check both mics, check display, check stereo speakers, check modem by calling and using mobile data (with a prepaid SIM), check (public) WLAN. Also consider doing backup of your TA partition which hosts the DRM keys to ease a possible warranty service.
After having tested the hardware, in Android go into Settings > About phone and tap about seven times on Build number to enable developer mode. After that go into Settings > Developer options and enable OEM unlocking and USB debugging.
This is a short write up on how you install Sailfish X. Installing Sailfish X from Linux takes no time at all as long as you have a working email and can access USB ports with your user.
Prepping for flashing
- step one download everything: https://shop.jolla.com/downloads/ and https://developer.sonymobile.com/downloads/software-binaries/software-binaries-for-aosp-marshmallow-android-6-0-1-kernel-3-10-loire/ (SHA-256 of version 13 of ...loire.zip 88f3aa103d1447007e3ccf3532721b45daa2228c533056158646819e22c7978e)
- unzip the two archives and place the content (.img file) of the Sony one into the folder unziped from the Jolla one.
- install the command line tool to handle the Android device. The name differs between distros: fastboot / android-tools-fastboot / android-tools / fastboot-android / etc. If you can't find it in the official repository the search engine of your choice will probably find a repo you can add to solve this. Then the usual apt-get/dnf/pacman/emerge/etc magic for installation.
Unlocking the bootloader
https://developer.sonymobile.com/unlockbootloader/unlock-yourboot-loader/ This link will explain how to get your unlock code. Now you must turn off your Xperia X, leave it off for at least fifteen (15) seconds. Then hold volume up at the same time as you plug it into the USB cord already connected to you computer. If a blue led shines after a quick visit of a red one and the screen is still black, then you're in fastboot mode.
Now.
- open a terminal and run
sudo fastboot devices
if anything shows you're connected.- If not you need to solve this before continuing. Try searching for how to configure fastboot on your distro.
- Now run
sudo fastboot -i 0x0fce oem unlock 0xYourUnlockCodeHere
and wait until it's done, it'll tell you.- YourUnlockCodeHere should be replaced by your unlock code
- Now your phone is unlocked. Keep it plugged in.
Flashing
- If the unlocking above went well and you kept your phone connected this will take no time at all.
- open a terminal and change directory to the folder unziped from the Jolla archive.
- run
bash ./flash.sh
this might also need sudo privileges and will either ask you for your password or fail. If it fails runsudo bash ./flash.sh
.- Looking at the script this should work on both mac and linux
- Wait till it's done.
- Done, disconnect your phone and boot it up. It will complain about an unlocked bootloader but that will pass.
This wiki was originally done with a Gentoo Laptop but shouldn't be much different on other distros.
Possible problems:
- Your user isn't in the "usb" group (can be named differently on other distros).
- The flash.sh isn't marked executable.
- You don't have the drivers you need.
Flashing without having the latest OTA update on your Xperia X see this comment below or research a more complete guide, for both mac and linux, here at an external site.
Can anybody tell if the result is identical to the one you'll get with Emma?
Aldrog ( 2017-10-12 11:29:42 +0200 )editI tried to follow your instructions, but did not succeed at the end. the flash script runs but ends with the following lines. If I start up the device then, I end up in a black on white Sony screen and nothing happens.
...
writing 'oem'...
FAILED (remote: Command not allowed)
finished. total time: 6.428s
Update: an update of Android using Emma helped.
SagaciousT ( 2017-10-12 11:33:15 +0200 )editThanks! Works like a charm.
For anyone else like me who's too busy to read instructions throughly: in case you run into "FAILED (remote: Command not allowed)", when unlocking bootloader, re-read section A2 on the Sony unlock instructions :) Also, I believe the required developer setting was "allow OEM unlock" or some such instead of "USB debugging" on Android 7.1.1.
tjp ( 2017-10-12 13:05:27 +0200 )edit@Edir please amend your WIKI with the following information to make it also work for MacOS Sierra:
XFish ( 2017-10-12 18:27:58 +0200 )editPrepping for flashing: Install Android SDK tools
Flashing: open the "flash.sh" file extracted in step 2 using a text editor and in the first paragraph enter the android SDK platform tools path to the fastboot binary e.g.:
if ./$FASTBOOT_BIN_NAME help &>/dev/null; then FASTBOOT_BIN_PATH="./Users/YourUserName/Library/Android/sdk/platform-tools" return 0
If you don't see the "YourUserName" library and android folder press COMMAND + "> key" + "shift key"
Works perfectly!
apo ( 2017-10-12 22:54:35 +0200 )edit