Quote:
Originally Posted by Stroker
I didn't know you could do a partial kernel recompile. May I ask how one does that?
|
It's a normal part of the make file processing. If you update a source file and then do "make all" without using "Make clean" then just the changed files will be compiled, and only the changed modules or executable files will be linked.
Changing some kernel settings that just affect one driver or module may also result in a selective set of files being compiled.
There are a few caveats. If you replace a C source file with a version dated earlier then you have to manually delete the corresponding object file to force it to be recompiled. Otherwise the object file is newer than the source file and is not recompiled. There also may be dependency errors or limitations in the make file that result in something not being compiled or linked. The safest way to build a kernel is to use "make clean" first, but that also takes the longest. After installing kernel sources or a Linux distro you should use "make mrproper" and then "make clean" before you compile the first time. That will force everything to be compiled.
To change the Linux boot logo I replaced the file "logo_linux_clut224.ppm" and deleted the file "logo_linux_clut224.c" and "logo_linux_clut224.o". Normally you would not want to delete a ".c" file but in this case the ".c" file is generated from the ".ppm" file.
Then I did "make all" and copied the resulting kernel to my boot directory. Since my changes did not affect modules nor the kernel configuration I didn't have to use "make modules_install" and I didn't have to rebuild my "initrd" image.
It still does take significant time for the make processing to check what files need to be compiled and linked so it isn't instantaneous when only a single file must be compiled. You also can't avoid the first complete kernel build because the object files don't exist until you build at least once.
Make file rules can be quite complicated and it's a programming job in itself just to maintain the make files for something as large as the Linux kernel.