# Fit the kernel for a specific machine



## piggy (Feb 25, 2011)

Not I complain about FreeBSD speed, I'm always totally satisfied about speed and everything, then I was wondering if compiling a new kernel, perfectly fit for single machines, could speed up boot process even more and better fit ram usage and generally speed things fast even more.

I mean: removing everything not related with the hardware configuration of every single machine, compiling just device drivers and system functions I'm surely to use per machines.

I did that in the past, many years ago mainly to integrate third party drivers and support for peripherals at the time not supported by the kernel, then I never tight the kernel down for my needs just for the fun to see if it can speed things up and maybe give me a gain in performance.

Do you guys think fit and tight the kernel for a specific machine is something worth the hassle to try it?


----------



## DutchDaemon (Feb 25, 2011)

In all honesty? No. Negligible gains. As a great learning experience, or to keep you 'in touch with your system'? Yes. I always strip my kernel to the bare essentials. Would I notice a difference when it was silently replaced with a GENERIC kernel and without me seeing the boot process? Highly unlikely.


----------



## qsecofr (Feb 25, 2011)

At the risk of maybe going off-topic: If one installed with the recommended size of 512MB for root partition and did require a custom kernel, then a smaller kernel might allow for rebuilding without filling the root partition in the process.


----------



## DutchDaemon (Feb 25, 2011)

I think the recommended size (for which I substitute the 'automatic' setting of sysinstall) was upped to 1 GB recently, probably because debug symbols were on by default in the GENERIC kernel configuration file.


----------



## wblock@ (Feb 26, 2011)

qsecofr said:
			
		

> At the risk of maybe going off-topic: If one installed with the recommended size of 512MB for root partition and did require a custom kernel, then a smaller kernel might allow for rebuilding without filling the root partition in the process.



All the modules are still built and saved in /boot/kernel/, so the only difference is that the kernel on disk may be smaller by a couple of meg.  /etc/src.conf can be used to disable certain modules, or nanobsd(8) can take that to embedded-style lengths.


----------



## Terry_Kennedy (Feb 26, 2011)

piggy said:
			
		

> Not I complain about FreeBSD speed, I'm always totally satisfied about speed and everything, then I was wondering if compiling a new kernel, perfectly fit for single machines, could speed up boot process even more and better fit ram usage and generally speed things fast even more.


Like DutchDaemon says, it is educational but not necessary for almost all systems. The only exceptions I can think of are if you're running in an embedded environment with limited memory or mass storage, or if you're trying to run a complete system from something like a Compact Flash card.

Back in the days when we ran Unix on non-virtual-memory machines with a maximum of 4MB RAM (like the PDP-11/70) it was necessary to remove as much as possible from a customized kernel in order to maximize the amount of memory available to user programs. Because of the need to fit into a machine of unknown memory size, the GENERIC kernels didn't include support for all possible devices. As I recall, if you had RK07 disks you were pretty much out-of-luck unless you could get another site to build a GENERIC kernel with RK07 support for you to boot from.

All of that is unnecessary these days - there is more than enough room for the GENERIC kernel in both memory and disk.

Since I have a number of non-default kernel config options and some site-specific kernel patches, when I configure my custom kernels I comment out almost all of the devices not actually present on my systems and any features I don't use. But the system would run just as well without doing that.


----------

