Skip to main content

← Back to EPC-R3720

EPC-R3720 Android 11 User Guide

Android BSP Version

Android 11.0.0

Kernel 5.10.72

Build Environment on Host

Currently, we adopt Docker as build environment.

You can get the latest version of advrisc/u18.04-rk3399abv10 Docker image for developing Rockchip RK3399 and rk3568 projects.

Docker command:

docker pull advrisc/u18.04-rk3399abv10:latest;

Run Docker example

Step1 Run docker container (example)

docker run --privileged -it --name android_R11 -v /home/your-name/myandroid:/home/adv/BSP:rw advrisc/u18.04-rk3399abv10 /bin/bash

Step2 In container, change the user. (example)

$ sudo chown adv:adv BSP

Getting Android Source Code

$ cd ~/BSP
$ mkdir bin
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ./bin/repo
$ mkdir imx8_android_R11
$ cd imx8_android_R11
$ git config --global user.name "Your Name"
$ git config --global user.email you@example.com
$ git config --global http.postBuffer 52428800000
$ git config --global http.maxRequestBuffer 100M
$ git config --global core.compression 0
$ ../bin/repo init -u https://dev.azure.com/AIM-Linux/RISC-IMX-Android11/_git/android-manifest -b android-11.0.0_2.6.0 -m default.xml
------If you want to get the latest code, please use default.xml------
$ ~/bin/repo sync

Getting Prebuilts  (must download)

Baidu:prebuilts.tar.gz Key: 1234    DropBox: prebuilts.tar.gz

Exit docker and copy the file to /home/your-name/myandroid
$ cp prebuilts.tar.gz /home/your-name/myandroid/imx8_android_R11/android

In container and Unzip file
$ docker attach android_R11
$ tar zxvf ~/BSP/imx8_android_R11/android/prebuilts.tar.gz

Compile all

i.MX Android platform needs some preparation for the first time when building the images. The image build steps are as follows:

Prepare the build environment for U-Boot and Linux kernel.
    This step is mandatory because there is no GCC cross-compile tool chain in the one in AOSP codebase.An approach is provided to use the self-installed GCC cross-compile tool chain.
   a. Download the tool chain for the A-profile architecture on arm Developer GNU-A Downloads page. It is recommended to use the 8.3 version for this release. You can download gcc-arm-8.3-2019.03-x86_64-aarch64-elf.tar.xz or gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz . The first one is dedicated for compiling bare-metal programs, and the second one can also be used to compile the application programs.
  b. Decompress the file into a path on local disk, for example, to /opt/ . Export a variable named AARCH64_GCC_CROSS_COMPILE to point to the tool as follows:

gcc-arm-8.3


# if "gcc-arm-8.3-2019.03-x86_64-aarch64-elf.tar.xz" is used
$ sudo tar -xvJf gcc-arm-8.3-2019.03-x86_64-aarch64-elf.tar.xz -C /opt
$ export AARCH64_GCC_CROSS_COMPILE=/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-elf/bin/aarch64-
elf-

# if "gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz" is used
$ sudo tar -xvJf gcc-arm-8.3-2019.03-x86_64-aarch64-linux-gnu.tar.xz -C /opt
$ export AARCH64_GCC_CROSS_COMPILE=/opt/gcc-arm-8.3-2019.03-x86_64-aarch64-linux-
gnu/bin/aarch64-linux-gnu-

The clang used to compile Linux kernel needs to be a newer version. Perform the following steps to set the clang to be used
to compile Linux kernel:

$ sudo git clone https://android.googlesource.com/platform/prebuilts/clang/host/linux-x86 /opt/
prebuilt-android-clang -b master-kernel-build-2021
$ cd /opt/prebuilt-android-clang
$ sudo git checkout bceb7274dda5bb587a5473058bd9f52e678dde98
$ export CLANG_PATH=/opt/prebuilt-android-clang

The preceding export commands can be added to /etc/profile . When the host boots up, AARCH64_GCC_CROSS_COMPILE
and CLANG_PATH are set and can be directly used.

Build U-boot

Build U-boot

$ ./imx-make.sh bootloader -j8

Build Kernel

Build Kernel

$ ./imx-make.sh kernel -j8

Build RSB-3720 Android project

$ source build/envsetup.sh
$ lunch rsb3720_a1-userdebug
$./imx-make.sh -j12

Build RSB-5722 Android project

$ source build/envsetup.sh
$ lunch rom5722_a1-userdebug
$./imx-make.sh -j12

All image in

out/target/product/${Project_Name}/

The common image files are listed below:

boot.img
dtbo-imx8mp.img
partition-table-28GB.img
partition-table.img super.img
u-boot-imx8mp.imx
vbmeta.img
vbmeta-imx8mp.img
vendor_boot.img
vendor.img

How to flash images to SDCard

$ cd out/target/product/\${Project_Name}/
$ sudo ./imx-sdcard-partition.sh -f imx8mp /dev/sdx

How to flash images to eMMC

 Note: put the image folder and script(imx-emmc-partition.sh) into /data folder (in the system)
$ sudo ./imx-emmc-partition.sh -f imx8mp /dev/block/mmcblk2