pcie设备驱动卸载与加载

在linux系统在PCIE设备驱动被占用的情况下可以通过以下脚本卸载当前驱动、加载新驱动:

#!/bin/sh
echo "update nvme driver..."
cd /sys/bus/pci/drivers/nvme
#讲pcie设备驱动解绑
echo -n "0000:11:00.0" > unbind 
#移除pcie总线上的设备
echo 1 > /sys/bus/pci/devices/0000:11:00.0/remove
#卸载当前安装驱动,这里以nvme驱动为例
rmmod nvme.ko
echo "uninstall old nvme driver finished!"
#加载新的nvme驱动
insmod /home/kylin/nvme_new.ko
echo "install new nvme driver finished!"
#重新扫描设备,将设备挂到pcie总线
sudo echo 1 > /sys/bus/pci/rescan
echo "update nvme driver finished!"

你可能感兴趣的:(数据库,linux)