Building an AOSP based system.img
This is an example of building the AOSP based Ubuntu for Phones tree to run on the Nexus 4. This only builds the Android parts, that is the system.img run within the LXC container and the Android initrd that is included in that system.img. The Ubuntu boot.img and root file system are independent of the Android source tree.
Flash the device with the official images. See https://wiki.ubuntu.com/Touch/Install#Flashing_the_device for details. Make sure you have all the prerequisite packages for building the Android ROM tree. Check the https://wiki.ubuntu.com/Touch/Building#Set_up_your_development_environment section.
Get the AOSP based tree
Currently you should try phablet-4.4.2_r1.
Check out the AOSP 4.4.2 based Ubuntu for Phones tree. It includes everything (including vendor blobs) needed to get a working system.img
$ mkdir phablet-4.4.2 && cd $_ $ repo init -u git://phablet.ubuntu.com/aosp/platform/manifest.git -b phablet-4.4.2_r1 (here you can optionally pass --reference /path/to/aosp/mirror if you have an AOSP mirror set up.) $ repo sync -j 4 $ bzr branch lp:~phablet-team/phablet-tools/aosp-vendor-4.4.2 vendor
You can also use phablet-dev-bootstrap (which includes repo init and sync) in order to include the vendor binary blobs:
$ mkdir phablet-4.4.2 $ phablet-dev-bootstrap -v mako phablet-4.4.2
$ source ./build/envsetup.sh $ lunch aosp_mako-userdebug $ make -j 8
Copy to the device
From recovery (adb reboot recovery):
$ ./build/tools/update-system-img.sh out/target/product/mako/system.img