rk3506b移植lvgl_chess流程

将lvgl作为子模块

在本地通过sdl模拟运行

1
cd /home/dky/workspaces/CChess && make TARGET=lvgl DBG=1 -j && ./build/lvgl/chess_lvgl

交叉编译

1
2
3
export CROSS_COMPILE=/home/dky/workspaces_rk/prebuilts/gcc/linux-x86/arm/gcc-arm-10.3-2021.07-x86_64-arm-none-linux-gnueabihf/bin/arm-none-linux-gnueabihf-
export CC=${CROSS_COMPILE}gcc
make TARGET=lvgl DBG=1 LVGL_BACKEND=drm CC="$CC" PKG="$PKG_CONFIG" -j

还有一些变量的配置写在了lvgl.mk中

或者直接执行脚本自动设置交叉编译的变量

1
./build_lvgl_rk3506.sh

将代码拷贝到SD卡

1
2
sudo mount -t drvfs F: /mnt/sdcard/
sudo umount /mnt/sdcard
1
2
3
cp -r assets /mnt/sdcard/
cp run_rk_drm.sh /mnt/sdcard/
cp build/lvgl/chess_lvgl /mnt/sdcard/build/lvgl/

开发板

1
2
root@ATK-DLRK3506:/mnt/sdcard# ls
run_rk_drm.sh assets build chess_lvgl

关闭默认的ui,这两个启动脚本具体内容可以看附录

1
2
/etc/init.d/S50systemui stop #kill正点原子的默认ui
/etc/init.d/S49weston stop #kill weston进程
1
2
3
4
5
6
root@ATK-DLRK3506:/mnt/sdcard# ./run_rk_drm.sh
[run_rk_drm] BIN=/mnt/sdcard/build/lvgl/chess_lvgl
[run_rk_drm] XQ_DRM_CARD=/dev/dri/card0
[run_rk_drm] XQ_LVGL_POINTER_DEV=/dev/input/event0
[lvgl] started (viewport=480x854). Press Ctrl+C to quit.

image-20260328233654593

运行结果

chess_lvgl_rk3506b_3.1_mipi_realrunning

附录

脚本目录:/etc/init.d/S49weston

代码目录:buildroot/package/weston/S49weston

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
#!/bin/sh
### BEGIN INIT INFO
# Provides: weston
# Required-Start: mountvirtfs
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Linux weston daemon
### END INIT INFO

PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"

# Load default env variables from profiles(e.g. /etc/profile.d/weston.sh)
. /etc/profile

start_weston()
{
/usr/bin/weston 2>&1 | tee /var/log/weston.log &
}

stop_weston()
{
killall weston
}

case "$1" in
start)
echo -n "starting weston... "
start_weston
echo "done."
;;
stop)
echo -n "stoping weston... "
stop_weston || true
echo "done."
;;
restart|reload)
echo -n "stoping weston... "
stop_weston

while pgrep -x weston; do
sleep .1
done
echo "done."

echo -n "starting weston... "
start_weston
echo "done."
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

exit 0

脚本目录:/etc/init.d/S50systemui

代码目录:buildroot/board/alientek/atk-dlrk3506/fs-overlay/etc/init.d/S50systemui

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
# Provides:          systemui
# Required-Start: mountvirtfs
# Required-Stop:
# Should-Start:
# Should-Stop:
# Default-Start: 2 3 4 5
# Default-Stop: 0 1 6
# Short-Description: Qt systemui
### END INIT INFO

PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"

# Load default env variables from profiles(e.g. /etc/profile.d/*.sh)
. /etc/profile

start_systemui()
{
# Wait for weston ready, 5 seconds timeout
counter=0
while [ ! -e "${XDG_RUNTIME_DIR}/wayland-0" ] && [ $counter -lt 50 ]; do
sleep 0.1
counter=$((counter + 1))
done
/userdata/ui/systemui > /dev/null 2>&1 &
}

stop_systemui()
{
killall systemui
}

case "$1" in
start)
echo -n "starting systemui... "
start_systemui
echo "done."
;;
stop)
echo -n "stoping systemui... "
stop_systemui
echo "done."
;;
restart|reload)
echo -n "stoping systemui... "
stop_systemui && sleep .3
echo "done."

echo -n "starting systemui... "
start_systemui
echo "done."
;;
*)
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

exit 0

参考

  • 项目 Git Submodule(LVGL 依赖)管理规范