Finally got everything working.
Notes here in case anyone else is interested, or I forget what I did later.
Building the kernel and android system using phablet-tools is much easier and actually takes up less space than manually doing a repo sync for just the kernel! (Fits comfortably in a 30GB vm).
On an ubuntu 16.04 vm:
sudo add-apt-repository ppa:phablet-team/tools
sudo apt-get update
sudo apt-get install phablet-tools
Install build requirements:
sudo dpkg --add-architecture i386
sudo apt-get update
sudo apt-get install git gnupg flex bison gperf build-essential \
zip bzr curl libc6-dev libncurses5-dev:i386 x11proto-core-dev \
libx11-dev:i386 libreadline6-dev:i386 libgl1-mesa-glx:i386 \
libgl1-mesa-dev g++-multilib tofrodos \
python-markdown libxml2-utils xsltproc zlib1g-dev:i386 schedtool \
g++-4.8-multilib
Ignore section about installing repo, there is already a package for it which is a dependency of phablet-tools
mkdir ~/phablet
cd ~/phablet
repo init -u https://github.com/ubports/android -b ubp-5.1
local manifest (for oneplus one):
touch .repo/local_manifests/oneplus_bacon.xml
I used this for oneplus_bacon.xml:
<?xml version="1.0" encoding="UTF-8"?>
<manifest>
<project path="device/oneplus/bacon" name="ubports/android_device_oneplus_bacon-1" remote="ubp" />
<project path="device/oppo/common" name="ubports/android_device_oppo_common" remote="ubp" />
<project path="device/qcom/common" name="android_device_qcom_common" remote="cm" />
<project path="kernel/oneplus/msm8974" name="ubports/android_kernel_oneplus_msm8974" remote="ubp" revision="refs/heads/ubp-5.1-caf" />
<project path="vendor/oppo" name="proprietary_vendor_oppo" remote="them" />
<project path="vendor/oneplus" name="proprietary_vendor_oneplus" remote="them" />
</manifest>
Then:
repo sync
...and wait for a long time...
change whatever you want, then:
. build/envsetup.sh
lunch
and select 9 (cm_bacon-userdebug)
make
My experiments were not very successful - I thought that some of the high battery usage might be partially due to the kernel not being properly tuned for the way the phone operates and wakes on ubuntu-touch.
Unfortunately, nothing I tried made much difference really - the phone is simply waking a lot and doing a lot in the background and no kernel tuning is going to make a big difference to the amount of power that uses.
RC OTA-4 (16.04) has just been released though, so I'll have a play with that and have another look at the kernel later.