You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 3 Next »

The Android source tree is located in a Git repository hosted by Google. The Git repository includes metadata for the Android source, including changes to the source and when the changes were made. This page describes how to download the source tree for a specific Android code-line.

To start with a factory image for a specific device instead of downloading the source, see Selecting a device build - download an image - raspberry pi or emulator

Installing Repo

Repo is a tool that makes it easier to work with Git in the context of Android. For more information about Repo, see the Repo Command Reference (point to create section) and Repo README.

Repo comes in two parts: One is a launcher script you install, and it communicates with the second part, the full Repo tool included in a source code checkout. To install Repo:

  1. Make sure that you have a bin/ directory in your home directory and that it's included in your path:

    mkdir ~/bin PATH=~/bin:$PATH
  2. Download the Repo Launcher and ensure that it's executable:

    curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo chmod a+x ~/bin/repo

Initializing a Repo client


After installing the Repo Launcher, set up your client to access the Android source repository:

  1. Create an empty directory to hold your working files. If you're using macOS, this has to be on a case-sensitive filesystem. Give it any name you like:

    mkdir WORKING_DIRECTORY 
    cd WORKING_DIRECTORY

  2. Configure Git with your real name and email address. To use the Gerrit code-review tool, you need an email address that's connected with a registered Google account. Make sure that this is a live address where you can receive messages. The name that you provide here shows up in attributions for your code submissions.

    git config --global user.name "Your Name" 
    git config --global user.email "you@example.com"

  3. Run repo init to get the latest version of Repo with its most recent bug fixes. You must specify a URL for the manifest, which specifies where the various repositories included in the Android source are placed within your working directory.

    repo init -u https://android.googlesource.com/platform/manifest

    repo init -u https://code.rdkcentral.com/r/manifests -m <manifestfile.xml> –b <branch name>


    example : repo init -u https://code.rdkcentral.com/r/manifests -m rdkv-raspberrypi.xml –b morty

To check out a branch other than master, specify it with -b. For a list of branches, 

A successful initialization ends with a message stating that Repo is initialized in your working directory. Your client directory should now contain a .repo directory where files such as the manifest are kept.

Downloading the RDK Source tree

To download the RDK source tree to your working directory from the repositories as specified in the default manifest, run:

repo sync

The RDK source files are located in your working directory under their project names. To speed syncs, use the -jthreadcount flag. Also consider adding -qc to conduct quiet, current branch syncs only. See the Repo Command Reference for more details.

Using authentication

By default, access to the RDK source code is anonymous and for restricted content user need to set up credential in .netrc file

In that case, you can use authenticated access, which then uses a separate quota for each user, regardless of the IP address.

The first step is to create a password with the password generator and follow the instructions on the password generator page.

The second step is to force authenticated access by using the manifest URI  https://code.rdkcentral.com/r/manifests.  Notice how the /r/ directory prefix triggers mandatory authentication. You can convert an existing client to use mandatory authentication with the following command:

repo init -u https://code.rdkcentral.com/r/manifests

Troubleshooting Network issues

When downloading from behind a proxy (which is common in some corporate environments), you might need to to explicitly specify the proxy that is then used by Repo:

export HTTP_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port> 
export HTTPS_PROXY=http://<proxy_user_id>:<proxy_password>@<proxy_server>:<proxy_port>

More rarely, Linux clients experience connectivity issues, getting stuck in the middle of downloads (typically during receiving objects). It's been reported that tweaking the settings of the TCP/IP stack and using non-parallel commands can improve the situation. You need root access to modify the TCP setting:

sudo sysctl -w net.ipv4.tcp_window_scaling=0 repo sync -j1

Using local mirror


Note: We may need to verify this section, we should publish if it is working.

When using several clients, especially in situations where bandwidth is scarce, it's better to create a local mirror of the entire server content, and to sync clients from that mirror (which requires no network access). The download for a full mirror is smaller than the download of two clients, while containing more information.

These instructions assume that the mirror is created in /usr/local/aosp/mirror. First, create and sync the mirror itself. Notice the --mirror flag, which you can specify only when creating a new client:

mkdir -p /usr/local/aosp/mirror 
cd /usr/local/rdk/mirror
repo init -u https://code.rdkcentral.com/r/manifests --mirror
repo sync

When the mirror is synced, you can create new clients from it. Note that it's important to specify an absolute path:

mkdir -p /usr/local/rdk/master 
cd /usr/local/rdk/master
repo init -u /usr/local/rdk/mirror/platform/manifest.git
repo sync

Finally, to sync a client against the server, sync the mirror against the server, then the client against the mirror:

cd /usr/local/rdk/mirror
repo sync
cd /usr/local/rdk/master
repo sync

It's possible to store the mirror on a LAN server and to access it over NFS, SSH, or Git. It's also possible to store it on a removable drive and to pass that drive among users or machines.


  • No labels