vkernel: Fix compilation with profiling support.
authorSascha Wildner <saw@online.de>
Thu, 17 May 2012 14:17:22 +0000 (16:17 +0200)
committerSascha Wildner <saw@online.de>
Thu, 17 May 2012 14:17:22 +0000 (16:17 +0200)
commitb96eeefdbef8ad746365c234181372389428cc11
tree04a799dc3ee58d65fa615d8d5d5327023f7b3fee
parent3533a1834a0ba3a7c441ede5120c3720d8a34c4c
vkernel: Fix compilation with profiling support.

The vkernel is a special userland program in the regard that its Makefile
is generated by config(8), which is kind of tailored to the real kernel.

So first of all, we have to modify config(8) to detect it's a vkernel we
want to build and in this case it should not define GPROF which otherwise
activates the real kernel's profiling bits.

Then, modify libkern's mcount.c to skip kernel specific parts too.

Then, modify the vkernels' Makefiles to take into account ${PROF} (and
while we're here, ${DEBUG} too) which are set by the surrounding Makefile
which is generated by config(8).

The vkernel is now (from profiling point of view) treated like any other
userland program.

Last but not least, add some documentation about building a vkernel with
profiling support to vkernel's manpage.

To build with profiling, simply add CONFIGARGS=-p to the buildkernel
command line. It will need the config(8) program to be in /usr/obj's
btools dir, so either a buildworld with this commit needs to be done,
or config can be installed manually to /usr/sbin and nativekernel can
be used.

Tested-by: tuxillo
share/man/man7/vkernel.7
sys/libkern/mcount.c
sys/platform/vkernel/conf/Makefile
sys/platform/vkernel64/conf/Makefile
usr.sbin/config/mkmakefile.c