example 2.4 standalone modules?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Greetings,

I am trying to port a driver I wrote for the 2.2 series to 2.4.  Not
surprisingly, an attempted build generate a bunch of warnings and
errors.  However...I have searched extensively for some documentation
or examples of making standalone modules for 2.4, and they do not seem
to exist!

Every online resource, including the LKMP:

http://www.tldp.org/LDP/lkmpg/mpg.html

...seem to reference the 2.2 kernel.  The code for chardev.c, here:

http://www.tldp.org/LDP/lkmpg/node14.html

...is exactly what I need.  If I could get chardev.c to compile, I
could get my driver to compile, because they produce the same errors.
I have attached the error output below.

Does anyone have any advice, or know where I can find an example of
a working, standalone character device driver for 2.4?

Thanks!
-Adam


----------------------------------------------------------------
gcc -Wall -DMODULE -D__KERNEL__ -DLINUX -c chardev.c
In file included from /usr/include/linux/fs.h:23,
                 from chardev.c:21:
/usr/include/linux/string.h:8:2: warning: #warning Using kernel header
in userland!
chardev.c:41:45: asm/uaccess.h: No such file or directory
chardev.c:75: warning: `struct file' declared inside parameter list
chardev.c:75: warning: its scope is only this definition or
declaration, which is probably not what you want
chardev.c:75: warning: `struct inode' declared inside parameter list
chardev.c: In function `device_open':
chardev.c:86: warning: implicit declaration of function `printk'
chardev.c:87: dereferencing pointer to incomplete type
chardev.c:87: dereferencing pointer to incomplete type
chardev.c:87: `amp' undeclared (first use in this function)
chardev.c:87: (Each undeclared identifier is reported only once
chardev.c:87: for each function it appears in.)
chardev.c:87: parse error before ';' token
chardev.c:92: `EBUSY' undeclared (first use in this function)
chardev.c:121: warning: implicit declaration of function `sprintf'
chardev.c:140: warning: implicit declaration of function `atomic_inc'
chardev.c:140: union has no member named `usecount'
chardev.c: At top level:
chardev.c:154: warning: `struct file' declared inside parameter list
chardev.c:154: warning: `struct inode' declared inside parameter list
chardev.c: In function `device_release':
chardev.c:170: warning: implicit declaration of function `atomic_dec'
chardev.c:170: union has no member named `usecount'
chardev.c: At top level:
chardev.c:187: warning: `struct file' declared inside parameter list
chardev.c: In function `device_read':
chardev.c:206: `amp' undeclared (first use in this function)
chardev.c:206: parse error before ';' token
chardev.c:206: parse error before ')' token
chardev.c: At top level:
chardev.c:227: parse error before "return"
chardev.c:239: warning: `struct file' declared inside parameter list
chardev.c: In function `device_write':
chardev.c:247: `EINVAL' undeclared (first use in this function)
chardev.c: At top level:
chardev.c:268: variable `Fops' has initializer but incomplete type
chardev.c:269: warning: excess elements in struct initializer
chardev.c:269: warning: (near initialization for `Fops')
chardev.c:270: warning: excess elements in struct initializer
chardev.c:270: warning: (near initialization for `Fops')
chardev.c:271: warning: excess elements in struct initializer
chardev.c:271: warning: (near initialization for `Fops')
chardev.c:272: warning: excess elements in struct initializer
chardev.c:272: warning: (near initialization for `Fops')
chardev.c:273: warning: excess elements in struct initializer
chardev.c:273: warning: (near initialization for `Fops')
chardev.c:274: warning: excess elements in struct initializer
chardev.c:274: warning: (near initialization for `Fops')
chardev.c:275: warning: excess elements in struct initializer
chardev.c:275: warning: (near initialization for `Fops')
chardev.c:276: warning: excess elements in struct initializer
chardev.c:276: warning: (near initialization for `Fops')
chardev.c:278: warning: excess elements in struct initializer
chardev.c:278: warning: (near initialization for `Fops')
chardev.c:281: warning: excess elements in struct initializer
chardev.c:281: warning: (near initialization for `Fops')
chardev.c: In function `init_module':
chardev.c:288: warning: implicit declaration of function
`module_register_chrdev'
chardev.c:290: `amp' undeclared (first use in this function)
chardev.c:290: parse error before ';' token
chardev.c: In function `cleanup_module':
chardev.c:320: warning: implicit declaration of function
`module_unregister_chrdev'
chardev.c: At top level:
chardev.c:268: storage size of `Fops' isn't known
make: *** [chardev.o] Error 1
[




--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/



[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux