LKM - .modinfo

Posted in How To's by Shafkat Shahzad, M.Sc - Senior Technical Content Manager on December 27th, 2009

Welcome to the tutorial guide. The guide will provide a user with guidance and information on .modinfo

An ELF object file consists of various named sections. Some of them are basic parts of an object file, for example the .text section contains executable code that a loader loads. If you want to make up any section you want and have it used by special programs, then you can. For the purposes of Linux LKMs, there is the .modinfo section. An LKM doesn’t have to have a section named .modinfo to work, but the macros that a user is supposed to use to code an LKM cause one to be generated, so they generally do.

If you would like to view the sections of an object file, including the .modinfo section if it exists, please use the objdump program.
-In order to see all the sections in the object file for the msdos LKM, please see following:
objdump msdos.o –section-headers

- in order to see the contents of the .modinfo section:
objdump msdos.o –full-contents –section=.modinfo

A user can use the modinfo program to interpret the contents of the .modinfo section.
Please note that insmod uses the .modinfo section for the following:
• It contains the kernel release number for which the module was built. I.e. of the kernel source tree whose header files were used in compiling the module.
insmod uses that information as explained in Section 6.
• It describes the form of the LKM’s parameters. insmod uses this information to format the parameters you supply on the insmod command line into data structure initial values, which insmod inserts into the LKM as it loads it.
If you followed guidance and advise as provided in this tutorial guide then you would have learnt about .modinfo.

Bookmark Us
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Mixx
  • Google
  • MisterWong
  • Netvouz
  • Reddit
  • Slashdot
  • Spurl
  • StumbleUpon
  • Technorati
  • Wists

Leave a Comment