[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Problem with module compilation
Hi,
I think you have Redhat 7.0, try using kgcc instead of gcc
Amit
----- Original Message -----
From: Tiziano Fagni
To: kernelnewbies@nl.linux.org
Sent: Thursday, February 15, 2001 2:33 AM
Subject: Problem with module compilation
Hi, I am a new kernel hacker and I am trying to write my first character
device
driver. I want to develop the driver as module so I get "Linux Kernel Module
Programming Guide" and I begin writing....
After I have writed the basic code such as init_module() and
cleanup_module()
I have tryed to compile the module but I obtain an infinite number of
errors.
The errors are relative to the standard include files.
This is the output of my compiler (the first lines):
gcc -D__KERNEL__ -D__SMP__ -Wall -DMODULE -DMODVERSIONS -c -o idx_module.o
idx_module.c
In file included from /usr/include/linux/dcache.h:7,
from /usr/include/linux/fs.h:19,
from idx_module.c:7:
/usr/include/linux/mount.h:32: parse error before `uid_t'
/usr/include/linux/mount.h:32: warning: no semicolon at end of struct or
union
/usr/include/linux/mount.h: In function `mntget':
/usr/include/linux/mount.h:38: dereferencing pointer to incomplete type
/usr/include/linux/mount.h: In function `mntput':
/usr/include/linux/mount.h:45: dereferencing pointer to incomplete type
/usr/include/linux/mount.h:46: warning: implicit declaration of function
`printk_Rsmp_1b7d4074'
In file included from /usr/include/linux/string.h:21,
from /usr/include/linux/fs.h:23,
from idx_module.c:7:
/usr/include/asm/string.h: At top level:
/usr/include/asm/string.h:47: parse error before `size_t'
/usr/include/asm/string.h: In function `strncpy':
/usr/include/asm/string.h:61: `src' undeclared (first use in this function)
/usr/include/asm/string.h:61: (Each undeclared identifier is reported only
once
/usr/include/asm/string.h:61: for each function it appears in.)
/usr/include/asm/string.h:61: `dest' undeclared (first use in this function)
/usr/include/asm/string.h:61: `count' undeclared (first use in this
function)
/usr/include/asm/string.h:63: warning: control reaches end of non-void
function
My module source file is this:
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/modversions.h>
/* For character devices. */
#include <linux/types.h>
#include <linux/fs.h>
#include <linux/wrapper.h>
#include <asm/uaccess.h>
/* Initialize the module - Register the character device */
int init_module()
{
/* Register the character device. */
Major = module_register_chrdev(0, DEVICE_NAME, &Fops);
if (Major < 0)
{
printk("Register device failed\n");
return Major;
}
printk("Device register with major <%d>!!\n", Major);
return 0;
}
/* Cleanup function. */
void cleanup_module()
{
int ret;
/* Unregister the device. */
ret = module_unregister_chrdev(Major, DEVICE_NAME);
if (ret < 0)
printk("Error <%d> when try to unloading module!!\n", ret);
}
I try to compile the module on a system running kernel 2.4.0 in SMP mode.
Anyone can help me to solve this problem?
Thanks Tiziano Fagni
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/
IRC Channel: irc.openprojects.net / #kernelnewbies
Web Page: http://www.surriel.com/kernelnewbies.shtml