Regarding custom compilation in FreeBSD

Hello folks,

I have been reading about compiling the kernel mostly from hereand the relevant links that page contains like this and this.

Now since I want to enable kernel level debugging I am following this page about enabling ddb. To do that, I have created a configuration file called MYKERNEL ( sounds cliched :), but what the heck) and in keeping with the present trend, have included the original GENERIC file in the new configuration file called MYERNEL.

Now my new config file starts out like:
Code:
include GENERIC
ident MYKERNEL
followed by

Code:
options KDB
options DDB
But when I compile the kernel, using
Code:
make buildkernel KERNCONFIG=MYKERNEL
it looks like it rebuilds everything or atleast seems to check the dependencies that this change might have affected. IS there a way to speeden things up a little?

Now one of the links above, i.e. this talks about speeding up the compile process by explicitly telling the make uitlity to only build those modules which have been 'tainted' in some way because of the new config file. But I do not know the modules that might need to be rebuilt yet I want the build process to figure it out itself. Is this what happens or am I asking for too much?

Looking to hear from you,

Regards,
Aijaz Baig.
 
aijazbaig1 said:
But when I compile the kernel, using
Code:
make buildkernel KERNCONFIG=MYKERNEL
it looks like it rebuilds everything or atleast seems to check the dependencies that this change might have affected. IS there a way to speeden things up a little?

I think the fastest way is to create a 2GB ram disk and mount that on /usr/obj. Of course you will lose everything when you reboot. But seriously, it only takes about 2 hours on my machine to do a full buildworld and several kernels.

Now one of the links above, i.e. this talks about speeding up the compile process by explicitly telling the make uitlity to only build those modules which have been 'tainted' in some way because of the new config file. But I do not know the modules that might need to be rebuilt yet I want the build process to figure it out itself. Is this what happens or am I asking for too much?
That'll work but you have to have built it at least once for this to work.
 
Well thanks for the very prompt reply sir!

Could you please elaborate on
"That'll work but you have to have built it at least once for this to work."

I guess I would try that once my new custom kernel is up and running (assuming it does run since I have been had problems running it previously!)

Regards,
Aijaz
 
The build process can tell which modules are tainted and would need a rebuild. Usually this works without problems. I've never used it though, just compiling the kernel only takes a few minutes. And if you run into problems you are advised to do a full kernel build anyway.
 
To avoid recompiling everything, use KERNFAST (e.g. "make buildkernel KERNCONF=MYKERNEL KERNFAST=1"). Note that this won't work if you have clean object directory - basically, if you have empty /usr/obj (after "make clean"), you first have to build the kernel without KERNFAST. After that, you can change code and compile it quickly using KERNFAST.
 
Nice addition to the build framework. :)

Haven't finished reading through Makefile.inc1 to see exactly what this does, but is it safe to assume it's roughly equivalent to (but safer than) "make -DNO_CLEAN -DNOCLEAN buildkernel"?
 
Hello everyone,

now That is some really nice info. Now that I have compiled the kernel I would definitely use the KERNFAST option to avoid waiting for those few mins :)

thanks everyone!
 
Back
Top