Документ взят из кэша поисковой машины. Адрес
оригинального документа
: http://www.arcetri.astro.it/irlab/doc/library/linux/khg/HyperNews/get/khg/170.html
Дата изменения: Thu Mar 23 12:37:46 2000 Дата индексирования: Wed Sep 15 00:50:24 2010 Кодировка: Поисковые слова: р р р р р р п п р р |
As far as I can tell, this site doesn't yet have
information on how to write a loadable kernel module
(although there are quite a few queries from
people asking about how to do it).
After looking around, I found that the insmod/modules.doc and
insmod/HOWTO-modularize files in the modules-2.0.0.tar.gz package
contained a fairly good description of some of the things
you need to do when writing a kernel module.
The insmod/drv_hello.c and insmod/Makefile files
in that package provide an example character
device driver that can be built as a module.
It would be nice if these files (or the relevant contents) could get incorporated into the KHG at some point. To summarize, it looks like modules should be built with the following compiler options (at least, this is the way the Makefile for drv_hello.o goes): -O6 -pipe -fomit-frame-pointer -Wall -DMODULE -D__KERNEL__ -DLINUX Of the above, it seems likely that the key arguments are the -DMODULE -D__KERNEL__ and possibly the -O6 are actually needed. If you want to build your module with versioning support, add the following options: -DMODVERSIONS -include /usr/include/linux/modversions.h From the examples and docs, it looks like modules should be in the form: #include
Again, see the documentation scattered through the modules-2.0.0 package (and also presumably through the newer modutils-2.1.x packages) for more detailed information. |