= Porting the Ubuntu for Phones Android ROM patches to another source tree = The Android components in Ubuntu for Phones are currently built from a CyanogenMod based ROM source tree. This approach was selected for several reasons: * the CM sources are more developer friendly than the vanilla AOSP, both in the tooling and in the resulting ROM build * the community is larger and more active * the number of devices supported is very large However most OEMs and some independent developers would like to port Ubuntu to a device that is not supported by CyanogenMod but which already has Android built from AOSP, CodeAurora or some other AOSP based tree. For these developers a we provide an AOSP based tree to avoid the overhead required by porting the CM patches to another tree. There are trivial and more intrusive changes which take time to port otherwise. This tree contains in addition to the Ubuntu patches the components unique in Ubuntu such as hybris, platform-api, upstart-property-watcher and external/gpg so only the vendor/ and device/ dirs need adding to start targetting a new device. You can browse both the CM and AOSP based repositories here (eventually they should be separate instead of this mixed up gitweb view but for now simply making the AOSP ones available was a priority) http://phablet.ubuntu.com/gitweb == Tools == This set of scripts lets one export patches from and apply patches to AOSP like trees, for example getting the above mentioned phablet changes and applying them against vanilla AOSP. https://github.com/janimo/phablet-patches == Example porting to an AOSP based tree == Here's how to port our patches to a vendor tree based on AOSP 4.2.2 : === Step 0: Create a mirror === Using an AOSP mirror is recommended. It makes creating new throwaway trees or trees for separate ports much faster than always getting them from the network. {{{ $ 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 }}} === Step 1: Check out our AOSP tree with Ubuntu modifications in place === Pass --reference only if you followed step 0 {{{ $mkdir phablet-4.2.2 && cd $_ $repo init -u git://phablet.ubuntu.com/aosp/platform/manifest.git -b phablet-4.2.2_r1 --reference /path/to/aosp/mirror $repo sync -j 4 }}} === Step 2: Export the Ubuntu patches === If your changes to AOSP are minimal (device/ vendor/ and few other changes) you may apply them and start building. If you'd prefer applying the Ubuntu changes to your original tree you'll need to export the patches using the tools mentioned above by supplying the git refs to diff and the destination directory to place the patches in. This will be created if it does not already exist. The patches are in 'git am' format {{{ $ /path/to/phablet-patches-export android-4.2.2_r1 aosp/phablet-4.2.2_r1 /path/to/patchesdir }}} === Step 3: Apply the patches to your tree === {{{ $ cd /path/to/vendor/aosptree $ /path/to/phablet-patches-appy /path/to/patchesdir }}} Ideally the above will go smoothly but it is likely that you will get some merge conflicts, or missing projects resulting in failed patch applications. You'll see the errors reported by the tool. For each of those patches you can go in the destination project, then apply and resolve them manually. If for example one of the Bionic patches fails you can do this: {{{ $git apply --reject /path/to/patchesdir/bionic/0002-Better-TLS-handling-over-hybris-dev-alog-migration.patch }}} Then merge the Ubuntu changes with your own and commit. === Step 4: Add the Ubuntu project === Check out the default manifest file of the Ubuntu tree and add the last section (Ubuntu components) to your own manifest so you have the Ubuntu glue in your sources.