Disclaimer
The step-by-step guidelines below provided by ARM for your convenience contain information about downloading and installing files, licensed by third parties, which are subject to their own licence terms and conditions. Your use of such downloads are expressly subject to those third party terms. You hereby agree to comply with all the terms and conditions imposed on you by the relevant third party terms. You acknowledge that ARM shall have no liability to you in respect of those third party files and that your use of the step-by-step guidelines is at your own risk.
WARNING: Use at your own risk.
Following the steps below will void the warranty of your Nexus 10 device and all user data on the device will be deleted.
Only follow this guide if you understand the risks and if you are interested in doing Android development.
This guide provides instructions to build Android AOSP from source with the latest ARM Mali-T60x GPU binary drivers and install it on a Google Nexus 10. It is primarily targeted at developers who wish to have complete control over an engineering build of Android on a production-quality device, with all graphics development features enabled.
If you only want to develop applications then Factory Images for Nexus Devices - Nexus Files for Developers — Google Developers may be just what you need to get the latest stock Android version on your device.
If you want to profile your application on a standard system then you may want to look at Using DS-5 Streamline with Mali on Google Nexus 10.
If you want to do any of the above and also modify or debug Android itself or use the very latest Mali GPU drivers, then this may help you. Please note that you will end up with a plain AOSP engineering system without Google Play or any other Google proprietary application installed on your Nexus 10 device.
In addition to having a Nexus 10 device, please take a look at Downloading and Building | Android Developers to find out you what you'll need.
Once you have a capable system at hand, please follow the instructions about Initializing a Build Environment | Android Developer. The steps below summarise what this involves and should work in most cases and have been tested on Ubuntu 12.04 and 14.04 as well as Debian 7.5.
You'll need to install the Java 7 JDK and packages as explained on this page:
https://source.android.com/source/initializing.html#installing-the-jdk
https://source.android.com/source/initializing.html#installing-required-packages-ubuntu-1404
On Debian, you'll need to run the following commands first and then install the Ubuntu 12.04 packages listed on the page mentioned above:
sudo dpkg --add-architecture i386 sudo apt-get update
Install Google's repo command following the instructions at the top of the following page:
https://source.android.com/source/downloading.html#installing-repo
Only install repo but do not follow the other instructions to manually get the source code and build it. There is a script attached to this page which will get the correct source code version and build it with the correct options for Nexus 10 as described in the next steps.
Download the attached mali_nexus10-setup_001.tar.gz set-up archive which contains the set-up script, kernel patches and configuration files and extract it on your disk. This is where all the build commands will be run from.
tar xzf mali_nexus10-setup_???.tar.gz cd mali_nexus10-setup_???
The set-up script will replace the ARM Mali GPU driver binary found in stock Nexus 10 AOSP firmware with the latest version available from ARM. You will need to download the driver manually for Mali-T60x on Android 5.0 after accepting the terms of the End User License Agreement:
http://malideveloper.arm.com/resources/drivers/arm-mali-midgard-gpu-user-space-drivers/
The downloaded binary archive mali-t60x_r5p0-06rel0_android-5.0_1.tar.gz needs to be placed in the current set-up directory.
If you want to be able to profile your system and capture the CPU and GPU activity then you will need DS-5 Downloads | ARM DS-5 Development Studio
Then you'll need to extract the source code for the Gator kernel driver and user-side daemon in order to use DS-5 Streamline with your Nexus 10 device. This is necessary to let it connect to your device and capture the activity data. Still within the set-up directory, run these commands after adjusting the paths to the DS-5 installation directory:
tar xzf $HOME/DS-5/arm/gator/driver-src/gator-driver.tar.gz tar xzf $HOME/DS-5/arm/gator/daemon-src/gator-daemon.tar.gz
The script will look for the gator-driver and gator-daemon directories. If they are present, it will build and install Gator on the Android file system. Otherwise, it will ignore Gator and proceed without it. It is always possible to build Gator later and install it manually; see 5. Manual mode for mode details.
In order to build the user-side Gator daemon mentioned in the previous step, download the Android NDK for Linux and install it somewhere on your computer:
https://developer.android.com/tools/sdk/ndk/index.html
Add the Android NDK to your PATH variable. This should typically look like this but you'll need to adjust it to match your installation paths:
PATH=$HOME/android-ndk-rX:$PATH
You should now have all these files in your set-up directory (Gator is optional):
$ ls data gator-daemon gator-driver mali-t60x_r5p0-06rel0_android-5.0_1.tar.gz nexus10-setup.sh
To automatically download all the code for the Linux kernel and Android and build it, run this command:
./nexus10-setup.sh do_everything
As well as downloading the source code, it will also download proprietary firmware files distributed by Google that are not part of AOSP. They are necessary in order to get sound, wireless network and graphics to work. You will need to accept the licensing terms when the script will extract them in the set-up directory.
Getting the Android source code takes a long time and may sometimes fail due to network errors, so it may be necessary to run the command again to resume. In case you're experiencing problems, you may want to only rerun certain steps of the process manually; see 5. Manual mode for more details.
Please note that if you have less than 8GB of RAM then you'll probably need to create an extra swap partition as some libraries take a huge amount of RAM to link during the build. Of course using swap will be slower than having enough RAM but it will work. You can create a temporary swap of 4GB with the following commands:
dd if=/dev/zero of=swap-file bs=4096 count=1048576 sudo losetup /dev/loop0 swap-file sudo mkswap /dev/loop0 sudo swapon /dev/loop0
If all went well in step 3, the script should have printed this information at the end of the process:
To flash your device, reboot it in bootloader mode by pressing Volume-Up + Volume-Down + Power or running this command: adb reboot bootloader Then run: cd nexus10-mali-r5p0-06rel0 sudo ./nexus10-setup.sh flashall
The adb command should have been built as part of the AOSP build and can be found here:
aosp/out/host/linux-x86/bin/adb
Alternatively, Download Android Studio and SDK Tools | Android Developers contains adb and other standard Android tools.
If you follow these instructions and run the flashall command then your fresh Android build should be flashed on the device and it should reboot automatically at the end of the process.
The manual mode can be used to diagnose issues or to do more advanced things, for example to modify the source code and rebuild only a part of it. When run with no argument, the script produces a detailed help message. A summary of that is available below:
Usage:
./nexus10-setup.sh COMMAND [OPTIONS...]
Run all the commands to build everything from scratch.
Get the AOSP source code and pre-built binaries.
Get the Linux kernel source code.
Build the Linux kernel.
Build the Gator driver and daemon if directories are present.
Build AOSP and create the Android file systems.
Create a tarball with files ready to be flashed on a Nexus 10 device.
Thank you for this tutorial, good work