Getting the code
Getting the Android ROM sources that Ubuntu is relying on can be done using only the standard git and repo tools that Android ROM developers are already familiar with.
Install the repo tool first as described here: http://source.android.com/source/downloading.html#installing-repo
Note : repo init can optionally be passed --reference /path/to/existing/source/tree where the latter is an existing checkout of an Android ROM source tree or mirror. This will share several Gb of git objects with the referenced repo and result in much lower disk footprint. It is especially helpful if you have more than one tree checked out simultaneously.
Note : repo sync -j 8 instructs repo to use 8 concurrent threads to sync from the repo. You can use any number there or drop -j 8 altogether. Syncing from a local mirror on fast SSD, multiple threads do not make much difference. With slow and blocking network connection on the other hand, being able to go in parallel results in significant speedups.
A direct checkout
Use this if you want to get the sources in the simplest way possible and without plans to do long term development. If you think you'll do serious development check out the next section instead.
mkdir -p /path/to/phablet; cd /path/to/phablet repo init -u https://code-review.phablet.ubuntu.com/p/aosp/platform/manifest.git -b phablet-4.4.2_r1 repo sync -j 8
repo init -u git://phablet.ubuntu.com/CyanogenMod/android.git -b phablet-saucy
It is recommended you first create a local mirror to speed up the creation of new work trees. Getting 15Gb via the network is quite slow even if you have a good connection.
Using an AOSP mirror (optional)
If you already have a local AOSP mirror or plan on doing work on an AOSP based tree in addition to the phablet/CyanogenMod one, you can optionally use this mirror as a starting point for the phablet mirror itself If not, skip to the next section
mkdir -p /path/to/aosp-mirror cd /path/to/aosp-mirror repo init -u https://android.googlesource.com/mirror/manifest --mirror repo sync -j 8
Creating the phablet mirror
If you do not use an AOSP mirror as well, drop the --reference /path/... parameter in the repo init below
mkdir -p /path/to/phablet-mirror cd /path/to/phablet-mirror repo init -u https://code-review.phablet.ubuntu.com/p/aosp/platform/manifest.git --mirror --reference /path/to/aosp-mirror repo sync -j 8
Now to initialize a working tree from a local mirror do
mkdir -p /path/to/phablet; cd /path/to/phablet repo init -u /path/to/phablet-mirror/p/aosp/platform/manifest.git -b phablet-4.4.2_r1 --reference /path/to/phablet-mirror repo sync
Android ROM changes made in order to support Ubuntu Touch
Official Ubuntu Touch ROMs are based on CyanogenMod 10.1 which in turn is based on AOSP 4.2.2. People may want to build Ubuntu Touch ROM images out of other source trees that may be at different versions and/or be based from AOSP, CodeAurora or other Android source trees.
STEP 1: Getting the ROM changes from Ubuntu Touch repositories
The Ubuntu Touch ROM git repositories are still being developed in so it's good to be able to extract the latest set of changes from them.
This shows the paths of all individual git repositories (also called projects in repo/Android terminology) underneath a repo checkout of the Android source tree.
repo list | cut -f 1 -d\
We can use the output of this command to compare the projects making up various Android trees.
A lot of code and data are removed and entire git repos excluded from the original CyanogenMod build in order to drastically reduce build-times and because they are not needed to help run Ubuntu. Almost everything Dalvik, Java and Android app support related is removed for instance.
These projects are in the Ubuntu Touch tree but not in CodeAurora. The ones explicitly required for Ubuntu Touch are gpg and the CWM tree.
- prebuilts/gcc/linux-x86/arm/linaro-4.7.2 - The fallback toolchain used on Ubuntu if there's no system wide cross toolchain installed. The AOSP toolchain is only 3rd choice so make sure you either use this for custom ROM builds or watch out for possible gcc 4.6 related errors.
The following ones are the bridge between the running Ubuntu and Android systems.
- ubuntu/assets - various data
- ubuntu/upstart-property-watcher - part of the manifest, gets checked out automatically
The majority of git repos in Ubuntu Touch have a few branches named similarly
phablet/cm-10.1 - the original CyanogenMod branches phablet/phablet-10.1 - the original Ubuntu Touch branches phablet/phablet-saucy - the new Ubuntu Touch branches cleaned up and working only with flipped images. To be the default branches sometimes.
This will not include projects that do not have cm-10.1 or phablet branches but that's ok as those are mostly prebuilt toolchains, device/ vendor trees or the Ubuntu repos themselves
This prints the projects that have no phablet-saucy branch and either need to be ignored or moved wholesale in the new ROM tree.
repo forall -c 'git branch -a|grep phablet-saucy >/dev/null || echo $REPO_PATH'
For now get the scripts from
./extract-diffs phablet/cm-10.1 phablet/phablet-saucy patches_dir
There is a particularly large (~1GiB) patch that is the result of removing a lot of files in frameworks/base. That does not apply to other trees cleanly so it is better to ignore it and have a script explicitly removing files and directories to achieve the same effect.
Step 2: Applying the changes to another Android tree
Use the apply-diffs script and for patches that fail do git apply --reject /path/to/0001-XXXXX.patch and fix it up manually.
Description of the patches
While most ROM patches are adding features some are build fixes to make it work with gcc 4.7 or to further disable components that are not removed wholesale from the tree: The patches against device/ vendor/cm build/ and recovery/ are omitted from this listing so only the core patches are here.