Skip to main content

Android BSP User Guide for RK3399 Series Android7

1. Introduction


This document provides comprehensive instructions for building and deploying Android BSP for RK3399 series platforms running 7.1.2. The guide covers environment setup, source code acquisition, building processes for multiple processors platforms, and deployment methods.

2. Android BSP Version


  • OS: Android 7.1.2
  • Kernel: 4.4.126

3. Build Environment on Host


Currently, we adopt Docker as build environment.

You can get the latest version of advrisc/u16.04-imx6abv5 Docker image for developing Rockchip RK3399 projects.

3.1 Docker Installation Commands

$ sudo apt-get update
$ sudo apt-get install -y qemu-user-static
$ sudo apt-get install -y live-build
$ sudo docker pull advrisc/u16.04-imx6abv5:20170523

3.2 Run Docker Example

  • Step 1: Run Docker Container
    Assume your working directory is home/bsp/myLinux and the Docker container name is rk3399_android_n7.
    Replace home/bsp/myLinux and rk3399_android_n7 with the actual ones based on your environment.
$ export WORKSPACE="home/bsp/myLinux"
$ export CONTAINER_NAME="rk3399_android_n7"
$ sudo docker run -it --name ${CONTAINER_NAME} -v ${WORKSPACE}:/home/adv/BSP:rw --privileged advrisc/u16.04-imx6abv5:20170523 /bin/bash
  • Step 2: Change User in Container
adv@7cc0fa834366:~$ sudo chown adv:adv -R BSP
  • Step 3: Install build dependencies in Container

    • Install live build
    adv@7cc0fa834366:~$ cd ~
    adv@7cc0fa834366:~$ git clone https://salsa.debian.org/live-team/live-build.git --depth 1 -b debian/1%20230131
    adv@7cc0fa834366:~$ cd live-build
    adv@7cc0fa834366:~$ rm -rf manpages/po/
    adv@7cc0fa834366:~$ sudo make install -j8
    adv@7cc0fa834366:~$ cd ~
    adv@7cc0fa834366:~$ rm -rf live-build
    • Install qemu and binfmts
    adv@7cc0fa834366:~$ sudo apt-get update
    adv@7cc0fa834366:~$ sudo apt-get install binfmt-support qemu-user-static --reinstall
    adv@7cc0fa834366:~$ sudo update-binfmts --enable qemu-aarch64
    • Install gettext
    adv@7cc0fa834366:~$ sudo apt-get update
    adv@7cc0fa834366:~$ sudo apt-get install gettext -y

4. Getting Android Source Code


4.1 Full SDK

$ cd ~/BSP
$ sudo git clone https://github.com/ADVANTECH-Rockchip/repo.git
$ mkdir rk3399_android_n7
$ cd rk3399_android_n7
$ git config --global user.name "Your Name"
$ git config --global user.email you@example.com
$ ../repo/repo init -u https://AIM-Linux@dev.azure.com/AIM-Linux/RISC-RK3399-Android/_git/android-n7-manifest -b android-7.1.2 -m default.xml
$ ../repo/repo sync
$ ../repo/repo forall -c git checkout -b local --track advantech-azure/android-7.1.2

5. Building


5.1 Build Instructions

$ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
$ export PATH=$JAVA_HOME/bin:$PATH
$ export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar

5.2 Build U-boot

Build RSB-4710 U-boot

$ cd u-boot
$ make rk3399_rsb4710a2_2G_defconfig
$ make ARCHV=aarch64

Build ROM-5780 U-boot

$ cd u-boot
$ make rk3399_rom5780a3_2G_defconfig
$ make ARCHV=aarch64

5.3 Build Kernel

Build RSB-4710 platform

$ cd kernel
$ make ARCH=arm64 rk3399_adv_defconfig -j8
$ make ARCH=arm64 rk3399-rsb4710-a2.img -j12

Build ROM-5780 platform

$ cd kernel
$ make ARCH=arm64 rk3399_adv_defconfig -j8
$ make ARCH=arm64 rk3399-rom5780-a3.img -j12

5.4 Build Android

Build RSB-4710 platform

$ source build/envsetup.sh
$ lunch rk3399_rsb4710-userdebug
$ make -j4 2>&1 | tee build-log.txt

Build ROM-5780 platform

$ source build/envsetup.sh
$ lunch rk3399_rom5780-userdebug
$ make -j4 2>&1 | tee build-log.txt

5.5 Push all image to rockdev folder

$ ./mkimage.sh

All image in rockdev/Image-rk3399_rsb4710/ or rockdev/Image-rk3399_rom5780/

The common image files are listed below:

boot.img
kernel.img
misc.img
recovery.img
resource.img
system.img
uboot.img
trust.img
MiniLoaderAll.bin

5.6 Create OTA zip

Step1 After Build Android, you will be create image for OTA update.

$ ./mkimage.sh ota

Step2 Package the update.zip

$ make otapackage

Step3 Rename the out/target/product/rk3399_rsb4710/rk3399_rsb4710-ota-eng.adv.zip to update.zip

$ mv out/target/product/rk3399_rsb4710/rk3399_rsb4710-ota-eng.adv.zip update.zip

Step4 Copy the update.zip to SD or USB disk.

Step5 Follow Android update.

6. Update Images


1._Using_AndroidToool.

There is no limitation by this way.

2._Using_storage(such sd_or_USB_disk)with_update.zip_in_it.

There are some limitations:

(1) The device must be able to boot up to Android system. (2) Only update images from the same OS, eg: Android6.0 upgrade to Android6.0 or Android7.1 upgrade to Android7.1. (3) Using update.zip to upgrade.

3._Using_bootup_sd_disk made_by_SDDiskTool.

(1) Only update images from the same OS, eg: Android6.0 upgrade to Android6.0 or Android7.1 upgrade to Android7.1. (2) Using update.img to upgrade.

7. Summary


7.1 Supported Hardware Platforms

  • RSB-4710: RSB-4710 Single Board Computer
  • ROM-5780: ROM-5780 Computer-on-Module

7.2 System Requirements

  • Docker environment with advrisc/u16.04-imx6abv5 image
  • Ubuntu 16.04 base system
  • BSP tarball from our released BSP
  • Build tools and dependencies
  • Sufficient disk space for source code and build artifacts
  • Internet connection for package installation
  • Target processors (RSB-4710, ROM-5780)

7.3 Build Workflow Summary

  1. Environment Setup → Docker + Ubuntu 16.04
  2. Source Acquisition → BSP tarball or Full SDK
  3. Project Selection → Choose target processors platform
  4. Component Build → U-boot → Kernel → (Recovery)* → (Debian)*
  5. Image Generation → Firmware packaging → (Update image)*
  6. Deployment → AndroidTool, SD/USB storage, or SDDiskTool

Components marked with asterisk () are not supported in BSP tarball mode.

7.4 Development Modes

7.4.1 BSP Tarball Mode (Limited)

  • Use Case: Quick U-boot and kernel development
  • Advantages: Fast setup, smaller download size
  • Limitations: Cannot build recovery, debian, or update images
Important Notes about BSP Tarball

The BSP tarball is designed for fast development of uboot and kernel components. However, it has some limitations.

  • Supported: U-boot building
  • Supported: Kernel building
  • NOT Supported: Recovery building
  • NOT Supported: Debian building
  • NOT Supported: Update image building

7.4.2 Full SDK Mode (Complete)

  • Use Case: Complete system development and customization
  • Advantages: Full build capability, all components supported
  • Requirements: Contact PM for access