Board rk3566
Buildroot
1. Create the environment
Memory requirement for computer configuration is at least 100GB free space. because after extracting
the sdk it has grown to 80GB.
Install Ubuntu 20.04 version.
Create a folder with Linux or whatever name to contain the SDK provided by the developer. This is
where we will build the image for the board.
Download the SDK to your working directory from the following link:
[Link]
Unzip SDK in Linux folder
tar -zxvf tspi_linux_sdk_20230916.[Link]
Check current directory after unzipping
Navigate to the extracted SDK directory tspi_linux_sdk_20230916
cd tspi_linux_sdk_20230916
View the contents of the SDK directory as follows
tspi_linux_sdk_20230916# ls
app buildroot debian [Link] IMAGE Makefile
prebuilts [Link] tools yocto
[Link] [Link] device external kernel [Link]
rkbin rockdev u-boot
2. Install the necessary packages
Update
apt update && apt upgrade –y
Install the basic toolkit
apt install -y build-essential gcc g++ make cmake \
pkg-config autoconf automake libtool \
bison flex m4
Libraries and tools for kernel / u-boot
apt install -y bc libssl-dev u-boot-tools \
device-tree-compiler python3-dev
Python and pip (for Rockchip build scripts)
apt install -y python3 python3-pip python3-setuptools python3-wheel
Cross-compilation / image support tools
apt install -y qemu-user-static binfmt-support \
parted dosfstools mtools \
android-sdk-libsparse-utils android-sdk-ext4-utils
Tool supports Buildroot / Debian rootfs
apt install -y rsync sudo file locales
For GUI or Qt
apt install -y libncurses5-dev libncursesw5-dev \
libglib2.0-dev libdrm-dev
Install Python2
apt install -y python2
Create a link for the python or python2 command to work
update-alternatives --install /usr/bin/python python /usr/bin/python2 1
Create symlink between python and python2
ln -s /usr/bin/python2 /usr/bin/python
Measure build time
apt install -y time
Tool to convert binary data to hex and vice versa
apt-get install -y vim-common
3. Reconfigure the display for Linux
need to replace the screen file to match the screen in use.
Link to download screem file to match the screen in use : [Link]
disp-6/blob/master/[Link]#
Place the /tspi-disp-6-master/[Link] file in the following folder and
replace the file in this path.
Release/kernel/arch/arm64/boot/dts/rockchip/tspi-rk3566-dsi-
[Link]
In this file [Link] that we are replace. We need to fix some parameter to
the screen can operate by command: /kernel/arch/arm64/boot/dts/rockchip# nano tspi-rk3566-
[Link]
From this
/*
* video_phy1 needs to be enabled
* when dsi1 is enabled
*/
&dsi1 {
status = "okay";
};
&dsi1_in_vp0 {
status = "disabled";
};
&dsi1_in_vp1 {
status = "okay";
};
&video_phy1 {
status = "okay";
};
&route_dsi1 {
status = "okay";//wucaicheng mipi okay
connect = <&vp1_out_dsi1>;
};
To this:
/*
* video_phy1 needs to be enabled
* when dsi1 is enabled
*/
&dsi1 {
status = "okay";
};
&dsi1_in_vp0 {
status = "okay";
};
&dsi1_in_vp1 {
status = "disabled";
};
&video_phy1 {
status = "okay";
};
&route_dsi1 {
status = "okay";//wucaicheng mipi okay
connect = <&vp0_out_dsi1>;
};
Find the [Link] file in the same folder , open it and edit it to
change the following content to enable the DSI screen, otherwise the MIPI screen will
not display
#include "[Link]"
#include "[Link]"
And comment other library
Touch part driver modification:
Copy the /tspi-disp-6-master/gt9xx folder in the attachment to the following and replace :
[Link]
/Release/kernel/drivers/input/touchscreen/gt9xx
4. Build image
To compile the Linux SDK, you need to install the following libraries
sudo apt-get install git ssh make gcc libssl-dev liblz4-tool expect \
g++ patchelf chrpath gawk texinfo chrpath diffstat binfmt-support \
qemu-user-static live-build bison flex fakeroot cmake gcc-multilib \
g++-multilib unzip device-tree-compiler ncurses-dev
Before starting the compilation, you need to configure the board for the LCSC Taishan-
RK3566-Linux
./[Link] device/rockchip/rk356x/[Link]
To check if the configuration has been applied correctly
./[Link] -h kernel
Select the Buildroot operating system
export RK_ROOTFS_SYSTEM=buildroot
Enable environment variables, if build into docker enviroment
export FORCE_UNSAFE_CONFIGURE=1
Check the added environment variables again
printenv
Build Image
./[Link] all
The first compilation requires selecting the power source.
Resuit
5. Packaging
Although the compilation is complete, we still need to execute the firmware packaging:
to create [Link] file in to rockdev folder
./[Link]
Next go to packaging all to [Link] to flash on chip rk3566
/tools/linux/Linux_Pack_Firmware/rockdev# ls
Image [Link] [Link]
rk3588-package-file-nvr-emmc rv1126-package-file-spi-nor-uvc
afptool rk3036-package-file rk3326-package-file
rk3588-package-file-nvr-spi-nand rv1126_rv1109-[Link]
[Link] [Link] [Link]
rkImageMaker rv1126_rv1109-package-file
[Link] rk3128-package-file rk3328-package-file
rv1126-package-file-emmc-dualcam-tb rv1126_rv1109-package-file-2-ab
orion-package-file [Link] [Link]
rv1126-package-file-emmc-tb rv1126_rv1109-package-file-2-ota
package-file rk3128h-package-file rk3358-package-file
rv1126-package-file-sllock rv1126_rv1109-package-file-ab
[Link] [Link] [Link]
rv1126-package-file-snapshot rv1126_rv1109-package-file-ota
px30-package-file rk312x-package-file rk3399-package-file
rv1126-package-file-spi-nand rv1126_rv1109-package-file-ramboot
[Link] [Link] [Link]
rv1126-package-file-spi-nand-256MB-ab rv1126_rv1109-package-file-uvc
px3se-package-file rk3229-package-file rk356x-package-file
rv1126-package-file-spi-nand-256MB-ota rv1126_rv1109-package-file-uvc-ab
[Link] [Link] rk356x-package-file-
nvr-emmc rv1126-package-file-spi-nand-ab rv1126_rv1109-package-
file-uvc-ota
[Link] rk3288-package-file rk356x-package-file-
nvr-spi-nand rv1126-package-file-spi-nand-ota sdcard-update-package-
file
[Link] [Link] rk356x-package-file-
spi-nand rv1126-package-file-spi-nand-uvc [Link]
rk1808-package-file rk3308-package-file rk356x-package-file-
spi-nor rv1126-package-file-spi-nand-uvc-ab
rk1808-package-file-ab rk3308-package-file-ab [Link]
rv1126-package-file-spi-nand-uvc-ota
rk1808-package-file-ota rk3308-package-file-ota rk3588-package-file
rv1126-package-file-spi-nor-tb
rk1808-rk1608-package-file rk3308-package-file-rootfs rk3588-package-file-ab
rv1126-package-file-spi-nor-tiny
To pack we use the following command
./[Link]
Resuilt
Download image file with name [Link]
6. Load firmware into the board
In Linux os
Dowload the tool from this website: Image Flashing Guide | LC Development Board
Tech Document Cente
Download [Link] file into the Linux_Upgrade_Tool 1.65, and the upgrade tool file is
in the same folder as the [Link] file.
In the board dev kit, press the REC button the first time, then press the RST button the
second time. in the last time, release the RST button and wait for the LED to turn on and
go into loading mode
./upgrade_tool
Press the R on the keyboard and press the 1 on the keyboard to choose the chip for
loading
uf [Link]
Wait for the firmwave to load into the chip
QT5 PORTING (build QT library for RK3566 dev
board )
1. Install the Cross Compiler (GNU)
Cross compiler download
link: [Link]
Copy the downloaded cross-compilation tool gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-
[Link] to the directory where you want to install it. Here, we choose the /opt folder. After
copying, run the following command in the /opt directory to extract it:
sudo tar -xvf gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-
[Link] -C /opt/
After extraction, a folder named gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu will be
created. The name of this folder is quite long, so we will rename it to gcc-aarch64-linux-gnu:
sudo mv gcc-linaro-7.5.0-2019.12-x86_64_aarch64-linux-gnu gcc-
aarch64-linux-gnu
Add the /opt/gcc-aarch64-linux-gnu/bin directory to the environment variables:
sudo nano /etc/profile
At the end of the file, add the following content:
export PATH="/opt/gcc-aarch64-linux-gnu/bin:$PATH" -> change this
path if you place gcc-aarch64-linux-gnu in orther folder.
Then run the command to make the environment variables take effect:
source /etc/profile
Reboot the system:
Reboot
After rebooting, run the following command to check if the environment variables have been
applied successfully:
aarch64-linux-gnu-gcc –v
If you see the following situation, it means the installation was successful.
2. Cross-compiling the Qt Library’
Link: [Link]
Copy the downloaded compressed package to the /opt directory and extract it:
tar -xvf [Link]
1
After extraction, you will have the folder /opt/qt-everywhere-src-5.12.10. Next, we need to edit
the qmake configuration file:
sudo nano /opt/qt-everywhere-src-5.12.10/qtbase/mkspecs/linux-aarch64-gnu-
g++/[Link]
1
Modify the file to the following:
#
# qmake configuration for building with aarch64-linux-gnu-g++
#
MAKEFILE_GENERATOR = UNIX
CONFIG += incremental
QMAKE_INCREMENTAL_STYLE = sublib
QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS_RELEASE += -O2 -march=armv8-a -lts
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv8-a -lts
include(../common/[Link])
include(../common/[Link])
include(../common/g++-[Link])
# modifications to g++.conf
QMAKE_CC = aarch64-linux-gnu-gcc
QMAKE_CXX = aarch64-linux-gnu-g++
QMAKE_LINK = aarch64-linux-gnu-g++
QMAKE_LINK_SHLIB = aarch64-linux-gnu-g++
# modifications to [Link]
QMAKE_AR = aarch64-linux-gnu-ar cqs
QMAKE_OBJCOPY = aarch64-linux-gnu-objcopy
QMAKE_NM = aarch64-linux-gnu-nm -P
QMAKE_STRIP = aarch64-linux-gnu-strip
load(qt_config)
The key lines to add are:
QT_QPA_DEFAULT_PLATFORM = linuxfb
QMAKE_CFLAGS_RELEASE += -O2 -march=armv8-a -lts
QMAKE_CXXFLAGS_RELEASE += -O2 -march=armv8-a –lts
Navigate to the Qt library folder:
cd /opt/qt-everywhere-src-5.12.10/
Create an [Link] script:
sudo nano [Link]
Enter the following content in the script:
#!/bin/sh
./configure \
-prefix /opt/qt5.12.10-arm \
-confirm-license \
-opensource \
-release \
-make libs \
-xplatform linux-aarch64-gnu-g++ \
-pch \
-qt-libjpeg \
-qt-libpng \
-qt-zlib \
-no-opengl \
-no-sse2 \
-no-openssl \
-no-cups \
-no-glib \
-no-dbus \
-no-separate-debug-info \
NOTE : -prefix /opt/qt5.12.10-arm \ -> IN THIS LINE YOU CHANGE PATH, IF YOU
PALCE qt5.12.10-arm FOLDER INTO ORTHER FOLDER
-prefix /opt/qt5.12.10-arm: Specifies the Qt installation path as /opt/qt5.12.10-arm. After compilation,
the Qt libraries and tools will be installed in this directory.
-confirm-license: Confirms the acceptance of the Qt license agreement.
-opensource: Compiles Qt under the open-source license.
-release: Compiles Qt as a release version, rather than a debug version.
-make libs: Compiles only the Qt libraries, without compiling example programs.
-xplatform linux-aarch64-gnu-g++: Specifies the target platform as Linux and compiles using
the aarch64 architecture. gnu-g++ means using the GNU toolchain.
-pch: Enables precompiled headers to speed up the compilation process.
-qt-libjpeg, -qt-libpng, -qt-zlib: Specifies using the system-installed libjpeg, libpng, and zlib libraries
during Qt compilation.
-no-opengl: Does not compile the OpenGL module of Qt.
-no-sse2: Disables the SSE2 instruction set optimization.
-no-openssl: Does not compile the OpenSSL module of Qt.
-no-cups: Does not compile the CUPS module of Qt (for printing support).
-no-glib: Does not compile the GLib module of Qt.
-no-dbus: Does not compile the D-Bus module of Qt.
-no-separate-debug-info: Does not generate separate debug information files.
Grant execution permissions to the .sh script:
sudo chmod 777 [Link]
Now, run the [Link] script to automatically generate the Makefile:
./[Link]
In this step you with meet some issure aboat version gcc do not match. So you will meet
error and the squence build was stopped.
You are building Qt 5.12.10 but using GCC 13 toolchain (on Ubuntu 22.04/24.04 host for
example).
Qt 5.12 is an old version (2019) → the source code is not fully compatible with the new
GCC (C++17/C++20 standard), so this type of error often occurs.
you need to find this file :
nano qtbase/src/corelib/tools/qbytearraymatcher.h
add this line in the top of the file and behind orther #include:
#include <limits>
Next have to include <limits> in this file:
nano qtbase/src/tools/moc/[Link]
add this line in the top of the file and behind orther #include:
#include <limits>
folder permissions qt-everywhere-src-5.12.10
sudo chown -R $(whoami):$(whoami)
~/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-src-5.12.10
change the path if you use the orther path
go to the file and include the library : #include <limits>:
nano ~/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-src-
5.12.10/qtbase/src/qml/jsruntime/qv4propertykey_p.h
change the path if you use the orther path
go to the file and include the library : #include<limits>:
qtdeclarative/src/qml/jsruntime/qv4propertykey_p.h
Manually create .obj folder in pcre2:
mkdir -p ~/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-src-5.12.10/qtbase/src/
3rdparty/pcre2/.obj
And rebuild
make clean
./[Link]
After the progress has done, Next, we use the make command to begin the compilation
(this may take some time):
make -j$(nproc)
result:
.10/qtbase/include/QtGui
-I/home/phuoc-embedded/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-
src-5.12.10/qtdeclarative/include/QtQml/5.12.10 -I/home/phuoc-
embedded/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-src-5.12.10/
qtdeclarative/include/QtQml/5.12.10/QtQml
-I/home/phuoc-embedded/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-
src-5.12.10/qtdeclarative/include/QtQml
-I/home/phuoc-embedded/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-
src-5.12.10/qtbase/include/QtNetwork
-I/home/phuoc-embedded/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-
src-5.12.10/qtbase/include/QtCore/5.12.10
-I/home/phuoc-embedded/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-
src-5.12.10/qtbase/include/QtCore/5.12.10/QtCore -I/home/phuoc-
embedded/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-src-5.12.10/
qtbase/include/QtCore -[Link] -I/home/phuoc-embedded/PROJECTS/facelog-
ng/linux1/opt/qt-everywhere-src-5.12.10/qtbase/mkspecs/linux-aarch64-
gnu-g++ -o .obj/webview.o [Link] rm -f libdeclarative_webview.so
aarch64-linux-gnu-g++ -Wl,-O1 -fuse-ld=gold -Wl,--enable-new-dtags -
Wl,-z,origin -Wl,-rpath,\$ORIGIN/../../lib -shared -o
libdeclarative_webview.so .obj/webview.o
/home/phuoc-embedded/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-src-
5.12.10/qtdeclarative/lib/[Link]
/home/phuoc-embedded/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-src-
5.12.10/qtwebview/lib/[Link]
/home/phuoc-embedded/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-src-
5.12.10/qtbase/lib/[Link] /home/phuoc-embedded/PROJECTS/facelog-
ng/linux1/opt/qt-everywhere-src-5.12.10/qtdeclarative/lib/[Link]
/home/phuoc-embedded/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-src-
5.12.10/qtbase/lib/[Link]
/home/phuoc-embedded/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-src-
5.12.10/qtbase/lib/[Link] -lpthread mv -f
libdeclarative_webview.so
../../qml/QtWebView/libdeclarative_webview.so make[3]: Leaving
directory '/home/phuoc-embedded/PROJECTS/facelog-ng/linux1/opt/qt-
everywhere-src-5.12.10/qtwebview/src/imports' make[2]: Leaving
directory '/home/phuoc-embedded/PROJECTS/facelog-ng/linux1/opt/qt-
everywhere-src-5.12.10/qtwebview/src' make[1]: Leaving directory
'/home/phuoc-embedded/PROJECTS/facelog-ng/linux1/opt/qt-everywhere-
src-5.12.10/qtwebview'
Next we will go to install, you will go to the root directory of qt-everywhere-src-5.12.10
sudo make install
After a while, you should see the installation directory /opt/qt5.12.10-arm in the /opt folder,
indicating that the installation was successful.
MOVE THE QT LIBRARY THAT WE HAVE INTEGRATED
FROM COMPUTER TO THE /OPT FOLDER IN THE RK3566
VIA USB
Create the zip file will library [Link]
tar -zcvf [Link] qt5.12.10-arm
Copy the [Link] file into the USB
Dowload thẻ electerm app to connect with board via USA to TTL
[Link]
When you press the enter button in the keyboard you will see: root@RK356X: /# this
mean you was connected into the board rk3566. And you stand on the terminal of board.
Mount the USB into the boark rk3566 and move the file [Link] into the /opt
folder from the usb to the board rk3566.
Check device that mount with the board, run this command into the terminal of
boark rk356.
mkdir -p /mnt/usb -> create a folder into the board to mount
with usb
mount /dev/sda1 /mnt/usb -> mount the folder with usb
cp /mnt/usb/[Link] /opt/ -> copy to /opt
Now you can remove the usb from the board.
Now unzip the folder
gunzip [Link] -> [Link]
tar [Link] -> qt5.12.10
Then, add the relevant files and configurations required by the Qt program to the
environment variables:
vi /etc/profile
At the end of the file, add the following:
export QTEDIR=/opt/qt5.12.10-arm/
export LD_LIBRARY_PATH=/opt/qt5.12.10-arm/lib:
$LD_LIBRARY_PATH
export QT_QPA_PLATFORM_PLUGIN_PATH=$QTEDIR/plugins
export QT_QPA_PLATFORM=linuxfb
export QT_QPA_FONTDIR=/usr/share/fonts/truetype/ubuntu
Finally, reboot the development board to make the environment variables take effect:
Reboot
INSTALL QT CREATE FOR COMPUTER TO DEV
Install QT Create with version 5.12 to math with library QT 5.12 that we are
crosscompiling for board rk3566.
Link to download QT Create for linux, windown, maxo:
[Link]
Because, we are build the qt library 5.12 for board rk3566, so that we have to install qt
5.12 for computer for develop qt application.
After download version for linux, you will run this commands to install qt create for
linux.
chmod +x [Link]
./[Link]
Next we can dev with your app with QT Creater. You can dev with QT qml
BUILD THE QT APP THAT WE WAS DEVELOPED IN THE COMPUTER WITH
CROSSCOMP THAT WE WAS BUILD FOR BOAR RK3566.
Use the cd command to enter the project folder directory. Inside, type the following
command to create a Makefile using qmake:
Note: This is the cross-compiled Qt library installation directory (qt5.12.10-arm). Use the
absolute path of qmake. If you changed the qmake path, make sure to update it to the correct
absolute path.
/opt/qt5.12.10-arm/bin/qmake
After running this, you should see a Makefile in the project directory. Now, run the
Makefile:
sudo make -j12 or make –j12
Wait a moment, and you will see a runnable program with the same name as the .pro file:
Now you have to copy and move all file in the project into the board rk3566 by USB.
Run the your app in rk3566
Before running the app, export additional environment variables:
export QML2_IMPORT_PATH=/opt/qt5.12.10-arm/qml
export QT_PLUGIN_PATH=/opt/qt5.12.10-arm/plugins
export LD_LIBRARY_PATH=/opt/qt5.12.10-arm/lib:$LD_LIBRARY_PATH
export QT_QPA_PLATFORM=linuxfb
And make sure that with qt 5.12 you have to import QtQuick 2.12 in your project
./ClockTop to run your project on the board rk3566. ClockTop is your
project that you build befor by toolchain.