IMX6 transplants X11vnc to build a remote control environment

Copyright statement: This article is a reprinted article, in compliance with the CC 4.0 BY-SA copyright agreement, please attach the original source link and this statement for reprinting.
Original link: https://blog.csdn.net/wanvan/article/details/86506718

It can be directly copied to the X11VNC application used on the arm32 linux system, without configuration, just decompress and use:

Support X11 version [Shareable screen, keyboard and mouse operation]

https://download.csdn.net/download/wanvan/10920626
server start:
./x11vnc

X11 version is not supported [Only sharing screen, not keyboard and mouse operation]

vnc_arm32_withoutX11_rawfb
https://download.csdn.net/download/wanvan/10920632

Server start:
./x11vnc -rawfb /dev/fb0 -clip 640x480+0+0

Then the PC side can connect to the server side through VNC-Viewer. Note: It is a prerequisite to ensure that the server and client networks can be pinged before they can be connected.

There is an IMX6 board in hand, in order to facilitate the direct display of the interface content of the arm32 board on the PC (so that you can display the content without an external monitor on the board), and can be operated by the mouse and keyboard. To put it bluntly, it is to realize remote control. After investigation, X11VNC can be used, but there is no version that can be directly used for imx6 arm32, so there is no way to compile and transplant it yourself.
The entire process of building a VNC environment on the IMX6 embedded platform is as follows:

Method 1: Install the VNC server on the IMX6 development board:

Install x11vnc as a VNC server through script
https://blog.csdn.net/zjqlovell/article/details/52910097

https://github.com/suchja/x11server

https://github.com/LibVNC/libvncserver

Method 2: The process of VNC cross-compilation and transplantation to the ARM development board [the final solution used]

X11VNC source code download address:
http://x11vnc.sourceforge.net/dev/x11vnc-0.9.14-dev.tar.gz

Compile the version that does not support x11


Just start to configure according to the following command: CC=arm-poky-linux-gnueabi-gcc CFLAGS=-O2 ./configure --host=arm-linux --without-x --prefix=/opt/vnc/

Insert picture description here

The reason for reporting that libraries and object files such as crtl.o and -lgcc_s cannot be found is: Some cross-compilation parameters are missing during configure. The correct parameters are as follows:

AR=arm-poky-linux-gnueabi-ar LD=arm-poky-linux-gnueabi-ld AS=arm-poky-linux-gnueabi-as ./configure CC=arm-poky-linux-gnueabi-gcc -cache-file=cache0 --host=arm-poky-linux --prefix=/opt/vnc/
CFLAGS="-march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi”

The final command to configure OK normally is as follows:
AR=arm-poky-linux-gnueabi-ar LD=arm-poky-linux-gnueabi-ld AS=arm-poky-linux-gnueabi-as ./configure CC=arm-poky -linux-gnueabi-gcc -cache-file=cache0 --host=arm-poky-linux --without-x --prefix=/opt/vnc/ CFLAGS="-march=armv7-a -mfpu=neon -mfloat -abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi" [rawfb is also OK]
as above The compiled version can only use rawfb when running on imx6, because X11 is not supported

The output after Configure is as follows:

Insert picture description here

After make, sudo make install
must add "sudo" to sudo make install, otherwise the directory creation under opt/vnc/ will fail and the installation process will fail. The installation is OK as above.

Compile the version that supports x11

Configure the vnc server version that supports X11 mode:
AR=arm-poky-linux-gnueabi-ar LD=arm-poky-linux-gnueabi-ld AS=arm-poky-linux-gnueabi-as ./configure CC=arm- poky-linux-gnueabi-gcc -cache-file=cache0 --host=arm-poky-linux --prefix=/opt/vnc_arm32/ CFLAGS="-march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi" [Use the cross-compilation tool chain extracted on imx6 】

Compile

Insert picture description here

Insert picture description here

The above report could not find -lX11 and related libraries, in fact, I ended up going to the path fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib to find any- lX11, and there is no such library in this path before. In addition, the related libraries are all x86-x64 versions, not arm versions. Replace the relevant library under this path with the so library under usr/lib on imx6, then configure passes;

The following error is reported when make compiles:
Insert picture description here

Solution: Extract the entire X11 directory from the imx6 board usr/include to the cross-compilation tool chain fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include path Then the compilation is passed.

Finally, there is no problem with make install. Then pack it into tar format, copy it to imx6 board, and decompress it.

Start and run: ./x11vnc can be configured without anything, and then the PC side connects to it through VNC-Viewer, you can see the interface of the arm board, the mouse and the keyboard can also be operated

Method 3: Develop your own program based on the VNC library

LibVNCServer/LibVNCClient are cross-platform C libraries that allow you to easily implement VNC server or client functionality in your program.

https://sourceforge.net/projects/libvncserver/

Connect and preview

Copy the vnc library compiled by the previous method 2 to the opt directory of IMX6 (in fact, copy it to any path), and then run ./x11vnc directly, and you can bring some parameters to
set the PC-IMX direct communication
PC Set the static IP of the Ethernet: eth0 set the static IP, and the IP should not be in the same network segment as the ip of wlan0

Set the static IP of the Ethernet on the IMX6 side: sudo ifconfig eth0 192.168.0.101 to
keep the PC and IMX6 on the same network. After the crossover cable is connected, ping each other. If they can ping each other, it means that they can communicate normally.

Start the VNC service
on the IMX6 side. After compiling the make install before, transplant the compiled package to the IMX6 /opt directory, without configuring the password and other operations.

The compiled non-X11 vnc version starts as follows:

Run the following commands:
./x11vnc -rawfb / dev / FB0 -pipeinput UINPUT: Touch, tslib_cal = / etc / pointercal, direct_abs = / dev / INPUT / Event2, nouinput, dragskip. 4 = 0 + 0 + 640x480, Clip
wherein the calibration The path of the file tslib_cal and the touch screen device direct_abs should be replaced with the path in your own device. [Tag: The mouse and keyboard do not respond after the compiled non-X11 version of the client is connected. I have tried many configurations and have not solved it]

The compiled X11 version starts as follows:

./x11vnc can be configured without anything, and then the PC side connects to it through VNC-Viewer, you can see the interface of the arm board, the mouse and the keyboard can also be operated

The PC is connected
through vncviewer. Connect the device through the vnc client tool such as vncviewer on the PC side. At this time, you can see the content displayed by the device, and you can operate the device through the mouse.

The problem encountered:
According to the above operation, the PC terminal can indeed see the screen on the imx6. But the PC mouse cannot be clicked. Similar to the following: The
transplantation of x11vnc on the embedded arm development board is successful, and the test program can be run.
At this time, use VNCviewer on the PC to access the program on the arm. The result can only display the real-time display desktop, and the client cannot be controlled by the mouse and keyboard. Server
(./x11vnc -noipv6 -rawfb /dev/fb0 -pipeinput UINPUT:touch,tslib_cal=/etc/pointercal,direct_abs=/dev/input/event2,nouinput,dragskip=4 -clip 640x480+0+0 -usepw ) This is my code to start x11vnc on arm

The reason why the mouse and keyboard cannot be used: When compiling the x11vn source code earlier, the compilation mode selected does not support the x11 mode. X-server related content is used in X11 mode. X-server can be operated with mouse and keyboard, so keyboard and mouse can be used in X11 version. Previously compiled in non-x11 mode, you can only use ./x11vnc -rawfb to display the contents of the screen of the arm board. The mouse and keyboard are not available. The above command says that keyboard and mouse can be used. It should be supported by tslib_cal and direct_abs. And my arm board is currently not ported to tslib

                                </div>
            <link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-095d4a0b23.css" rel="stylesheet">
                </div>
Copyright statement: This article is a reprinted article, in compliance with the CC 4.0 BY-SA copyright agreement, please attach the original source link and this statement for reprinting.
Original link: https://blog.csdn.net/wanvan/article/details/86506718

It can be directly copied to the X11VNC application used on the arm32 linux system, without configuration, just decompress and use:

Support X11 version [Shareable screen, keyboard and mouse operation]

https://download.csdn.net/download/wanvan/10920626
server start:
./x11vnc

X11 version is not supported [Only sharing screen, not keyboard and mouse operation]

vnc_arm32_withoutX11_rawfb
https://download.csdn.net/download/wanvan/10920632

Server start:
./x11vnc -rawfb /dev/fb0 -clip 640x480+0+0

Then the PC side can connect to the server side through VNC-Viewer. Note: It is a prerequisite to ensure that the server and client networks can be pinged before they can be connected.

There is an IMX6 board in hand, in order to facilitate the direct display of the interface content of the arm32 board on the PC (so that you can display the content without an external monitor on the board), and can be operated by the mouse and keyboard. To put it bluntly, it is to realize remote control. After investigation, X11VNC can be used, but there is no version that can be directly used for imx6 arm32, so there is no way to compile and transplant it yourself.
The entire process of building a VNC environment on the IMX6 embedded platform is as follows:

Method 1: Install the VNC server on the IMX6 development board:

Install x11vnc as a VNC server through script
https://blog.csdn.net/zjqlovell/article/details/52910097

https://github.com/suchja/x11server

https://github.com/LibVNC/libvncserver

Method 2: The process of VNC cross-compilation and transplantation to the ARM development board [the final solution used]

X11VNC source code download address:
http://x11vnc.sourceforge.net/dev/x11vnc-0.9.14-dev.tar.gz

Compile the version that does not support x11


Just start to configure according to the following command: CC=arm-poky-linux-gnueabi-gcc CFLAGS=-O2 ./configure --host=arm-linux --without-x --prefix=/opt/vnc/

Insert picture description here

The reason for reporting that libraries and object files such as crtl.o and -lgcc_s cannot be found is: Some cross-compilation parameters are missing during configure. The correct parameters are as follows:

AR=arm-poky-linux-gnueabi-ar LD=arm-poky-linux-gnueabi-ld AS=arm-poky-linux-gnueabi-as ./configure CC=arm-poky-linux-gnueabi-gcc -cache-file=cache0 --host=arm-poky-linux --prefix=/opt/vnc/
CFLAGS="-march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi”

The final command to configure OK normally is as follows:
AR=arm-poky-linux-gnueabi-ar LD=arm-poky-linux-gnueabi-ld AS=arm-poky-linux-gnueabi-as ./configure CC=arm-poky -linux-gnueabi-gcc -cache-file=cache0 --host=arm-poky-linux --without-x --prefix=/opt/vnc/ CFLAGS="-march=armv7-a -mfpu=neon -mfloat -abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi" [rawfb is also OK]
as above The compiled version can only use rawfb when running on imx6, because X11 is not supported

The output after Configure is as follows:

Insert picture description here

After make, sudo make install
must add "sudo" to sudo make install, otherwise the directory creation under opt/vnc/ will fail and the installation process will fail. The installation is OK as above.

Compile the version that supports x11

Configure the vnc server version that supports X11 mode:
AR=arm-poky-linux-gnueabi-ar LD=arm-poky-linux-gnueabi-ld AS=arm-poky-linux-gnueabi-as ./configure CC=arm- poky-linux-gnueabi-gcc -cache-file=cache0 --host=arm-poky-linux --prefix=/opt/vnc_arm32/ CFLAGS="-march=armv7-a -mfpu=neon -mfloat-abi=hard -mcpu=cortex-a9 --sysroot=/opt/fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi" [Use the cross-compilation tool chain extracted on imx6 】

Compile

Insert picture description here

Insert picture description here

The above report could not find -lX11 and related libraries, in fact, I ended up going to the path fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/lib to find any- lX11, and there is no such library in this path before. In addition, the related libraries are all x86-x64 versions, not arm versions. Replace the relevant library under this path with the so library under usr/lib on imx6, then configure passes;

The following error is reported when make compiles:
Insert picture description here

Solution: Extract the entire X11 directory from the imx6 board usr/include to the cross-compilation tool chain fsl-imx-x11/4.1.15-2.1.0/sysroots/cortexa9hf-neon-poky-linux-gnueabi/usr/include path Then the compilation is passed.

Finally, there is no problem with make install. Then pack it into tar format, copy it to imx6 board, and decompress it.

Start and run: ./x11vnc can be configured without anything, and then the PC side connects to it through VNC-Viewer, you can see the interface of the arm board, the mouse and the keyboard can also be operated

Method 3: Develop your own program based on the VNC library

LibVNCServer/LibVNCClient are cross-platform C libraries that allow you to easily implement VNC server or client functionality in your program.

https://sourceforge.net/projects/libvncserver/

Connect and preview

Copy the vnc library compiled by the previous method 2 to the opt directory of IMX6 (in fact, copy it to any path), and then run ./x11vnc directly, and you can bring some parameters to
set the PC-IMX direct communication
PC Set the static IP of the Ethernet: eth0 set the static IP, and the IP should not be in the same network segment as the ip of wlan0

Set the static IP of the Ethernet on the IMX6 side: sudo ifconfig eth0 192.168.0.101 to
keep the PC and IMX6 on the same network. After the crossover cable is connected, ping each other. If they can ping each other, it means that they can communicate normally.

Start the VNC service
on the IMX6 side. After compiling the make install before, transplant the compiled package to the IMX6 /opt directory, without configuring the password and other operations.

The compiled non-X11 vnc version starts as follows:

Run the following commands:
./x11vnc -rawfb / dev / FB0 -pipeinput UINPUT: Touch, tslib_cal = / etc / pointercal, direct_abs = / dev / INPUT / Event2, nouinput, dragskip. 4 = 0 + 0 + 640x480, Clip
wherein the calibration The path of the file tslib_cal and the touch screen device direct_abs should be replaced with the path in your own device. [Tag: The mouse and keyboard do not respond after the compiled non-X11 version of the client is connected. I have tried many configurations and have not solved it]

The compiled X11 version starts as follows:

./x11vnc can be configured without anything, and then the PC side connects to it through VNC-Viewer, you can see the interface of the arm board, the mouse and the keyboard can also be operated

The PC is connected
through vncviewer. Connect the device through the vnc client tool such as vncviewer on the PC side. At this time, you can see the content displayed by the device, and you can operate the device through the mouse.

The problem encountered:
According to the above operation, the PC terminal can indeed see the screen on the imx6. But the PC mouse cannot be clicked. Similar to the following: The
transplantation of x11vnc on the embedded arm development board is successful, and the test program can be run.
At this time, use VNCviewer on the PC to access the program on the arm. The result can only display the real-time display desktop, and the client cannot be controlled by the mouse and keyboard. Server
(./x11vnc -noipv6 -rawfb /dev/fb0 -pipeinput UINPUT:touch,tslib_cal=/etc/pointercal,direct_abs=/dev/input/event2,nouinput,dragskip=4 -clip 640x480+0+0 -usepw ) This is my code to start x11vnc on arm

The reason why the mouse and keyboard cannot be used: When compiling the x11vn source code earlier, the compilation mode selected does not support the x11 mode. X-server related content is used in X11 mode. X-server can be operated with mouse and keyboard, so keyboard and mouse can be used in X11 version. Previously compiled in non-x11 mode, you can only use ./x11vnc -rawfb to display the contents of the screen of the arm board. The mouse and keyboard are not available. The above command says that keyboard and mouse can be used. It should be supported by tslib_cal and direct_abs. And my arm board is currently not ported to tslib

                                </div>
            <link href="https://csdnimg.cn/release/phoenix/mdeditor/markdown_views-095d4a0b23.css" rel="stylesheet">
                </div>

Guess you like

Origin blog.csdn.net/qq_34743935/article/details/100981405