hi,
I am using a angstrom distro for BeagleBone Black. I have written a simple
char DD but while inserting there is a error as
root@beaglebone:/home/adi/myNUll# insmod mullchar.ko
Error: could not insert module nullchar.ko: Invalid parameters
when i run a dmesg i get
root@beaglebone:/home/adi/myNUll# dmesg |tail
[ 6449.821628] nullchar: disagrees about version of symbol cdev_add
[ 6449.821653] nullchar: Unknown symbol cdev_add (err -22)
[ 6449.821671] nullchar: disagrees about version of symbol device_create
[ 6449.821681] nullchar: Unknown symbol device_create (err -22)
[ 6449.821706] nullchar: disagrees about version of symbol device_destroy
[ 6449.821715] nullchar: Unknown symbol device_destroy (err -22)
[ 6449.821730] nullchar: disagrees about version of symbol cdev_init
[ 6449.821739] nullchar: Unknown symbol cdev_init (err -22)
[ 6449.821748] nullchar: disagrees about version of symbol cdev_del
[ 6449.821757] nullchar: Unknown symbol cdev_del (err -22)
The vermagic using modinfo nullchar.ko
vermagic: 3.8.13 SMP mod_unload modversions ARMv7 thumb2 p2v8
root@beaglebone:/home/adi/myNUll# uname -a
Linux beaglebone 3.8.13 #1 SMP Tue Jun 18 02:11:09 EDT 2013 armv7l GNU/Linux
The code that i have written is
#include<linux/init.h>
#include<linux/module.h>
#include<linux/version.h>
#include<linux/types.h>
#include<linux/fs.h>
#include<linux/device.h>
#include<linux/cdev.h>
#include<linux/kdev_t.h>
#include<linux/kernel.h>
#include<asm/uaccess.h>
MODULE_LICENSE("GPL");
MODULE_VERSION("0.1");
static dev_t first=MKDEV(0,0);
static struct cdev c_dev;
static struct class *cl;
static int my_open(struct inode *inode,struct file *filp)
{
printk(KERN_INFO "driver is now open");
return 0;
}
static int my_close(struct inode *inode,struct file *filp)
{
printk(KERN_INFO "the driver is closed");
return 0;
}
static ssize_t my_read(struct file *filp,char __user *buf,size_t len,loff_t
*off)
{
printk(KERN_INFO "the driver is reading");
return 0;
}
static ssize_t my_write(struct file *filp,const char __user *buff ,size_t
len,loff_t *off)
{
printk(KERN_INFO "the driver is writing");
return len;
}
static struct file_operations fops={
.owner= THIS_MODULE,
.open=my_open,
.read=my_read,
.write=my_write,
.release=my_close,
};
static int __init my_init(void)
{
printk(KERN_ALERT "Device Init running");
if(alloc_chrdev_region(&first,0,1,"Simple_char_driver")<0)
{
return -1;
}
if((cl=class_create(THIS_MODULE,"Simple_char_driver"))==NULL)
{
unregister_chrdev_region(first,1);
return -1;
}
if(device_create(cl,NULL,first,NULL,"Simple_char_driver")==NULL)
{
class_destroy(cl);
unregister_chrdev_region(first,1);
return -1;
}
cdev_init(&c_dev,&fops);
c_dev.owner=THIS_MODULE;
if(cdev_add(&c_dev,first,1)==-1)
{
device_destroy(cl,first);
class_destroy(cl);
unregister_chrdev_region(first,1);
return -1;
}
return 0;
}
static void __exit my_exit(void)
{
cdev_del(&c_dev);
device_destroy(cl,first);
class_destroy(cl);
unregister_chrdev_region(first,1);
printk(KERN_INFO " driver running __exit");
}
module_init(my_init);
module_exit(my_exit);
MODULE_AUTHOR("ADITHYA");
MODULE_DESCRIPTION("Simple char driver");
I am unable to realize the problem in this.i need help to resovling this
error.
Regards
--
For more options, visit http://beagleboard.org/discuss
---
You received this message because you are subscribed to the Google Groups
"BeagleBoard" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.