home *** CD-ROM | disk | FTP | other *** search
- 1. What is a module?
-
- A module is a collection of code which can be dynamicly linked into the
- kernel. Modules can contain things such as device drivers, system calls,
- and file system types [system calls are actually nolonger permitted].
-
-
- 2. How do I create a module?
-
- A module consists of a normal .o file. If you have multiple source
- files, combine them into a single .o file using "ld -r".
-
-
- 3. How does the kernel know to use my module?
-
- Your code must contain a routine named "init_module" and a routine named
- "cleanup_module". These routines are defined as:
-
- "C" int init_module(void);
- "C" void cleanup_module(void);
-
- "Init_module" will be called when the module is loaded. It should return
- zero on success and -1 on failure. "Cleanup_module" will be called before
- the module is deleted. It should undo the operations performed by
- "init_module". For example, if a module defines a special device type
- "init_module" should register the device major number and and
- "cleanup_module" should remove it.
-
-
- 4. Show me a simple example!
-
- See drv_hello.c in this directory. Note the use count checking macros,
- these prevent the module being freed while it is still running!
- Also note for the module to be installed it must contain a string
- kernel_version[] that matches the release of the current kernel (i.e.
- matches uname -r).
-
-
- 5. How do I load and unload modules?
-
- "insmod object_file" will install a module into the kernel. The name
- of the module consists of the name of the object file with the .o and
- any directory names removed.
-
- "lsmod" will produce a list of modules currently in the kernel,
- including the module name and size in pages.
-
- "rmmod name" will remove a module. The argument should be the module
- name, not the object file name.
-
- [Written by Jon Tombs or Bas Larhooven?]
-