目录
1 安装系统和内核文件:
1.1 下载镜像
1.2 内核头安装
1.2.1 下载内核
1.2.2 将内核头文件导入开发板中
1.2.3 安装内核头
2 安装依赖工具:
2.1 Installing Required Host Utilities
3 驱动步骤:
3.1 下载模块驱动文件
3.2 找到接近内核的文件
3.3 将内核头文件和v5.4.51文件导入开发板中
3.4 添加对应的PID VID
3.5 编译并安装驱动
4 验证驱动:
4.1 接入4G/5G模块
4.2 查看USB节点
4.3 查看模块版本号
4.4 查看模块网卡
1 安装系统和内核文件:
Linux orangepizero 5.4.65-sunxi #2.2.2 SMP Tue Aug 15 17:45:28 CST 2023 armv7l armv7l armv7l GNU/Linux
1.1 下载镜像
https://download.csdn.net/download/weixin_37613240/88258590
1.2 内核头安装
1.2.1 下载内核
https://download.csdn.net/download/weixin_37613240/88258469
1.2.2 将内核头文件导入开发板中
orangepi@orangepizero:~$ ls
linux-headers-current-sunxi_2.2.2_armhf.deb
1.2.3 安装内核头
sudo dpkg -i linux-headers-current-sunxi_2.2.2_armhf.deb
2 安装依赖工具:
2.1 Installing Required Host Utilities
sudo install make
sudo install make-guile
sudo install gcc
sudo install udhcpc
3 驱动步骤:
3.1 下载模块驱动文件
下载:模块Linux驱动文件https://download.csdn.net/download/weixin_37613240/87636073
3.2 找到接近内核的文件
本文章镜像为5.4.65内核,那么就选择 v5.4.51文件
3.3 将内核头文件和v5.4.51文件导入开发板中
orangepi@orangepizero:~$ ls
v5.4.51
3.4 添加对应的PID VID
orangepi@orangepizero:sudo vi ~/v5.4.51/drivers/usb/serial/option.c在option.c添加入这些PID和VID
#if 1 //Added by Quectel//****省略****//{ USB_DEVICE(0x2C7C, 0x6002) }, /* Quectel EC200s ECx00M ECx00N*/{ USB_DEVICE(0x2C7C, 0x6005) }, /*EC200A */{ USB_DEVICE(0x2C7C, 0x6007) }, /*EG800Q */{ USB_DEVICE(0x2C7C, 0x0903) }, /* ECx00E */{ USB_DEVICE(0x2C7C, 0x0901) }, /* ECx00U */{ USB_DEVICE(0x2C7C, 0x0902) }, /* ECx00D */{ USB_DEVICE(0x2C7C, 0x0904) }, /* ECx00G */{ USB_DEVICE(0x2C7C, 0x0900) }, /* Rxx00U *///****省略****//
#endif
3.5 编译并安装驱动
orangepi@orangepizero:~$ cd v5.4.51
orangepi@orangepizero:~/v5.4.51$ sudo make install//****过程****//
make -C /lib/modules/5.4.65-sunxi/build M=/home/orangepi/v5.4.51 clean
make[1]: Entering directory '/usr/src/linux-headers-5.4.65-sunxi'CLEAN /home/orangepi/v5.4.51/Module.symvers
make[1]: Leaving directory '/usr/src/linux-headers-5.4.65-sunxi'
make -C /lib/modules/5.4.65-sunxi/build M=/home/orangepi/v5.4.51 modules
make[1]: Entering directory '/usr/src/linux-headers-5.4.65-sunxi'CC [M] /home/orangepi/v5.4.51/./drivers/usb/serial/option.oCC [M] /home/orangepi/v5.4.51/./drivers/usb/serial/usb_wwan.oCC [M] /home/orangepi/v5.4.51/./drivers/usb/serial/qcserial.oBuilding modules, stage 2.MODPOST 3 modulesCC [M] /home/orangepi/v5.4.51/./drivers/usb/serial/option.mod.oLD [M] /home/orangepi/v5.4.51/./drivers/usb/serial/option.koCC [M] /home/orangepi/v5.4.51/./drivers/usb/serial/qcserial.mod.oLD [M] /home/orangepi/v5.4.51/./drivers/usb/serial/qcserial.koCC [M] /home/orangepi/v5.4.51/./drivers/usb/serial/usb_wwan.mod.oLD [M] /home/orangepi/v5.4.51/./drivers/usb/serial/usb_wwan.ko
make[1]: Leaving directory '/usr/src/linux-headers-5.4.65-sunxi'
cp /home/orangepi/v5.4.51/drivers/usb/serial/*.ko /lib/modules/5.4.65-sunxi/kernel/drivers/usb/serial/
depmod
4 验证驱动:
4.1 接入4G/5G模块
4.2 查看USB节点
orangepi@orangepizero:~$ lsusb
Bus 008 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 005 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 007 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 006 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 003: ID 2c7c:6005
Bus 003 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
orangepi@orangepizero:~$ ls /dev/ttyUSB*
/dev/ttyUSB0 /dev/ttyUSB1 /dev/ttyUSB2
orangepi@orangepizero:~$
4.3 查看模块版本号
orangepi@orangepizero:~$ cat /dev/ttyUSB2&
[1] 1680
orangepi@orangepizero:~$ echo -en "ATI\r\n" > /dev/ttyUSB2
ATI
Quectel
EC200A
Revision: EC200ACNHAR01A09M16OK
orangepi@orangepizero:~$
4.4 查看模块网卡
orangepi@orangepizero:~$ ifconfig usb0
usb0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500inet6 fe80::e40f:ef33:14fc:3c85 prefixlen 64 scopeid 0x20<link>ether d2:59:3b:a3:e5:8b txqueuelen 1000 (Ethernet)RX packets 7 bytes 460 (460.0 B)RX errors 0 dropped 0 overruns 0 frame 0TX packets 132 bytes 28619 (28.6 KB)TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0