Introduction
This post describes how to build Ubuntu Touch for Motorola Photon Q. It’s based on the official porting guide. If you face any issues or have doubts, please consult the official porting guide.
Requirements
This guide assumes that you are using Ubuntu Linux as your host OS. All the commands are relevant to Ubuntu only.
Preparing the environment
Before you start with the actual build you will have to prepare the environment by installing the necessary tools and libraries:
- Install the phablet-tools package:
sudo apt-get install phablet-tools
Note: Prior Ubuntu 14.04 you will need to set up the tools PPA first.
- Then, install all the other packages, you will need:
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 mingw32 tofrodos \ python-markdown libxml2-utils xsltproc zlib1g-dev:i386 schedtool \ g++-4.8-multilib
Checkout Ubuntu and Android source
- Create a new “phablet” directory, that will contain the source code and checkout there:
mkdir phablet phablet-dev-bootstrap phablet
- Edit the .repo/local_manifests/roomservice.xml file in order to add the git repositories that are specific to Photon Q:
<?xml version="1.0" encoding="UTF-8"?> <manifest> <remote fetch="git://github.com/" name="gh"/> <project name="CyanogenMod/android_device_qcom_common" path="device/qcom/common" remote="gh" revision="stable/cm-11.0" /> <project name="CyanogenMod/android_device_motorola_qcom-common" path="device/motorola/qcom-common" remote="gh" revision="stable/cm-11.0" /> <project name="CyanogenMod/android_kernel_motorola_msm8960-common" path="kernel/motorola/msm8960-common" remote="gh" revision="stable/cm-11.0" /> <project name="CyanogenMod/android_device_motorola_moto_msm8960" path="device/motorola/moto_msm8960" remote="gh" revision="cm-11.0-3.0" /> </manifest>
- Download the additional repositories, added above:
phablet-dev-bootstrap phablet -c
Building
Proprietary files
The following files were missing from my phone:
/system/etc/firmware/melfas_45_7_15.fw
/system/lib/hw/vendor-camera.msm8960.so
/system/lib/libc2d2_a3xx.so
/system/lib/libc2d2_z180.so
/system/xt897/lib/libaudcal.so
/system/xt897/etc/firmware/atmxt-r2.tdat
/system/xt901/lib/libqmiservices.so
/system/xt901/lib/libril-qc-qmi-1.so
/system/lib/libExtendedExtractor.so
/system/lib/libOmxAmrwbplusDec.so
Download missing files https://gitlab.com/aosplus/platform_vendor_moto (or setup repository)
Photon Q specific changes
- Remove all java related projects, because they are not needed. I did that by searching for *.java files:
find . -name *.java
Go to the folders, returned by find and either rename all Android.mk files or erase the entire folder. I renamed the files Android.mk in the following folders:
./device/motorola/moto_msm8960/QCMediaPlayer ./device/motorola/moto_msm8960/AsantiKeypad ./device/motorola/qcom-common/modules/DevicePerformanceSettingsHelper
- Create a vendorsetup.sh file, full_moto_msm8960 is the makefile
Enable Ubuntu-specific kernel config options by executing:
./check-config kernel/motorola/msm8960-common/arch/arm/configs/msm8960_mmi_defconfig -w
Note: check-config can be found here.
Actual Build
Build sequence:
. build/envsetup.sh lunch full_moto_msm8960-userdebug make -j8
Build issues
This section describes some of the changes, I’ve made for the code to build.
device/motorola/qcom-common/sepolicy/file.te:
type sysfs_wake_lock, fs_type, sysfs_type;
vim hardware/qcom/display/msm8960/common.mk
common_includes += hardware/qcom/msm8960/kernel-headers
vim hardware/qcom/audio/legacy/alsa_sound/Android.mk
dd AudioUsbALSA.cpp \
cp device/motorola/moto_msm8960/include/private/android_filesystem_config.h device/motorola/qcom-common/include/private
Flashing the image
After the build is complete, the device specific images such as boot.img, system.img, recovery.img will be located in .
This images can be flashed using fastboot to the respective partitions.
As our Ubuntu image is not built by the Android build system, the best approach is to just flash it directly using rootstock, like described bellow (from bootloader):
fastboot boot out/target/product/mako/boot.img
fastboot recovery out/target/product/mako/recovery.img
bzr branch lp:project-rootstock-ng
cd project-rootstock-ng/
./rootstock-touch-install utopic-preinstalled-touch-armhf.tar.gz out/target/product/mako/system.img
Helpful Commands
Rebooting the phone
To reboot the device, press and hold the power key + volume down key for 10 to 20 seconds.
Mount the sdcard
In order to mount the sdcard:
adb shell mount -o rw /dev/block/platform/msm_sdcc.3/mmcblk1p1 /mnt/sdcard/
Have you got this working? I’d love to try Ubuntu touch on my Razr M, if you’re willing to share files!
I don’t mind sharing the files, but unfortunately I wasn’t able to get Ubuntu Touch working. It’s booting fine, but the display doesn’t work, so you can only connect using adb.
Do you have any details about the display issues?
The last issue was:
E/qdmemalloc( 1567): clean_buffer: ION_IOC_CLEAN_INV_CACHES failed with error – Inappropriate ioctl for device
did u changed this?
# Needs to be changed for M
DEVICE_RESOLUTION := 720×1280
#DEVICE_RESOLUTION := 540×960