linux-kernel - Linux 驱动程序 phys_mem_access_prot 未定义

标签 linux-kernel linux-device-driver

我有一个可加载模块,在 Ubuntu 9.10(Linux 2.6.31-22-server)下构建时会发出有关 phys_mem_access_prot 的警告。

[664] make -C /lib/modules/`uname -r`/build M=`pwd` 
make: Entering directory `/usr/src/linux-headers-2.6.31-22-server'
  LD      /home/chuck/dev/svd/built-in.o
  CC [M]  /home/chuck/dev/svd/svd.o
  LD [M]  /home/chuck/dev/svd/svd_drv.o
  Building modules, stage 2.
  MODPOST 1 modules
WARNING: "phys_mem_access_prot" [/home/chuck/dev/svd/svd_drv.ko] undefined!
  CC      /home/chuck/dev/svd/svd_drv.mod.o
  LD [M]  /home/chuck/dev/svd/svd_drv.ko
make: Leaving directory `/usr/src/linux-headers-2.6.31-22-server'

该函数确实显示在 System.map-2.6.31-22-server 文件中
[667] grep phys_mem_access_prot /boot/System.map-2.6.31-22-server 
ffffffff8103fb40 T phys_mem_access_prot
ffffffff8103fb50 T phys_mem_access_prot_allowed

和驱动程序加载,所以我很困惑为什么 modpost不开心。这是一个问题,因为内核没有导出函数 EXPORT_SYMBOL() ?

最佳答案

你已经回答了你自己的问题!模块使用的任何内核函数都需要由各种 EXPORT_SYMBOL() 宏之一导出。

如果非 GPL 模块需要使用 EXPORT_SYMBOL_GPL 导出的函数,您也会看到问题。

关于linux-kernel - Linux 驱动程序 phys_mem_access_prot 未定义,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3055318/

相关文章:

linux - 驱动程序编程 : cat command not showing output

c - 闪存和 tft LCD 共享 SPI 硬件的问题

linux-device-driver - Linux 设备驱动程序字符设备 "Subdirectory"

c - Linux 上的用户空间串行通信库

linux - 在用户程序中使用 <linux/types.h> 或在驱动程序模块代码中使用 <stdint.h> ……这有关系吗?

c - 文件数据在设备文件中存放在哪里?

c - 如果我使用两个 alloc_pages 进行检查,则 alloc_pages 返回的地址相同

c - 如何在不释放它指向的数据指针的情况下释放 skb 缓冲区?

c - 为数组元素赋值时出错

c - Linux 信号量初始化 : error implicit declaration of function 'semaphore_init'