相关文档下载
1、查看Linux内核版本
uname -r
![在这里插入图片描述](https://i-blog.csdnimg.cn/blog_migrate/d9ee016d6da5f359bcffe6daba25ec63.png)
2、根据内核版本在Github上下载Linux内核源码(最好再Github上确定一下有没有这个分支)
git clone --depth=1 https://github.com/raspberrypi/linux --branch rpi-5.15.y
3、下载依赖库
sudo apt-get update
sudo apt-get install raspberrypi-kernel-headers
sudo apt-get install bc libncurses5-dev bison flex libssl-dev make libc6-dev
4、配置
cd linux
(1)修改第1个文件(从#if 1 到 #endif)
sudo nano drivers/usb/serial/option.c
static const struct usb_device_id option_ids[] = {
{ USB_DEVICE_AND_INTERFACE_INFO(0x2c7c, 0x0900, 0xff, 0x00, 0x00) },
static struct usb_serial_driver option_1port_device = {
......
.suspend = usb_wwan_suspend,
.resume = usb_wwan_resume,
.reset_resume = usb_wwan_resume,
};
(2)修改第2个文件(从#if 1 到 #endif)
sudo nano drivers/usb/serial/usb_wwan.c
static struct urb *usb_wwan_setup_urb(struct usb_serial *serial, int endpoint,
int dir, void *ctx, char *buf, int len,void (*callback) (struct urb *))
{
......
usb_fill_bulk_urb(urb, serial->dev,usb_sndbulkpipe(serial->dev, endpoint) | dir,buf, len, callback, ctx);
if (dir == USB_DIR_OUT)
{
struct usb_device_descriptor *desc = &serial->dev->descriptor;
if (desc->idVendor == cpu_to_le16(0x2C7C))
{
urb->transfer_flags |= URB_ZERO_PACKET;
}
}
return urb;
}
5、编译
KERNEL=kernel8
sudo make bcm2711_defconfig
sudo make -j4 modules
sudo make modules_install