SailfishOS Porting for Xperia XZ¶
This is a draft
Official vs Community¶
Official Sailfish X builds use a different structure. We will focus on community adaptations.
First of, the setup is a bit unintuitive to understand: Sailfish relies on a
ready-made AOSP or LineageOS port on the
system partition. Then Sailfish
provides its own boot image named
hybris-boot.img. It contains a single
script in its ramdisk that loads the Sailfish root filesystem from
chroots to it early in the boot sequence.
(The Sailfish root file system gets built using
Focus here on procedure for community builds
Use the following settings in your ~/.hadk.env:
export PLATFORM_SDK_ROOT="/srv/mer" export ANDROID_ROOT="$HOME/hadk" export VENDOR="sony" export DEVICE="f8331" export FAMILY="tone" export HABUILD_DEVICE="kagura" # ARCH conflicts with kernel build # Need to use armv7hl instead of aarch64 until the SDK target becomes available export PORT_ARCH="armv7hl" export USE_CCACHE=1 # Extra options for building with mic export RELEASE=126.96.36.199 # Increment version to match your SDK/target/tooling export EXTRA_NAME=-kagura
You can also put your Android tree somewhere else, just remember to update
First, build an AOSP or LineageOS
system.img using the regular android build
make systemimage. Flash that image to your device’s
To sync the regular AOSP build env:
Comment out the following lines from
repo sync and
Enter the Android build environment and run
Save the image somewhere and then run
make installclean in your Android tree.
Then, swap in the patched
repos by un-commenting the lines in the manifest again, run
repo sync -
this time without
repo_update.sh afterwards - and build the needed hybris
It is important that you do not mix these steps up!
Use the provided
build_packages.sh script from
droid-configs, all needed
middleware packages, and,
It is smarter to run the individual stages of
--mwfor all middleware packages
This way, you will know which part exactly failed and do not have to rebuild everything after you have fixed a component.
The middleware packages will get cloned to
hybris/mw/*. The built package
.rpm files will go into
You need to build
droidmedia manually for tone devices.
Refer to the HADK and follow the steps.
Then, you must run
process_patterns.sh to populate the pattern db for
mic. If you do not run this(or let
--configs will run it for you),
will fail to find your
Jolla Config $DEVICE pattern and exit prematurely.
Create the kickstart file as instructed in the HADK and run
mic create ....
.zip file will not be ready to be flashed because the current
build system produces an
update-script that contains a
instruction, which Android Oreo’s
updater binary does not understand.
So, manually unzip the file, flash
hybris-boot.img to the boot partition
system.img to the system partition via
fastboot. Then push the
.bz2 file to
/sdcard/ on the device and run these commands manually
in the device’s recovery, e.g. TWRP:
rm -rf /data/.stowaways/sailfishos/ mkdir -p /data/.stowaways/sailfishos tar --numeric-owner \ -xvjf /sdcard/sailfishos-$DEVICE-$RELEASE-$EXTRA_NAME.tar.bz2 \ -C /data/.stowaways/sailfishos rm /sdcard/sailfishos-$DEVICE-$RELEASE-$EXTRA_NAME.tar.bz2
$DEVICE etc. for the actual file name)