GENERIC kernel configuraion
Paul Schenkeveld
freebsd at psconsult.nl
Tue Oct 30 14:50:35 UTC 2012
On Tue, Oct 30, 2012 at 07:05:41AM -0700, Jack Mc Lauren wrote:
> Hello
>
> Does customizing (commenting unused devices in GENERIC) kernel in /usr/src/amd64/conf cause nanobsd image get lighter ??
Here are two amd64 NanoBSD kernels I've archived:
# ls -ls kernel1 kernel2
15 -r-xr-xr-x 1 root wheel 15572950 Apr 9 2012 kernel1
7 -r-xr-xr-x 1 root wheel 6921921 Jul 25 11:27 kernel1
# size kernel1 kernel2
text data bss dec hex filename
12011364 1331748 1137248 14480360 dcf3e8 kernel1
5155629 513459 637256 6306344 603a28 kernel2
The first one is FreeBSD 9.0, the second one FreeBSD 8.3 but 9.0 is not
twice as big as 8.3. So yes, trimming /usr/src/amd64/conf can make a
big difference!
If memory is your constraint, trim the kernel as much as possible, don't
forget to strip things like SCTP, NFS*, INET6, MAC etc. if you don't
need them and leave "makeoptions DEBUG=-g" out too.
If it's the size of your flash image you worry about, put in a line like
makeoptions MODULES_OVERRIDE=""
to not build/install kernel modules or include only those that you really
need. /boot/kernel takes almost 50% of the space in a NanoBSD image with
a generic kernel and all modules built.
Another thing that can save a lot of space on your flash image is tuning
CONF_WORLD, CONF_BUILD and CONF_INSTALL (see src/tools/build/options/ for
an explanation of each option). This may take several iterations before
you get it right though because sometimes it's not immediately visible
which options are required by other ones (eg. if you build with INET6
enabled, you appear to need KVM and KVM_SUPPORT too).
HTH
Paul Schenkeveld
More information about the freebsd-embedded
mailing list