Android BSP User Guide for rk3399 series 7.1.2

From ESS-WIKI
Jump to: navigation, search

Android BSP Version

Android 7.1.2

Kernel 4.4.126

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.

Docker command:

docker pull advrisc/u16.04-imx6abv5:20170523 

Run Docker example

Step1 Run docker container (example)

 $ docker run -it --name android_n7 -v /home/bsp/myandroid:/home/adv/BSP:rw advrisc/u16.04-imx6abv5:20170523 /bin/bash

Step2 In container, change the user. (example)

 

 adv@7cc0fa834366:~$ sudo chown adv:adv -R BSP

Getting Android Source Code

$ 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
$ 

For DeviceOn, please repo following command

$ ../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 deviceon.xml

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

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

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

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

Push all image to rockdev folder

$ ./mkimage.sh

All image in rockdev/Image-rk3399_rsb4710 or rockdev/Image-rk3399_rom5780 ./mkimage.sh at previous step will repack boot.img and system.img, and copy other related image files to the rockdev/Image-project/ directory. The common image files are listed below:

 

# boot.img         : Android's initramfs, to initialize and mount system partition. 
# kernel.img       : Kernel image.
# misc.img         : Misc partition image, to switch boot mode and pass parameter in recovery mode.
# recovery.img     : Recovery mode image.
# resource.img     : Resource image, containing boot logo and kernel's device tree info.
# system.img       : System partition image with ext4 filesystem format.
# uboot.img        :uboot
# trust.img        :File about sleep
# MiniLoaderAll.bin :Loader

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

Note :  "adv" in rk3399_rsb4710-ota-eng.adv.zip  is the name of your building PC.

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

Step5 Follow Android update.

How to update images?

There are three ways to 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. (see more detail in "Create OTA zip" on how to create update.zip)

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.

DeviceOn

Remount /system partition

$ adb root
$ adb remount

Modify agent_config.xml

There are following tags have to do update at least.

<CredentialURL></CredentialURL>
<IoTKey></IoTKey>
<DeviceName></DeviceName>
<SN></SN>

Update agent_config.xml

$ adb push agent_config.xml /system/bin/
$ adb push agent_config.xml /system/lib/

After update agent_config.xml, please reboot device.