做一个led驱动insmod时出现了上面的问题 在驱动里随机加句话或者减句话 可能能加载上 但再改改其他的问题又出来了
#include <linux/module.h>
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/cdev.h>
#include <asm/io.h>
#include <asm/system.h>
#include <linux/gpio.h>
#include <linux/device.h>
#include <asm/uaccess.h>
#include <mach/regs-gpio.h>
#include <linux/module.h>
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/errno.h>
#include <linux/mm.h>
#include <linux/sched.h>
#include <linux/init.h>
#include <linux/cdev.h>
#include <asm/io.h>
#include <asm/system.h>
#include <asm/uaccess.h>
#include <linux/device.h>
#include <linux/miscdevice.h>
#include <linux/delay.h>
#include <asm/irq.h>
#include <mach/regs-gpio.h>
#include <mach/gpio-fns.h>
#include <mach/hardware.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/init.h>
#include <linux/mm.h>
#include <linux/fs.h>
#include <linux/types.h>
#include <linux/delay.h>
#include <linux/moduleparam.h>
#include <linux/slab.h>
#include <linux/errno.h>
#include <linux/ioctl.h>
#include <linux/cdev.h>
#include <linux/string.h>
#include <linux/list.h>
#include <linux/pci.h>
#include <linux/gpio.h>
#include <asm/uaccess.h>
#include <asm/atomic.h>
#include <asm/unistd.h>
#include <linux/smp_lock.h>
#include <linux/jiffies.h>
#include <asm/uaccess.h>
int mem_major;
struct device *dev;
struct class *myclass;
struct cdev cdev;
int led[4]={S3C2410_GPB(5),S3C2410_GPB(6),S3C2410_GPB(7),S3C2410_GPB(8)};
int bright[4]={1,2,4,8};
int led_ctl(struct inode* node,struct file* led_file,unsigned int cmd,unsigned long arg){
int *a;
int i;
if((a=kmalloc(4,GFP_KERNEL))==NULL)return -EINVAL;
copy_from_user(a,(int *)arg,4);
printk("<0>""ioctl:%d\n",arg);
switch(cmd) {
case 0:
case 1:
if (arg > 4) {
return -EINVAL;
}
s3c2410_gpio_setpin(led[arg], !cmd);
return 0;
default:
return -EINVAL;
}
return 0;
}
int led_open(struct inode *inode, struct file *filp){
printk("<0>""open\n");
return 0;
}
int mem_release(struct inode *inode, struct file *filp)
{
return 0;
}
static struct file_operations mem_fops={
.owner= THIS_MODULE,
.open=led_open,
.ioctl=led_ctl,
.release = mem_release,
};
static int __init ledinit(void){
dev_t devno=0;
int i;
if(alloc_chrdev_region(&devno, 0, 1, "leddev")<0){
return -1;
}
cdev_init(&cdev, &mem_fops);
cdev.owner = THIS_MODULE;
cdev.ops = &mem_fops;
/* ×¢²á×Ö·ûÉ豞 */
cdev_add(&cdev, devno, 1);
mem_major = MAJOR(devno);
for(i=0;i<4;i++){
s3c2410_gpio_cfgpin(led[i], S3C2410_GPIO_OUTPUT);
s3c2410_gpio_setpin(led[i], 0);
}
printk("<0>""init %d\n",mem_major);
myclass=class_create(THIS_MODULE,"bianjing_class");
dev=device_create(myclass,NULL,MKDEV(mem_major, 0),NULL,"bian");
return 0;
}
static void __exit memdev_exit(void)
{
device_unregister(dev);
class_destroy(myclass);
printk(KERN_DEBUG"exit\n");
cdev_del(&cdev);
unregister_chrdev_region(MKDEV(mem_major, 0), 1);
}
module_init(ledinit);
module_exit(memdev_exit);
MODULE_AUTHOR("Bian Jing");
MODULE_LICENSE("GPL");
makefile:
ifneq ($(KERNELRELEASE),)
obj-m := led.o
else
KDIR := /home/a/linux-2.6.32.2
all:
make -C $(KDIR) M=$(PWD) modules ARCH=arm CROSS_COMPILE=arm-linux-
clean:
rm -f *.ko *.o *.mod.o *.mod.c *.symvers
endif
[root@FriendlyARM /]# insmod led.ko
led: Unknown symbol unregister_chrdev_410_gpio_setpin
led: Unknown symbol rdev_region
led: Unknown symbol bright
led: Unknown symbol _major
insmod: cannot insert 'led.ko': unknown symbol in module or invalid parameter
就是那几个函数在内核里面没有,也没有其它模块export这几个接口,当然无法运行了