Getting Android5.1.1 Source Code (For China only)

Document created by Wigros Sun Employee on Jan 3, 2016Last modified by Wigros Sun Employee on Nov 9, 2016
Version 4Show Document
  • View in full screen mode

Some Chinese customers using i.MX series SoC maybe encounter some issues when they download android , u-boot & kernel source code by 'git' command, the following steps will show customer how to get them:

1. Getting repo

--No.1 methord

# cd ~

# mkdir myandroid

# mkdir bin

# cd bin

# git clone git://

<if git failed, use : git clone>

# cd git-repo

# cp ./repo ../

--No.2 methord

# cd ~

# mkdir bin

# curl > ~/bin/repo

# chmod a+x ~/bin/repo

[Note]Customers can select one of above to get "repo"

2. Modifying repo File
Open ~/bin/repo file with 'gedit' and Change google address

       REPO_URL = ''
       REPO_URL = 'git://'

       like following:

## repo default configuration


REPO_URL = 'git://'

REPO_REV = 'stable'

3Setting email address

# cd ~/myandroid

# git config --global ""

# git config --global "weidong.sun"


[ Email & Name should be yours]

4Getting manifest

# ~/bin/repo init -u -b android-5.1.1_r1

# cd ~/myandroid/.repo

# gedit manifest.xml

       Then change the value of fetch to " git:// ", like following:


  <remote name="aosp"

           fetch="git://" />

  <default revision="refs/tags/android-5.1.1_r1"


[Note] android-5.1.1_r1 is version of branch,customer can change it to another.

5# ~/bin/repo sync

         [Note] During runing repo sync, maybe errors will occur like the following:


* [new tag]         studio-1.4 -> studio-1.4


error: Exited sync due to fetch errors

         Then 'repo sync' exits. But don't worry about it, continue to run the command please !

" ~/bin/repo sync", downloading source code will be continous.

6Getting Cross Compiler

# cd ~/myandroid/prebuilts/gcc/linux-x86/arm

# git clone

# cd arm-eabi-4.6

# git checkout android-4.4.3_r1

7Getting linux kernel source code

       Probably, customer can't normally get linux kernel by using "git clone" command, she can download it directly from the following weblink:


       At first, create a temperary directory, then download kernel into the directory. see following steps:

# cd ~ /Downloads

# mkdir linux-kernel

  Atfer downloading l5.1.1_2.1.0-ga.tar.gz, use 'tar zxvf l5.1.1_2.1.0-ga.tar.gz' command to decompress it.

       Then you can find a subdirectory name " l5.1.1_2.1.0-ga" is created, linux source code is in the directory, we should copy all files in the directory to ~/myandroid/kernel_imx/


# cd ~/myandroid

# mkdir kernel_imx

# cd kernel_imx

# cp -a ~ /Downloads/linux-kernel/l5.1.1_2.1.0-ga ./

8Getting uboot source code

              Probably, customer can't normally get linux kernel by using "git clone" command, she can download it directly from the following weblink:


       We can use similar way to that of linux kernel to get u-boot source code:

# cd ~ /Downloads

# mkdir u-boot

       Download l5.1.1_2.1.0-ga.tar.gz file, and save it in ~ /Downloads/ u-boot, then decompress it, then u-boot source code will be in ~ /Downloads/ u-boot / l5.1.1_2.1.0-ga/, we should copy all file in the path to ~/myandroid/bootable/bootloader/uboot-imx/


# cd ~/myandroid/bootable/bootloader

# mkdir uboot-imx

# cd uboot-imx

# cp -a ~ /Downloads/u-boot/l5.1.1_2.1.0-ga/* ./


9Patch android BSP source code

       android_L5.1.1_2.1.0_consolidated-ga_core_source.gz is the name of patch. Run following command to patch android.


# copy android_L5.1.1_2.1.0_consolidated-ga_core_source.gz /opt/

# tar zxvf android_L5.1.1_2.1.0_consolidated-ga_core_source.gz

# cd /opt/ android_L5.1.1_2.1.0_consolidated-ga_core_source/code/

# tar zxvf L5.1.1_2.1.0_consolidated-ga.tar.gz


# cd ~/myandroid

# source /opt/ android_L5.1.1_2.1.0_consolidated-ga_core_source/code/ L5.1.1_2.1.0_consolidated-ga/

# help


# c_patch /opt/ android_L5.1.1_2.1.0_consolidated-ga_core_source/code/ L5.1.1_2.1.0_consolidated-ga/ imx_L5.1.1_2.1.0-ga


       If everything is OK, the following logs will display on console:



       Success: Now you can build the Android code for FSL i.MX platform


10Patch Freescale extended feathures code

       Please refer to chapter 3.3 of Android_User's_Guide.pdf to patch another 2 files:

       (1) android_L5.1.1_2.1.0_consolidated-ga_omxplayer_source.gz

       (2) android_L5.1.1_2.1.0_consolidated-ga_wfdsink_source.gz



      As for other steps, such as compiling etc, please refer to Android_User's_Guide.pdf that released by NXP.


TICS team

Weidong Sun


3 people found this helpful