快速开始
第一步:下载文件(本步骤尚不完全)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
| sudo apt upgrade sudo apt update sudo apt-get install pkg-config sudo apt-get install libncurses* sudo apt-get install flex sudo apt-get install bison sudo apt-get build-dep linux sudo apt-get install libncurses-dev flex bison openssl libssl-dev dkms libelf-dev libudev-dev libpci-dev libiberty-dev autoconf fakeroot
mkdir ~/kernel
cd ~/kernel
wget https://mirrors.tuna.tsinghua.edu.cn/kernel/v5.x/linux-5.10.60.tar.xz
tar -xf linux-5.10.60.tar.xz
wget https://mirrors.tuna.tsinghua.edu.cn/kernel/projects/rt/5.10/older/patch-5.10.100-rt62.patch.gz
gunzip patch-5.10.100-rt62.patch.gz
cd linux-5.10.100
wget -O .config https://alist.muyangplus.repl.co/d/Guest/%E5%8D%9A%E5%AE%A2%E9%99%84%E4%BB%B6/%E5%A6%82%E4%BD%95%E8%AE%A9%E4%BD%A0%E7%9A%84%20Windows%20WSL%20%E8%BF%9E%E6%8E%A5%E6%91%84%E5%83%8F%E5%A4%B4/.config?sign=j3sbdeMoFJaCWNDP_VPqQOcg_MqrelT1I1IpjtUiopI=:0
patch -p1 < ../patch-5.10.100-rt62.patch
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
| │ Symbol: USB_CONFIGFS_F_UVC [=n] │ │ Type : bool │ │ Defined at drivers/usb/gadget/Kconfig:448 │ │ Prompt: USB Webcam function │ │ Depends on: USB_SUPPORT [=y] && USB_GADGET [=n] && USB_CONFIGFS [=n] && VIDEO_V4L2 [=n] && VIDEO_ │ │ Location: │ │ -> Device Drivers │ │ -> USB support (USB_SUPPORT [=y]) │ │ (1) -> USB Gadget Support (USB_GADGET [=n]) │ │ -> USB Gadget functions configurable through configfs (USB_CONFIGFS [=n]) │ │ Selects: VIDEOBUF2_VMALLOC [=n] && USB_F_UVC [=n] │ │ │ │ │ │ Symbol: USB_F_UVC [=n] │ │ Type : tristate │ │ Defined at drivers/usb/gadget/Kconfig:204 │ │ Depends on: USB_SUPPORT [=y] && USB_GADGET [=n] │ │ Selected by [n]: │ │ - USB_CONFIGFS_F_UVC [=n] && USB_SUPPORT [=y] && USB_GADGET [=n] && USB_CONFIGFS [=n] && VIDEO_V4 │ │ - USB_G_WEBCAM [=n] && USB_SUPPORT [=y] && USB_GADGET [=n] && VIDEO_V4L2 [=n]
|
第二步:
参考(明明是照搬):
https://docs.microsoft.com/zh-cn/windows/wsl/connect-usb
- Windows 安装:usbipd-win
- Linux 安装:
1 2
| sudo apt install linux-tools-5.4.0-77-generic hwdata sudo update-alternatives --install /usr/local/bin/usbip usbip /usr/lib/linux-tools/5.4.0-77-generic/usbip 20
|
- Windows 命令:找到你的摄像头
- Windows 命令:选择要附加到 WSL 的设备总线 ID,然后运行此命令。 WSL 会提示你输入密码以运行 sudo 命令。 要附加的 Linux 发行版必须是默认分发版。 (参阅 comands FOR WSL Doc Basic ,以更改默认分发) 。
1
| usbipd wsl attach --busid <busid>
|
- Linux 命令:打开 Ubuntu(或首选的 WSL 命令行),使用以下命令列出附加的 USB 设备:
- 用完后请移除,否则 Windows 将无法继续使用
1
| usbipd wsl detach --busid <busid>
|
参考资料:
https://zhuanlan.zhihu.com/p/509248038
https://blog.csdn.net/weixin_34408918/article/details/116737822
文章附件
云盘