Confused - was Xperia XZ2 Compact supported?

Hi all

*This is my first post, hope I chose the right category for it :slight_smile: *

I want to run some nice OS (meaning not Google’s Android) on my Xperia XZ2 Compact.

I saw that it is not in the list of supported devices…
… HOWEVER…
I also saw this thread (an old one, yes but still), where people discuss what works and does not work on their XZ2 Compact:

So it seems the phone was supported some time ago.

So my questions are:

What can I do to get the Jolla version that works with this phone?

I have done some cross-platform development but not for android.. so I am not too scared to try and build my own image - the only thing that holds me back is what precautions should I take not to brick the phone?

Thanks!

1 Like

Not officially supported, there are sailfishos versions for officially unsuppirted devices, made by community developpers. Some are apparently very nice, but no android app support

1 Like

But maybe Android via Waydroid, works in my Volla Community port flawless

2 Likes

for working waydroid community port needs binderfs (and ashmem? not sure about this one) kernel modules, else it wont work

i had by far the best experience on SFOS ever on my XZ2c. the tama port by rinigus is excellent. waydroid works out of the box on the kernel in the flashable image, and in my opinion, works better than aliendalvik/appsupport, though there are also clear downsides. i had to switch because 3G went away where i live and i needed VoLTE, and i do not believe the tama port will ever get VoLTE.

follow the instructions here: main/flashing.md at hybris-10 · sailfishos-sony-tama/main · GitHub

note that you have to flash 4.6.0.13, then do OTA updates to get to latest version.

3 Likes

Hi

i’d like to try this.

I’m new to this sort of thing but in truth the guide misses MANY things.

some observations:

• For windows, the .bat file in the file

Sailfish_OS-4.6.0.13-h8314-0.5.0.1.zip contains a typo which stalls the procedure.

line 42 is redundant, together 42 and 43 read:

:: :: H8314
:: H8314

To fix this one removes line but also the md5 checksum line, that checks the .bat itself (removing line 42 breaks the integrity check).

• On the git guide links to sony SW binaries is broken. I posted this on XDA forum, subsequently informed these resources had moved and a link was given which lists the binaries

BUT an account is required to expose the latest build in that list… Here is the direct new link to binaries:

https://opendevices.sony.net/file/download/software-binaries-for-aosp-android-10-0-kernel-4-14-tama

• The jolla guide referenced in the github guide, does not distinguish between adb, adb driver, usb driver and fastboot, or what adb driver version to use which can confuse newcomers. These tools were likely bundled in same archive at the now since-broken link. There is a fastboot bundled with the sailfish image by ringus but no driver. The link for usb driver moved to sony.developer. On the referenced jolla guide (for Xperia 10) the usb driver specified is Sony sa0114 ADB Interface Driver. But the XZ2c uses sa0118. However sa0118 does not match the missing ‘android(!)’ device in device manager when phone is in fastboot mode (phone off, plug in + vol up method) … It only installs when phone is plugged in while on - In such case, upon successful installation to ‘android!’ icon, the phone screen immediately notifies, it asks ‘allow access?’. Once allowed, ‘Sony sa0118 ADB Interface Driver’ is shown in device manager. Then the phone notifies/offers to install Xperia Companion (presumably on the Pc).

• zero info on what adb driver version to use or how/where to retrieve it. An automated installer tool is the ‘latest adb fastboot and usb driver tool’ by fawazahmed on XDA. Another option is ‘ADB & Fastboot++’ by K3V1991.

Tip: These tools install fastboot system wide so that the fastboot invoked is not necessarily the one in the folder. In any case if you hold shift while right click on folder this adds ‘open command window here’ - one can use this to launch fastboot commands (from guide) from same location where binaries/images are saved.

• There appears to be a reported general incompatibility on windows with adb driver and AMD ryzen pc (windows) documented on XDA forum with workarounds.

Guide really needs to be updated with above in mind.

I realise this is an obscure device/port combo but the XZ2c remains the ‘smallest’ phone today.

Are you talking about the guide at the Sailfish X Installation Instructions - The Privacy Respecting European OS and AI Solution Provider or the guide at Checklist for Sailfish OS | Sailfish OS Documentation ?

The first Jolla has to fix themselves, but for the later you can make pull requests at GitHub - sailfishos/docs.sailfishos.org: Source for the docs.sailfishos.org site · GitHub

Haha, good one! (20 chars)

Can someone knowledgeable please have a skim over the 10 Xperia script (written by sailfish) that was ‘repurposed’ for XZ2c? This was supplied in the sailfish image archive. The batch stalls at Line 42 on windows 7 (but reported to work on windows 8 on github issue)

The code has intentionally been split in two parts, to more visibly indicate where the fault starts…

Summary
@echo off

:: This is simple windows flashing script for Sony Xperia 10 device
:: This script is using fastboot to flash which differs from the factory method.

set tmpflashfile=tmpfile.txt
set emmawebsite=https://developer.sony.com/develop/open-devices/get-started/flash-tool/download-flash-tool/
set unlockwebsite=https://developer.sony.com/develop/open-devices/get-started/unlock-bootloader/
set oemblobwebsite=https://developer.sony.com/develop/open-devices/downloads/software-binaries/
set fastbootkillretval=0
set serialnumbers=

echo(
echo This is a Windows flashing script for Sony Xperia 10 device.
echo(
echo Power on the device in fastboot mode, by doing the following:
echo 1. Turn off your Xperia.
echo 2. Connect one end of a USB cable to your PC.
echo 3. While holding the volume up button pressed, connect the other end of
echo    the USB cable to your Xperia.
echo 4. After this you should see the blue LED lit on Xperia, and it will be
echo    ready for flashing
echo(
pause

echo Verifying MD5 checksums...
call :sleep 3

:: Ensure that tools have valid md5sum before using them
@call :md5sum AdbWinApi.dll
@call :md5sum AdbWinUsbApi.dll
@call :md5sum fastboot.exe
@call :md5sum flash-on-windows.bat

set fastbootcmd_no_device=fastboot.exe
set products=

echo(
echo Searching for a compatible device...

:: Ensure that we are flashing right device
:: :: H8314
:: H8314

<<<<<< stall >>>>>>>


@call :devices

if not "%serialnumbers%" == "" GOTO no_error_serialnumbers

:: If fastboot devices does not list any devices, then we cannot flash.
echo(
echo We did not find any devices with fastboot.
echo(
echo The device is not properly connected to your computer or
echo you might be missing the required windows fastboot drivers for your device.
echo(
echo Go to the Windows Device Manager and verify that the fastboot driver for the
echo device is properly installed.
echo(
pause
exit /b 1

:no_error_serialnumbers

for %%d in ( %serialnumbers% ) do (
  set fastbootcmd=%fastbootcmd_no_device% -s %%d
  @call :getvar product
  findstr /R ":: H8314
:: H8314" %tmpflashfile% >NUL 2>NUL
  if not errorlevel 1 (
    call :new_product_found %%d
  )
)

if not [%products%] == [] goto :no_error_product 

echo(
echo The DEVICE this flashing script is meant for WAS NOT FOUND!
echo(
echo This script found following device:
type %tmpflashfile%
pause
exit /b 1

:no_error_product

if "%products%" == "%products: =%" GOTO :no_multiple_products

echo(
echo It seems that there are multiple compatible devices connected in fastboot mode.
echo Make sure only the device that you intend to flash is connected.
pause
exit /b 1


:no_multiple_products

:: Now we know which device we need to flash
set fastbootcmd=%fastbootcmd_no_device% -s %products%

:: Check that device has been unlocked
@call :getvar secure
findstr /R /C:"secure: no" %tmpflashfile% >NUL 2>NUL
if not errorlevel 1 GOTO no_error_unlock
echo(
echo This device has not been unlocked for the flashing. Please follow the
echo instructions how to unlock your device at the following webpage:
echo %unlockwebsite%
echo(
echo Press enter to open browser with the webpage.
echo(
pause
start "" %unlockwebsite%
exit /b 1

:no_error_unlock

echo(
echo The device is unlocked for the flashing process. Continuing..

echo(
del %tmpflashfile% >NUL 2>NUL
setlocal EnableDelayedExpansion

:: Find the blob image. Make sure there's only one.
for /r %%f in (*_v12a_tama.img) do (
if not defined blobfilename (
REM Take only the filename and strip out the path which otherwise is there.
REM This is to make sure that we do not face issues later with e.g. spaces in the path etc.
set blobfilename=%%~nxf
) else (
echo(
echo More than one supported Sony Vendor image was found in this directory.
echo Please remove any additional files.
echo(
pause
exit /b 1
)
)

:: Bail out if we don't have a blob image
if not defined blobfilename (
echo(
echo The supported Sony Vendor partition image wasn't found in the current directory
echo Please download it from
echo %oemblobwebsite%
echo(
echo Ensure you download the supported version of the image found under:
echo "Software binaries for AOSP Android 10.0 - Kernel 4.14 - Tama"
echo and unzip it into this directory.
echo Note: information on which versions are supported is written in our Sailfish X
echo installation instructions online.
echo(
echo Press enter to open the browser with the webpage.
echo(
pause
start "" %oemblobwebsite%
exit /b 1
)

echo(
echo Found '%blobfilename%' that will be used as vendor image. Continuing..

:: We want to print the fastboot commands so user can see what actually
:: happens when flashing is done.
@echo on

@call :fastboot flash boot hybris-boot.img
@call :fastboot flash dtbo dtbo.img
:: @call :fastboot flash system_b fimage.img001
@call :fastboot flash userdata sailfish.img001
@call :fastboot flash oem_a %blobfilename%

:: NOTE: Do not reboot here as the battery might not be in the device
:: and in such situation we should not reboot the device.
@echo(
@echo Flashing completed.
@echo(
@echo Remove the USB cable and bootup the device by pressing powerkey.
@echo(
@pause

@exit /b 0

:: Function to sleep X seconds
:sleep
:: @echo "Waiting %*s.."
ping 127.0.0.1 -n %* >NUL
@exit /b 0

:devices
for /f "tokens=1" %%f in ('fastboot devices') do call :new_serialno_found %%f
@exit /b 0

:new_serialno_found
set serialno=%1
if "%serialnumbers%" == "" (
set serialnumbers=%serialno%
) else (
set "serialnumbers=%serialno% %serialnumbers%"
)
@exit /b 0

:new_product_found
set product=%1
if "%products%" == "" (
set products=%product%
) else (
set "products=%product% %products%"
)
@exit /b 0

:getvar
del %tmpflashfile% >NUL 2>NUL

start /b cmd /c %fastbootcmd% getvar %* 2^>^&1 ^| find "%*:" ^> %tmpflashfile%
call :sleep 3
:: In case the device is not online, fastboot will just hang forever thus
:: kill it here so the script ends at some point.
taskkill /im fastboot.exe /f >NUL 2>NUL
set fastbootkillretval=%errorlevel%
@exit /b 0

:md5sum
@set md5sumold=
:: Before flashing calculate md5sum to ensure file is not corrupted, so for each line in md5.lst do
@for /f %%i in ('findstr %~1 md5.lst') do @set md5sumold=%%i
:: Some files e.g. oem partition image is not part of md5.lst so skip checking md5sum for that file
@if [%md5sumold%] == [] goto :skip_md5sum
:: We want to take the second line of output from CertUtil, if you know better way let me know :)
:: delims= is needed for this to work on windows 8
@for /f "skip=1 tokens=1 delims=" %%i in ('CertUtil -hashfile "%~1" MD5') do @set md5sumnew=%%i && goto :file_break
:file_break
:: Drop all spaces from the md5sumnew as the format provided by CertUtil is two chars space two chars..
@set md5sumnew=%md5sumnew: =%
:: Drop everything after the first space in md5sumold
@set "md5sumold=%md5sumold: ="&rem %
@IF NOT "%md5sumnew%" == "%md5sumold%" (
  @echo(
  @echo MD5SUM '%md5sumnew%' of file '%~1' does not match to '%md5sumold%' found from md5.lst.
  @call :exitflashfail
)
@echo MD5SUM '%md5sumnew%' match for file '%~1'.
:skip_md5sum
@exit /b 0

:: Function to call fastboot command with error checking
:fastboot
:: When flashing check md5sum of files
@IF "%~1" == "flash" (
  @call :md5sum %~3
)
%fastbootcmd% %*
@IF "%ERRORLEVEL%" == "1" (
  @echo(
  @echo ERROR: Failed to execute '%fastbootcmd% %*'.
  @call :exitflashfail
)
@exit /b 0

:exitflashfail
@echo(
@echo FLASHING FAILED!
@echo(
@echo Please go to https://forum.sailfishos.org/ and ask for guidance.
@echo(
@pause
@exit 1
@exit /b 0

Perhaps it is possible to flash sailfish and ROM using only fastboot without this script…

On my win 7 (with USB 2.0) it just hangs at “Searching for a compatible device…”

A separate fastboot command reports the device as present…

I would think it hangs in the :devices section and not where you put the mark.
Have you tried running the for loop manually as well?

I found the problem. Lines 62 to 72… The typo is the H8314 part. It should just read “H8314”.

I’ve highlighted this on XDA also here.


    :no_error_serialnumbers

    for %%d in ( %serialnumbers% ) do (
    set fastbootcmd=%fastbootcmd_no_device% -s %%d
    @call :getvar product
    findstr /R ":: H8314
    :: H8314" %tmpflashfile% >NUL 2>NUL
    if not errorlevel 1 (
    call :new_product_found %%d
    )
    )
 

The md5 checksum check at line 33 for the batch itself must be deleted also.

Worked..Happy

Now I cannot seem do start updates from within sailfish. Must it be done via USB?

Have you logged in with your Jolla-account on the phone? I think that is a requirement for OTA-updates.

Logged in? i’m more than logged in, i want a jolla helmet, the complete outfit…

yes logged in

Edit:
In sub menu on sailfish OS updates, “Open Backup Settiings”

“No cloud account or memory card available”
Perhaps a requirement?

Keep in mind its an unofficial port. Theres some reference here but its all alien to me, looks like linux is required> main/ota.md at hybris-10 · sailfishos-sony-tama/main · GitHub

Only if you want to do backups before updating. And the updates menu doesn’t find anything if you use the pulldown menu to check for updates? Have you tried downloading something from the Jolla store to check everything works there? If you still can’t get going, enable the Developer mode and in Terminal try something like:

devel-su
ssu release 5.0.0.76
version --dup
reboot

Okay, the guide is explaining how to update from command line. You need to enable the Developer mode and either do this on the phone from Terminal app or remote connect to your phone with PuTTY or any other SSH-client and then run the commands one by one as a root (devel-su).

1 Like

Its daunting. I struggled as it was just flashing sailfish lol. I see the terminal app. I’ll have a read over it.

I see that the version installed is updated on Jun 23, 2024 which actually is fresher than the device i’m moving away from.

The only apps i’d like to use is telegram, and perhaps a newer web browser if the built in one is a bit older. I have an aversion to apps in general, tend to use browser as much I can.

Edit:

PuTTY […] supports several network protocols, including SCP, SSH, Telnet, rlogin, and raw socket connection.

Oh I like the sound of that, a raw socket connection. yum.

The guide you linked explains how to enable the Developer-mode, then just remote connect with SSH to you phone and follow the guide by copy&pasting the commands one by one.

Start from the beginning, but replace the ssu release 5.0.0.61 with ssu release 5.0.0.67 at the proper step to get the newest version for your phone.

1 Like

OK thanks

Is skipping releases as you say good idea?
Also, how much data (mb) will the downloads eat… I use not-unlimited 4g connection (wifi dongle).

I’m assuming that

  • ‘terminal’ is the same thing as “shell” mentioned in the guide (not obvious).
  • That these updates are downloaded via wifi direct to the phone, so it needs to be connected via wifi(?).

please ignore this (i see my mistake).