This document provides instructions for building and running the Android Nougat 7.1 source code on NXP's i.MX 6Q SABRE-SD platform. It describes how to:
1) Set up a Linux build environment and download the necessary source code repositories
2) Apply patches to integrate support for the i.MX 6Q hardware
3) Build the Android system images
4) Program the images to an SD card using MFGTool
5) Boot the Android system on the i.MX 6Q SABRE-SD board
2. Preface
The document describes how to build Android Nougat 7.1 platform for the
i.MX6 and i.MX7 series SABRE devices. It provides instructions for
• Setting up a Linux build environment
• Downloading, patching, and building the software components that
create the Android system image
• Copying the images to a boot media
• Hardware/software configurations for programming the boot media and
running the images
3. Agenda
1) Setting up your computer
2) Getting Android source code (AOSP)
3) Getting kernel and U-Boot source code
4) Apply all the i.MX Android patch
5) Building Android images
6) Programming images with MFGTool
7) Booting
4. Agenda
1) Setting up your computer
2) Getting Android source code (AOSP)
3) Getting kernel and U-Boot source code
4) Apply all the i.MX Android patch
5) Building Android images
6) Programming images with MFGTool
7) Booting
5. Setting up your computer: 64-bit environment
Ubuntu 14.04 LTS, 64-bit
• 16GB RAM
• 300GB disk space
• http://ftp.ubuntu-tw.org/mirror/ubuntu-releases/14.04.5/ubuntu-14.04.5-
desktop-amd64.iso
8. Setting up your computer: JDK (cont.)
OpenJDK8 Installation
$ sudo dpkg -i openjdk-8-jre-headless_8u45-b14-1_amd64.deb
9. Setting up your computer: JDK (cont.)
OpenJDK8 Installation
$ sudo dpkg -i openjdk-8-jre_8u45-b14-1_amd64.deb
10. Setting up your computer: JDK (cont.)
OpenJDK8 Installation
$ sudo dpkg -i openjdk-8-jdk_8u45-b14-1_amd64.deb
11. Setting up your computer: Required package on
the Android website
// Installing required packages for Android(Ubuntu 14.04)
$ sudo apt-get install git-core gnupg flex bison gperf build-essential zip curl
zlib1g-dev gcc-multilib g++-multilib libc6-dev-i386 lib32ncurses5-dev
x11proto-core-dev libx11-dev lib32z-dev ccache libgl1-mesa-dev
libxml2-utils xsltproc unzip
12. Setting up your computer: Additional requested
packages
$ sudo apt-get install uuid uuid-dev zlib1g-dev liblz-dev liblzo2-2 liblzo2-
dev lzop git-core curl u-boot-tools mtd-utils android-tools-fsutils
libncurses5-dev
13. Agenda
1) Setting up your computer
2) Getting Android source code (AOSP)
3) Getting kernel and U-Boot source code
4) Apply all the i.MX Android patch
5) Building Android images
6) Programming images with MFGTool
7) Booting
14. Getting Android source code
• Installing Repo tool
$ cd ~
$ mkdir bin
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
• Create working directory
$ mkdir android_7.1.1_r13 && cd android_7.1.1_r13
• Configure git with your real name and email address
$ git config --global user.name "Your Name"
$ git config --global user.email “you@example.com”
• Check out a branch
$ ~/bin/repo init -u https://android.googlesource.com/platform/manifest -b
android-7.1.1_r13
$ ~/bin/repo sync # This command loads most needed repos.
Therefore, it can take several hours to load
16. Agenda
1) Setting up your computer
2) Getting Android source code (AOSP)
3) Getting kernel and U-Boot source code
4) Apply all the i.MX Android patch
5) Building Android images
6) Programming images with MFGTool
7) Booting
17. Getting kernel and U-Boot source code
Get N7.1.1_1.0.0 kernel source code from Freescale open source git:
$ cd ~/android_7.1.1_r13
$ git clone git://git.freescale.com/imx/linux-imx.git kernel_imx
$ cd kernel_imx
$ git checkout n7.1.1_1.0.0-ga
18. Getting kernel and U-Boot source code (cont.)
Clone the U-Boot git repository from the open source git:
$ cd ~/android_7.1.1_r13/bootable
$ mkdir bootloader && cd bootloader
$ git clone git://git.freescale.com/imx/uboot-imx.git uboot-imx
$ cd uboot-imx
$ git checkout n7.1.1_1.0.0-ga
19. Agenda
1) Setting up your computer
2) Getting Android source code (AOSP)
3) Getting kernel and U-Boot source code
4) Apply all the i.MX Android patch
5) Building Android images
6) Programming images with MFGTool
7) Booting
20. Patch standard features code package
Download i.MX 6 Android 7.1.1 Nougat BSP source code from the link
(need to sign in NXP web site):
http://www.nxp.com/products/software-and-tools/software-development-tools/i.mx-software-
and-tools/i.mx-6series-i.mx-7series-software-and-development-tool-resources:IMX_SW
21. Patch standard features code package (cont.)
Save the “android_N7.1.1_1.0.0_source.tar.gz” file in the local folder. For
example: /opt/
22. Patch standard features code package (cont.)
Unpacking the Android release package
$ cd /opt
(or any other directory where the android_N7.1.1_1.0.0_source.tar.gz file is placed)
$ tar xzf android_N7.1.1_1.0.0_source.tar.gz
23. Patch standard features code package (cont.)
Apply all the i.MX Android patches by performing the following steps:
$ cd ~/android_7.1.1_r13
$ source /opt/android_N7.1.1_1.0.0_source/code/N7.1.1_1.0.0/and_patch.sh
$ 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
25. Agenda
1) Setting up your computer
2) Getting Android source code (AOSP)
3) Getting kernel and U-Boot source code
4) Apply all the i.MX Android patch
5) Building Android images
6) Programming images with MFGTool
7) Booting
26. Building Android images
Argument <Build name>-<Build type> string for the build configuration
command lunch
• The Build Name is the Android device name found in the directory
~/myandroid/device/fsl/
27. Building Android images (cont.)
Android build steps are as follows:
$ cd ~/android_7.1.1_r13
$ source build/envsetup.sh
$ lunch sabresd_6dq-eng
$ make BUILD_TARGET_DEVICE=emmc -j8 2>&1 | tee imx6q_android-7.1.1.1_r13_eng.log
29. Building Android images (cont.)
Compiling with Jack – Out of memory error
$ jack-admin stop-server
$ vi ~/android_7.1.1_r13/prebuilts/sdk/tools/jack-admin
Add –Xmx option in the JACK_SERVER_COMMAND for Host memory size limitation
$ jack-admin start-server
30. Building Android images (cont.)
The following outputs are generated by default in
WORKING_Directory/out/target/product/sabresd_6dq:
• root/: root file system (including init, init.rc). Mounted at /.
• system/: Android system binary/libraries. Mounted at /system.
• data/: Android data area. Mounted at /data.
• recovery/: root file
• boot-imx6q.img: composite image for i.MX 6Dual/6Quad SABRE-SD, which includes the kernel
zImage, ramdisk, board's device tree binary, and boot parameters.
• ramdisk.img: ramdisk image generated from "root/". Not used directly.
• system.img: EXT4 image generated from "system/". It can be programmed to "SYSTEM" partition on
SD/eMMC card with "dd".
• recovery-imx6q.img: EXT4 image for i.MX 6Dual/6Quad SABRE-SD, which is generated from
"recovery/". Can be programmed to the "RECOVERY" partition on SD/eMMC card with "dd".
• u-boot-imx6q.imx: U-Boot image with no padding for i.MX 6Dual/6Quad SABRE-SD.
31. Building Android images (cont.)
An example for the SABRE Board for Smart Devices i.MX 6Dual/Quad is:
$ cd ~/WORKING_DIRECTORY
$ source build/envsetup.sh
$ lunch sabresd_6dq-user
$ make
To create Android platform over-the-air, OTA, and package, the following
make target is specified:
$ make otapackage
For more Android platform building information, see
source.android.com/source/building.html.
32. Agenda
1) Setting up your computer
2) Getting Android source code (AOSP)
3) Getting kernel and U-Boot source code
4) Apply all the i.MX Android patch
5) Building Android images
6) Programming images with MFGTool
7) Booting
33. Programming images with MFGTool
The images needed to create an Android system on MMC/SD are listed
below:
‧ U-Boot image: u-boot.imx
‧ boot image: boot.img
‧ Android system root image: system.img
‧ Recovery root image: recovery.img
35. Programming images with MFGTool (cont.)
Download MFGTool from the link (need to sign in NXP web site):
http://www.nxp.com/products/software-and-tools/software-development-tools/i.mx-software-
and-tools/i.mx-6series-i.mx-7series-software-and-development-tool-resources:IMX_SW
36. Programming images with MFGTool (cont.)
Android Quick Start Guide (AQSUG) for a detailed description of MFGTool.
37. Programming images with MFGTool (cont.)
Android Quick Start Guide (AQSUG) for a detailed description of MFGTool.
38. Programming images with MFGTool (cont.)
Android Quick Start Guide (AQSUG) for a detailed description of MFGTool.
39. Programming images with MFGTool (cont.)
Copy the image files to the
MFGTool-Dir/Profiles/Linux/OS/Firmware/files/android/sabresd path
$ cd android_7.1.1_r13/out/target/product/sabresd_6dq/
$ cp *imx6q.im* ~/android_N7.1.1_1.0.0_tools/mfgtools/Profiles/Linux/OS
Firmware/files/android/sabresd/
$ cp system.img ~/android_N7.1.1_1.0.0_tools/mfgtools/Profiles/Linux/OS
Firmware/files/android/sabresd/