Skip to content
Permalink
master
Switch branches/tags
Go to file
 
 
Cannot retrieve contributors at this time
896 lines (630 sloc) 48.4 KB

HADK FAQ

Abstract

FAQ for Sailfish OS porting guide (HADK)

Table of Contents

1   Useful hints

1.1   Skip tutorial

Congratulations if you have got gui working. During the debugging process you will be building and flashing quite a few times, in which tutorial during the setup screen can be annoying. You can skip that by tapping on the each corner of the screen clockwise, while starting from left-top corner.

1.2   Monitoring udev events

  • udevadm monitor is your friend.
  • To get it for cyanogenmod, add this repository https://github.com/chombourger/android-udev/ to your manifest as external/usb and make udevadm
  • To monitor boot-time events, compile the kernel with CONFIG_DEBUG_KOBJECT=y and increase the log buffer size by setting the kernel command line option: log_buf_len=21 (or higher)

1.3   Persistent journalctl

  • Modify /etc/systemd/journald.conf
    • Storage=volatile --> Storage=automatic
    • mkdir /var/log/journal
    • Reboot
  • Systemd suppresses journal, and some valuable info might get hidden. To prevent this, set
    • RateLimitInterval=0

2   Build issues

2.1   Updating local build target

  • Change release version in the command if needed

  • In Platform SDK:

    sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R ssu release 2.1.4.14
    sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R zypper ref
    sb2 -t $VENDOR-$DEVICE-$PORT_ARCH -m sdk-install -R zypper dup
    

2.2   Updating submodules

  • Submodule locations:

    rpm/dhd
    hybris/droid-configs/droid-configs-device
    hybris/droid-hal-version-$DEVICE/droid-hal-version
    
  • In the each folder check remote name using:

    git remote -v
    
  • Run (replace remote_name with the name you found out in previous step):

    git fetch remote_name
    git pull remote_name master
    

2.3   rpm/dhd/helpers/build_packages.sh fails building libhybris, ...

  • HOST$:

    cd $HOME
    sudo mkdir -p $MER_ROOT/devel
    sudo chown -R $USER mer/devel
    
  • Run the script again

2.4   Repo init fails because of gpg

  • In sdk chroot gpg command is gpg2:

    $MERSDK
    git config --global gpg.program gpg2
    

2.5   Nothing provides /system/bin/sh

  • Add this to your .spec:

    %define __provides_exclude_from ^/system/.*$
    %define __requires_exclude ^/system/bin/.*$
    %define __find_provides %{nil}
    %define __find_requires %{nil}
    

2.6   Existence_error (yes, you read that right) when locally building policy-settings-common

  • You get:
    ERROR: error(existence_error(procedure, qsave_program/2), context(precompile/0, _G669))
  • Solution::
    sb2 -t $VENDOR-$DEVICE-armv7hl -R -msdk-install cd /usr/lib/swipl-5.6.50/library rm INDEX.pl zypper in fakeroot fakeroot swipl -g true -t 'make_library_index(.)'
  • then rebuild the package again with mb2

2.7   make[3]: [security/commoncap.o] Error 1

  • Those errors appears because ANDROID_CONFIG_PARANOID_NETWORK is disabled in your kernel and with it enabled, you can't access internet with Sailfish OS. ( Since hybris-12.1, rild does not work without ANDROID_CONFIG_PARANOID_NETWORK. Add nemo to group inet if it is enabled.)

  • Check http://forum.xda-developers.com/showpost.php?p=42880275&postcount=104

  • To resolve this replace in <path of your kernel>/security/commoncap.c:

    if (cap == CAP_NET_RAW && in_egroup_p(AID_NET_RAW))
        return 0;
    if (cap == CAP_NET_ADMIN && in_egroup_p(AID_NET_ADMIN))
        return 0;
    
  • With this:

    #ifdef CONFIG_ANDROID_PARANOID_NETWORK
           if (cap == CAP_NET_RAW && in_egroup_p(AID_NET_RAW))
               return 0;
           if (cap == CAP_NET_ADMIN && in_egroup_p(AID_NET_ADMIN))
               return 0;
    #endif
    
  • Save the file and recompile the kernel

2.8   Building droid-config fails with: Segmentation fault (core dumped) /usr/lib/qt5/bin/kmap2qmap

  • Try updating the packages in the target with:

    sb2 -t $VENDOR-$DEVICE-armv7hl -R -m sdk-install zypper ref
    sb2 -t $VENDOR-$DEVICE-armv7hl -R -m sdk-install zypper dup
    

2.9   libdsyscalls is cause of segfault after lipstick or minimer

  • Usually means that in your device repo, its enabling clang somewhere, do a grep and disable clang and rebuild :)

2.10   Issues with ngfd or ngfd-plugin-droid or pulseaudio

2.11   No installroot directory after droid-configs build when preparing .ks file

  • rpm2cpio droid-local-repo/$DEVICE/droid-configs/droid-config-$DEVICE-ssu-kickcdstarts-1-1.armv7hl.rpm | cpio -idmv
  • In the sed command use $ANDROID_ROOT/usr/share/kickstarts/$KS instead of $ANDROID_ROOT/hybris/droid-configs/installroot/usr/share/kickstarts/$KS

2.12   No rule to make target kernel needed by boot.img or similar error

  • Open device/$VENDOR/$DEVICE/BoardConfig.mk

  • Comment out the lines:

    TARGET_KERNEL_SOURCE
    TARGET_KERNEL_PREBUILT
    
  • Common error in hybris10.1 due to the old CM10.1 kernels and how they were built back then.

2.13   Migrate patterns to meta-packages

Sailfish OS 3.4.0 is the last version where patterns are still supported.

If you're still using patterns (i.e. you still have $ANDROID_ROOT/hybris/droid-configs/patterns/jolla-hw-adaptation-$DEVICE.yaml), the next Sailfish OS release will cause error when trying to build a flashable image for your port:

Error <creator>[01/28 07:26:14] : Unable to find package: patterns-sailfish-device-configuration-$DEVICE

To fix, migrate patterns to meta-packages with this helper script from the droid-configs submodule:

PLATFORM_SDK $

cd $ANDROID_ROOT
cd hybris/droid-configs/droid-configs-device
git fetch origin master
git checkout master
cd ..
droid-configs-device/helpers/migrate_patterns.sh

Check the changes with git status; git diff, commit when happy. The end result will be similar to https://github.com/mer-hybris/droid-config-sony-ganges-pie/pull/62.

If the script fails, comment out the offending patterns until it succeeds. Convert the failed patterns manually as shown in the sub-section below.

Lastly, update your droid-hal-version submodule to have this change https://github.com/mer-hybris/droid-hal-version/pull/18, which ensures your existing users also switch to meta-packages when they upgrade from 3.4.0 to newer releases.

If all of the above looks daunting, there should be someone to guide you through at the #sailfishos-porters IRC channel.

Alternatively, if you haven't gone too far into your port yet and/or haven't released it, you could restart porting from scratch (the add_new_device.sh script and the templates will initialise device repos to use meta-packages already).

2.13.1   Converting manually

The conversion is pretty straightforward. Let's assume the contents of the patterns/my-extra-tools.yaml file:

Description: My extra tools for porting
Name: my-extra-tools
Requires:
- pattern:my-other-helpers
- valgrind
- my-custom-debugger
- my-test-suite

Summary: My extra tools

becomes a section in your .spec (or patterns/my-extra-tools.inc which then gets included into .spec):

%package -n patterns-sailfish-device-my-extra-tools
Summary: My extra tools
Requires: patterns-sailfish-device-my-other-helpers
Requires: valgrind
Requires: my-custom-debugger
Requires: my-test-suite

%description -n patterns-sailfish-device-my-extra-tools
My extra tools for porting

%files -n patterns-sailfish-device-my-extra-tools

3   Android base specific fixes

3.1   hybris-14.1

Details of what the script does:

Symlinks for services: ::sh-3.2# ls -lh /usr/libexec/droid-hybris/system/etc/init/
total 4.0K
lrwxrwxrwx 1 root root   26 Oct  6 20:52 atrace.rc -> /system/etc/init/atrace.rc
lrwxrwxrwx 1 root root   28 Oct  6 20:52 bootstat.rc -> /system/etc/init/bootstat.rc
lrwxrwxrwx 1 root root   29 Oct  6 20:52 debuggerd.rc -> /system/etc/init/debuggerd.rc
lrwxrwxrwx 1 root root   29 Oct  6 20:52 drmserver.rc -> /system/etc/init/drmserver.rc
lrwxrwxrwx 1 root root   29 Oct  6 20:52 dumpstate.rc -> /system/etc/init/dumpstate.rc
lrwxrwxrwx 1 root root   31 Oct  6 20:52 gatekeeperd.rc -> /system/etc/init/gatekeeperd.rc
lrwxrwxrwx 1 root root   30 Oct  6 20:52 init-debug.rc -> /system/etc/init/init-debug.rc
lrwxrwxrwx 1 root root   28 Oct  6 20:52 installd.rc -> /system/etc/init/installd.rc
lrwxrwxrwx 1 root root   27 Oct  6 20:52 logcatd.rc -> /system/etc/init/logcatd.rc
lrwxrwxrwx 1 root root   24 Oct  6 20:52 logd.rc -> /system/etc/init/logd.rc
lrwxrwxrwx 1 root root   30 Oct  6 20:52 mediacodec.rc -> /system/etc/init/mediacodec.rc
lrwxrwxrwx 1 root root   34 Oct  6 20:52 mediadrmserver.rc -> /system/etc/init/mediadrmserver.rc
lrwxrwxrwx 1 root root   34 Oct  6 20:52 mediaextractor.rc -> /system/etc/init/mediaextractor.rc
lrwxrwxrwx 1 root root   24 Oct  6 20:52 mtpd.rc -> /system/etc/init/mtpd.rc
lrwxrwxrwx 1 root root   29 Oct  6 20:52 perfprofd.rc -> /system/etc/init/perfprofd.rc
lrwxrwxrwx 1 root root   26 Oct  6 20:52 racoon.rc -> /system/etc/init/racoon.rc
lrwxrwxrwx 1 root root   24 Oct  6 20:52 rild.rc -> /system/etc/init/rild.rc
lrwxrwxrwx 1 root root   29 Oct  6 20:52 superuser.rc -> /system/etc/init/superuser.rc
lrwxrwxrwx 1 root root   27 Oct  6 20:52 uncrypt.rc -> /system/etc/init/uncrypt.rc
lrwxrwxrwx 1 root root   23 Oct  6 20:52 vdc.rc -> /system/etc/init/vdc.rc
lrwxrwxrwx 1 root root   23 Oct  6 20:52 vold.rc -> /system/etc/init/vold.rc

NOTE, no audioserver and mediaserver links! NOTE, bootanim was removed in the updated script, also vold was added

3.2   hybris-15.1

3.3   hybris-16.0

  • Before building hybris-hal run the following commands:

    cd $ANDROID_ROOT/external
    git clone --recurse-submodules https://github.com/mer-hybris/libhybris.git
    cd $ANDROID_ROOT
    hybris-patches/apply-patches.sh --mb
    
  • Copy files from https://github.com/sailfishos-oneplus5/droid-config-cheeseburger/tree/hybris-16.0/sparse/usr/libexec/droid-hybris/system/etc/init to your config repo (to hybris/droid-configs/sparse/usr/libexec/droid-hybris/system/etc/init) and rebuild config packages using rpm/dhd/helpers/build_packages.sh -c

  • When you get telnet in the SFOS rootfs (port 2323) and can run /usr/libexec/droid-hybris/system/bin/logcat, see if you get lines similar to below filtering the output using grep for example:

    E linker  : library "/usr/libexec/droid-hybris/system/lib64/libselinux_stubs.so" ("/usr/libexec/droid-hybris/system/lib64/libselinux_stubs.so") needed or dlopened by "/system/bin/hwservicemanager" is not accessible for the namespace: [name="(default)", ld_library_paths="", default_library_paths="/system/lib64", permitted_paths="/system/lib64/drm:/system/lib64/extractors:/system/lib64/hw:/system/product/lib64:/system/framework:/system/app:/system/priv-app:/vendor/framework:/vendor/app:/vendor/priv-app:/odm/framework:/odm/app:/odm/priv-app:/oem/app:/system/product/framework:/system/product/app:/system/product/priv-app:/data:/mnt/expand"]
    F linker  : CANNOT LINK EXECUTABLE "/system/bin/hwservicemanager": library "/usr/libexec/droid-hybris/system/lib64/libselinux_stubs.so" needed or dlopened by "/system/bin/hwservicemanager" is not accessible for the namespace "(default)"
    E linker  : library "/usr/libexec/droid-hybris/system/lib64/libselinux_stubs.so" ("/usr/libexec/droid-hybris/system/lib64/libselinux_stubs.so") needed or dlopened by "/system/bin/servicemanager" is not accessible for the namespace: [name="(default)", ld_library_paths="", default_library_paths="/system/lib64", permitted_paths="/system/lib64/drm:/system/lib64/extractors:/system/lib64/hw:/system/product/lib64:/system/framework:/system/app:/system/priv-app:/vendor/framework:/vendor/app:/vendor/priv-app:/odm/framework:/odm/app:/odm/priv-app:/oem/app:/system/product/framework:/system/product/app:/system/product/priv-app:/data:/mnt/expand"]
    F linker  : CANNOT LINK EXECUTABLE "/system/bin/servicemanager": library "/usr/libexec/droid-hybris/system/lib64/libselinux_stubs.so" needed or dlopened by "/system/bin/servicemanager" is not accessible for the namespace "(default)"
    E linker  : library "/usr/libexec/droid-hybris/system/lib64/libselinux_stubs.so" ("/usr/libexec/droid-hybris/system/lib64/libselinux_stubs.so") needed or dlopened by "/vendor/bin/vndservicemanager" is not accessible for the namespace: [name="(default)", ld_library_paths="", default_library_paths="/vendor/lib64", permitted_paths="/odm:/vendor"]
    F linker  : CANNOT LINK EXECUTABLE "/vendor/bin/vndservicemanager": library "/usr/libexec/droid-hybris/system/lib64/libselinux_stubs.so" needed or dlopened by "/vendor/bin/vndservicemanager" is not accessible for the namespace "(default)"
    

4   Graphics

4.1   Lipstick segfaults/no display

  • As you follow steps below, strace any of the binaries that would fail for non-obvious reasons. You'll need to install strace to do so: zypper in strace
  • test simple hwc as root:t
    • EGL_PLATFORM=hwcomposer test_hwcomposer
    • ^^ strace if segfaults
  • if strace dies after open("/sys/kernel/debug/tracing/trace_marker..., perform
    • systemctl mask sys-kernel-debug.mount
  • test_hwcomposer should not be used as reliable hwc test!! if fails, then try minimer:
    • curl -O https://qtl.me/minimer3.tar.gz # seems to currently give 404, the archive is mirrored at https://1drv.ms/u/s!AuDqiTFly4jxgxYNUdt16YluZn90
    • zypper in qt5-qtdeclarative-qmlscene
    • tar -xf minimer3.tar.gz; cd minimer
    • EGL_PLATFORM=hwcomposer /usr/lib/qt5/bin/qmlscene -platform hwcomposer main.qml
    • if fails as user, try as root
    • /system/bin/surfaceflinger", R_OK) = -1 ENOENT (No such file or directory)
  • for more info: zypper in gdb
    • if you get test_hwcomposer, minimer or lipstick segfault, or test_hwcomposer or minimer running but doing nothing (as on m7)
    • Check if your device uses qcom_display-caf or display-legacy
    • Look in any of the BoardConfig.mk or BoardConfigCommon.mk in any of the device repos for the device for the variable TARGET_QCOM_DISPLAY_VARIANT. It should be set to either caf or legacy.
    • The repos included can be determined by looking at the -include device/$VENDOR//BoardConfig.mk or device/$VENDOR//BoardConfigCommon.mk lines at beginning the .mk files starting from the primary BoardConfig.mk
    • If you're on display-legacy or display-caf(repo sync before 2015.06.04) patch hwcomposer withhttp://pastebin.com/AfRXPKVA
    • From HABUILD_SDK recompile android hwcomposer*.so for your device
      • Find the name of the hwcomposer*.so module: run make modules | grep hwcomposer
      • If this command complains about missing column command run sudo apt-get install bsdmainutils)
      • Run make hwcomposer.module_name from results above
    • Once rebuilt, hwcomposer.*.so will be picked up and used by droid hal rebuild, and reside under /usr/libexec/droid-hybris/system/lib/hw
    • If your apps are crashing (like on flo): Repeat the same for gralloc and copybit
    • Scream on the IRC if this worked for you
  • If strace indicates something like:
  • "Waiting for service display.qservice..."

4.2   BOARD_USES_QCOM_HARDWARE is not in vendor device repo

  • On some Qualcomm devices QCOM hardware detection script fails to find needed define from device repos

  • Add the following lines to rpm/droid-hal-$DEVICE.spec before the line "%include rpm/dhd/droid-hal-device.inc" (do not change that line or add anything after it):

    %define android_config \
    #define QCOM_BSP 1\
    #define QTI_BSP 1\
    %{nil}
    
  • Rebuild packages with build_packages.sh

4.3   Devices with Mali GPU

  • Add this to $ANDROID_ROOT/rpm/droid-hal-$DEVICE.spec before the last line (do not change the last line, ever):

    %define android_config \
    #define MALI_QUIRKS 1\
    %{nil}
    
  • Rebuild droid-hal and libhybris packages:

    sudo mount -i -o remount,suid $HOME)
    

4.4   Graphics performance improvements

  • Test framerate display (can be enabled in Settings->Developer mode) when using some apps like gallery
  • If the top view is mostly red try to set QPA_HWC_IDLE_TIME=5 in /var/lib/environment/compositor/droid-hal-device.conf
  • Run systemctl restart user@100000 using devel-su
  • Test framerate display again and if you see more green than before you should use the value
  • Different values can be tested but value 5 has been found to be helping on some devices
  • On some devices also setting QPA_HWC_BUFFER_COUNT=3 in /var/lib/environment/compositor/droid-hal-device.conf helps with graphics performance

4.5   Black gallery pictures and no browser content/browser crash:

Add this to droid-hal .spec file (before the last line, never change the last line in the spec file) and rebuild droid-hal and libhybris packages (remove the sources from hybris/mw/libhybris to make sure a clean rebuild is done):

%define android_config \
#define WANT_ADRENO_QUIRKS 1\
%{nil}

4.6   To change pixel ratio on a running device, as user

devel-su dconf update

# PIXEL_RATIO should be close to the value of horizontal_display_resolution/540 # e.g. Nexus 7 (800 x 1280) displays the pixel ratio is 800/540~=1.48 # always round the value up with two decimal precision

PIXEL_RATIO=1.48

# UPDATE! Please test the new formula for pixel ratio calculation: # diagonal_display_size_inches/4.5 * horizontal_display_resolution/540 # and feedback the outcome to sledges via IRC (better/worse/closer via own trial&error picks?) # Yet another formula: YourDevicePPI/sbjPPI (245), e.g. OnePlusX PPI 441/245 = 1.8 # Available ICON_RES values are 1.0, 1.25, 1.5, 1.75, and 2.0. Choose the closest one to

PIXEL_RATIO: ICON_RES=1.5 devel-su zypper in sailfish-content-graphics-default-z$ICON_RES dconf write /desktop/sailfish/silica/theme_pixel_ratio $PIXEL_RATIO dconf write /desktop/sailfish/silica/theme_icon_subdir "z$ICON_RES"

# check that everything worked:

dconf read /desktop/sailfish/silica/theme_pixel_ratio devel-su reboot

# PIXEL_RATIO and ICON_RES are subjects to fine tuning: https://bugs.nemomobile.org/show_bug.cgi?id=814#c1

Script to scale your icons https://pastebin.com/mxKRkt7Z

5   Touchscreen

5.1   Determine which is the touch event

  • Install mce-tools on device and monitor output of evdev_trace -t
  • Use command "getevent" as super user in adb shell. The event which spams most outputs on the screen when the screen is touched is the touch event.

5.2   Touchscreen problems / erratic behaviour

  • Try the evdev plugin instead of the evdevtouch plugin in droid-hal-device.conf

6   WLAN

6.1   Build Wlan Driver as Module

6.2   BCMDHD WLAN Driver sleep/suspend issues

  • This is based on experience using the bcmdhd driver on the Xiaomi MiPad 2 (latte) device.
  • The original driver would connect to networks ok, but then fail after the device tried to sleep. This was resolved by doing the following:
  • This resulted in a working driver, but which failed to sleep/suspend. The new driver has many config options in the makefile, 2 specific ones seemed responsible for the behaviour: DHD_PCIE_RUNTIMEPM and CONFIG_HAS_WAKELOCK
    • The driver has a config option for supporting runtime power management, the runtime PM rarely (never?) goes into a sleep state becuase of a wakelock
    • The wakelock also prevents mem sleep
    • There is a also a config option for wakelocks, so, turning off wakelocks and runtime PM allows sleeping which all seems a little counter intuitive!
  • See https://github.com/piggz/android_kernel_xiaomi_latte/commits/hybris-13.0-latte-bcmdhd

7   Audio

7.1   Audio not routed to headphones

Run evdev_trace from mce-tools package and find /dev/input/eventX that detects headphones connection. It will be the one with SW_HEADPHONE_INSERT* and SW_MICROPHONE_INSERT* like here:

----====( /dev/input/event0 )====----
Name: "sensorprocessor"
ID: bus 0x0, vendor, 0x0, product 0x0, version 0x0
Type 0x00 (EV_SYN)
Type 0x01 (EV_KEY)
         KEY_VOLUMEDOWN KEY_VOLUMEUP KEY_POWER KEY_CAMERA KEY_MEDIA KEY_VOICECOMMAND
Type 0x05 (EV_SW)
         SW_LID SW_HEADPHONE_INSERT* SW_MICROPHONE_INSERT*

Add this https://github.com/mlehtima/droid-config-fp2-sibon/blob/master/sparse/etc/ohm/plugins.d/accessories.ini file and replace jack-match and jack-device with values from evdev_trace:

  • jack-match matches Name: field
  • jack-device matches /dev/input/eventX, where X is your device input number

Optional way for devices without headphone connector event device:

  • If your device doesn't have event device for the headphone jack then it might have a switch in /sys/class/switch/h2w/ or similar path

  • If the state file in the /sys/class/switch/h2w/ or similar path reacts to headphone connection by changing the value it can be used for headphone detection

  • Add file /etc/ohm/plugins.d/accessories.ini with the following content (replace switch name with the name found in the path on your device):

    model = uevent
    switch = h2w
    
  • If the headphone detection works then add the file to your config repo sparse for future builds

8   Sensors

Enabling the various hw settings for device (fixing sensors in latest builds and autobrightness toggle):

  • If your device has broken sensors after updating to latest SailfishOS version or if your autobrightness toggle doesn't appear in settings, it is due to hw-settings.ini missing for device (light sensor is not declared in the configs and that's why Autobrightness option is not enabled in jolla-settings)
  • Use this as a reference https://github.com/mer-hybris/droid-config-f5121/blob/master/sparse/usr/share/csd/settings.d/hw-settings.ini and make changes accordingly.
  • When satisfied, make a copy of the file to $ANDROID_ROOT/hybris/droid_configs/sparse/usr/share/csd/settings.d/ and git commit !

9   Telephony (ofono/RIL)

9.1   RILD is running but ofono does not work

If ofono is not working properly and shows "ERROR! Can't connect to RILD: No such file or directory" in logs, edit /etc/ofono/ril_subscription.conf to contain:

[ril_0]
name=RIL1
socket=/dev/socket/rild

9.2   Dual SIM devices

Add the jolla-settings-networking-multisim to patterns like done here https://github.com/mlehtima/droid-config-fp2-sibon/blob/master/patterns/jolla-configuration-fp2-sibon.yaml#L15

If your device is dual SIM, add also these lines (don't add them otherwise!):

[ril_1]
name=RIL2
socket=/dev/socket/rild2

Or for hybris-15.1 or higher devices (e.g. OnePlus 5/5T/6):

[ril_1]
transport=binder:name=slot2
name=slot2

9.3   Devices without modem

  • File /etc/ofono/ril_subscription.conf should contain:

    [Settings]
    EmptyConfig=true
    

9.4   SIM card not detected

  • This often causes a bootloop

  • Cellular Modem bringup is now in HADK v1.1.1 section 13.3

  • Additional checks:

  • Replicate /dev/block structure from Android as closely as possible (for rild to be able to access the modem partition)

    • Run ls -lR /dev/block in CM
    • Run ls -lR /dev/block in Sailfish OS
    • diff the two outputs (this is WIP - android's toolbox ls might need more parameters to produce a comparable output)
  • If you see differences you need to add custom udev rules to create the correct /dev/block structure

  • (added automatically since 2016-12-10) For devices with /dev/block/platform/msm_sdcc.1/by-name/ paths (msm_sdcc.1 can be different) add to $ANDROID_ROOT/rpm/ these paths and files with contents, and it most probably will help (but still paste your diff to the IRC channel):

  • (added automatically since 2017-06-03) Some devices (at least all hybris-13.0 based ports) have /dev/block/bootdevice/by-name/ as /dev/block structure in CM in which case you need to add the following line to the end of the 998-droid-system.rules file in the last link:

    ENV{ID_PART_ENTRY_SCHEME}=="gpt", ENV{ID_PART_ENTRY_NAME}=="?*", IMPORT{program}="/bin/sh /lib/udev/platform-device $env{DEVPATH}", SYMLINK+="block/bootdevice/by-name/$env{ID_PART_ENTRY_NAME}"
    
  • If you have logcat and journal error messages suggesting that RIL/ofono can't power the modem on and you have a qcom chipset, have a look in your init.qcom.rc for lines that power it on when the boot animation (bootanim) stops. If you have those, try this (paths may need correcting): https://github.com/stephgosling/android_device_htc_m7-common/commit/9f4abdca65356090e6dd6f0356c5cf4a1870aa5f (note the typo there in the chown line!)

  • If you have pil-q6v5-mss fc880000.qcom,mss: modem: Failed to locate modem.mdt in your dmesg then try this steps:

10   Bluetooth

10.1   Fix remembering Bluetooth state on reboot

10.2   Devices with binderized Bluetooth (Android 8.1/LineageOS 15.1 or newer)

  • Not available on all Android 8.1+ devices especially if device was originally using older Android base
  • Enable CONFIG_BT_HCIVHCI=y in kernel defconfig, rebuild kernel and repackage droid-hal
  • Add bluebinder to patterns and rebuild config packages

10.3   Qualcomm devices (Android 7 (Lineage 14.1) or older)

10.4   Using backported Bluetooth drivers in 3.4 kernel for devices with Qualcomm bluetooth chip using hci_smd driver

10.5   Broadcomm devices (Android 7 (Lineage 14.1) or older)

11   FM radio

11.1   Qualcomm

12   Vibrator

12.1   ff-memless haptics

To use memless haptics driver instead of droid-vibrator, you need a kernel haptics driver that supports a memless interface (evdev). This is briefly explained in HADK pdf chapter 13.1.

13   Miscellaneous

13.1   Bootctl fixes (Operation not permitted)

13.2   Flashlight shortcut

  • Starting from Sailfish 2.0.2 it's possible to have flashlight shortcut in eventsview. If your device supports flash torch mode add jolla-settings-system-flashlight package to patterns in your droid-configs repo. The shortcut can be enabled in the eventsview settings.

13.3   Actdead charging animation

13.4   Failed at step OOM_ADJUST spawning /usr/libexec/mapplauncherd/booster-qt5: Permission denied

13.5   perf :)

  • MER_SDK $:

    cd $ANDROID_ROOT
    mkdir -p perf/rpm
    cd perf
    ln -s $ANDROID_ROOT/kernel/$VENDOR/$DEVICE linux
    curl -o rpm/perf.spec http://pastebin.com/raw/QiW7FD02
    
  • Replace string <YOUR_KERNEL_VERSION> in rpm/perf.spec with kernel version for which you're building perf (for example: 3.4.0):

    mb2 -s rpm/perf.spec -t $VENDOR-$DEVICE-armv7hl build
    mv RPMS/*.rpm $ANDROID_ROOT/droid-local-repo/$DEVICE/
    createrepo $ANDROID_ROOT/droid-local-repo/$DEVICE
    
  • "less" package is needed for perf to format its output. You can find it here: http://repo.merproject.org/obs/nemo:/testing:/hw:/common/sailfish_latest_armv7hl/

13.6   Access Android's virtual SD card (needs more massaging)

13.7   If the pm-service complains about no permissions its because PARANOID_NETWORK is required for your kernel config

13.8   Kernel changes needed for updated systemd in Sailfish 2.1.1.X

13.9   Devices that have qseecomd usually have issues getting to UI so its best to disable it in the init.$DEVICE.rc

13.10   Problems with tfa9890

  • Copy /system/etc/firmware to /etc/firmware. Symlink or mount doesn't work! (But why?)

13.11   Fixing the screen timeout issue

  • If display gets automatically blanked from lockscreen, but not when in app/home -> logical diffrences between those include:
    1. user activity (=input events) does not reset blanking timers in lockscreeen,
    2. similarly some blanking inhibitors are ignored while lockscreen is active
  • In past there have been constantly reporting , such as gyros that have been mistaken for something that user is doing -> check with evdev_trace if there is something that sends events regularly
  • Could be some blanking inhibit mode (keep display on while charging, demo-mode & co), or some application doing blank prevent ping-pong with mce -> check with "dbus-monitor --system sender=com.nokia.mce" what kind of signals get emitted when swiping away from lockscreen / shortly after
  • https://github.com/sailfishos-wt88047/droid-config-wt88047/commit/4512092dbba56ac9a6bf69cb034ceca8512f5a38

14   OBS build and Over-the-Air updates (OTA)

14.1   OBS build

  • Benefits: automated builds, Jolla Store (see below), OTA (see below); local PC is then only needed for Android, dhd, audioflingerglue and droidmedia building (which barely happen when port becomes stable), and mic image creation
  • It makes sense to go OBS as soon as you have polished your code, minimised hacks, and pushed it to github (usually when display+touch+WLAN and maybe cellular are working)
  • On IRC ask r0kk3rz, mal, or sledges to create project and get maintainership for your nemo:devel:hw:$VENDOR:$DEVICE (you can try things out in your home repo first)
  • Click on Repositories tab in your nemo:devel:hw:$VENDOR:$DEVICE
    • Then "Add repositories"
    • Check "SailfishOS latest"
    • Click "Add selected repositories" at the bottom of the page
  • Add a hw:devel:common repo to build against (which contains all important backports for all ports:), you'll need to add it as an additional repo:
    • Click on Repositories tab in your nemo:devel:hw:$VENDOR:$DEVICE
    • Click "Edit repository"
    • Click Add additional path to this repository
    • Project: nemo:devel:hw:common
    • Repository: sailfish_latest_armv7hl
  • Check how other devices are built here e.g.
  • Create droid-hal-$DEVICE package manually and upload RPMs for droid-hal-device and droidmedia (and audioflingerglue if device needs it)
  • For all other packages create webhooks and trigger builds
  • Add cibot as maintainer, then ask lbt via IRC to "patternise" your nemo:devel:hw:$VENDOR:$DEVICE
  • Build an image successfully on your PC by following HADK but, using .ks file from droid-config-$DEVICE-ssu-kickstarts-*.rpm built on OBS (don't forget to sed the repos and add nemo:hw:devel:common as adaptation1, this will help you more: http://images.devaamo.fi/sfe/mako/gamma6/Jolla-2.0.1.11-mako-armv7hl.ks )

14.2   Over-the-Air updates (OTA)

Prerequisities

14.3   OBS-less OTA updates

Follow the "OTA (Over-the-Air) Updates" chapter in HADK.

For ports that already have and established OTA via the current Sailfish OBS, this is how to switch your current users to the self-hosted repository:

  • Add the following two lines to your config spec:
diff --git a/droid-config-$DEVICE.spec b/droid-config-$DEVICE.spec
 %define community_adaptation 1
+# OTA via self-hosted repo needs to have all adaptation-community repos removed
+Conflicts: community-adaptation-testing
+Obsoletes: community-adaptation-testing
  • Once you have tested the switch-over successfully, publish the changes made to your droid-configs repo to the existing OBS, so that all the users of your port can update and thus switch to your provided repository hosting.
  • The above switch-over will remove both adaptation-community and adaptation-community-common repos. The latter is for the backports, which means it will be porter's responsibility to maintain backports after having switched to a self-hosted server.

15   Jolla Store access

  • Your device adaptation should be on Sailfish OS OBS (read "Building things on OBS" above)
  • Do ssu s on your device, Device UID should show a unique ID that is:
  • IMEI for devices with modem, note - your GSM modem should provide a valid IMEI even without an inserted SIM! Always a good cross-check that IMEI matches the one on your phone's box or under battery, and in CM/Lineage/Android
  • For devices without modem -- WLAN or BT MAC address.
  • Find another port/phone and prove that unique ID there is different than yours, and that all of them persist across reboots.
  • If unique ID is OK then ping pketo on #sailfishos-porters with "Device model" line from ssu s to enable store for you.