From 04f777b5cd2713eca47362a97fdb39c2ec0cd7fa Mon Sep 17 00:00:00 2001 From: superconvert Date: Wed, 19 Oct 2022 14:09:51 +0000 Subject: [PATCH] can run mouse driver --- 01_build_src.sh | 21 +++++++++++++++++++++ 02_build_img.sh | 10 +++++++++- common.sh | 1 + mk_xfce.sh | 11 ++++++++--- 4 files changed, 39 insertions(+), 4 deletions(-) diff --git a/01_build_src.sh b/01_build_src.sh index 96000bf..e785eb9 100755 --- a/01_build_src.sh +++ b/01_build_src.sh @@ -21,6 +21,7 @@ LINUX_SRC_URL=https://mirror.bjtu.edu.cn/kernel/linux/kernel/v5.x/linux-5.8.6.ta 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 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 @@ -42,6 +43,7 @@ LINUX_SRC_NAME=$(download_src ${LINUX_SRC_URL}) 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}) PCIUTILS_SRC_NAME=$(download_src ${PCIUTILS_SRC_URL}) OPENSSL_SRC_NAME=$(download_src ${OPENSSL_SRC_URL}) OPENSSH_SRC_NAME=$(download_src ${OPENSSH_SRC_URL}) @@ -60,6 +62,7 @@ LINUX_SRC_DIR=$(unzip_src ".tar.xz" ${LINUX_SRC_NAME}); echo "unzip ${LINUX_SRC_ GLIBC_SRC_DIR=$(unzip_src ".tar.xz" ${GLIBC_SRC_NAME}); echo "unzip ${GLIBC_SRC_NAME} source code" 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" 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" @@ -262,6 +265,13 @@ if [ ! -d "linux_install" ]; then sed -i "/# CONFIG_INPUT_MOUSEDEV is not set/a\CONFIG_INPUT_MOUSEDEV_PSAUX=y" .config sed -i "s/# CONFIG_INPUT_MOUSEDEV is not set/CONFIG_INPUT_MOUSEDEV=y/" .config + sed -i "s/# CONFIG_UHID is not set/CONFIG_UHID=y/" .config + sed -i "s/# CONFIG_USB_DYNAMIC_MINORS is not set/CONFIG_USB_DYNAMIC_MINORS=y/" .config + sed -i "s/# CONFIG_USB_XHCI_PLATFORM is not set/CONFIG_USB_XHCI_PLATFORM=y/" .config + sed -i "s/# CONFIG_USB_EHCI_ROOT_HUB_TT is not set/CONFIG_USB_EHCI_ROOT_HUB_TT=y/" .config + 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 + # 网络需要 TUN/TAP 驱动 [ Device Drivers ] ---> [ Network device support ] ---> [ Universal TUN/TAP device driver support ] make bzImage -j8 make modules -j8 @@ -288,6 +298,8 @@ fi # 编译 busybox if [ ! -d "busybox_install" ]; then mkdir -pv busybox_install && cd ${BUSYBOX_SRC_DIR} && make distclean && make defconfig + # 屏蔽掉 lsof 这个自带的太简单 + sed -i "s/CONFIG_LSOF=y/# CONFIG_LSOF is not set/" .config # 屏蔽掉 lspci 这个自带的太简单 sed -i "s/CONFIG_LSPCI=y/# CONFIG_LSPCI is not set/" .config # 静态编译 sed -i "s/# CONFIG_STATIC is not set/CONFIG_STATIC=y/g" .config @@ -313,6 +325,15 @@ if [ ! -d "pciutils_install" ]; then cd .. fi +# 编译 lsof ( busybox 的太简单 ) +if [ ! -d "lsof_install" ]; then + mkdir -pv lsof_install && cd ${LSOF_SRC_DIR} + ./Configure linux -n + CFLAGS="-L${glibc_install}/lib64 $CFLAGS" make -j8 + mkdir -pv ${lsof_install}/usr/bin && cp ./lsof ${lsof_install}/usr/bin + 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 a09ff33..3d57c95 100755 --- a/02_build_img.sh +++ b/02_build_img.sh @@ -41,7 +41,7 @@ grub-install --boot-directory=${diskfs}/boot/ --target=i386-pc --modules=part_ms #--------------------------------------------- # -# 制作内核和 rootfs +# 制作内核和 rootfs ( run 目录下 udev 被服务 udevd 使用,否则 xfce 鼠标不能使用 ) # #--------------------------------------------- rm -rf rootfs @@ -50,6 +50,7 @@ mkdir -pv rootfs/dev mkdir -pv rootfs/etc mkdir -pv rootfs/sys mkdir -pv rootfs/mnt +mkdir -pv rootfs/run mkdir -pv rootfs/tmp mkdir -pv rootfs/lib mkdir -pv rootfs/sbin @@ -199,6 +200,9 @@ cp rootfs/* ${diskfs} -r # 单独的 lshw cp ${lshw_install}/* ${diskfs} -r +# 单独的 lsof +cp ${lsof_install}/* ${diskfs} -r + # 单独的 pciutils cp ${pciutils_install}/* ${diskfs} -r if [ -f "${diskfs}/usr/share/pci.ids.gz" ]; then @@ -356,6 +360,9 @@ 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 EOF @@ -393,6 +400,7 @@ losetup -d ${loop_dev} # dmidecode查看硬件信息,包括bios、cpu、内存等信息 # dmesg | more 查看硬件信息 # modinfo命令可以单看指定的模块/驱动的信息 +# 查看设备名称 cat /sys/class/input/mouse2/device/name # linux为什么访问设备数据先要mount? https://www.zhihu.com/question/524667726 #--------------------------------------------------------------- diff --git a/common.sh b/common.sh index 887db0d..1feec08 100755 --- a/common.sh +++ b/common.sh @@ -38,6 +38,7 @@ linux_install=${build_dir}"/linux_install" glibc_install=${build_dir}"/glibc_install" busybox_install=${build_dir}"/busybox_install" lshw_install=${build_dir}"/lshw_install" +lsof_install=${build_dir}"/lsof_install" pciutils_install=${build_dir}"/pciutils_install" openssl_install=${build_dir}"/openssl_install" openssh_install=${build_dir}"/openssh_install" diff --git a/mk_xfce.sh b/mk_xfce.sh index 5a0170e..bd18be6 100755 --- a/mk_xfce.sh +++ b/mk_xfce.sh @@ -38,8 +38,6 @@ PIXMAN_SRC_URL=https://www.cairographics.org/releases/pixman-0.40.0.tar.gz ZLIB_SRC_URL=https://nchc.dl.sourceforge.net/project/libpng/zlib/1.2.11/zlib-1.2.11.tar.xz LIBPNG_SRC_URL=https://nchc.dl.sourceforge.net/project/libpng/libpng16/1.6.37/libpng-1.6.37.tar.xz FREETYPE_SRC_URL=https://nchc.dl.sourceforge.net/project/freetype/freetype2/2.12.0/freetype-2.12.0.tar.xz -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 LIBJPEGTURBO_SRC_URL=https://sourceforge.net/projects/libjpeg-turbo/files/2.1.0/libjpeg-turbo-2.1.0.tar.gz XKBCOMMON_SRC_URL=https://xkbcommon.org/download/libxkbcommon-1.4.1.tar.xz XTERM_SRC_URL=https://invisible-island.net/archives/xterm/xterm-372.tgz @@ -47,13 +45,13 @@ EXPAT_SRC_URL=https://nchc.dl.sourceforge.net/project/expat/expat/2.4.9/expat-2. LIBUDEV_SRC_URL=https://dev.gentoo.org/~blueness/eudev/eudev-3.2.9.tar.gz LIBNETTLE_SRC_URL=https://ftp.gnu.org/gnu/nettle/nettle-3.8.1.tar.gz LIBPCRE_SRC_URL=https://nchc.dl.sourceforge.net/project/pcre/pcre/8.39/pcre-8.39.tar.gz -LLVM_SRC_URL=https://github.com/llvm/llvm-project/releases/download/llvmorg-10.0.0/llvm-10.0.0.src.tar.xz NCURSES_SRC_URL=https://ftp.gnu.org/pub/gnu/ncurses/ncurses-6.2.tar.gz XFCE_SRC_URL=https://archive.xfce.org/xfce/4.16/fat_tarballs/xfce-4.16.tar.bz2 LIBEDIT_SRC_URL=https://thrysoee.dk/editline/libedit-20210910-3.1.tar.gz IMSENSORS_SRC_URL=https://ftp.gwdg.de/pub/linux/misc/lm-sensors/lm_sensors-3.4.0.tar.bz2 # download from https://github.com +LIBUSB_SRC_URL=https://github.com/libusb/libusb/releases/download/v1.0.26/libusb-1.0.26.tar.bz2 LIBFFI_SRC_URL=https://github.com/libffi/libffi/releases/download/v3.4.2/libffi-3.4.2.tar.gz LIBTHAI_SRC_URL=https://github.com/tlwg/libthai/releases/download/v0.1.29/libthai-0.1.29.tar.xz LIBDATRIE_SRC_URL=https://github.com/tlwg/libdatrie/releases/download/v0.2.13/libdatrie-0.2.13.tar.xz @@ -62,7 +60,10 @@ XRDP_SRC_URL=https://github.com/neutrinolabs/xrdp/releases/download/v0.9.19/xrdp FRIBIDI_SRC_URL=https://github.com/fribidi/fribidi/releases/download/v1.0.12/fribidi-1.0.12.tar.xz HARFBUZZ_SRC_URL=https://github.com/harfbuzz/harfbuzz/releases/download/5.1.0/harfbuzz-5.1.0.tar.xz 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 +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 # download from https://gitlab.freedesktop.org WAYLANDCORE_SRC_URL=https://wayland.freedesktop.org/releases/wayland-1.20.0.tar.xz @@ -203,6 +204,7 @@ WAYLANDPROT_SRC_NAME=$(download_src ${WAYLANDPROT_SRC_URL}) STARTUPNOTI_SRC_NAME=$(download_src ${STARTUPNOTI_SRC_URL}) LIBGUDEV_SRC_NAME=$(download_src ${LIBGUDEV_SRC_URL}) UPOWER_SRC_NAME=$(download_src ${UPOWER_SRC_URL}) +LIBUSB_SRC_NAME=$(download_src ${LIBUSB_SRC_URL}) LIBWNCK_SRC_NAME=$(download_src ${LIBWNCK_SRC_URL}) LIBATK_CORE_SRC_NAME=$(download_src ${LIBATK_CORE_SRC_URL}) LIBATK_BRIDGE_SRC_NAME=$(download_src ${LIBATK_BRIDGE_SRC_URL}) @@ -354,6 +356,7 @@ WAYLANDPROT_SRC_DIR=$(unzip_src ".tar.xz" ${WAYLANDPROT_SRC_NAME}); echo "unzip STARTUPNOTI_SRC_DIR=$(unzip_src ".tar.gz" ${STARTUPNOTI_SRC_NAME}); echo "unzip ${STARTUPNOTI_SRC_NAME} source code" LIBGUDEV_SRC_DIR=$(unzip_src ".tar.xz" ${LIBGUDEV_SRC_NAME}); echo "unzip ${LIBGUDEV_SRC_NAME} source code" UPOWER_SRC_DIR=$(unzip_src ".tar.gz" ${UPOWER_SRC_NAME}); echo "unzip ${UPOWER_SRC_NAME} source code" +LIBUSB_SRC_DIR=$(unzip_src ".tar.bz2" ${LIBUSB_SRC_NAME}); echo "unzip ${LIBUSB_SRC_NAME} source code" GOBJINTROSPE_SRC_DIR=$(unzip_src ".tar.xz" ${GOBJINTROSPE_SRC_NAME}); echo "unzip ${GOBJINTROSPE_SRC_NAME} source code" LIBWNCK_SRC_DIR=$(unzip_src ".tar.xz" ${LIBWNCK_SRC_NAME}); echo "unzip ${LIBWNCK_SRC_NAME} source code" GSTREAMER_SRC_DIR=$(unzip_src ".tar.xz" ${GSTREAMER_SRC_NAME}); echo "unzip ${GSTREAMER_SRC_NAME} source code" @@ -870,6 +873,8 @@ llvm_build() { common_build hicoloricontheme ${HICOLORICONTHEME_SRC_DIR} # 编译 xterm # common_build xterm ${XTERM_SRC_DIR} + # 编译 libusb + # common_build libusb ${LIBUSB_SRC_DIR} # fontutil common_build fontutil ${FONTUTIL_SRC_DIR} # mkfontdir