Yocto BSP layer for the Rockchip SOC boards
This README file contains information on building and booting the meta-rockchip BSP layers.
Please see the corresponding sections below for details.
This layer depends on:
-
URI: git://git.yoctoproject.org/poky
-
branch: kirkstone
-
URI: git://git.openembedded.org/meta-openembedded
-
layers: meta-oe
-
branch: kirkstone
I. Configure yocto/oe Environment
II. Building meta-rockchip BSP Layers
III. Booting your Device
IV. Tested Hardwares
V. Supporting new Machine
In order to build an image with BSP support for a given release, you need to download the corresponding layers described in the "Dependencies" section. Be sure that everything is in the same directory.
~ $ mkdir yocto; cd yocto
~/yocto $ git clone git://git.yoctoproject.org/poky -b kirkstone
~/yocto $ git clone git://git.openembedded.org/meta-openembedded.git -b kirkstoneAnd put the meta-rockchip layer here too.
Then you need to source the configuration script:
~/yocto $ source poky/oe-init-build-envHaving done that, you can build a image for a rockchip board by adding the location of the meta-rockchip layer to bblayers.conf, along with any other layers needed.
For example:
# build/conf/bblayers.conf
BBLAYERS ?= " \
${TOPDIR}/../poky/meta \
${TOPDIR}/../poky/meta-poky \
${TOPDIR}/../poky/meta-yocto-bsp \
${TOPDIR}/../meta-openembedded/meta-oe \
${TOPDIR}/../meta-openembedded/meta-multimedia \
${TOPDIR}/../meta-openembedded/meta-python \
${TOPDIR}/../meta-openembedded/meta-networking \
${TOPDIR}/../meta-rockchip \Here is an example of our configuration of bblayer.conf: https://github.com/simongiec/build.git
To enable a particular machine, you need to add a MACHINE line naming the BSP to the local.conf file:
MACHINE = "xxx"This project's MACHINE is “rockchip-rk3568-evb”.
All supported machines can be found in meta-rockchip/conf/machine.
You should then be able to build a image as such:
$ bitbake core-image-minimalAll services we need can be found in meta-rockchip/conf/machine/rockchip-rk3568-evb.conf:

At the end of a successful build, you should have an .wic image in /path/to/yocto/build/tmp/deploy/images/<MACHINE>/, also with an rockchip firmware image: update.img.
Under Windows,you can use RKDevTool_Release Download link: https://drive.google.com/file/d/12XlHy0PA1AME0AE1xXZ9u_Lds6wYOyMk/view?usp=drive_link
- Put your device into rockusb mode:Turn off the machine, connect the adapter and use a USB cable to connect to the computer,press and hold the white button next to TypeC, press the power button, and release both buttons,the device will enter loader mode.
- Flash the image(update.img),as shown in the following figure,click "Upgrade".

Under Linux, you can use upgrade_tool: http://opensource.rock-chips.com/wiki_Upgradetool to flash the image:
-
Put your device into rockusb mode: http://opensource.rock-chips.com/wiki_Rockusb
-
If it's maskrom rockusb mode, try to enter miniloader rockusb mode:
$ sudo upgrade_tool db <IMAGE PATH>/loader.bin- Flash the image (wic image or rockchip firmware image)
$ sudo upgrade_tool wl 0 <IMAGE PATH>/<IMAGE NAME>.wic # For wic image$ sudo upgrade_tool uf <IMAGE PATH>/update.img # For rockchip firmware imageRun "ifconfig -a",you will see wlan0,use iw to test wifi. Please refer to the following diagram for the testing process.


eth0, after connecting the network cable,first,use "ifup eth0",then use “ping www.baidu.com" to test network,ping OK. Finally run "ifdown eth0".
eth1, after connecting the network cable,,use "ifup eth1",then use “ping www.baidu.com" to test network,ping OK. Finally run "ifdown eth1".
Firstly,you need to install desktop services,add to build/conf/bblayers.conf.
DISPLAY_PLATFORM ?= "wayland"
DISTRO_FEATURES:append = " ${@d.getVar('DISPLAY_PLATFORM')}"
DISTRO_FEATURES:remove = " ${@'x11' if d.getVar('DISPLAY_PLATFORM') == 'wayland' else 'wayland'}"
IMAGE_FEATURES:append = " ${@'x11-base' if d.getVar('DISPLAY_PLATFORM') == 'x11' else ''}"
IMAGE_INSTALL:append = " ${@'weston weston-init weston-examples' if d.getVar('DISPLAY_PLATFORM') == 'wayland' else 'xf86-video-modesetting xserver-xorg-module-exa'}"Then connect the monitor with an HDMI cable, display ok.
Connect a USB drive to any USB port. Please refer to the following diagram for the testing process.

Connect the USB drive with an OTG cable and then connect it to the TypeC port,use cmd "mount",same with step 5.
Use cmd "mount",same with step 5.
(1) The wiring method is shown in the following figure. Connect the other side to the computer.

(2) Configuration of serial port to be tested

(3) Send instructions from the device to the computer.
device: echo testSerialCharString > /dev/ttyS4

(4) Send instructions from the computer to the device.
device: cat /dev/ttyS4&

(1) The card insertion method is shown in the following figure.

(2) Enter the following commands
cat /dev/ttyUSB1 & echo -e "AT+CPIN?\r\n" > /dev/ttyUSB1
echo -en 'AT+CGPADDR\r\n' > /dev/ttyUSB1 && cat /dev/ttyUSB1
echo -en 'AT+QNETDEVCTL=1,1,1\r\n' > /dev/ttyUSB1 && cat /dev/ttyUSB1
udhcpc -i usb0 (3) ping test OK
(1) Add glmark2 in bblayers.conf
# For glmark2
DISTRO_FEATURES:append = " opengl"
IMAGE_INSTALL:append = " glmark2"
PACKAGECONFIG:pn-glmark2 = \
"${@bb.utils.contains('DISTRO_FEATURES', 'x11 opengl', 'x11-gles2', '', d)} \
${@bb.utils.contains('DISTRO_FEATURES', 'wayland opengl', 'wayland-gles2', '', d)} \
drm-gles2"(2) Test GPU Run the following comman to test GPU in terminal or adb
XDG_RUNTIME_DIR=/run/user/1000 glmark2-es2-wayland Test result is shown in the following figure.

(3) View GPU occupancy rate
cat /sys/class/devfreq/fde60000.gpu/load



