how to check if a file builds before firing the kernel build

During development it happens all the time that you have made a mistake somewhere in the code and your code does not even compile.
How to find this without firing the whole build. So basically how does one just build one file in kernel source tree.

thank.
 
'make buildkernel' by default cleans your source tree, re-configs, does a 'make depend', and then builds the kernel and modules. With some caution, you can do these steps individually, or force the kernel build to skip steps, saving a lot of time. src/Makefile.inc1 documents the following -D options:
Code:
#       -DNO_KERNELCONFIG do not run config in ${MAKE} buildkernel
#       -DNO_KERNELCLEAN do not run ${MAKE} clean in ${MAKE} buildkernel
#       -DNO_KERNELDEPEND do not run ${MAKE} depend in ${MAKE} buildkernel
You can also look at the buildkernel target to see what it does to build the kernel -- historically, most developers did something like the following:
Code:
  cd src/sys/i386/conf
  config MYKERNEL
  cd ../../i386/compile/MYKERNEL
  make depend
  make
In which case you can just do "make foo.o" in the kernel build directory to rebuild the one file. If you're cross-building, you need to use a cross-toolchain, which is something buildkernel does automatically.
 
Back
Top