LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices



Reply
 
Search this Thread
Old 02-22-2011, 01:53 AM   #1
paresh.nakhe
LQ Newbie
 
Registered: Nov 2007
Posts: 20

Rep: Reputation: 0
Modifying the elevator.c module in linux kernel


There is a file called elevator.c. It is written as a module (i.e it has specific init and exit functions). However we are not able to see it in lsmod listing.

We are working on a project where we need to modify this file. Compiling every time we change something will be time consuming. Is it possible to compile just this file and insert it as a normal module?

Regards.
 
Old 02-22-2011, 02:01 AM   #2
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
If the module can be loaded/unloaded dynamically, then you can do that. Some modules can only work as built-in modules, in which case, you will have to reload the new kernel (re-boot) to test your changes. You shouldn't have to re-build the whole kernel, only the modified module. That is what make does for you.
--- rod.
 
Old 02-22-2011, 02:48 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 12,491

Rep: Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077Reputation: 1077
Elevator is a I/O scheduler, not a "normal" (FSVO normal) kernel module. You can elect to have this as your I/O scheduler, or use another - I haven't looked to see how the selection is done in the (kernel) source. Shouldn't be too hard to track down.
 
Old 02-22-2011, 04:27 AM   #4
paresh.nakhe
LQ Newbie
 
Registered: Nov 2007
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by theNbomr View Post
If the module can be loaded/unloaded dynamically, then you can do that. Some modules can only work as built-in modules, in which case, you will have to reload the new kernel (re-boot) to test your changes. You shouldn't have to re-build the whole kernel, only the modified module. That is what make does for you.
--- rod.
This seems to be the solution for our problem. We however, have never tried rebuilding an existing built-in module. How are we supposed to go about doing this?

As far as i know, we will need to 'make modules'. How to load the modified module??

Thanks
 
Old 02-22-2011, 09:35 AM   #5
dugan
Senior Member
 
Registered: Nov 2003
Location: Canada
Distribution: distro hopper
Posts: 4,987

Rep: Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555Reputation: 1555
If you try to set up the kernel source with make menuconfig, make xconfig, make gconfig, etc, then you'll see if the option to build elevator.c as a module is available.

If you do change the kernel source's build settings, then you will of course need to rebuild it. The procedures for rebuilding a kernel are distribution-dependent.

Last edited by dugan; 02-22-2011 at 09:36 AM.
 
Old 02-22-2011, 11:22 AM   #6
theNbomr
LQ 5k Club
 
Registered: Aug 2005
Distribution: OpenSuse, Fedora, Redhat, Debian
Posts: 5,396
Blog Entries: 2

Rep: Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903Reputation: 903
If the module is a built-in, as syg00 suggests it is, then just edit and run 'make vmlinuz', or whatever compressed image format is being used for your kernel. You will have to copy the new image to the boot directory.
I must say that it seems odd that you are able to assess that the particular file must be modified, and yet you don't seem to know how to rebuild a kernel.

--- rod.
 
Old 02-25-2011, 06:44 AM   #7
paresh.nakhe
LQ Newbie
 
Registered: Nov 2007
Posts: 20

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by theNbomr View Post
If the module can be loaded/unloaded dynamically, then you can do that. Some modules can only work as built-in modules, in which case, you will have to reload the new kernel (re-boot) to test your changes. You shouldn't have to re-build the whole kernel, only the modified module. That is what make does for you.
--- rod.
But how do we exactly do it?
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
kernel module for udp-traffic modifying Kulti Programming 2 03-10-2010 03:29 AM
kernel module for udp-traffic modifying Kulti Linux - Kernel 0 03-05-2010 08:50 AM
How to find the elevator algorithm used by running kernel in older versions vduvvuru Linux - Kernel 2 03-12-2008 09:35 AM
Modifying / replacing a kernel module dplazz Linux - General 1 07-22-2005 04:14 PM
modifying TCP packets using kernel module shinkm Linux - Networking 2 09-02-2004 10:37 AM


All times are GMT -5. The time now is 02:42 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration