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

From ESS-WIKI
Jump to: navigation, search
 
(52 intermediate revisions by 5 users not shown)
Line 1: Line 1:
<h2> Android BSP Version </h2>
+
 
<p>Android 7.1.2
+
== Linux BSP Version ==
</p><p>Kernel 4.4.126
+
 
</p>
+
Debian 9.x / Debian 10.x&nbsp;
<h2> Build Environment on Host </h2>
+
 
<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.
+
<!--&nbsp;Ubuntu 18.04 -->
</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.
+
 
</p><p>Docker command:
+
Kernel 4.4.194
</p>
+
 
<pre>docker pull advrisc/u16.04-imx6abv5:20170523&amp;nbsp;</pre>
+
== Build Environment on Host ==
<h2> Run Docker example </h2>
+
 
<p>Step1 Run docker container (example)
+
Currently, we adopt [https://www.docker.com/ Docker] as build environment.
</p>
+
 
<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
+
You can get the latest version of advrisc/u18.04-rklbv1 Docker image for developing Rockchip RK3399 projects.
 +
 
 +
Docker command:
 +
<pre>docker pull advrisc/u18.04-rklbv1</pre>
 +
 
 +
== Run Docker example ==
 +
 
 +
Step1 Run docker container (example)
 +
<pre>sudo docker run -it --name rk3399_linux_risc -v /home/bsp/myLinux:/home/adv/BSP:rw --privileged advrisc/u18.04-rklbv1:latest /bin/bash
 
</pre>
 
</pre>
<p>Step2 In container, change the user. (example)
+
 
</p><p>
+
Step2 In container, change the user. (example)
</p>
+
 
 +
&nbsp;
 
<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>
+
 
<pre>$ cd ~/code
+
== Install Some tools ==
$ sudo git clone https://github.com/rockchip-linux/repo.git
+
<pre>$sudo apt-get install expect
$ mkdir rk3399_android_n7
+
$</pre>
$ cd rk3399_android_n7
+
 
$ git config --global user.name &quot;Your Name&quot;
+
== Getting Linux Source Code ==
 +
 
 +
Debian 9.x&nbsp;
 +
<pre>$ cd ~/BSP
 +
$ sudo git clone https://github.com/ADVANTECH-Rockchip/repo.git
 +
$ mkdir rk3399_linux_risc
 +
$ cd rk3399_linux_risc
 +
$ 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://github.com/ADVANTECH-Rockchip/linux-manifest.git -b rk3399_linux_v231_risc -m default.xml
 
$ ../repo/repo sync
 
$ ../repo/repo sync
$ ../repo/repo forall -c git checkout -b local --track advantech-gitlab/android-7.1.2
+
$ ../repo/repo forall -c git checkout -b local --track advantech-github/rk3399_linux_v231_risc
 
$  
 
$  
 
</pre>
 
</pre>
<h2> Build Instructions </h2>
+
 
<pre>$ export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
+
Debian 10.x
$ export PATH=$JAVA_HOME/bin:$PATH
+
<pre>$ cd ~/BSP
$ export CLASSPATH=.:$JAVA_HOME/lib:$JAVA_HOME/lib/tools.jar
+
$ sudo git clone https://github.com/ADVANTECH-Rockchip/repo.git
 +
$ mkdir rk3399_linux_risc
 +
$ cd rk3399_linux_risc
 +
$ git config --global user.name "Your Name"
 +
$ git config --global user.email you@example.com
 +
$ ../repo/repo init -u https://github.com/ADVANTECH-Rockchip/linux-manifest.git -b rk3399_linux_v251_risc -m default.xml
 +
$ ../repo/repo sync
 +
$ ../repo/repo forall -c git checkout -b local --track advantech-github/rk3399_linux_v251_risc
 +
$ </pre>
 +
 
 +
== Build U-boot ==
 +
 
 +
=== Build RSB-3710 U-boot ===
 +
<pre>$ export TOP=`pwd`
 +
$ cd $TOP
 +
$ cd u-boot
 +
$ ./make.sh rk3399_rsb3710a2_2G
 +
</pre>
 +
 
 +
=== Build RSB-4710 U-boot ===
 +
<pre>$ export TOP=`pwd`
 +
$ cd $TOP
 +
$ cd u-boot
 +
$ ./make.sh rk3399_rsb4710a2_2G
 
</pre>
 
</pre>
<h2> Build U-boot </h2>
+
 
<pre>$ cd u-boot
+
=== Build ROM-5780 U-boot ===
$ make rk3399_rsb4710a2_2G_defconfig
+
<pre>$ export TOP=`pwd`
$ make ARCHV=aarch64
+
$ cd $TOP $ cd u-boot  
 +
$ ./make.sh rk3399_rom5780a3_2G
 
</pre>
 
</pre>
<h2> Build Kernel </h2>
+
 
<h3> Build for RSB4710 platform </h3>
+
== Build Kernel ==
<pre>$ cd kernel
+
 
 +
=== Build RSB-3710 Kernel ===
 +
<pre>$ cd $TOP
 +
$ 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-rsb3710-a2.img -j12
 
</pre>
 
</pre>
<h2> Build Android </h2>
+
 
<pre>$ source build/envsetup.sh  
+
=== Build RSB-4710 Kernel ===
$ lunch rk3399_rsb4710-userdebug
+
 
$ make -j4 2&gt;&amp;1 | tee build-log.txt
+
 
 +
 
 +
=== Build ROM-5780 Kernel ===
 +
<pre>$ cd $TOP
 +
$ cd kernel
 +
$ make ARCH=arm64 rk3399_adv_defconfig -j8
 +
$ make ARCH=arm64 rk3399-rom5780-a3.img -j12</pre>
 +
 
 +
== Build Recovery ==
 +
<pre>$ cd $TOP
 +
$ rm buildroot/output/rockchip_rk3399_recovery -rf
 +
$ source envsetup.sh rockchip_rk3399_recovery
 +
$ ./build.sh recovery
 
</pre>
 
</pre>
<h2> Push all image to rockdev folder </h2>
+
 
<pre>$ ./mkimage.sh
+
== Build Debian 9.x / Debian 10.x ==
 +
<pre>$ cd $TOP
 +
$ source envsetup.sh rockchip_rk3399
 +
$ sudo BUILD_IN_DOCKER=TRUE ./mk-debian.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>
 
</p>
 
<pre># boot.img        &amp;nbsp;: Android's initramfs, to initialize and mount system partition.
 
# kernel.img      &amp;nbsp;: Kernel image.
 
# misc.img        &amp;nbsp;: Misc partition image, to switch boot mode and pass parameter in recovery mode.
 
# recovery.img    &amp;nbsp;: Recovery mode image.
 
# resource.img    &amp;nbsp;: Resource image, containing boot logo and kernel's device tree info.
 
# system.img      &amp;nbsp;: System partition image with ext4 filesystem format.
 
# uboot.img        :uboot
 
# trust.img        :File about sleep
 
# MiniLoaderAll.bin :Loader
 
  
 +
<!-- == Build ubuntu 18.04 ==
 +
<span _fck_mw_customtag="true" _fck_mw_tagname="pre" _fck_mw_tagtype="t" class="fck_mw_special">$ cd $TOPfckLR$ source envsetup.sh rockchip_rk3399fckLR$ cd rootfs_adv/ubuntu18.04/fckLR$ sudo ./mk-ubuntu.shfckLR$fckLR</span> -->
 +
 +
<!--You can get ubuntu 18.04 "rootfs.img" in the fold "rootfs_adv/ubuntu18.04" .-->
 +
 +
== Push all image to rockdev folder ==
 +
<pre>$ ./mkfirmware.sh
 
</pre>
 
</pre>
<h2> Create OTA zip </h2>
+
 
<p><b><big>Step1</big></b> After Build Android, you will be create image for OTA update.
+
All image in rockdev/ ./mkfirmware.sh at previous step will repack boot.img and rootfs.img, and copy other related image files to the rockdev/&nbsp;directory. The common image files are listed below:
</p>
+
 
<pre>$ ./mkimage.sh ota
+
&nbsp;
 +
<pre># board.img     
 +
# boot.img   
 +
# misc.img   
 +
# oem.img
 +
# recovery.img   
 +
# rootfs.img   
 +
# uboot.img   
 +
# trust.img       
 +
# MiniLoaderAll.bin
 +
# parameter.txt
 +
#
 
</pre>
 
</pre>
<p><b><big>Step2</big></b> Package the update.zip
+
 
</p>
+
== Make update.img ==
<pre>$ make otapackage
+
<pre>$ cd $TOP
 +
$ source envsetup.sh rockchip_rk3399
 +
$ ./build.sh updateimg
 
</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>
+
You can get update.img in rockdev/
<pre>$mv out/target/product/rk3399_rsb4710/rk3399_rsb4710-ota-eng.adv.zip update.zip
 
</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.
 
</p><p><b><big>Step5&#160;</big></b>Follow Android update.
 
</p>
 
<h2> How to do about update RSB4710 Platform? </h2>
 
<p>There are three ways to update images:
 
</p>
 
<h3> <b><a href="1.%20Using%20AndroidToool.">1._Using_AndroidToool.</a></b> </h3>
 
<p>There is no limitation by this way.
 
</p>
 
<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:
 
</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;
 
</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)
 
</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>
 
<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.
 
</p><p>(2)Using update.img to upgrade.
 
</p>
 

Latest revision as of 02:42, 6 February 2024

Linux BSP Version

Debian 9.x / Debian 10.x 


Kernel 4.4.194

Build Environment on Host

Currently, we adopt Docker as build environment.

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

Docker command:

docker pull advrisc/u18.04-rklbv1

Run Docker example

Step1 Run docker container (example)

sudo docker run -it --name rk3399_linux_risc -v /home/bsp/myLinux:/home/adv/BSP:rw --privileged advrisc/u18.04-rklbv1:latest /bin/bash

Step2 In container, change the user. (example)

 

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

Install Some tools

$sudo apt-get install expect 
$

Getting Linux Source Code

Debian 9.x 

$ cd ~/BSP
$ sudo git clone https://github.com/ADVANTECH-Rockchip/repo.git
$ mkdir rk3399_linux_risc
$ cd rk3399_linux_risc
$ git config --global user.name "Your Name"
$ git config --global user.email you@example.com
$ ../repo/repo init -u https://github.com/ADVANTECH-Rockchip/linux-manifest.git -b rk3399_linux_v231_risc -m default.xml
$ ../repo/repo sync
$ ../repo/repo forall -c git checkout -b local --track advantech-github/rk3399_linux_v231_risc
$ 

Debian 10.x

$ cd ~/BSP
$ sudo git clone https://github.com/ADVANTECH-Rockchip/repo.git
$ mkdir rk3399_linux_risc
$ cd rk3399_linux_risc
$ git config --global user.name "Your Name"
$ git config --global user.email you@example.com
$ ../repo/repo init -u https://github.com/ADVANTECH-Rockchip/linux-manifest.git -b rk3399_linux_v251_risc -m default.xml
$ ../repo/repo sync
$ ../repo/repo forall -c git checkout -b local --track advantech-github/rk3399_linux_v251_risc
$ 

Build U-boot

Build RSB-3710 U-boot

$ export TOP=`pwd`
$ cd $TOP
$ cd u-boot
$ ./make.sh rk3399_rsb3710a2_2G

Build RSB-4710 U-boot

$ export TOP=`pwd`
$ cd $TOP
$ cd u-boot
$ ./make.sh rk3399_rsb4710a2_2G

Build ROM-5780 U-boot

$ export TOP=`pwd` 
$ cd $TOP $ cd u-boot 
$ ./make.sh rk3399_rom5780a3_2G

Build Kernel

Build RSB-3710 Kernel

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

Build RSB-4710 Kernel

Build ROM-5780 Kernel

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

Build Recovery

$ cd $TOP
$ rm buildroot/output/rockchip_rk3399_recovery -rf
$ source envsetup.sh rockchip_rk3399_recovery
$ ./build.sh recovery

Build Debian 9.x / Debian 10.x

$ cd $TOP
$ source envsetup.sh rockchip_rk3399
$ sudo BUILD_IN_DOCKER=TRUE ./mk-debian.sh


Push all image to rockdev folder

$ ./mkfirmware.sh

All image in rockdev/ ./mkfirmware.sh at previous step will repack boot.img and rootfs.img, and copy other related image files to the rockdev/ directory. The common image files are listed below:

 

# board.img       
# boot.img     
# misc.img    
# oem.img 
# recovery.img    
# rootfs.img    
# uboot.img     
# trust.img        
# MiniLoaderAll.bin
# parameter.txt
# 

Make update.img

$ cd $TOP
$ source envsetup.sh rockchip_rk3399
$ ./build.sh updateimg

You can get update.img in rockdev/