In my project I configure the kernel (2.6.32) in block/ioctl.c. We all know that kernel compiling and building takes few hours. Even for a small change, I'm compiling from scratch. So is there any way to compile and build only the changed file?

  • 1
    the first question in KernelCustomBuild might help you
    – Yogu
    Commented Apr 21, 2014 at 10:56
  • A few hours for a single .c file change? What commands are you using exactly and what hardware do you have?
    – Mat
    Commented Apr 21, 2014 at 11:10
  • @Mat I have to analyze the block/ioctl.c code. simple ex: addind printk function. And changing some macro kind of things
    – gangadhars
    Commented Apr 21, 2014 at 11:13
  • I understand that. Rebuilding after a small change in a .c file should not result in a complete rebuild, and even if it did that shouldn't take hours.
    – Mat
    Commented Apr 21, 2014 at 11:14
  • 2
    Don't reconfigure if you're not changing the configuration. Don't clean if you intend to rebuild with a small change.
    – Mat
    Commented Apr 21, 2014 at 11:26

1 Answer 1


No, kernel compiling does not take “few hours”. Linus Torvalds said that it took him 12 minutes in the old days, and a lot less these days. Of course it depends whether you're compiling a kernel with just the drivers you need for your hardware, or a distribution kernel with all the drivers people may need — but even for a distribution kernel on a slightly elderly machine, it takes way less than an hour to do a full build.

Furthermore, if you change one file of the kernel, you don't need to do a full build. Just run make (and make modules if there are modules you need to recompile), and only the changed file (and the files that depend on it, if it's a header file) will be recompiled.

  • 1
    Even the smallest change in configuration results in entire kernel being rebuilt, and it does take hours. It always did as long as I remember (20 years and counting). It became worse when deps target was dropped.
    – ajeh
    Commented May 12, 2018 at 13:06

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .