What is an lkm?

I wish to know few things which makes Linux different from other Operating systems, i.e., about the Loadable Kernel Modules.

  1. Brief intro on how LKMs works?
  2. In which language a new module is written?
  3. How to add a new module to Linux Kernel? and
  4. Possibility of a wreak havoc when a new module is inserted to the kernel.

1 Answer

Read this for full documentation

If you want to add code to a Linux kernel, the most basic way to do that is to add some source files to the kernel source tree and recompile the kernel. In fact, the kernel configuration process consists mainly of choosing which files to include in the kernel to be compiled.

But you can also add code to the Linux kernel while it is running. A chunk of code that you add in this way is called a loadable kernel module.LKM

There are six main things LKMs are used for:

  1. Device drivers.
  2. Filesystem drivers.
  3. System calls.
  4. Network drivers.
  5. TTY line disciplines.
  6. Executable interpreters.

A module is mainly written in C language and maybe include assembly in some cases.

To insert a module use

insmod module

To remove a mdoule use

rmmod module

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like