AndroidDevel

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

Using mirrors

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 Smile :)

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.

Removals

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.

Additions

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.

  • external/busybox
  • system/su
  • external/gpg
  • external/htop
  • external/libncurses
  • external/wpa_supplicant_8_ti
  • 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/platform-api
  • ubuntu/hybris
  • ubuntu/upstart-property-watcher - part of the manifest, gets checked out automatically

Patches

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

https://code.launchpad.net/~jani/+junk/ufp-export and run

./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.

  • system/security/0001-Fixing-narrowing-errors.patch
  • system/core/0012-init.rc-moving-sensorservice-to-late_start-to-avoid-.patch
  • system/core/0008-Temporary-hack-to-force-adb.patch
  • system/core/0013-property_service.c-adding-support-for-getprop-and-li.patch
  • system/core/0002-Mount-yaffs2-data-partition-without-nosuid.patch
  • system/core/0014-Fix-failure-to-build-from-source-with-modern-_host_-.patch
  • system/core/0009-init.rc-sensorservice-should-also-be-under-the-input.patch
  • system/core/0001-Running-adb-as-root-by-default.patch
  • system/core/0007-init.rc-dev-fd-needs-to-be-linked-to-proc-self-fd-fo.patch
  • system/core/0003-Porting-Android-s-log-path-to-dev-alog-to-avoid-conf.patch
  • system/core/0004-Updating-init.rc-to-include-our-needed-services.patch
  • system/core/0011-init.rc-allowing-any-user-to-use-the-vibrator-driver.patch
  • system/core/0006-Do-not-try-starting-inexistent-services-in-init.rc.patch
  • system/core/0010-init.rc-allow-anyone-to-read-proc-cmdline.patch
  • system/core/0005-init.rc-pass-init-as-a-parameter-to-ubuntu_chroot.patch
  • system/core/0015-Revert-init.usb.rc-set-sys.usb.config-to-none-before.patch
  • system/extras/0001-Porting-Android-s-log-path-to-dev-alog-to-avoid-conf.patch
  • bionic/0003-_system_properties.h-adding-PROP_MSG_GETPROP-and-PRO.patch
  • bionic/0001-Adding-bionic-changes-for-better-tls-handly-over-hyb.patch
  • bionic/0002-bionic-Add-workarounds-for-current-compilers.patch
  • external/libpng/0001-Revert-Switch-back-to-LOCAL_CLANG-with-std-gnu89.patch
  • external/protobuf/0001-Disabling-build-for-java-libraries.patch
  • external/liblzf/0001-Removing-java-host-build-for-liblzf.patch
  • external/jhead/0001-Remove-exif-jni.patch
  • frameworks/base/0001-Disabling-build-for-libdrmframework_jni.patch
  • frameworks/base/0002-Enabling-the-dispatcher-by-default-as-with-ICS.patch
  • frameworks/base/0004-mResampleTouch-should-not-be-const-to-avoid-gcc-4.6-.patch
  • frameworks/base/0005-Remove-permission-checks-for-services-in-the-service.patch
  • frameworks/base/0003-Propagate-events-down-all-layers-in-InputDispatcher..patch

  • frameworks/native/0003-Disabling-android-gui-specific-tests-not-needed.patch
  • frameworks/native/0002-binder-don-t-use-android-s-check-permission-feature.patch
  • frameworks/native/0005-sensorservice-adding-sleep-to-avoid-race-condition-d.patch
  • frameworks/native/0001-Disabling-not-needed-tests.patch
  • frameworks/native/0004-Disabling-communication-with-the-batteryinfo-service.patch
  • frameworks/av/0002-libstagefright-removing-dependency-on-chromium_http.patch
  • frameworks/av/0003-Disabling-build-of-chromium_http.patch
  • frameworks/av/0001-Remove-need-for-SchedulingPolicyService-JAVA-based.patch

  • hardware/libhardware_legacy/0001-Setting-current-stream-volume-as-max-by-default.patch
  • hardware/ril/0001-Remove-credential-check-for-rild.patch
  • hardware/ti/wpan/0001-Disabling-builds-for-extras-and-not-needed-tools.patch
  • hardware/ti/omap4xxx/0001-Disabling-tf_daemon-and-CameraHal-for-proper-phablet.patch

  • hardware/qcom/display/0001-Fixing-signed-x-unsigned-comparison-for-gcc-4.7.patch

Touch/AndroidDevel (last edited 2014-05-29 15:03:36 by bm-3096932868)