Skip to content

Instantly share code, notes, and snippets.

@rinigus rinigus/

forked from kimmoli/
Last active Aug 28, 2019
What would you like to do?

Setup your SDK


export MER_ROOT="$HOME/mer"
export ANDROID_ROOT="$MER_ROOT/android/droid"
export VENDOR="OnePlus"
export DEVICE="onyx"
export PORT_ARCH="armv7hl"

After setting up sdk

Enter the build engine

ubu-chroot -r $PLATFORM_SDK_ROOT/sdks/ubuntu



Prepare android root

sudo mkdir -p $ANDROID_ROOT
sudo chown -R $USER $ANDROID_ROOT
repo init -u git:// -b hybris-12.1

Fetch local manifest

mkdir $ANDROID_ROOT/.repo/local_manifests
cd $ANDROID_ROOT/.repo/local_manifests
curl -O

Compare the fetched manifest with the one used to build latest release at

Sync sources (this takes a while)

repo sync --fetch-submodules

Remove duplicate configpanel and keyhandler

rm -rI device/oppo/common/configpanel/
rm -rI device/oppo/common/keyhandler/

Build hybris-hal. This is the reusable part

Note: copypaste make commands one by one

source build/
export USE_CCACHE=1
breakfast $DEVICE

make -j4 clean

make -j4 hybris-hal

make -j4 libwcnss_qmi

Using backported Bluetooth drivers

Kernel has been patched, no need for additional patching. Add to local_manifest,

<project name="mlehtima/backports-bluetooth" path="external/backports-bluetooth" revision="master" />

Build backported drivers by running make backports in HABUILD_SDK. If you want to run make hybris-hal after that, you must run make backports again to ensure that you use backported modules.



Build packages


Build pulseaudio-modules-droid-glue

Follow corresponding chapter HADK documentation ("Phone calls don’t work (but SMS and mobile data works)"). If there is an issue with package building due to missing tar, install it in the target

sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -R -m sdk-install zypper in tar

Build support for camera and video

Camera support requires droidmedia and gst-droid with onyx-specific patches by kimmoli. See and for examples.

Follow GStreamer v1.0 part of HADK documentation. However, note that onyx doesn't need LD_PRELOAD for minimediaservice. For, add libminisf to droidmedia make command like this in HABUILD_SDK:

make -j4 libdroidmedia minimediaservice minisfservice libminisf

In addition, if builkding locally, when cloning gst-droid, use onyx-specific repo for it. If non-default branch is needed, you can clone it before building gst-droid:

git clone
cd gst-droid/
git checkout onyx_2.1.4.14
git submodule init
git submodule update

Since camera resolution info is already available in configs, no need to change that.


Got through OBS packages and update all repos, as needed. Some specific instructions below.


At the moment of writing (Aug 2019), libhybris has a bug preventing start of lipstick during boot. Version which is known to work is (commit a426857906dda89370a4b670f23d92a82e6f243b). Set it at and . Keep an eye on for changes, in case if issue gets resolved.


droid-hal-onyx requires locally built packages. All commands are given in the repository folder.

Update local osc repository:

osc up

Replace all RPMs with the new ones:

rm *rpm
# copy new RPMs
osc ar

Commit the changes:

osc commit -m "commit message here"


For local build without extenal dependencies, you can comment out "OnePlus X specific packages" in hybris/droid-configs/patterns/jolla-hw-adaptation-onyx.yaml .


Get the kickstart file

For local build, don't download KS, but generate as in HADK documentation. If downloading, use

curl -O$EXTRA_NAME/Jolla-$RELEASE-$DEVICE-armv7hl.ks


Edit kickstart for your own local repo

uncomment and modify the first repo line in .ks to use your freshly built packages instead of OBS built.

username and $ANDROID_ROOT path

Build rootfs

sudo mic create fs --arch $PORT_ARCH \
--record-pkgs=name,url \
--pack-to=sfe-$DEVICE-$RELEASE$EXTRA_NAME.tar.bz2 \

The flashable image zip is


Observation from image generation: the name of generated zip depends on the version of SDK. So, if /etc/sailfish-release corresponds to some other version, zip will have that in its name.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.