This git repository contains specifications used by the anagrman tool to create local_manifest.xml files with the specified modules (project bundles or feature packages). The following instructions will guide you in downloading a complete Android OS source tree, extract the firmware blobs, build, and install. If you need to restore a factory image, see: https://developers.google.com/android/nexus/images 1. Preparations: anagrman Get git://git.collabora.co.uk/git/android/anagrman.git From there you get the command 'anagrman' which is a python script. It will be needed later for creating a local_manifest.xml. Set up udev rules for Galaxy Nexus, as described in http://source.android.com/source/initializing.html Install the repo tool as described here: http://source.android.com/source/downloading.html so that you have the 'repo' command in your PATH. 2. Downloading: Get the Android tree used for Samsung Galaxy Nexus: $ mkdir galaxy-nexus && cd galaxy-nexus $ repo init -u git://git.collabora.co.uk/git/android/manifest.git Select the modules you want with anagrman, a local_manifest.xml file is written in the current directory. This example selects wayland: $ cd .repo $ anagrman -m wayland $ cd .. Fetch it all, this will take a while: $ cd galaxy-nexus && repo sync -j2 $ cd .. You may need to run 'repo sync' multiple times, if some git repositories fail to download. This will take quite a while, depending on your internet speed. 3. Environment setup The following is a summary from http://source.android.com/source/building.html $ cd galaxy-nexus $ source build/envsetup.sh $ lunch and select full_maguro-userdebug. You need to do this every time you launch a new shell to work in. 4. Build device tools We follow http://source.android.com/source/building-devices.html like this: $ make fastboot adb On your Galaxy Nexus device, go to Settings -> Developer options, and enable USB debugging. After that, plug the device to your computer via USB. 5. Unlocking the device Reboot the device into the bootloader: $ adb reboot-bootloader Unlock the device: $ fastboot oem unlock and follow the intructions appearing on the device, and finally reboot the device. Booting may take a while, and when it is ready, enable USB debugging again, see Section 4. 6. Extracting the firmware blobs First, download all the packages for you particular device from http://code.google.com/android/nexus/drivers.html and get the shell scripts from the packages. Go to your android root directory (galaxy-nexus), and run the scripts you got from the packages. Then, we download more firmware directly from the device: $ cd device/samsung/maguro $ ./extract-files.sh Now you have all the firmware blobs in your Android tree. It is nice to save those for later, in case you need them: $ cd galaxy-nexus $ tar zcf vendor-backups.tar.gz vendor The blobs can also be extracted again, if you first flash the factory image into your device. 7. Building We assume you have executed Section 3, Environment setup. To build everything: $ m That will take several hours. The build process will configure all projects that use autotools, and generate their Android makefiles. Due to this process, GNU Make will automatically reload all makefiles 2-3 times during the first build. 8. Installing First, make sure your build completed successfully: $ m It should not build anything more at this point, and it should exit successfully. The device needs to be set into fastboot mode again: $ adb reboot-bootloader You install everything into your device by: $ fastboot -w flashall The device will reboot automatically, and afterwards you should have the new Android OS running in your device. Don't worry if the device "spontaneously" reboots once more. That is just Android finalising the installation. If nothing appears on screen in few minutes, something could be wrong. See Appendix A, Troubleshooting. Appendix A. Troubleshooting: If after building 'repo sync' fails with a dirty source tree, try $ make contrib-reset If the command 'adb root' fails with "adbd cannot run as root in production builds", verify that you chose a userdebug variant for 'lunch'. If any 'adb' command says "device not found", make sure you have the udev rules in place and the device plugged in and turned on. If after installation, the device does not show anything on screen, try to see what it is doing: $ adb logcat '*:V' Appendix B. Special make targets: contrib-reset For every autotools project, run the equivalent of 'git reset --hard HEAD' and 'git clean -dxf'. Does not remove any build products, that are outside the source trees (all Android build system products). Usually used with contrib-clean as: 'make contrib-clean contrib-reset' contrib-clean Runs the clean- targets for all non-AOSP modules. Note, that is not a special clean-up rule like 'clean' is. If there are makefiles to generate, they will be generated, before contrib-clean runs. Removes Android build system products with the benefit of not wiping the whole out/. contrib-debug Prints some info, like configure variables and found pkg-config packages.