![Modpost:“模块…使用命名空间…中的符号…”将 FL2000_DRM 驱动程序移植到较新版本时出错](https://linux22.com/image/220301/Modpost%EF%BC%9A%E2%80%9C%E6%A8%A1%E5%9D%97%E2%80%A6%E4%BD%BF%E7%94%A8%E5%91%BD%E5%90%8D%E7%A9%BA%E9%97%B4%E2%80%A6%E4%B8%AD%E7%9A%84%E7%AC%A6%E5%8F%B7%E2%80%A6%E2%80%9D%E5%B0%86%20FL2000_DRM%20%E9%A9%B1%E5%8A%A8%E7%A8%8B%E5%BA%8F%E7%A7%BB%E6%A4%8D%E5%88%B0%E8%BE%83%E6%96%B0%E7%89%88%E6%9C%AC%E6%97%B6%E5%87%BA%E9%94%99.png)
我正在尝试移植https://github.com/kenballus/fl2000_drm_519,专为 linux 5.19 设计,适用于 linux 6.2.11,但在应用下面附加的补丁后,我收到此错误,但我不知道如何修复它:
$ make
make CHECK="/usr/bin/sparse" -C /lib/modules/6.2.11-300.fc38.x86_64/build M=/home/guillem/Downloads/fl2000_drm_519 modules
make[1]: Entering directory '/usr/src/kernels/6.2.11-300.fc38.x86_64'
MODPOST /home/guillem/Downloads/fl2000_drm_519/Module.symvers
ERROR: modpost: module fl2000 uses symbol dma_buf_end_cpu_access from namespace DMA_BUF, but does not import it.
ERROR: modpost: module fl2000 uses symbol dma_buf_begin_cpu_access from namespace DMA_BUF, but does not import it.
make[2]: *** [scripts/Makefile.modpost:138: /home/guillem/Downloads/fl2000_drm_519/Module.symvers] Error 1
make[1]: *** [Makefile:1977: modpost] Error 2
make[1]: Leaving directory '/usr/src/kernels/6.2.11-300.fc38.x86_64'
make: *** [Makefile:21: modules] Error 2
我已经修补了fl2000.h
这种方式来解决其他导入错误:
diff --git a/fl2000.h b/fl2000.h
index 718e247..c4a6910 100644
--- a/fl2000.h
+++ b/fl2000.h
@@ -23,6 +23,7 @@
#include <linux/dma-mapping.h>
#include <linux/time.h>
#include <linux/device.h>
+#include <linux/dma-buf.h>
#include <drm/drm_gem.h>
#include <drm/drm_prime.h>
#include <drm/drm_vblank.h>
@@ -37,6 +38,8 @@
#include <drm/drm_probe_helper.h>
#include <drm/drm_damage_helper.h>
#include <drm/drm_gem_atomic_helper.h>
+#include <drm/drm_framebuffer.h>
+#include <drm/drm_fbdev_generic.h>
#include "fl2000_registers.h"
答案1
正如错误所示,您需要导入该名称空间。
适当的补丁是:
diff --git a/fl2000_drv.c b/fl2000_drv.c
index 31b7ef4..218b87a 100644
--- a/fl2000_drv.c
+++ b/fl2000_drv.c
@@ -195,3 +195,4 @@ module_usb_driver(fl2000_driver);
MODULE_AUTHOR("Artem Mygaiev");
MODULE_DESCRIPTION("FL2000 USB display driver");
MODULE_LICENSE("GPL v2");
+MODULE_IMPORT_NS(DMA_BUF);