We have moved to a new Sailfish OS Forum. Please start new discussions there.
57

Sailfish X install: flash-on-Linux

asked 2017-10-12 09:24:59 +0200

this post is marked as community wiki

This post is a wiki. Anyone with karma >75 is welcome to improve it.

updated 2017-11-22 09:28:08 +0200

JoHe gravatar image

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

  1. 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)
  2. unzip the two archives and place the content (.img file) of the Sony one into the folder unziped from the Jolla one.
  3. 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.

  1. 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.
  2. 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
  3. Now your phone is unlocked. Keep it plugged in.

Flashing

  1. If the unlocking above went well and you kept your phone connected this will take no time at all.
  2. open a terminal and change directory to the folder unziped from the Jolla archive.
  3. run bash ./flash.sh this might also need sudo privileges and will either ask you for your password or fail. If it fails run sudo bash ./flash.sh.
    • Looking at the script this should work on both mac and linux
  4. Wait till it's done.
  5. 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.

edit retag flag offensive close delete

Comments

Can anybody tell if the result is identical to the one you'll get with Emma?

Aldrog ( 2017-10-12 11:29:42 +0200 )edit

I 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 )edit
1

Thanks! 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:
Prepping 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"

XFish ( 2017-10-12 18:27:58 +0200 )edit
1

Works perfectly!

apo ( 2017-10-12 22:54:35 +0200 )edit

6 Answers

Sort by » oldest newest most voted
6

answered 2017-10-24 21:21:05 +0200

TomC gravatar image

Official instructions as of today:

https://jolla.com/sailfishx-linux-instructions/

edit flag offensive delete publish link more
4

answered 2017-10-12 15:40:43 +0200

Robomike gravatar image

If using SOLUS:

seems that there's no android-tools or similar in the repos, but you may install Android Studio from the third-party section (huge :( ). Youll find fastboot in ~/Android/Sdk/platform-tools then, but that doesn't mean "installed". You can use fastboot from there (with sudo) to unlock the bootloader, but the script will not work. When starting the flash.sh script from somewhere else, you'll receive an error

No 'fastboot' found in $PATH.

To fix it just add the folder to your $PATH temporarly:

PATH=$PATH:/home/USERNAME/Android/Sdk/platform-tools
export PATH

and run ./flash.sh (as root, did not test it as user).

[Remarkably, I did the whole crap on a virtual SOLUS on a Win10-host, because I was unable to bring fastboot to work on windows. This computer has only USB 3 and up connections, maybe the driver installation failed for this reason - don't know. On a second system with Win7 I was unable to install the Sony-drivers. The virtual Solus did the job flawlessly, I just needed to claim the fastboot device in VirtualBox, and after that (because windows was too busy to release the driverless interface) unplug and plug again with volume up key. The connection established immediately. So - where's the beef with Emma?]

edit flag offensive delete publish link more

Comments

Oh just saw you provided the answer here so ignore my duplicate note above.

XFish ( 2017-10-12 18:33:03 +0200 )edit
3

answered 2017-10-16 14:11:50 +0200

Broekeman gravatar image

updated 2017-10-16 14:32:08 +0200

Thanks @JoHe, it worked without a hiccup. I am currently enjoying Sailfish on the Xperia X!

Some extra information:

--> I am using Ubuntu 16.04 32-bit. Installing fastboot was easy as it is in the official repositories (sudo apt-get install android-tools-fastboot).

--> Follow the instructions for unlocking the bootloader by Sony THOROUGHLY. So, be sure to enable developer support and USB debugging.

--> USE ROOT PRIVILEGES! Ergo, use sudo fastboot and sudo ./flash.sh. It will not work otherwise.

I have added the terminal output during flashing. This might be handy for you to know what to expect. All in all, it took me just a couple of minutes.

Good luck to everyone!

Terminal output:

    sudo ./flash.sh 
Detected Linux
Searching device to flash..
Found device with vendor id '0fce': Bus 002 Device 002: ID 0fce:0dde Sony Ericsson Mobile Communications AB Xperia Mini Pro Bootloader
Fastboot command: fastboot -i 0x0fce 
Flashing boot partition..
target reported max download size of 536870912 bytes
sending 'boot' (10842 KB)...
OKAY [  0.355s]
writing 'boot'...
OKAY [  0.077s]
finished. total time: 0.431s
target reported max download size of 536870912 bytes
erasing 'system'...
OKAY [  0.248s]
sending sparse 'system' (524284 KB)...
OKAY [ 16.995s]
writing 'system'...
OKAY [  3.649s]
sending sparse 'system' (92428 KB)...
OKAY [  3.027s]
writing 'system'...
OKAY [  0.647s]
finished. total time: 24.567s
target reported max download size of 536870912 bytes
erasing 'userdata'...
OKAY [  0.116s]
sending sparse 'userdata' (524284 KB)...
OKAY [ 17.029s]
writing 'userdata'...
OKAY [  3.626s]
sending sparse 'userdata' (524284 KB)...
OKAY [ 17.098s]
writing 'userdata'...
OKAY [  3.638s]
sending sparse 'userdata' (252840 KB)...
OKAY [  8.226s]
writing 'userdata'...
OKAY [  1.750s]
finished. total time: 51.482s
Flashing oem partition..
target reported max download size of 536870912 bytes
sending 'oem' (163040 KB)...
OKAY [  5.190s]
writing 'oem'...
OKAY [ 22.385s]
finished. total time: 27.575s

Flashing completed.

Remove the USB cable and bootup the device by pressing powerkey.
edit flag offensive delete publish link more
1

answered 2017-10-13 11:22:34 +0200

pfbach gravatar image

updated 2017-10-16 22:02:43 +0200

Begin update 2017-10-16

With the SW_binaries_for_Xperia_AOSP_M_MR1_3.10_v13_loire.img, I had to convert it to ext4 img (using simg2img) and copy it onto my existing community build SFOS to apply it on the correct partition (/dev/mmcblk0p28), as fastboot/flash was unable to write it to the cache/oem partition. (This may also work using recovery mode).

scp oem.img nemo@<xperiax-ip>:/tmp

[root@Sailfish ~]# dd if=/tmp/oem.img of=/dev/mmcblk0p28 bs=512
793488+0 records in
793488+0 records out
406265856 bytes (406 MB) copied, 55.0178 s, 7.4 MB/s

After that I modified flash.sh script to not run the $FLASHCMD cache oem.img command.

End update 2017-10-16

If you already have a community build on your Xperia X, it is possible to flash without going via latest OTA upgrade.

As @Jarno suggested in this post: Fix partition

In Short:

devel-su
mkdir ~/oem
mount /dev/disk/by-partlabel/oem ~/oem
rm -rf ~/oem/*
cp -ar /system/vendor/* ~/oem
umount ~/oem
rmdir ~/oem
edit flag offensive delete publish link more

Comments

That did not work for me. I had to flash the latest Stock Firmware image (>= 34.3) using flashtool. There is an oem sim that get's written to the phone which I am guessing the Sailfish install is expecting to have some config files there.

./android-config/apns-conf.xml
./android-config/dpm.conf
./android-config/early_config.xml
./app
./app/com.ebay.carrier
./app/com.ebay.carrier/com.ebay.carrier.apk
./deletable-app
./deletable-app/com.amazon.avod.thirdpartyclient
./deletable-app/com.amazon.avod.thirdpartyclient/com.amazon.avod.thirdpartyclient.apk
./deletable-app/com.ebay.mobile
./deletable-app/com.ebay.mobile/com.ebay.mobile.apk
./deletable-app/com.hutchison3g.planet3
./deletable-app/com.hutchison3g.planet3/com.hutchison3g.planet3.apk
./deletable-app/com.hutchison3g.threelikes
./deletable-app/com.hutchison3g.threelikes/com.hutchison3g.threelikes.apk
./deletable-app/deezer.android.app
./deletable-app/deezer.android.app/deezer.android.app.apk
./deletable-app/uk.amazon.mshop.android
./deletable-app/uk.amazon.mshop.android/uk.amazon.mshop.android.apk
./etc
./etc/NOTICE.html.gz
./etc/amzn.aiv.properties
./etc/amzn.mshop.properties
./etc/appmanager.conf
./etc/spotify.preload
./media
./media/bootanimation.zip
./modem-config
./modem-config/modem.conf
./overlay
./overlay/Settings-Overlay-285-release.apk
./overlay/TeleService-Overlay-285-no-imei-emergency-call-release.apk
./overlay/TeleService-Overlay-285-vodafone-release.apk
./overlay/android-res-305.apk
./overlay/com.android.browser-res-305.apk
./overlay/com.android.carrierconfig-res-305.apk
./overlay/com.android.phone-res-305.apk
./overlay/com.android.providers.partnerbookmarks-res-305.apk
./overlay/com.android.providers.settings-res-305.apk
./overlay/com.android.settings-res-305.apk
./overlay/com.android.systemui-res-305.apk
./overlay/com.sonyericsson.conversations-res-305.apk
./overlay/com.sonyericsson.customizedsettings-res-305.apk
./overlay/com.sonyericsson.home-res-305.apk
./overlay/com.sonyericsson.settings-res-305.apk
./overlay/com.sonyericsson.setupwizard-res-305.apk
./overlay/com.sonyericsson.trackid-res-305.apk
./overlay/com.sonyericsson.updatecenter-res-305.apk
./overlay/com.sonyericsson.usbux-res-305.apk
./overlay/com.sonyericsson.wappush-res-305.apk
./overlay/com.sonymobile.android.contacts-res-305.apk
./overlay/com.sonymobile.android.dialer-res-305.apk
./overlay/com.sonymobile.customizationselector-res-305.apk
./overlay/com.sonymobile.email-res-305.apk
./overlay/com.sonymobile.emergencysms-res-305.apk
./priv-app
./priv-app/com.ironsource.appcloud.oobe.hutchison
./priv-app/com.ironsource.appcloud.oobe.hutchison/com.ironsource.appcloud.oobe.hutchison.apk
./system-properties
./system-properties/config.prop
./system-properties/cust.prop
veritanuda ( 2017-10-13 12:47:10 +0200 )edit
1

answered 2017-10-14 12:46:41 +0200

Jmuxor gravatar image

updated 2017-10-14 12:47:34 +0200

Worked without any problems. Thanks @JoHe

edit flag offensive delete publish link more
1

answered 2017-10-14 19:01:48 +0200

Filip K. gravatar image

updated 2017-10-25 10:49:40 +0200

I also needed to run it as root.

In Mageia fastboot is called fastboot-android. So I just made symlink to it.

edit flag offensive delete publish link more
Login/Signup to Answer

Question tools

Follow
18 followers

Stats

Asked: 2017-10-12 09:24:59 +0200

Seen: 4,936 times

Last updated: Nov 22 '17