phytec bsp包默认不带x11环境,  在某些情况下, 如果需要安装x11环境, 可按本文方法配置安装x11环境.

本文以BSP-Yocto-i.MX6-PD18.1.0 为例, 其他bsp修改方式也可类推.

使能X11

默认的phytec bsp去掉了x11的依赖, 需要先恢复x11的依赖关系,  需要修改yogurt.conf和phytec-qt5demo-image.bb文件.

修改sources/meta-yogurt/conf/distro/yogurt.conf 文件, 如下:

diff --git a/conf/distro/yogurt.conf b/conf/distro/yogurt.conf
index dc7d6dc..9a28535 100644
--- a/conf/distro/yogurt.conf
+++ b/conf/distro/yogurt.conf
@@ -4,8 +4,8 @@ require common.inc
 DISTRO = "yogurt"
 DISTRO_NAME = "Yogurt (Phytec Example Distribution)"
 
-DISTRO_FEATURES += "systemd"
-DISTRO_FEATURES_remove = "argp irda pcmcia zeroconf x11 ptest multiarch vulkan wayland"
+DISTRO_FEATURES += "systemd x11"
+DISTRO_FEATURES_remove = "argp irda pcmcia zeroconf ptest multiarch vulkan wayland"
 
 VIRTUAL-RUNTIME_dev_manager = "udev"
 VIRTUAL-RUNTIME_init_manager = "systemd"

修改sources/meta-yogurt/recipes-images/images/phytec-qt5demo-image.bb, 如下:

diff --git a/recipes-images/images/phytec-qt5demo-image.bb b/recipes-images/images/phytec-qt5demo-image.bb
index 0c8e694..1d2c104 100644
--- a/recipes-images/images/phytec-qt5demo-image.bb
+++ b/recipes-images/images/phytec-qt5demo-image.bb
@@ -9,7 +9,7 @@ LICENSE = "MIT"
 
 inherit distro_features_check populate_sdk_qt5
 
-CONFLICT_DISTRO_FEATURES = "x11 wayland"
+CONFLICT_DISTRO_FEATURES = "wayland"
 
 IMAGE_INSTALL += "\
     packagegroup-base \

取消使能phytec-qtdemo.service

在x11的桌面环境下,  bsp包可取消使能phytec-qtdemo.service, 可修改sources/meta-yogurt/recipes-qt/examples/phytec-qtdemo_git.bb

diff --git a/recipes-qt/examples/phytec-qtdemo_git.bb b/recipes-qt/examples/phytec-qtdemo_git.bb
index ce6cdca..27d7355 100644
--- a/recipes-qt/examples/phytec-qtdemo_git.bb
+++ b/recipes-qt/examples/phytec-qtdemo_git.bb
@@ -29,6 +29,7 @@ S = "${WORKDIR}/git"
 inherit qmake5 systemd
 
 SYSTEMD_SERVICE_${PN} = "phytec-qtdemo.service"
+SYSTEMD_AUTO_ENABLE = "disable"
 
 PACKAGES += "${PN}-democontent ${PN}-videos"
 

安装x11桌面环境

在bsp包的build/conf/local.conf文件中, 需要添加以下内容, 为开发板安装x11桌面环境.

REQUIRED_DISTRO_FEATURES = "x11"
IMAGE_FEATURES += "package-management x11-base x11-sato"

经过以上修改, 重新编译phytec-qt5demo-image镜像完成后, 镜像就会安装了x11-sato桌面环境. 

使能sato内置的虚拟键盘/触摸屏键盘

新建 /etc/formfactor/machconfig文件


HAVE_TOUCHSCREEN=1 (是否显示指针)
HAVE_KEYBOARD=0 (是否使能软键盘)

将tslib设为X server的输入设备

sato默认的输入设备为libinput,它没有电阻屏需要的滤波,校准等功能,而sato自带的校准程序 xinput_calibrator虽然可以校准,但不能生成X server可用的校准参数。

因此需要使用tslib来作为输入设备。

首先需要增加xf86-input-tslib,在local.conf中增加:

IMAGE_INSTALL_append = " xf86-input-tslib"

由于这个版本BSP中的xf86-input-tslib软件版本有点儿老,需要打一个补丁(https://github.com/merge/xf86-input-tslib/commit/93673abfeb499aa760dd132bd318fb4a5edd4eaf):

diff --git a/meta-oe/recipes-graphics/xorg-driver/xf86-input-tslib/0001-src-fix-the-build-for-xserver-1.19-a
new file mode 100644
index 0000000..42a71ff
--- /dev/null
+++ b/meta-oe/recipes-graphics/xorg-driver/xf86-input-tslib/0001-src-fix-the-build-for-xserver-1.19-and-late
@@ -0,0 +1,44 @@
+From 93673abfeb499aa760dd132bd318fb4a5edd4eaf Mon Sep 17 00:00:00 2001
+From: Martin Kepplinger <martink@posteo.de>
+Date: Wed, 26 Apr 2017 19:20:31 +0200
+Subject: [PATCH] src: fix the build for xserver 1.19 and later
+
+We suffer from the same thing other X input drivers suffered, see
+for example https://bugs.gentoo.org/show_bug.cgi?id=599938
+
+Let's use the same fix proposed there.
+---
+ src/tslib.c | 9 ++++++++-
+ 1 file changed, 8 insertions(+), 1 deletion(-)
+
+diff --git a/src/tslib.c b/src/tslib.c
+index 283fd61..ac48d32 100644
+--- a/src/tslib.c
++++ b/src/tslib.c
+@@ -102,6 +102,10 @@ xf86XInputSetScreen(InputInfoPtr  pInfo,
+ }
+ #endif
+
++#if GET_ABI_MAJOR(ABI_XINPUT_VERSION) >= 23
++#define HAVE_THREADED_INPUT   1
++#endif
++
+ enum { TSLIB_ROTATE_NONE=0, TSLIB_ROTATE_CW=270, TSLIB_ROTATE_UD=180, TSLIB_ROTATE_CCW=90 };
+
+ enum button_state { BUTTON_NOT_PRESSED = 0, BUTTON_1_PRESSED = 1, BUTTON_3_CLICK = 3, BUTTON_3_CLICKED=4,
+@@ -435,8 +439,11 @@ xf86TslibControlProc(DeviceIntPtr device, int what)
+               break;
+
+       case DEVICE_ON:
++#if HAVE_THREADED_INPUT
++              xf86AddEnabledDevice(pInfo);
++#else
+               AddEnabledDevice(pInfo->fd);
+-
++#endif
+               device->public.on = TRUE;
+               break;
+
+--
+2.7.4
+
diff --git a/meta-oe/recipes-graphics/xorg-driver/xf86-input-tslib_0.0.6.bb b/meta-oe/recipes-graphics/xorg-
index 6a3689a..828375b 100644
--- a/meta-oe/recipes-graphics/xorg-driver/xf86-input-tslib_0.0.6.bb
+++ b/meta-oe/recipes-graphics/xorg-driver/xf86-input-tslib_0.0.6.bb
@@ -17,6 +17,7 @@ SRC_URI = "http://www.pengutronix.de/software/xf86-input-tslib/download/xf86-inp
            file://99-xf86-input-tslib.rules \
            file://xf86-input-tslib-port-ABI-12-r48.patch \
            file://xf86-input-tslib-0.0.6-xf86XInputSetScreen.patch \
+           file://0001-src-fix-the-build-for-xserver-1.19-and-later.patch \
 "

 SRC_URI[md5sum] = "b7a4d2f11637ee3fcf432e044b1d017f"

再次编译文件系统。

此时系统并不会自动使用tslib作为输入设备,这个可以通过阅读/var/log/xorg.0.log文件来看是加载的哪个驱动。

需要在 /usr/share/X11/xorg.conf.d/ 中增加如下文件(关于这个文件的格式、X server的配置方式,包括X server自己的校准参数的写法 https://www.x.org/archive/current/doc/man/man5/xorg.conf.5.xhtml):

root@phyboard-mira-imx6-3:/usr/share/X11/xorg.conf.d# cat 80-tslib.conf
#
# Catch-all tslib loader for udev-based systems
#
# We match on all touchscreen devices. If you have multiple, please specify.

Section "InputClass"
        Identifier "tslib touchscreen catchall"
        MatchIsTouchscreen "on"
        MatchDevicePath "/dev/input/*"
        Driver "tslib"
EndSection

重启X server就会调用tslib来做为输入设备,此时可运行ts_calibrate来矫正屏幕。

如果要实施第一次开机自动弹出校准程序,请参考 https://github.com/merge/xf86-input-tslib

wifi配置

如果使用sato桌面系统的wifi配置选项配置wifi时, 有时候重启后wifi会连接不上

[   14.638145] wlan0: authenticate with 30:fc:68:6e:59:15
[   14.661769] wlan0: send auth to 30:fc:68:6e:59:15 (try 1/3)
[   14.669004] wlan0: send auth to 30:fc:68:6e:59:15 (try 2/3)
[   14.676535] wlan0: send auth to 30:fc:68:6e:59:15 (try 3/3)
[   14.683373] wlan0: authentication with 30:fc:68:6e:59:15 timed out

解决方式: 不使用x11的wifi配置, 先把x11的connman服务屏蔽掉

systemctl mask connman

然后重启系统, 按照以下文档的方法配置wifi:

开发板wifi模块PEB-WLBT-01设置 / Wifi Module PEB-WLBT-01 Setting

  • No labels