The general idea is to bring Android app support to SailfishOS on OnePlus X (ONE E1003 a.k.a. onyx). Now you only get the barebone CM that boots and is mostly functional, but won't give you working SailfishOS with Android support. Bluetooth seems to mute audio. I haven't tried telephony. Turning selinux off doesn't seem to have any effect (SailfishOS doesn't work with selinux).
When in TWRP go to Advanced>Terminal and type getprop. Look for ro.product.device. If it says ONE go ahead to next stage. If it says onyx means you are stuck with version 2.x of TWRP -try updating inside recovery by choosing install image. TWRP 3.0-1 will change ro.product.device to ONE. This source code checks out with OxygenOS 2.2.0 so I suggest updating or downgrading the stock firmware to that level. Stock recovery will install stock firmware at least the rooted one. To install TWRP you need to unlock the bootloader. Instructions on https://forum.xda-developers.com/oneplus-x/general/guide-oneplus-x-how-to-unlock-t3748730. From this point on the instructions cover Linux environment. Storage occupied is somewhere around 120 GB. flash card of at least 1 GB for the zipped installers.
We'll be using ubuntu chroot from Sailfish HADK, so prepare the environment for starters. https://sailfishos.org/wp-content/uploads/2017/09/SailfishOS-HardwareAdaptationDevelopmentKit-2.0.1.pdf Building instructions for onyx https://gist.github.com/rinigus/7fa2f6f9aebfa340d8496ec8f46d0e43 Note that for sfdroid_renderer by kimmoli to install you have to add libhybris-libGLESv1 to patterns. Sfdroid can be made into an installable package.
mkdir -p ~/android/system
cd ~/android/system/
repo init -u https://github.com/LineageOS/android.git -b stable/cm-12.1-YOG7D
cd .repo/local_manifests
curl -O https://gist.githubusercontent.com/paulivil/9d28f98ad40eae350464c35b155e6054/raw/onyx.xml
The actual sfdroid patched sources are commented out at this stage.
onyx.xml is among the files in this gist
~/android/system/.repo/manifest.xml
- revision="refs/tags/android-5.1.1_r37" />
+ revision="refs/tags/android-5.1.1_r38" />
This takes some time, about 80GBytes
cd ~/android/system
repo sync
rm -rI ~/android/system/device/oppo/common/configpanel/
rm -rI ~/android/system/device/oppo/common/keyhandler/
rm -rI ~/android/system/device/oppo/common/cmhw/
~/android/system/device/oneplus/onyx/overlay/packages/services/Telecomm/res/values/config.xml
- <bool name="config_speed_up_audio_on_mt_calls">true</bool>
+<!-- <bool name="config_speed_up_audio_on_mt_calls">true</bool> -->
sdk
ubu-chroot -r $MER_ROOT/sdks/ubuntu
cd ~/android/system
This might be needed or not (ref bouncycastle errors)
sudo apt-get install unzip
hadk
cd ~/android/system
source build/envsetup.sh
export USE_CCACHE=1
breakfast $DEVICE
croot
brunch $DEVICE
Build time was roughly 4 hours with i3
Current status: make completed successfully
scp /home/pauli/android/system/out/target/product/onyx/cm-12.1-20180415-UNOFFICIAL-onyx.zip nemo@....:/media/sdcard/nnnn-nnnn/
Wipe, factory reset
Install zip
reboot system
Uncomment the sfdroid sources, comment out the matching sources from default.xml located in .repo/manifests
cd ~/android/system
repo sync --force-sync
place buildscript on the root of ~/android/system and make it runnable chmod a+x buildscript.sh
sdk
ubu-chroot -r $MER_ROOT/sdks/ubuntu
hadk
cd ~/android/system
./buildscript.sh
exit
Use pack-sfdroid.sh (make it runnable first) in the same way like buildscript to create archive
make hybris/mw/sfdroid folder
Copy the resulting sfdroid-0.0.0.tgz to your hybris/mw/sfdroid folder
make rpm folder within sfdroid folder and place sfdroid.spec in there.
Once you get to prepare your SailfishOS hardware adaptation you can also build the installable package
rpm/dhd/helpers/build_packages.sh --build=hybris/mw/sfdroid
add sfdroid to patterns eg. onyx specific section and don't forget to add libhybris-libGLESv1 (in addition to v2)
This will bring sfdroid launcher (two actually) to Sailfish. But you have to install it separately once Sailfish is up and running. sfdroid_renderer is built in obs, https://build.merproject.org/package/show/home:kimmoli:sfdroid/sfdroid_renderer
ssu ar kimmoli-sfdroid http://repo.merproject.org/obs/home:/kimmoli:/sfdroid/sailfish_latest_armv7hl/
devel-su pkcon repo-set-data kimmoli-sfdroid refresh-now true
devel-su pkcon install sfdroid_renderer
located at PlatformSDK:$ANDROID_ROOT/system/core/rootdir
import /init.trace.rc
+import /init.sfdroid.rc
#Include CM's extra init file
If you build your hybris-hal after adding this line it will transfer to your device. Alternatively you can edit your file via ssh connection or adb shell (using vi). drop init.sfdroid.rc file into root of hybris/droid-configs/sparse folder before processing patterns
OpenJDK 7 needed for succesfull compilation.
If you get some BouncyCastle error with file keys, run this command (change paths) from outside ubuntu chroot
java -jar \
/home/$USER/android/system/out/host/linux-x86/framework/dumpkey.jar \
build/target/product/security/testkey.x509.pem \
build/target/product/security/cm.x509.pem \
build/target/product/security/cm-devkey.x509.pem > \
/home/$USER/android/system/out/target/product/scorpion/obj/PACKAGING/ota_keys_intermediates/keys