Monday, 20 October 2014

Download Jolla factory image file for recovery

In the sails of Open Source - Jolla

The story begins from November 2013, two days after the first Jolla phone was sold. These phones were expected to be open, so a simple question was asked by user juiceme at TMO:
"I think we need a thread for flashing new kernels / OS releases for Jolla too"

In the name of Open Source - Jolla factory recovery image

Share and Shout! Your friends might read it.

That TMO thread has been active ever since, and it's currently 34 pages long. Meanwhile, some users like t0mps0 have managed to get their Jolla phones into a bootloop.

In most cases this problem is solved via a recovery menu brought to us by Jolla. Here's a few of the important words shared by Carsten Munk, Chief Research Engineer at Jolla, on December 2013:

"I don't personally buy devices that can't be hacked. We started developing Sailfish on hackable devices - we know our roots. And I have one coming to me at full price - no rebates or special treatment." 

Beyond this great recovery menu, some hackers like NielDK want to go further. If you're into openness by your heart, you don't want to recover your phone via any internet service provided by any company - not even Jolla. Well, as open as Jolla is (and wants to be even more), Carsten has also shared to us:

"The bootloader of the Jolla is 'little kernel' ("lk") which speaks the typical Android fastboot protocol, which has a open source flasher. There's three modes of booting: 

  • Normal booting - boot into 'boot' partition, which is a combined kernel + initrd + cmdline image
  • Recovery booting (volume down + power on) - doesn't do anything at the moment as there's nothing in recovery but boots into 'recovery' partition (same format as boot) [editor's note: content updated later, currently access to recovery menu]
  • Fastboot mode (volume down + put USB in) - opens a fastboot session on USB that you can connect to with fastboot flasher

What comes to the last option, it also enables access to the phones unlocked bootloader (yes, you can easily unlock it via the recovery menu. Open Source at it's best), giving you the full access to the phone. Well, Carsten also shared that Jolla can't directly offer a factory image file... Phones requiring this level of recovery must be sent to the company.

No companies needed for that, thought PhantomR6 at TMO:
Hi everyone!
Can anyone make dd backup of /dev/mmcblk0p28 of factory resetted device to help me unbrick my Jolla partition?

The community helped him out quickly, and he managed to recover his Jolla via self installed factory image without sending it to the company. But they are open at Jolla too - couple of great Sailors from inside the company joined the community work, resulting copying the needed partition, without user data, from one factory resetted Jolla into another broken one.

They encountered a few difficulties in the process because of the file size, but when another user TuukkaH faced this problem just a while ago, ...
"My phone stopped booting and there seem to be unrecoverable errors in the btrfs root filesystem. Recovery menu entries for factory reset and btrfs recovery just hang..."
...the story went on, and again with some help from inside the company, Tuukka shared these steps to recover a broken btrfs (file system) on Jolla

Grande finale:

Just yesterday this story got the best possible ending, as CodeRus (Andrey Kozhevnikov) has added all the needed factory image files (copied from a factory resetted Jolla) and a simple step by step guide into his server. Now we can all enjoy an Open Source, flashable Jolla smartphone
Easy guide:
  1. Format your sdcard to ext4
  2. Unpack jolla-sailfish-1.0.8.21.tar.xz and put jolla-sailfish-1.0.8.21.img to sdcard
  3. Boot your phone to recovery mode, enter shell
  4. Execute: 
    mkdir /sdcard
    mount /dev/mmcblk1p1 /sdcard
    dd if=/sdcard/jolla-sailfish.img of=/dev/mmcblk0p28

    #change jolla-sailfish.img to real filename if needed
    sync
    reboot -f
  5. Your Jolla should boot normally
Link to the full guide and the factory image files

UPDATE, October 23 08:40 UTC: Files were removed from the site originally linked above, as it was found that the image file included 3rd party bits by Qualcomm. Jolla community would still support sharing a recovery file in public, but there are only these options:

  1. Qualcomm open sources this part of their code.
  2. Jolla separates this image file to two parts, one including only Sailfish open source licensed code
  3. Jolla changes part of the code into similar open source code provided by another, more open 3rd party. This might reduce the performance/features of the phone, or even require changes in the hardware for the next phone model. 
Jolla offers recovery as before, via their official warranty/repair partner(s). If your phone can't be recovored by the recovery menu, please contact care@jolla.com

Open Source Sailfish OS parts may be delivered among customers, and most of them are available in public too. See:


 [end of update]

Disclaimer: This is community work, image has not been checked or confirmed to work. Also, hacking your phone in this level might void your warranty. "When you really take it as your own, it's really your own to fix too"

Warning: It's not recommended to leave Jolla's bootloader into an unlocked mode. Loosing a phone with unlocked bootloader might compromise your privacy.



Share and Shout! Your friends might read it.

Sources: TMO, TJC, Andrey Kozhevnikov (CodeRus)
Published: October 20, 2014 04:30 UTC
Updated: October 23, 2014 08:40 UTC

5 comments:

  1. Hi I had a problem with the app registry corruption and the rpm db rebuild did not work.
    I am not a linux expert but I tried to follwo this and now my phone does not even boot beyond the logo.
    When entering the terminal from ubuntu and trying to run option 5 on jolla recovery 0.2.7 I get "mount: mounting /dev/mmcblk0p28 on /mnt/ failed: No such file or directory"

    Here is what I did:
    1) Downloaded the v .19 of sailfish (tar.bz2) renamed it to .img and copied it to my ext4 SD
    2) Followed the instructions after that but now it is more broken than ever.

    How do you make the tar.bz2 to an image? maybe that is where I failed... Thanks in advanced

    ReplyDelete
    Replies
    1. tar is the img file, but renaming it doesn't work. File must be extracted with any unpacking/untar software, or tar -x command on Linux.

      As this was already something you didn't know, I should advice you not to go any further with your tweaks - please also read the update part and disclaimer in the end of this post. For your further questions, this TJC post or ppl at TMO might help.

      Delete
    2. The problem is that I can't mount the rtrfs not by shell not by command 5. So I kinda need a factory image of the mmcblk where el the mount points are... p28 I think it is or a way to regenerate it. But thanks anyway!

      Delete
  2. I have tried as much as I can but now I even get:
    # btrfs check --repair /dev/mmcblk0p28
    # enabling repair mode
    # No valid Btrfs found on /dev/mmcblk0p28
    # Couldn't open file system

    Guess I screwed my phone real good appreciate any help

    ReplyDelete
  3. Hi..Same things happened to me. Were you able to resurrect your phone?

    ReplyDelete