Difference between revisions of "Debian BSP User Guide for rk3399 risc series"

From ESS-WIKI
Jump to: navigation, search
Line 1: Line 1:
<h2> Android BSP Version </h2>
+
== Android BSP Version ==
<p>Android 7.1.2
+
 
</p><p>Kernel 4.4.126
+
Android 7.1.2
</p>
+
 
<h2> Build Environment on Host </h2>
+
Kernel 4.4.126
<p>Currently, we adopt <a href="https://www.docker.com/" alt="https://www.docker.com/" title="https://www.docker.com/">Docker</a> as build environment.
+
 
</p><p>You can get the latest version of <a href="https://hub.docker.com/r/advrisc/u16.04-imx6abv5" alt="https://hub.docker.com/r/advrisc/u16.04-imx6abv5" title="https://hub.docker.com/r/advrisc/u16.04-imx6abv5">advrisc/u16.04-imx6abv5</a> Docker image for developing Rockchip RK3399 projects.
+
== Build Environment on Host ==
</p><p>Docker command:
+
 
</p>
+
Currently, we adopt [https://www.docker.com/ Docker] as build environment.
<pre>docker pull advrisc/u16.04-imx6abv5:20170523&amp;nbsp;</pre>
+
 
<h2> Run Docker example </h2>
+
You can get the latest version of [https://hub.docker.com/r/advrisc/u16.04-imx6abv5 advrisc/u16.04-imx6abv5] Docker image for developing Rockchip RK3399 projects.
<p>Step1 Run docker container (example)
+
 
</p>
+
Docker command:
<pre>&amp;nbsp;$&amp;nbsp;docker run -it --name android_n7 -v /home/bsp/myandroid:/home/adv/BSP:rw advrisc/u16.04-imx6abv5:20170523 /bin/bash
+
<pre>docker pull advrisc/u16.04-imx6abv5:20170523&nbsp;</pre>
 +
 
 +
== Run Docker example ==
 +
 
 +
Step1 Run docker container (example)
 +
<pre>&nbsp;$&nbsp;docker run -it --name android_n7 -v /home/bsp/myandroid:/home/adv/BSP:rw advrisc/u16.04-imx6abv5:20170523 /bin/bash
 
</pre>
 
</pre>
<p>Step2 In container, change the user. (example)
+
 
</p><p>
+
Step2 In container, change the user. (example)
</p>
+
 
 +
 
 
<pre> adv@7cc0fa834366:~$ sudo chown adv:adv -R BSP
 
<pre> adv@7cc0fa834366:~$ sudo chown adv:adv -R BSP
 
</pre>
 
</pre>
<h2> Getting Android Source Code </h2>
+
 
 +
== Getting Android Source Code ==
 
<pre>$ cd ~/code
 
<pre>$ cd ~/code
 
$ sudo git clone https://github.com/rockchip-linux/repo.git
 
$ sudo git clone https://github.com/rockchip-linux/repo.git
 
$ mkdir rk3399_android_n7
 
$ mkdir rk3399_android_n7
 
$ cd rk3399_android_n7
 
$ cd rk3399_android_n7
$ git config --global user.name &quot;Your Name&quot;
+
$ git config --global user.name "Your Name"
 
$ git config --global user.email you@example.com
 
$ git config --global user.email you@example.com
 
$ ../repo/repo init -u https://gitlab.wise-paas.com/RISC/android-manifest.git -b android-7.1.2 -m default.xml
 
$ ../repo/repo init -u https://gitlab.wise-paas.com/RISC/android-manifest.git -b android-7.1.2 -m default.xml
Line 31: Line 38:
 
$  
 
$  
 
</pre>
 
</pre>
<h2> Build Instructions </h2>
+
 
 +
== Build Instructions ==
 
<pre>$ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
 
<pre>$ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
 
$ export PATH=$JAVA_HOME/bin:$PATH
 
$ export PATH=$JAVA_HOME/bin:$PATH
 
$ export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
 
$ export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
 
</pre>
 
</pre>
<h2> Build U-boot </h2>
+
 
 +
== Build U-boot ==
 
<pre>$ cd u-boot
 
<pre>$ cd u-boot
 
$ make rk3399_rsb4710a2_2G_defconfig
 
$ make rk3399_rsb4710a2_2G_defconfig
 
$ make ARCHV=aarch64
 
$ make ARCHV=aarch64
 
</pre>
 
</pre>
<h2> Build Kernel </h2>
+
 
<h3> Build for RSB4710 platform </h3>
+
== Build Kernel ==
 +
 
 +
=== Build for RSB4710 platform ===
 
<pre>$ cd kernel
 
<pre>$ cd kernel
 
$ make ARCH=arm64 rk3399_adv_defconfig -j8
 
$ make ARCH=arm64 rk3399_adv_defconfig -j8
 
$ make ARCH=arm64 rk3399-rsb4710-a2.img -j12
 
$ make ARCH=arm64 rk3399-rsb4710-a2.img -j12
 
</pre>
 
</pre>
<h2> Build Android </h2>
+
 
 +
== Build Android ==
 
<pre>$ source build/envsetup.sh  
 
<pre>$ source build/envsetup.sh  
 
$ lunch rk3399_rsb4710-userdebug
 
$ lunch rk3399_rsb4710-userdebug
$ make -j4 2&gt;&amp;1 | tee build-log.txt
+
$ make -j4 2>&1 | tee build-log.txt
 
</pre>
 
</pre>
<h2> Push all image to rockdev folder </h2>
+
 
 +
== Push all image to rockdev folder ==
 
<pre>$ ./mkimage.sh
 
<pre>$ ./mkimage.sh
 
</pre>
 
</pre>
<p>All image in rockdev/Image-rk3399_rsb4710 ./mkimage.sh at previous step will repack boot.img and system.img, and copy other related image files to the rockdev/Image-rk3399_rsb4710/ directory. The common image files are listed below:
+
 
</p><p>
+
All image in rockdev/Image-rk3399_rsb4710 ./mkimage.sh at previous step will repack boot.img and system.img, and copy other related image files to the rockdev/Image-rk3399_rsb4710/ directory. The common image files are listed below:
</p>
+
 
<pre># boot.img        &amp;nbsp;: Android's initramfs, to initialize and mount system partition.  
+
 
# kernel.img      &amp;nbsp;: Kernel image.
+
<pre># boot.img        &nbsp;: Android's initramfs, to initialize and mount system partition.  
# misc.img        &amp;nbsp;: Misc partition image, to switch boot mode and pass parameter in recovery mode.
+
# kernel.img      &nbsp;: Kernel image.
# recovery.img    &amp;nbsp;: Recovery mode image.
+
# misc.img        &nbsp;: Misc partition image, to switch boot mode and pass parameter in recovery mode.
# resource.img    &amp;nbsp;: Resource image, containing boot logo and kernel's device tree info.
+
# recovery.img    &nbsp;: Recovery mode image.
# system.img      &amp;nbsp;: System partition image with ext4 filesystem format.
+
# resource.img    &nbsp;: Resource image, containing boot logo and kernel's device tree info.
 +
# system.img      &nbsp;: System partition image with ext4 filesystem format.
 
# uboot.img        :uboot
 
# uboot.img        :uboot
 
# trust.img        :File about sleep
 
# trust.img        :File about sleep
Line 69: Line 83:
  
 
</pre>
 
</pre>
<h2> Create OTA zip </h2>
+
 
<p><b><big>Step1</big></b> After Build Android, you will be create image for OTA update.
+
== Create OTA zip ==
</p>
+
 
 +
'''<big>Step1</big>''' After Build Android, you will be create image for OTA update.
 
<pre>$ ./mkimage.sh ota
 
<pre>$ ./mkimage.sh ota
 
</pre>
 
</pre>
<p><b><big>Step2</big></b> Package the update.zip
+
 
</p>
+
'''<big>Step2</big>''' Package the update.zip
 
<pre>$ make otapackage
 
<pre>$ make otapackage
 
</pre>
 
</pre>
<p><b><big>Step3&#160;</big></b>Rename the out/target/product/rk3399_rsb4710/rk3399_rsb4710-ota-eng.adv.zip to update.zip
+
 
</p>
+
'''<big>Step3&nbsp;</big>'''Rename the out/target/product/rk3399_rsb4710/rk3399_rsb4710-ota-eng.adv.zip to update.zip
 
<pre>$mv out/target/product/rk3399_rsb4710/rk3399_rsb4710-ota-eng.adv.zip update.zip
 
<pre>$mv out/target/product/rk3399_rsb4710/rk3399_rsb4710-ota-eng.adv.zip update.zip
 
</pre>
 
</pre>
<p>Note&#160;:&#160; "adv" in rk3399_rsb4710-ota-eng.adv.zip&#160; is the name of your building PC.
+
 
</p><p><b><big>Step4&#160;</big></b>Copy the update.zip to SD or USB disk.
+
Note&nbsp;:&nbsp; "adv" in rk3399_rsb4710-ota-eng.adv.zip&nbsp; is the name of your building PC.
</p><p><b><big>Step5&#160;</big></b>Follow Android update.
+
 
</p>
+
'''<big>Step4&nbsp;</big>'''Copy the update.zip to SD or USB disk.
<h2> How to do about update RSB4710 Platform? </h2>
+
 
<p>There are three ways to update images:
+
'''<big>Step5&nbsp;</big>'''Follow Android update.
</p>
+
 
<h3> <b><a href="1.%20Using%20AndroidToool.">1._Using_AndroidToool.</a></b> </h3>
+
== How to do about update RSB4710 Platform? ==
<p>There is no limitation by this way.
+
 
</p>
+
There are three ways to update images:
<h3> <b><a href="2.%20Using%20storage%EF%BC%88such%20sd%20or%20USB%20disk%EF%BC%89with%20update.zip%20in%20it.">2._Using_storage(such&#160;sd_or_USB_disk)with_update.zip_in_it.</a></b> </h3>
+
 
<p>There are some&#160;limitations:
+
=== '''[[1._Using_AndroidToool.|1._Using_AndroidToool.]]''' ===
</p><p>(1)The device must be able to boot up to Android system.
+
 
</p><p>(2)Only update images from the same os,&#160; eg&#160;:&#160;
+
There is no limitation by this way.
</p><p>&#160; &#160; &#160; &#160; Android6.0 upgrade to Android6.0 or&#160;Android7.1&#160;upgrade to Android7.1.
+
 
</p><p>(3)Using update.zip to upgrade. (see more detail in "Create OTA zip" on how to create update.zip)
+
=== '''[[2._Using_storage(such_sd_or_USB_disk)with_update.zip_in_it.|2._Using_storage(such&nbsp;sd_or_USB_disk)with_update.zip_in_it.]]''' ===
</p>
+
 
<h3> <b><a href="3.%20Using%20bootup%20sd%20disk%20made%20by%20SDDiskTool.">3._Using_bootup_sd_disk&#160;made_by&#160;SDDiskTool.</a></b> </h3>
+
There are some&nbsp;limitations:
<p>(1)Only update images from the same os,&#160; eg&#160;:&#160;
+
 
</p><p>&#160; &#160; &#160; &#160; &#160;Android6.0 upgrade to Android6.0 or&#160;Android7.1&#160;upgrade to Android7.1.
+
(1)The device must be able to boot up to Android system.
</p><p>(2)Using update.img to upgrade.
+
 
</p>
+
(2)Only update images from the same os,&nbsp; eg&nbsp;:&nbsp;
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp; Android6.0 upgrade to Android6.0 or&nbsp;Android7.1&nbsp;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.|3._Using_bootup_sd_disk&nbsp;made_by&nbsp;SDDiskTool.]]''' ===
 +
 
 +
(1)Only update images from the same os,&nbsp; eg&nbsp;:&nbsp;
 +
 
 +
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp;Android6.0 upgrade to Android6.0 or&nbsp;Android7.1&nbsp;upgrade to Android7.1.
 +
 
 +
(2)Using update.img to upgrade.

Revision as of 03:19, 7 July 2020

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 ~/code
$ sudo git clone https://github.com/rockchip-linux/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://gitlab.wise-paas.com/RISC/android-manifest.git -b android-7.1.2 -m default.xml
$ ../repo/repo sync
$ ../repo/repo forall -c git checkout -b local --track advantech-gitlab/android-7.1.2
$ 

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

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

Build Kernel

Build for RSB4710 platform

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

Build Android

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

Push all image to rockdev folder

$ ./mkimage.sh

All image in rockdev/Image-rk3399_rsb4710 ./mkimage.sh at previous step will repack boot.img and system.img, and copy other related image files to the rockdev/Image-rk3399_rsb4710/ 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 do about update RSB4710 Platform?

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.