Compiling Android7.1.1 BSP on Ubuntu16.04.2 LTS

Document created by Wigros Sun Employee on Mar 15, 2017
Version 1Show Document
  • View in full screen mode

        The document will introduce how to setup cross‐compiling environment for android
android7.1.1 BSP on Ubuntu 16.04.2 LTS, The purpose is to help i.MX customers create
android BSP environment quickly, from this, save customer’s time and let them focus on
the development of their product.
Customer can compile android7.1.1 BSP according to the following steps:

‐‐Installing Ubuntu160.4.2 LTS
1. Running software updater to update system

      Customer can download ubuntu‐16.04.2‐desktop‐amd64.iso from
Then install it to VMware workstation player v12 or PC, after finishing installation, use
“Software Updater” to update system.

2. Installing necessary packages

   Before compiling android7.1.1 source code, we need to install some neccesary software packages, see following, please!

$ sudo apt-get install gnupg
$ sudo apt-get install flex
$ sudo apt-get install bison
$ sudo apt-get install gperf
$ sudo apt-get install build-essential
$ sudo apt-get install zip
$ sudo apt-get install zlib1g-dev

$ sudo apt-get install libc6-dev
$ sudo apt-get install lib32ncurses5-dev
$ sudo apt-get install x11proto-core-dev
$ sudo apt-get install libx11-dev
$ sudo apt-get install lib32z1-dev
$ sudo apt-get install libgl1-mesa-dev
$ sudo apt-get install tofrodos
$ sudo apt-get install python-markdown
$ sudo apt-get install libxml2-utils
$ sudo apt-get install xsltproc
$ sudo apt-get install uuid-dev:i386 liblzo2-dev:i386
$ sudo apt-get install gcc-multilib g++-multilib
$ sudo apt-get install subversion
$ sudo apt-get install openssh-server openssh-client

$ sudo apt-get install uuid uuid-dev
$ sudo apt-get install zlib1g-dev liblz-dev
$ sudo apt-get install liblzo2-2 liblzo2-dev
$ sudo apt-get install lzop
$ sudo apt-get install git-core curl
$ sudo apt-get install u-boot-tools
$ sudo apt-get install mtd-utils
$ sudo apt-get install android-tools-fsutils
$ sudo apt-get install openjdk-8-jdk

3. Downloading android7.1.1 source code, u‐boot, linux kernel
3.1 Downloading android7.1.1 source code

3.1.1 Getting source code from google .

   if users can access google site, she can get source code accroding to steps in "Android_User's_Guide.pdf" released by NXP

3.1.2 Getting source code from the server of tsinghua university( this is for customer in China )


(1) Getting repo
# cd ~
# mkdir myandroid
# mkdir bin
# cd bin
# git clone
# cd git‐repo
# cp ./repo ../

(2) Modifying repo File

Open ~/bin/repo file with 'gedit' and Change google address

(3) Setting email address

# cd ~/myandroid
# git config --global "email address"
# git config --global "name"

[ Email & Name should be yours]

(4) Modifying manifest.xml

# ~/bin/repo init -u -b android-7.1.1_r13
# cd ~/myandroid/.repo
# gedit manifest.xml
Then change the value of fetch to " ", like
<remote name="aosp"
fetch="" />
<default revision="refs/tags/android-5.1.1_r1"

(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.
3.2 Getting uboot source code

$ cd ~/myandroid/bootable
$ mkdir bootloader
$ cd bootloader
$ git clone git:// uboot-imx
$ cd uboot-imx
$ git checkout n7.1.1_1.0.0-ga

3.3 Downloading linux kernel

$ cd ~/myandroid
$ git clone git:// kernel_imx

$ cd kernel_imx
$ git checkout n7.1.1_1.0.0-ga

4. Downloading android7.1.1 BSP source code and patch it above source code

4.1 Android7.1.1 BSP can be downloaded from the link:

Android OS for i.MX Applications Processors|NXP 

---Board Support Packages (66)

After downloading it, copy it to /opt/

4.2 Patch it to android source code

$ cd ~/myandroid
$ source /opt/android_N7.1.1_1.0.0_source/code/N7.1.1_1.0.0/
$ help

$ c_patch /opt/android_N7.1.1_1.0.0_source/code/N7.1.1_1.0.0/ imx_N7.1.1_1.0.0

If everything is OK, "c_patch" generates the following output to indicate the successful patch:

5. Compiling android7.1.1 BSP source code for i.MX boards

$ export ARCH=arm
$ export CROSS_COMPILE=~/myandroid/prebuilts/gcc/linux-x86/arm/armlinux-androideabi-4.9/bin/arm-linux-androideabi-

$ cd ~/myandroid
$ source build/
$ lunch sabresd_6dq-user
$ make –j2   (Using 2 CPU cores to compile)


Probably, users will enconter this error during compiling:

[Solve it like this:]

$ export ANDROID_JACK_VM_ARGS="-Dfile.encoding=UTF-8 -XX:+TieredCompilation -Xmx4g"

$  cd ~/myandroid
$ ./prebuilts/sdk/tools/jack-admin kill-server

then run "make " to continue compiling.


After compiling, we can see images in output path:




Hope above items can help you!


If customers have questions about the document, she can submit case to me by our saleforce system. the following is how to submit cases to us:


In case a new customer is asking how to submit a technical case on ,here is a template for your reference.
1) Please visit and click on Support on the top of the webpage.
2) Select Sales and Support under Support Resources session.
3) Scroll down to the bottom ,click on “hardware & Software” .
4) Register by your business email to enter NXP Community
5) Get verification email and verify your account.
6) Select "contact support" on the top and click “submit a new case” to start the process.
Then label : "please forward it to TIC Weidong Sun" in your content , I can get it.



NXP TIC team Weidong.Sun

2017-03-16 in Shanghai China

2 people found this helpful