Skip to content

Instantly share code, notes, and snippets.

@rinigus rinigus/onyx-hadk.md

forked from kimmoli/onyx-hadk.md
Last active Aug 28, 2019
Embed
What would you like to do?

Setup your SDK

.hadk.env

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

HABUILD_SDK

hadk

Prepare android root

sudo mkdir -p $ANDROID_ROOT
sudo chown -R $USER $ANDROID_ROOT
cd $ANDROID_ROOT
repo init -u git://github.com/mer-hybris/android.git -b hybris-12.1

Fetch local manifest

mkdir $ANDROID_ROOT/.repo/local_manifests
cd $ANDROID_ROOT/.repo/local_manifests
curl -O https://raw.githubusercontent.com/mer-hybris/local_manifests/hybris-12.1/onyx.xml

Compare the fetched manifest with the one used to build latest release at https://raw.githubusercontent.com/rinigus/local_manifests/hybris-12.1/onyx.xml

Sync sources (this takes a while)

cd $ANDROID_ROOT
repo sync --fetch-submodules

Remove duplicate configpanel and keyhandler

cd $ANDROID_ROOT
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

hadk
cd $ANDROID_ROOT
source build/envsetup.sh
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.

MER_SDK

hadk

Build packages

cd $ANDROID_ROOT
rpm/dhd/helpers/build_packages.sh

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 https://github.com/rinigus/gst-droid/tree/onyx_2.1.4.14 and https://github.com/rinigus/droidmedia/tree/onyx_2.1.4.14 for examples.

Follow GStreamer v1.0 part of HADK documentation. However, note that onyx doesn't need LD_PRELOAD for minimediaservice. For 2.1.4.14, 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:

cd $ANDROID_ROOT
git clone https://github.com/rinigus/gst-droid.git
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.

OBS

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

libhybris

At the moment of writing (Aug 2019), libhybris has a bug preventing start of lipstick during boot. Version which is known to work is 0.0.5.24 (commit a426857906dda89370a4b670f23d92a82e6f243b). Set it at https://build.merproject.org/package/show/nemo:devel:hw:oneplus:onyx/libhybris and https://build.merproject.org/package/show/nemo:testing:hw:oneplus:onyx/libhybris . Keep an eye on https://build.merproject.org/package/show/nemo:testing:hw:motorola:moto_msm8960_jbbl/libhybris for changes, in case if issue gets resolved.

droid-hal-onyx

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"

Patterns

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

cd $ANDROID_ROOT
hybris/droid-configs/droid-configs-device/helpers/process_patterns.sh

Get the kickstart file

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

RELEASE=2.0.1.11
EXTRA_NAME=beta-1
cd $ANDROID_ROOT/tmp
curl -O http://images.devaamo.fi/sfa/onyx/$EXTRA_NAME/Jolla-$RELEASE-$DEVICE-armv7hl.ks

EXTRA_NAME=-$EXTRA_NAME

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

cd $ANDROID_ROOT
sudo mic create fs --arch $PORT_ARCH \
--tokenmap=ARCH:$PORT_ARCH,RELEASE:$RELEASE,EXTRA_NAME:$EXTRA_NAME \
--record-pkgs=name,url \
--outdir=sfe-$DEVICE-$RELEASE$EXTRA_NAME \
--pack-to=sfe-$DEVICE-$RELEASE$EXTRA_NAME.tar.bz2 \
$ANDROID_ROOT/tmp/Jolla-$RELEASE-$DEVICE-armv7hl.ks

The flashable image zip is

$ANDROID_ROOT/sfe-$DEVICE-$RELEASE$EXTRA_NAME/sailfishos-$DEVICE-release-$RELEASE$EXTRA_NAME.zip

Observation from 2.1.4.14 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.