修改驱动包(内核 5.13.0)
问题描述
驱动安装过程中出现类似如下报错。
[ERROR]Dkms install failed, details in : var/log/ascend_seclog/ascend_install.log. [ERROR]Driver_ko_install failed, details in : /var/log/ascend_seclog/ascend_install.log.
图1 报错信息


可能原因
内核不适配
解决方法
- 查看安装日志。
cat /var/log/ascend_seclog/ascend_install.log
- 找到错误说明,查看“make.log”。
cat /var/lib/dkms/davinci_ascend/1.0/build/make.log
- 查找“make.log”中报如下图所示错误error。
- 在run包目录下,解压run包。
./Ascend-hdk-310p-npu-driver_24.1.rc3_linux-aarch64.run --noexec --extract=./tmp
./Ascend-hdk-310p-npu-driver_24.1.rc3_linux-x86-64.run --noexec --extract=./tmp
- 进入“tmp/driver/script”目录,编辑“run_driver_install.sh”文件。
cd tmp/driver/script vi run_driver_install.sh
查找“run_driver_install.sh”文件的“set_os_custom_compile”函数(非编辑模式下,执行/set_os_custom_compile命令查询),如下图所示。
在函数最末尾增加:(如下5.13.0是安装时用的内核版本,仅为示例,请根据实际内核版本进行修改替换)
sed -i 's/KERNEL_VERSION(5, 10, 0)/KERNEL_VERSION(5, 13, 0)/g' "$sourcedir"/kernel/svmdrv/pmaster/comm/svm_master_cgroup.c >>/dev/null 2>&1 sed -i 's/KERNEL_VERSION(5, 10, 0)/KERNEL_VERSION(5, 13, 0)/g' "$sourcedir"/kernel/svmdrv/vmaster/comm/svm_master_cgroup.c >>/dev/null 2>&1 sed -i 's/KERNEL_VERSION(5, 10, 0)/KERNEL_VERSION(5, 13, 0)/g' "$sourcedir"/kernel/svm_agent_host/host/comm_master/comm/svm_master_cgroup.c >>/dev/null 2>&1 sed -i 's/KERNEL_VERSION(5, 10, 0)/KERNEL_VERSION(5, 13, 0)/g' "$sourcedir"/kernel/dev_inc/inc/kernel_cgroup_mem_adapt.h >>/dev/null 2>&1
- 找到.c文件的上级目录“/tmp/driver/kernel/vascend_drv”目录下的Makefile,在ccflags内容中添加如下参数,屏蔽报错。
-Wno-incompatible-pointer-types
- 修改完后,执行如下命令卸载。
/usr/local/Ascend/driver/script/uninstall.sh
- 回到“tmp”目录下,执行如下命令安装。
./driver/script/install.sh -- -- --full
- 安装成功后,回到“tmp”上级目录,执行如下命令将修改后的tmp目录打包(5.13.0内核版本仅为示例)。
./Ascend-hdk-310p-npu-driver_24.1.rc3_linux-aarch64.run --repack-path=./tmp new_driver_5.13.0.run
./Ascend-hdk-310p-npu-driver_24.1.rc3_linux-x86-64.run --repack-path=./tmp new_driver_5.13.0.run
- 如果打包报错,查看报错日志。依照上述步骤处理报错。
cat /var/log/ascend_seclog/ascend_rebuild.log
父主题: FAQ