Hi guys I'm a beginner in Android and Linux kernel. As an entry point to Android first of all I have to deal with the Linux kernel so one of the first tasks that I have to do is a simple driver runnable or configurable as module or embedded into the kernel (this configuration has been done within the menuconfig). Let me introduce my source code that I tried:
#define PROCFS_MAX_SIZE 80 #define procfs_name "calc1" static struct proc_dir_entry *Our_Proc_File; static unsigned long procfs_buffer_size = 0; int procfile_read (char *buffer, char **buffer_location, off_t offset, int buffer_length, int *eof, void *data) { int ret; if (offset > 0) // we have finished to read, return 0 ret = 0; else // fill the buffer, return the buffer size ret = sprintf(buffer, "%s= %d\n",equation,solution); //variables defined somewhere else return ret; } // This function is called with the /proc file is written int procfile_write(struct file *file, const char *buffer, unsigned long count, void *data) { int i; procfs_buffer_size = count; for (i=0; i<count-1; i++) equation[i]= buffer[i]; equation[i]= '\0'; calc1(); //this function is defined somewhere else return procfs_buffer_size; } int init_module() { Our_Proc_File = create_proc_entry(procfs_name, 0644, NULL); if (Our_Proc_File == NULL) { remove_proc_entry(procfs_name, &proc_root); printk(KERN_ALERT "Error: Not initialize /proc/%s\n", procfs_name); return -ENOMEM; } Our_Proc_File->read_proc = procfile_read; Our_Proc_File->write_proc = procfile_write; Our_Proc_File->owner = THIS_MODULE; Our_Proc_File->mode = S_IFREG | S_IRUGO; Our_Proc_File->uid = 0; Our_Proc_File->gid = 0; Our_Proc_File->size = 37; printk(KERN_ALERT "/proc/%s created\n", procfs_name); return 0; // everything is ok } void cleanup_module() { remove_proc_entry(procfs_name, &proc_root); printk(KERN_ALERT "/proc/%s removed\n", procfs_name); } MODULE_LICENSE("Dual BSD/GPL");RT_SYMBOL(procfile_write); This works fine as module an initializing with insmod & ending with rmmod constructs. the main goal is that, if it's a module avoid the needed of the uses of insmod/rmmod constructs or....... if this is embedded into the kernel....I coulded find and use this driver. If any one can help me to fix that I'll be really grateful: - How to link or init the module without using the insmod/rmmod constructs, and - If the driver (module) is embedded into th kernel, where is it placed or haw to use it. In advance many thaks for any help, Best regards. Reno. --~--~---------~--~----~------------~-------~--~----~ unsubscribe: [EMAIL PROTECTED] website: http://groups.google.com/group/android-kernel -~----------~----~----~----~------~----~------~--~---