Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    How to compile only one file of kernel source code instead of compilin


    I am going to write an I/O Scheduler for Linux kernel. I have already compiled the whole kernel before without any modification to the kernel source code. I have reached at noop-iosched.c file under /linux/block folder. Now firstly I am trying to modify noop-iosched.c file to test and play with it to just get familiarize with linux kernel source code. I have just added a following printk(KERN_INFO "Hello World....!!!!"); instruction in this file. Now I only want to compile noop-ioshed.c file instead of compiling the whole kernel source code (which takes around 2 hours to compile) so that I can see whether it's working or not at my side. So could you please guide me how to only compile noop-iosched.c file instead of whole kernel to see my change.

    Any help would be greatly appreciated!

    Thanks a lot, Ricky Ben

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    14,038
    The associated Makefile(s) should know what components have changed, and only require building/re-linking those, provided you have not cleaned the build tree (make clean). Alternatively, you can cd into the appropriate source directory and only make that one, assuming it is a loadable, and not built-in, module.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Linux Engineer docbop's Avatar
    Join Date
    Nov 2009
    Location
    Woodshed, CA
    Posts
    949
    -->
    make checks timestamps and only compiles changed files. So you can run the touch tool to change the timestamp on the file you want to compile and then run make.
    A lion does not lose sleep, over the opinion of sheep.

$spacer_open
$spacer_close

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •