Phytec中国的wiki
support@phytec.cn
热线:0755-61802110-803
本文测试环境为:BSP-Yocto-i.MX6-PD18.1.0
vnc依赖于x11环境, 在安装vnc之前需要先按照以下wiki内容配置x11环境:
yocto安装x11环境 / yocto install x11
开发板安装vnc客户端
在bsp包的build/conf/local.conf添加以下内容,安装vnc客户端软件
IMAGE_INSTALL_append = " tigervnc"
注意: BSP-Yocto-i.MX6-PD18.1.0 对应的yocto版本是Yocto 2.4.3 (rocko), tigervnc是在rocko及以上版本才有, 如果是使用其他yocto版本的bsp, 需要先在以下网页中查找该版本对应的vnc客户端软件
http://layers.openembedded.org/layerindex/branch/master/recipes/
以上修改之后, 重新编译镜像后, 开发板linux就会安装vnc客户端软件vncviewer.
主机ubuntu安装vnc服务端
sudo apt-get install tightvncserver
安装vncserver之后, 主机打开执行vncserver
nzhang@Z220:~$ vncserver You will require a password to access your desktops. Password: Verify: Would you like to enter a view-only password (y/n)? y Password: Password too short New 'X' desktop is Z220:1 Creating default startup script /mnt/work/home/nzhang/.vnc/xstartup Starting applications specified in /mnt/work/home/nzhang/.vnc/xstartup Log file is /mnt/work/home/nzhang/.vnc/Z220:1.log
第一次执行vncserver之后会在home目录下新建~/.vnc/xstartup的启动脚本.
此时如果用vnc客户端连接vncserver之后, 会发现显示的是空白内容.
因此, 需要在xstartup启动脚本中添加一些显示管理软件
首先需要在主机ubuntu中安装以下软件
sudo apt-get install gnome-panel sudo apt-get install metacity sudo apt-get install light-themes
然后修改~/.vnc/xstartup内容, 内容修改如下
#!/bin/sh xrdb $HOME/.Xresources xsetroot -solid grey x-terminal-emulator -geometry 80x24+10+10 -ls -title "$VNCDESKTOP Desktop" & #x-window-manager & # Fix to make GNOME work export XKL_XMODMAP_DISABLE=1 /etc/X11/Xsession #gnome-session & gnome-panel & gnome-settings-daemon & metacity & nautilus &
经过以上配置之后, 先关掉原来打开的vncserver, 再执行vncserver即可.
vncserver -kill :1 vncserver
开发板vnc客户端连接vncserver
在开发板的sato的桌面环境下点击Tiger Viewer 或者 在x11的Terminal中执行vncviewer 即可开启vnc客户端.
其中VNC server应该填写格式为[host][:display], 如192.168.1.253:1, display是主机执行vncserver后的display number.
另外注意, 不能在串口终端中执行vncviewer, 否则会有以下错误.
root@phyboard-mira-imx6-3:~# vncviewer TigerVNC Viewer 32-bit v1.8.0 Built on: 2018-11-14 07:46 Copyright (C) 1999-2017 TigerVNC Team and many others (see README.txt) See http://www.tigervnc.org for information on TigerVNC. Can't open display: