Difference between revisions of "FAQ"

From Rockchip open source Document
Jump to: navigation, search
Line 1: Line 1:
 
 
 
  
 
== How to select board config ==
 
== How to select board config ==
Line 15: Line 13:
  
 
Please note some board have disable emmc in u-boot though the hardware actually have emmc. (firefly-rk3288)
 
Please note some board have disable emmc in u-boot though the hardware actually have emmc. (firefly-rk3288)
 +
 +
 
 +
 +
= Overall =
 +
 +
Yocto has a ''powerful'' customization architecture that allows people create their own custom Linux distribution for their projectes. Compare to the desktop linux distribution(debian), it's more flexible to develop system/applcation with yocto. For examples, when we want to cross-compile gstreamer-rockchip on debian, we need prepare [http://opensource.rock-chips.com/wiki_Cross_Compile debian docker] and write [https://github.com/rockchip-linux/gstreamer-rockchip/tree/master/debian debian rules], on yocto, it just need a [https://github.com/rockchip-linux/meta-rockchip/blob/master/recipes-multimedia/gstreamer-rockchip/gstreamer1.0-rockchip_20170811.bb single bitbake file].
 +
 +
Though it have lots of advantages, it's not recommend to use it to''' bring up new boards '''unless you are familier with rockchip stuff. Please follow the [[Linux_user_guide|Linux_user_guide]] and build/flash kernel/u-boot separately!
 +
 +
 
 +
 +
= Getting the Sources =
 +
 +
The rockchip linux SDK source tree is located in multi Git repository hosted by Github.<br/> The SDK uses repo to sync down source code.
 +
 +
Create an empty directory to hold your working files
 +
<pre>mkdir rk-yocto-bsp
 +
cd rk-yocto-bsp
 +
</pre>
 +
 +
<br/> To initialize Yocto SDK source tree
 +
<pre>repo init --repo-url=https://github.com/rockchip-linux/repo -u https://github.com/rockchip-linux/manifests -b yocto
 +
repo sync
 +
</pre>
 +
 +
&nbsp;
 +
 +
The above command will choose "''master''" branch of poky&nbsp;(rolling update).
 +
 +
If you want to use a [https://wiki.yoctoproject.org/wiki/Stable_branch_maintenance stable yocto branch], then use below comands.
 +
<pre>repo init --repo-url=https://github.com/rockchip-linux/repo -u https://github.com/rockchip-linux/manifests -b yocto -m pyro.xml
 +
</pre>
 +
 +
&nbsp;
 +
 +
&nbsp;
 +
 +
= Building the Sources =
 +
 +
== Build environment ==
 +
 +
The essential and graphical support packages you need for a supported Ubuntu or Debian distribution are shown in the following command. see&nbsp;[http://www.yoctoproject.org/docs/2.2.1/mega-manual/mega-manual.html#required-packages-for-the-host-development-system here]&nbsp;for detail.
 +
<pre>sudo apt-get install gawk wget git-core diffstat unzip texinfo build-essential chrpath socat cpio python python3 pip3 pexpect libsdl1.2-dev xterm make xsltproc docbook-utils fop dblatex xmlto python-git libssl-dev pv
 +
</pre>
 +
 +
== Setup Yocto Environment ==
 +
 +
For example, if you want to build a x11 backend image for tinker board, you should use "MACHINE=tinker-rk3288 DISTRO=rk-x11".
 +
<pre>mkdir <build_dir>
 +
MACHINE=<MACHINE> DISTRO=<DISTRO> . ./setup-environment -b <build_dir>
 +
</pre>
 +
 +
== Start Building ==
 +
<pre>bitbake core-image-base
 +
</pre>
 +
 +
Now you can find images under <build_dir>/tmp/deploy/images/<MACHINE>/.
 +
 +
&nbsp;
 +
 +
&nbsp;
 +
 +
= Flash Image =
 +
 +
'''[http://opensource.rock-chips.com/wiki_Partitions reference&nbsp;:&nbsp;partition map]'''
 +
 +
'''*gpt.img''' is as same as '''system.img''','''&nbsp;'''which conatins the&nbsp;complete image.
 +
 +
Flash eMMC:
 +
<pre>./flash_tool.sh -c rk3288 -p system -i <build_dir>/tmp/deploy/images/<MACHINE>/*gpt.img
 +
</pre>
 +
 +
Burn SD-Card:
 +
<pre>./flash_tool.sh -c rk3288 -d /dev/sdc -p system -i <build_dir>/tmp/deploy/images/<MACHINE>/*gpt.img
 +
</pre>
 +
 +
To update kernel/dtb/extlinux,&nbsp; boot partition should be updated.
 +
<pre>./flash_tool.sh -c rk3288 -p boot -i <build_dir>/tmp/deploy/images/<MACHINE>/*boot.img
 +
</pre>
 +
 +
To update u-boot, it's kind of&nbsp;complex,&nbsp;please refer to [http://opensource.rock-chips.com/wiki_Boot_option Boot_option]. All necessary binarys&nbsp;can be found&nbsp;in the&nbsp;deploy directory and rkbin&nbsp;directory.
 +
 +
&nbsp;
 +
 +
= Mainline/Upstream =
 +
 +
Meta-rockchip layer&nbsp;support mainline kernel and have patch it for GPU/VPU features.
 +
 +
To use mainline kernel, &nbsp;please change&nbsp;
 +
 +
PREFERRED_PROVIDER_virtual/kernel = "linux-rockchip"
 +
 +
in machine/include/*.conf to
 +
 +
PREFERRED_PROVIDER_virtual/kernel = "linux-mainline"
 +
 +
<del>Mainline U-boot/ARM-Trust-Firmware are also available, by including</del>
 +
 +
<del>include conf/machine/include/openloader.inc.inc</del>
 +
 +
<del>in machine/*.conf.</del>
 +
 +
&nbsp;
 +
 +
= Demo Layer =
 +
 +
There are some layers for the spefic prototype under '''[https://github.com/rockchip-linux/meta-rockchip-extra/tree/master/demo meta-rockchip-extra/demo].'''
 +
 +
{| border="1"
 +
|-
 +
! Prototype
 +
! Introduction
 +
|-
 +
| QT Player
 +
| A play based on QT EGLFS plugin + QTMultimedia, &nbsp;make the video layer at the bottom.
 +
|}
 +
 +
&nbsp;
 +
 +
&nbsp;
 +
 +
= Available =
 +
 +
== Images ==
 +
 +
{| border="1"
 +
|-
 +
! Chip
 +
! Graphics
 +
|-
 +
| rk-image-base
 +
| Rockchip base Image.
 +
|-
 +
| rk-image-multimedia
 +
| Image with Rockchip's multimedia packages.
 +
|-
 +
| rk-image-machine-test
 +
| Image with Test tools for developing, testing and benchmark.
 +
|-
 +
| qt5-image
 +
| Image with qt packages.
 +
|}
 +
 +
== [https://github.com/rockchip-linux/meta-rockchip/tree/master/conf/machine Boards] ==
 +
 +
[https://github.com/rockchip-linux/meta-rockchip/tree/master/conf/machine https://github.com/rockchip-linux/meta-rockchip/tree/master/conf/machine]
 +
 +
&nbsp;
 +
 +
= Developer Guide =
 +
 +
== [[Qt|Qt in Yocto]] ==
 +
 +
== Apllication/kernel/u-boot ==
 +
 +
All build file and code source are in the&nbsp;''tmp''/work/ or tmp/work-shared&nbsp;subdirectory of the Build Directory.&nbsp;
 +
<pre>e.g&nbsp;:  u-boot&nbsp;: tmp/work/excavator_rk3399-rk-linux/u-boot-rockchip/20170901-r0/git</pre>
 +
 +
Once you have update the&nbsp;code, you should issue&nbsp;command like&nbsp;"bitbake u-boot-rockchip -c compile -f && bitbake u-boot-rockchip" to&nbsp;force it recompile and deploy.
 +
 +
&nbsp;
 +
 +
== Tips ==
 +
 +
*To make an image for suitable of development, you can add "tools-debug debug-tweaks dbg-pkgs" to EXTRA_IMAGE_FEATURES in local.conf to get tools like gdb and add " sshfs-fuse dhcp-client" to "IMAGE_INSTALL_append" to use sshfs for remote transfer. e.g.&nbsp;EXTRA_IMAGE_FEATURES = "tools-debug tools-profile tools-testapps dbg-pkgs debug-tweaks" IMAGE_INSTALL_append = “ sshfs-fuse dhcp-client”
 +
*To use&nbsp;local source,&nbsp;&nbsp;you could change SRC_URI in bb file to "[git:///home/debian/kernel.git;protocol=file;nocheckout=1;branch=release-4.4 git:///home/debian/kernel.git;protocol=file;nocheckout=1;branch=release-4.4]"

Revision as of 11:11, 10 October 2017

How to select board config

DDR:

We use opensource idbloader(See Boot_option)  on some chips (rk3036, rk3288) and its dmc driver can't support ddr-type autodetct, so the wrong ddr dts settings will make the board failed to enter u-boot.

PMIC:

PMIC setting usually is just important in kernel,  but for the board using rk818, USB input current should be configured during boot stage.

Boot:

Please note some board have disable emmc in u-boot though the hardware actually have emmc. (firefly-rk3288)

 

Overall

Yocto has a powerful customization architecture that allows people create their own custom Linux distribution for their projectes. Compare to the desktop linux distribution(debian), it's more flexible to develop system/applcation with yocto. For examples, when we want to cross-compile gstreamer-rockchip on debian, we need prepare debian docker and write debian rules, on yocto, it just need a single bitbake file.

Though it have lots of advantages, it's not recommend to use it to bring up new boards unless you are familier with rockchip stuff. Please follow the Linux_user_guide and build/flash kernel/u-boot separately!

 

Getting the Sources

The rockchip linux SDK source tree is located in multi Git repository hosted by Github.
The SDK uses repo to sync down source code.

Create an empty directory to hold your working files

mkdir rk-yocto-bsp
cd rk-yocto-bsp


To initialize Yocto SDK source tree

repo init --repo-url=https://github.com/rockchip-linux/repo -u https://github.com/rockchip-linux/manifests -b yocto
repo sync

 

The above command will choose "master" branch of poky (rolling update).

If you want to use a stable yocto branch, then use below comands.

repo init --repo-url=https://github.com/rockchip-linux/repo -u https://github.com/rockchip-linux/manifests -b yocto -m pyro.xml

 

 

Building the Sources

Build environment

The essential and graphical support packages you need for a supported Ubuntu or Debian distribution are shown in the following command. see here for detail.

sudo apt-get install gawk wget git-core diffstat unzip texinfo build-essential chrpath socat cpio python python3 pip3 pexpect libsdl1.2-dev xterm make xsltproc docbook-utils fop dblatex xmlto python-git libssl-dev pv

Setup Yocto Environment

For example, if you want to build a x11 backend image for tinker board, you should use "MACHINE=tinker-rk3288 DISTRO=rk-x11".

mkdir <build_dir>
MACHINE=<MACHINE> DISTRO=<DISTRO> . ./setup-environment -b <build_dir>

Start Building

bitbake core-image-base

Now you can find images under <build_dir>/tmp/deploy/images/<MACHINE>/.

 

 

Flash Image

reference : partition map

*gpt.img is as same as system.img, which conatins the complete image.

Flash eMMC:

./flash_tool.sh -c rk3288 -p system -i <build_dir>/tmp/deploy/images/<MACHINE>/*gpt.img

Burn SD-Card:

./flash_tool.sh -c rk3288 -d /dev/sdc -p system -i <build_dir>/tmp/deploy/images/<MACHINE>/*gpt.img

To update kernel/dtb/extlinux,  boot partition should be updated.

./flash_tool.sh -c rk3288 -p boot -i <build_dir>/tmp/deploy/images/<MACHINE>/*boot.img

To update u-boot, it's kind of complex, please refer to Boot_option. All necessary binarys can be found in the deploy directory and rkbin directory.

 

Mainline/Upstream

Meta-rockchip layer support mainline kernel and have patch it for GPU/VPU features.

To use mainline kernel,  please change 

PREFERRED_PROVIDER_virtual/kernel = "linux-rockchip"

in machine/include/*.conf to

PREFERRED_PROVIDER_virtual/kernel = "linux-mainline"

Mainline U-boot/ARM-Trust-Firmware are also available, by including

include conf/machine/include/openloader.inc.inc

in machine/*.conf.

 

Demo Layer

There are some layers for the spefic prototype under meta-rockchip-extra/demo.

Prototype Introduction
QT Player A play based on QT EGLFS plugin + QTMultimedia,  make the video layer at the bottom.

 

 

Available

Images

Chip Graphics
rk-image-base Rockchip base Image.
rk-image-multimedia Image with Rockchip's multimedia packages.
rk-image-machine-test Image with Test tools for developing, testing and benchmark.
qt5-image Image with qt packages.

Boards

https://github.com/rockchip-linux/meta-rockchip/tree/master/conf/machine

 

Developer Guide

Qt in Yocto

Apllication/kernel/u-boot

All build file and code source are in the tmp/work/ or tmp/work-shared subdirectory of the Build Directory. 

e.g :  u-boot : tmp/work/excavator_rk3399-rk-linux/u-boot-rockchip/20170901-r0/git

Once you have update the code, you should issue command like "bitbake u-boot-rockchip -c compile -f && bitbake u-boot-rockchip" to force it recompile and deploy.

 

Tips

  • To make an image for suitable of development, you can add "tools-debug debug-tweaks dbg-pkgs" to EXTRA_IMAGE_FEATURES in local.conf to get tools like gdb and add " sshfs-fuse dhcp-client" to "IMAGE_INSTALL_append" to use sshfs for remote transfer. e.g. EXTRA_IMAGE_FEATURES = "tools-debug tools-profile tools-testapps dbg-pkgs debug-tweaks" IMAGE_INSTALL_append = “ sshfs-fuse dhcp-client”
  • To use local source,  you could change SRC_URI in bb file to "git:///home/debian/kernel.git;protocol=file;nocheckout=1;branch=release-4.4"