Downloading and Compiling Android9.0.0-2.0.0 BSP on Ubuntu16.04.2 LTS

Document created by Wigros Sun Employee on May 5, 2019Last modified by Wigros Sun Employee on May 5, 2019
Version 2Show Document
  • View in full screen mode

Some of Chinese customer couldn’t normally download android source code from
google site, here give a way to download android source from Mirror site of Tsinghua
University.

Preparations

1. Installing Ubuntu16.04.2 LTS
Customer can download ubuntu-16.04.2-desktop-amd64.iso from
https://www.ubuntu.com/download/desktop
Then install it to VMware workstation player v12 or PC, after finishing installation, use
“Software Update” to update system.
In order to compile android9.0.0-2.0.0 BSP, necessary packages should also be
installed on Ubuntu 16.04.
$ 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
$ sudo apt-get install device-tree-compiler
$ sudo apt-get install gdisk
$ sudo apt-get install liblz4-tool
$ sudo apt-get install m4
$ sudo apt-get install libz-dev

More detail, see Android_User’s_Guide.pdf ( android 9.0.0-2.0.0 BSP documents)

2. Downloading and unpacking Android release package
https://www.nxp.com/support/developer-resources/evaluation-and-developmentboards/
sabre-development-system/android-os-for-i.mx-applicationsprocessors:
IMXANDROID?tab=Design_Tools_Tab
-- P9.0.0_2.0.0_GA_ANDROID_SOURCE
File name is imx-p9.0.0_2.0.0-ga.tar.gz
# cd ~
# tar xzvf imx-p9.0.0_2.0.0-ga.tar.gz

Downloading Android 9.0.0-2.0.0 source code

1. Getting repo
# cd ~
# mkdir bin
# cd bin
# curl https://mirrors.tuna.tsinghua.edu.cn/git/git-repo > ~/bin/repo
# chmod a+x ~/bin/repo
# export PATH=${PATH}:~/bin
2. Modifying repo File
Open ~/bin/repo file with 'gedit' and Change google address

From
REPO_URL = 'https://gerrit.googlesource.com/git-repo'
To
REPO_URL = ' https://mirrors.tuna.tsinghua.edu.cn/git/git-repo/ '

3、Setting email address
# git config --global user.email "xxxx@nxp.com"
# git config --global user.name "xxxx"
[ Email & Name should be yours]
4、Modifying android setup script and Running it
Open ~/imx-p9.0.0_2.0.0-ga/imx_android_setup.sh and add a line like below:

... ...

if [ "$rc" != 0 ]; then
echo "---------------------------------------------------"
echo "-----Repo Init failure"
echo "---------------------------------------------------"
return 1
fi
find -name 'aosp-p9.0.0_2.0.0-ga.xml'| \
xargs perl -pi -e 's|https://android.googlesource.com/|https://aosp.tuna.tsinghua.edu.cn/|g'
fi

... ...

Then save it and exit.
# cd ~/
# source ~/imx-p9.0.0_2.0.0-ga/imx_android_setup.sh
Then android_build directory is created at ~/
If fetching errors occur, like below, run “repo sync” again.

# repo sync

 

# export MY_ANDROID=~/android_build
[Note] imx_android_setup.sh will be in charge of downloading all android source
code.

5.Begin to compile android 9.0.0-2.0.0 BSP
$ export ARCH=arm64
$ export CROSS_COMPILE=${MY_ANDROID}/prebuilts/gcc/linuxx86/aarch64/aarch64-linuxandroid-4.9/bin/aarch64-linux-android-
$ cd ~/android_build/vendor
$ cp -r ~/imx-p9.0.0_2.0.0-ga/vendor/* ./
$ cd ~/android_build
$ source build/envsetup.sh
$ lunch evk_8mm-userdebug
$ make –j4

NXP TIC team
Weidong sun
2019-05-05

Outcomes