Книга: Embedded Linux Primer: A Practical, Real-World Approach

8.2.7. modinfo

8.2.7. modinfo

You might have noticed the last three lines of the skeletal driver in Listing 8-1, and later in Listing 8-6. These macros are there to place tags in the binary module to facilitate their administration and management. Listing 8-9 is the result of modinfo executed on our hello1.ko module.

Listing 8-9. modinfo Output

$ modinfo hello1
filename:       /lib/modules/.../char/examples/hello1.ko
author:         Chris Hallinan
description:    Hello World Example
license:        GPL
vermagic:       2.6.14 ARMv5 gcc-3.3
depends:
parm:           debug_enable:Enable module debug mode. (int)
$

The first field is obvious: It is the full filename of the device driver module. For readability in this listing, we have truncated the path again. The next lines are a direct result of the descriptive macros found at the end of Listing 8-6 namely, the filename, author, and license information. These are simply tags for use by the module utilities and do not affect the behavior of the device driver itself. You can learn more about modinfo from its man page and the modinfo source itself.

One very useful feature of modinfo is to learn what parameters the module supports. From Listing 8-9, you can see that this module supports just one parameter. This was the one we added in Listing 8-6, debug_enable. The listing gives the name, type (in this case, an int), and descriptive text field we entered with the MODULE_PARM_DESC() macro. This can be very handy, especially for modules in which you might not have easy access to the source code.

Оглавление книги


Генерация: 0.058. Запросов К БД/Cache: 0 / 3
поделиться
Вверх Вниз