前言
有时候我们可能远程开发,看不到HDMI显示器,或者我们可能没有HDMI或者LCD的显示器,但是又需要测试GUI程序,我们可以借助Xserver去实现。
我们可以在Windows下运行xming作为xserver,然后开发板作为client,在开发板运行GUI程序时,使用服务端的xserver作为显示器,发送到服务端显示,服务端windows下通过xming显示。
过程下载安装xming
https://sourceforge.net/projects/xming/files/latest/download
打开
image.png
image.png
image.png
image.png
image.png
image.png
image.png

开发板配置
vi /etc/ssh/sshd_config使能以下设置
X11Forwarding yes
image.png
Putty
Putty的下载和安装不再赘述
按如下连接ssh
查看开发板ip192.168.31.90
image.png
image.png
image.png
输入用户名和密码
如果没有设置root用户密码,需要先在串口终端中passwd设置密码。
image.png
连接
运行Xming
image.png
Putty ssh登录开发板后
sudo apt-get install x11-xserver-utils
复制代码
xhost +
复制代码
打印
image.png
root@IMX8-Tronlong:~# xhost +
  • access control disabled, clients can connect from any host
  • root@IMX8-Tronlong:~#
  • 复制代码
    Pc端查看ip地址为192.168.31.64
    image.png
    设置
    export DISPLAY=192.168.31.64:0.0
    复制代码
    0.0和上述xming显示的对应。
    192.168.31.64为服务端IP地址。
    putty中输入xclock可以看到windows下显示了GUI
    :需要先sudo apt-get install x11-apps
    image.png
    总结
    以上通过xserver解决了没有显示器而需要运行GUI程序的问题,后面我们进行GUI
    开发测试就非常方便了。