linux驱动找不到设备文件夹,Linux设备驱动程序:找不到符号“memcpy”

我正在尝试编写

Linux设备驱动程序.我已经让它工作得很好,直到我尝试使用“memcpy”.我甚至没有得到编译器错误,当我“制造”它只是警告我:

警告:“memcpy”[/root/homedir/sv/main.ko]未定义!

好的,当我尝试通过insmod加载时,我进入控制台:

insmod:插入’./main.ko’时出错:-1模块中的未知符号

在dmesg上:

main:未知符号memcpy(错误0)

我包括以下内容:

#include

#include

#include

#include /* printk() */

#include /* kmalloc() */

#include /* everything... */

#include /* error codes */

#include /* size_t */

#include /* O_ACCMODE */

#include

#include /* cli(), *_flags */

#include /* copy_*_user */

使用memcpy的功能:

static int dc_copy_to_user(char __user *buf, size_t count, loff_t *f_pos,

struct sv_data_dev *dev)

{

char data[MAX_KEYLEN];

size_t i = 0;

/* Copy the bulk as long as there are 10 more bytes to copy */

while (i < (count + MAX_KEYLEN)) {

memcpy(data, &dev->data[*f_pos + i], MAX_KEYLEN);

ec_block(dev->key, data, MAX_KEYLEN);

if (copy_to_user(&buf[i], data, MAX_KEYLEN)) {

return -EFAULT;

}

i += MAX_KEYLEN;

}

return 0;

}

有人能帮助我吗?我认为这件事是在linux / string.h中,但我得到的错误是一样的.我正在使用内核2.6.37-rc1(我在用户模式linux中进行,仅在2.6.37-rc1之后才有效).任何帮助是极大的赞赏.

# Context dependent makefile that can be called directly and will invoke itself

# through the kernel module building system.

KERNELDIR=/usr/src/linux

ifneq ($(KERNELRELEASE),)

EXTRA_CFLAGS+=-I $(PWD) -ARCH=um

obj-m := main.o

else

KERNELDIR ?= /lib/modules/$(shell uname -r)/build

PWD = $(shell pwd)

all:

$(MAKE) V=1 ARCH=um -C $(KERNELDIR) M=$(PWD) modules

clean:

rm -rf Module.symvers .*.cmd *.ko .*.o *.o *.mod.c .tmp_versions *.order

endif

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值