From 643a60907db44d53c7d7735cd7506881417edb53 Mon Sep 17 00:00:00 2001 From: superconvert Date: Fri, 21 Oct 2022 22:47:43 +0800 Subject: [PATCH] now keyboard & mouse can work in xfce smart-os --- 01_build_src.sh | 17 +++++++++++++++++ 02_build_img.sh | 16 ++++++++++++---- common.sh | 3 ++- mk_xfce.sh | 30 ++++++++++++++++++++++++++++-- 4 files changed, 59 insertions(+), 7 deletions(-) diff --git a/01_build_src.sh b/01_build_src.sh index e785eb9..bdcb1ab 100755 --- a/01_build_src.sh +++ b/01_build_src.sh @@ -22,6 +22,7 @@ GLIBC_SRC_URL=https://mirrors.ustc.edu.cn/gnu/glibc/glibc-2.27.tar.xz BUSYBOX_SRC_URL=https://busybox.net/downloads/busybox-1.34.1.tar.bz2 LSHW_SRC_URL=https://www.ezix.org/software/files/lshw-B.02.19.2.tar.gz LSOF_SRC_URL=https://github.com/lsof-org/lsof/releases/download/4.95.0/lsof_4.95.0.linux.tar.bz2 +STRACE_SRC_URL=https://github.com/strace/strace/releases/download/v5.19/strace-5.19.tar.xz PCIUTILS_SRC_URL=http://mj.ucw.cz/download/linux/pci/pciutils-3.8.0.tar.gz OPENSSL_SRC_URL=https://www.openssl.org/source/openssl-1.1.1q.tar.gz OPENSSH_SRC_URL=https://cdn.openbsd.org/pub/OpenBSD/OpenSSH/portable/openssh-8.8p1.tar.gz @@ -44,6 +45,7 @@ GLIBC_SRC_NAME=$(download_src ${GLIBC_SRC_URL}) BUSYBOX_SRC_NAME=$(download_src ${BUSYBOX_SRC_URL}) LSHW_SRC_NAME=$(download_src ${LSHW_SRC_URL}) LSOF_SRC_NAME=$(download_src ${LSOF_SRC_URL}) +STRACE_SRC_NAME=$(download_src ${STRACE_SRC_URL}) PCIUTILS_SRC_NAME=$(download_src ${PCIUTILS_SRC_URL}) OPENSSL_SRC_NAME=$(download_src ${OPENSSL_SRC_URL}) OPENSSH_SRC_NAME=$(download_src ${OPENSSH_SRC_URL}) @@ -63,6 +65,7 @@ GLIBC_SRC_DIR=$(unzip_src ".tar.xz" ${GLIBC_SRC_NAME}); echo "unzip ${GLIBC_SRC_ BUSYBOX_SRC_DIR=$(unzip_src ".tar.bz2" ${BUSYBOX_SRC_NAME}); echo "unzip ${BUSYBOX_SRC_NAME} source code" LSHW_SRC_DIR=$(unzip_src ".tar.gz" ${LSHW_SRC_NAME}); echo "unzip ${LSHW_SRC_NAME} source code" LSOF_SRC_DIR=$(unzip_src ".tar.bz2" ${LSOF_SRC_NAME}); echo "unzip ${LSOF_SRC_NAME} source code" +STRACE_SRC_DIR=$(unzip_src ".tar.xz" ${STRACE_SRC_NAME}); echo "unzip ${STRACE_SRC_NAME} source code" PCIUTILS_SRC_DIR=$(unzip_src ".tar.gz" ${PCIUTILS_SRC_NAME}); echo "unzip ${PCIUTILS_SRC_NAME} source code" OPENSSL_SRC_DIR=$(unzip_src ".tar.gz" ${OPENSSL_SRC_NAME}); echo "unzip ${OPENSSL_SRC_NAME} source code" OPENSSH_SRC_DIR=$(unzip_src ".tar.gz" ${OPENSSH_SRC_NAME}); echo "unzip ${OPENSSH_SRC_NAME} source code" @@ -272,6 +275,12 @@ if [ ! -d "linux_install" ]; then sed -i "s/# CONFIG_USB_EHCI_HCD_PLATFORM is not set/CONFIG_USB_EHCI_HCD_PLATFORM=y/" .config sed -i "s/# CONFIG_USB_OHCI_HCD_PLATFORM is not set/CONFIG_USB_OHCI_HCD_PLATFORM=y/" .config + # 键盘驱动 ( libevdev https://linuxfromscratch.org/blfs/view/11.0/x/x7driver.html ) + sed -i "s/# CONFIG_INPUT_UINPUT is not set/CONFIG_INPUT_UINPUT=y/" .config + + # wacom 驱动支持 ( xf86-input-wacom ) + sed -i "s/# CONFIG_HID_WACOM is not set/CONFIG_HID_WACOM=y/" .config + # 网络需要 TUN/TAP 驱动 [ Device Drivers ] ---> [ Network device support ] ---> [ Universal TUN/TAP device driver support ] make bzImage -j8 make modules -j8 @@ -334,6 +343,14 @@ if [ ! -d "lsof_install" ]; then cd .. fi +# 编译 strace ( 方便调试 ) +if [ ! -d "strace_install" ]; then + mkdir -pv strace_install && cd ${STRACE_SRC_DIR} + ./configure --prefix=/usr --enable-mpers=no + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 && make install -j8 DESTDIR=${strace_install} PREFIX=/usr + cd .. +fi + # 编译 openssl if [ ! -d "openssl_install" ]; then mkdir -pv openssl_install && cd ${OPENSSL_SRC_DIR} diff --git a/02_build_img.sh b/02_build_img.sh index 3d57c95..4804e3a 100755 --- a/02_build_img.sh +++ b/02_build_img.sh @@ -147,9 +147,16 @@ make_init # 指定了利用 /etc/init.d/rcS 启动 cat<<"EOF">etc/inittab -::sysinit:echo "sysinit 1++++++++++++++++++++++++++++++++++++++" + +# 启动 udevd 服务,保证鼠标设备能正常监视,否则键盘不能使用 +::sysinit:/bin/echo "starting udevd ... ..." +::sysinit:/usr/sbin/udevd --daemon +::sysinit:/usr/sbin/udevadm trigger +::sysinit:/usr/sbin/udevadm settle + +::sysinit:echo "sysinit ++++++++++++++++++++++++++++++++++++++" ::sysinit:/etc/init.d/rcS -::sysinit:echo "sysinit 2++++++++++++++++++++++++++++++++++++++" +::sysinit:echo "sysinit ++++++++++++++++++++++++++++++++++++++" # /bin/sh invocations on selected ttys # @@ -210,6 +217,9 @@ if [ -f "${diskfs}/usr/share/pci.ids.gz" ]; then mv ${diskfs}/usr/share/pci.ids.gz ${diskfs}/usr/local/share/pci.ids.gz fi +# 单独的 strace +cp ${strace_install}/* ${diskfs} -r + # 带有 openssl cp ${openssl_install}/* ${diskfs} -r @@ -360,8 +370,6 @@ ifconfig eth0 192.168.222.195 && ifconfig eth0 up route add default gw 192.168.222.2 # exec 执行 /etc/init.d/rc.local 脚本 -# 启动 udevd 服务,保证鼠标设备能正常监视 -/usr/sbin/udevd -d # 启动 sshd 服务,保证远程连接,调试跟踪非常方便 /usr/sbin/sshd diff --git a/common.sh b/common.sh index 1feec08..4b81db4 100755 --- a/common.sh +++ b/common.sh @@ -39,6 +39,7 @@ glibc_install=${build_dir}"/glibc_install" busybox_install=${build_dir}"/busybox_install" lshw_install=${build_dir}"/lshw_install" lsof_install=${build_dir}"/lsof_install" +strace_install=${build_dir}"/strace_install" pciutils_install=${build_dir}"/pciutils_install" openssl_install=${build_dir}"/openssl_install" openssh_install=${build_dir}"/openssh_install" @@ -70,7 +71,7 @@ file_dirname() { download_src() { SRC_NAME=$2$(file_name $1) if [ ! -f ${SRC_NAME} ]; then - wget -c -t 0 $1 -O $SRC_NAME || (echo "download $1 failed" && exit) + wget -c -t 0 $1 -O $SRC_NAME --no-check-certificate || (echo "download $1 failed" && exit) fi echo $SRC_NAME } diff --git a/mk_xfce.sh b/mk_xfce.sh index bd18be6..2fa12f4 100755 --- a/mk_xfce.sh +++ b/mk_xfce.sh @@ -62,6 +62,7 @@ HARFBUZZ_SRC_URL=https://github.com/harfbuzz/harfbuzz/releases/download/5.1.0/ha LIBPAM_SRC_URL=https://github.com/linux-pam/linux-pam/releases/download/v1.5.2/Linux-PAM-1.5.2.tar.xz LLVM_SRC_URL=https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/llvm-10.0.0.src.tar.xz LIBWACOM_SRC_URL=https://github.com/linuxwacom/libwacom/releases/download/libwacom-2.4.0/libwacom-2.4.0.tar.xz +XF86INPUTWACOM_SRC_URL=https://github.com/linuxwacom/xf86-input-wacom/releases/download/xf86-input-wacom-0.40.0/xf86-input-wacom-0.40.0.tar.bz2 DEJAVUFONTS1_SRC_URL=https://github.com/dejavu-fonts/dejavu-fonts/releases/download/version_2_37/dejavu-fonts-ttf-2.37.tar.bz2 DEJAVUFONTS2_SRC_URL=https://github.com/dejavu-fonts/dejavu-fonts/releases/download/version_2_37/dejavu-lgc-fonts-ttf-2.37.tar.bz2 @@ -130,6 +131,7 @@ XSHMFENCE_SRC_URL=https://www.x.org/releases/individual/lib/libxshmfence-1.3.tar XINERAMA_SRC_URL=https://www.x.org/releases/individual/lib/libXinerama-1.1.4.tar.gz LIBPCIACCESS_SRC_URL=https://www.x.org/releases/individual/lib/libpciaccess-0.16.tar.gz XORGMACROS_SRC_URL=https://www.x.org/releases/individual/util/util-macros-1.19.3.tar.gz +XINPUT_SRC_URL=https://www.x.org/releases/individual/app/xinput-1.6.3.tar.gz ICEAUTH_SRC_URL=https://www.x.org/releases/individual/app/iceauth-1.0.9.tar.xz XKBCOMP_SRC_URL=https://www.x.org/releases/individual/app/xkbcomp-1.4.5.tar.gz BDFTOPCF_SRC_URL=https://www.x.org/releases/individual/app/bdftopcf-1.1.tar.bz2 @@ -213,6 +215,7 @@ LIBXPROTO_SRC_NAME=$(download_src ${LIBXPROTO_SRC_URL}) XTRANS_SRC_NAME=$(download_src ${XTRANS_SRC_URL}) XINIT_SRC_NAME=$(download_src ${XINIT_SRC_URL}) LIBSM_SRC_NAME=$(download_src ${LIBSM_SRC_URL}) +XINPUT_SRC_NAME=$(download_src ${XINPUT_SRC_URL}) LIBICE_SRC_NAME=$(download_src ${LIBICE_SRC_URL}) LIBX11_SRC_NAME=$(download_src ${LIBX11_SRC_URL}) XRANDR_SRC_NAME=$(download_src ${XRANDR_SRC_URL}) @@ -279,6 +282,7 @@ XF86INPUT_SRC_NAME=$(download_src ${XF86INPUT_SRC_URL}) XF86INPUTVM_SRC_NAME=$(download_src ${XF86INPUTVM_SRC_URL}) XF86INPUTMM_SRC_NAME=$(download_src ${XF86INPUTMM_SRC_URL}) XF86INPUTEVDEV_SRC_NAME=$(download_src ${XF86INPUTEVDEV_SRC_URL}) +XF86INPUTWACOM_SRC_NAME=$(download_src ${XF86INPUTWACOM_SRC_URL}) XF86VIDEOATI_SRC_NAME=$(download_src ${XF86VIDEOATI_SRC_URL}) XF86VIDEOVESA_SRC_NAME=$(download_src ${XF86VIDEOVESA_SRC_URL}) XF86VIDEOINTEL_SRC_NAME=$(download_src ${XF86VIDEOINTEL_SRC_URL}) @@ -374,6 +378,7 @@ XKBCOMMON_SRC_DIR=$(unzip_src ".tar.xz" ${XKBCOMMON_SRC_NAME}); echo "unzip ${XK XEXT_SRC_DIR=$(unzip_src ".tar.gz" ${XEXT_SRC_NAME}); echo "unzip ${XEXT_SRC_NAME} source code" XEXTPROTO_SRC_DIR=$(unzip_src ".tar.gz" ${XEXTPROTO_SRC_NAME}); echo "unzip ${XEXTPROTO_SRC_NAME} source code" XINIT_SRC_DIR=$(unzip_src ".tar.gz" ${XINIT_SRC_NAME}); echo "unzip ${XINIT_SRC_NAME} source code" +XINPUT_SRC_DIR=$(unzip_src ".tar.gz" ${XINPUT_SRC_NAME}); echo "unzip ${XINPUT_SRC_NAME} source code" XTRANS_SRC_DIR=$(unzip_src ".tar.gz" ${XTRANS_SRC_NAME}); echo "unzip ${XTRANS_SRC_NAME} source code" XCBPROTO_SRC_DIR=$(unzip_src ".tar.gz" ${XCBPROTO_SRC_NAME}); echo "unzip ${XCBPROTO_SRC_NAME} source code" LIBXCB_SRC_DIR=$(unzip_src ".tar.xz" ${LIBXCB_SRC_NAME}); echo "unzip ${LIBXCB_SRC_NAME} source code" @@ -418,6 +423,7 @@ XF86INPUT_SRC_DIR=$(unzip_src ".tar.xz" ${XF86INPUT_SRC_NAME}); echo "unzip ${XF XF86INPUTVM_SRC_DIR=$(unzip_src ".tar.xz" ${XF86INPUTVM_SRC_NAME}); echo "unzip ${XF86INPUTVM_SRC_NAME} source code" XF86INPUTMM_SRC_DIR=$(unzip_src ".tar.bz2" ${XF86INPUTMM_SRC_NAME}); echo "unzip ${XF86INPUTMM_SRC_NAME} source code" XF86INPUTEVDEV_SRC_DIR=$(unzip_src ".tar.bz2" ${XF86INPUTEVDEV_SRC_NAME}); echo "unzip ${XF86INPUTEVDEV_SRC_NAME} source code" +XF86INPUTWACOM_SRC_DIR=$(unzip_src ".tar.bz2" ${XF86INPUTWACOM_SRC_NAME}); echo "unzip ${XF86INPUTWACOM_SRC_NAME} source code" XF86VIDEOATI_SRC_DIR=$(unzip_src ".tar.bz2" ${XF86VIDEOATI_SRC_NAME}); echo "unzip ${XF86VIDEOATI_SRC_NAME} source code" XF86VIDEOVESA_SRC_DIR=$(unzip_src ".tar.bz2" ${XF86VIDEOVESA_SRC_NAME}); echo "unzip ${XF86VIDEOVESA_SRC_NAME} source code" XF86VIDEOINTEL_SRC_DIR=$(unzip_src ".tar.bz2" ${XF86VIDEOINTEL_SRC_NAME}); echo "unzip ${XF86VIDEOINTEL_SRC_NAME} source code" @@ -657,6 +663,22 @@ llvm_build() { # 因为 apt install 安装的软件可能依赖系统自带的 glibc,这边指定编译的 glibc ,就会导致链接器工作混乱。导致链接失败 # 因此编译 xfce 时,一定保证 glibc_install/lib64 目录为空,否则就会出现上面的错误 died with # +# 有关 xorg 驱动相关的介绍,参考 https://linuxfromscratch.org/blfs/view/11.0/x/x7driver.html +# +# libevdev 介绍 --- +# The libevdev package contains common functions for Xorg input drivers. +# 需要内核支持 +# Device Drivers ---> +# Input device support ---> +# <*> Generic input layer (needed for keyboard, mouse, ...) [CONFIG_INPUT] +# <*> Event interface [CONFIG_INPUT_EVDEV] +# [*] Miscellaneous devices ---> [CONFIG_INPUT_MISC] +# <*> User level driver support [CONFIG_INPUT_UINPUT] +# +# xf86-input-evdev 介绍 --- +# The Xorg Evdev Driver package contains a Generic Linux input driver for the Xorg X server. It handles keyboard, mouse, +# touchpads and wacom devices, though for touchpad and wacom advanced handling, additional drivers are required. +# #!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! # if [ ! -d "xfce_install" ]; then @@ -753,6 +775,8 @@ llvm_build() { common_build xxf86vm ${XXF86VM_SRC_DIR} # 编译 xinit common_build xinit ${XINIT_SRC_DIR} + # 编译 xinput ( 输入设备探测 ) + common_build xinput ${XINPUT_SRC_DIR} # 编译 xi ( 问题解决见上面的注释 ) common_build xi ${XI_SRC_DIR} # 编译 xtst @@ -790,8 +814,8 @@ llvm_build() { common_build ncurses ${NCURSES_SRC_DIR} --with-shared --with-termlib # 编译 libedit common_build libedit ${LIBEDIT_SRC_DIR} - # 编译 libudev - common_build libudev ${LIBUDEV_SRC_DIR} + # 编译 libudev ( xkbcli interactive-evdev 可以测试键盘输入,xorg 就是不加载成功 ) + common_build libudev ${LIBUDEV_SRC_DIR} --enable-hwdb --enable-rule-generator --enable-mtd_probe # 编译 libpcre common_build libpcre ${LIBPCRE_SRC_DIR} # 编译 libnettle @@ -903,6 +927,8 @@ llvm_build() { common_build xf86inputvm ${XF86INPUTVM_SRC_DIR} # xf86inputmm common_build xf86inputmm ${XF86INPUTMM_SRC_DIR} + # xf86inputwacom + common_build xf86inputwacom ${XF86INPUTWACOM_SRC_DIR} # xf86inputevdev common_build xf86inputevdev ${XF86INPUTEVDEV_SRC_DIR} # xf86videoati ( 为了虚拟机上能显示图形,我们把常用的显卡驱动全部编译了 )