phyCORE-AM57x weston 开机默认是开启的,是在weston.service 中执行的。

可以使用以下命令开启和关闭weston.service

systemctl start weston.service
systemctl stop weston.service

如果直接在命令行中打开weston, 会有以下错误

root@am5728-phycore-rdk:/# weston
Date: 2018-01-15 UTC
[05:07:02.015] weston 1.11.0
               http://wayland.freedesktop.org
               Bug reports to: https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=weston&version=1.11.0
               Build: 1.10.93-2-g2d825ed configure.ac: bump to version 1.11.0 for the official release (2016-05-31 17:10:40 -0700)
[05:07:02.015] OS: Linux, 4.9.41-ga382b46-BSP-Yocto-TISDK-AM57xx-PD18.1.0, #1 SMP PREEMPT Sun Jan 14 21:44:05 PST 2018, armv7l
[05:07:02.015] Using config file '/etc//weston.ini'
[05:07:02.016] Output repaint window is 7 ms maximum.
[05:07:02.016] Loading module '/usr/lib/weston/wayland-backend.so'
[05:07:02.016] Failed to load module: /usr/lib/weston/wayland-backend.so: cannot open shared object file: No such file or directory
[05:07:02.016] fatal: failed to create compositor backend

系统里找不到wayland-backend.so 这个库。为了解决这个问题,可以先看看weston.service是如何执行的

root@am5728-phycore-rdk:/# find . -name "weston.service"
./run/systemd/generator.late/weston.service
./run/systemd/generator.late/graphical.target.wants/weston.service
./run/systemd/generator.late/multi-user.target.wants/weston.service

打开weston.service文件,发现weston.service 执行的是/etc/init.d/weston 脚本

ExecStart=/etc/init.d/weston start
ExecStop=/etc/init.d/weston stop

打开/etc/init.d/weston 脚本,发现执行start 参数时,需要先取消WAYLAND_DISPLAY环境变量

# Weston for some reason dies if these environment variables are set
unset WAYLAND_DISPLAY

按照/etc/init.d/weston脚本,先取消WAYLAND_DISPLAY环境变量

root@am5728-phycore-rdk:/# export | grep WAYLAND_DISPLAY
export WAYLAND_DISPLAY="wayland-0"
root@am5728-phycore-rdk:/# unset WAYLAND_DISPLAY
root@am5728-phycore-rdk:/# export | grep WAYLAND_DISPLAY
root@am5728-phycore-rdk:/# weston
Date: 2018-01-15 UTC
[05:30:19.065] weston 1.11.0
               http://wayland.freedesktop.org
               Bug reports to: https://bugs.freedesktop.org/enter_bug.cgi?product=Wayland&component=weston&version=1.11.0
               Build: 1.10.93-2-g2d825ed configure.ac: bump to version 1.11.0 for the official release (2016-05-31 17:10:40 -0700)
[05:30:19.065] OS: Linux, 4.9.41-ga382b46-BSP-Yocto-TISDK-AM57xx-PD18.1.0, #1 SMP PREEMPT Sun Jan 14 21:44:05 PST 2018, armv7l
[05:30:19.065] Using config file '/etc//weston.ini'
[05:30:19.065] Output repaint window is 7 ms maximum.
[05:30:19.065] Loading module '/usr/lib/weston/drm-backend.so'
[05:30:19.069] initializing drm backend
[05:30:19.069] failed to get VT mode: No such file or directory
[05:30:19.069] fatal: drm backend should be run using weston-launch binary or as root
[05:30:19.069] fatal: failed to create compositor backend

这里需要的动态库已经改为了drm-backend.so,并且找到了。但是还有一个问题,无法取得VT模式。再查看/etc/init.d/weston脚本,发现是用openvt打开weston

openvt -c 4 -f runWeston
root@am5728-phycore-rdk:/# which runWeston
/usr/bin/runWeston

打开runWeston脚本 , 发现是主要是调用weston应用程序

weston --idle-time=0 >> /var/log/weston.log 2>&1

所以依照脚本,使用openvt 来打开weston

root@am5728-phycore-rdk:/# openvt -c 4 -f weston

用这种方式打开weston之后,就不会报错了。

  • No labels