Subject: Re: Kernel compilation issues - where am I going wrong?
To: Andrew Leach <>
From: Perry E. Metzger <>
List: tech-kern
Date: 02/18/2007 20:05:43
"Andrew Leach" <> writes:
> I'm new to NetBSD and have come from a Linux background where I've compiled
> the kernel many, many times.
> I appreciate that this process isn't an easy one at the best times but I'm
> having absolutely no success with NetBSD.

Compiling a kernel under NetBSD is very easy, actually. It is much
more difficult to do under Linux.

> cat /etc/mk.conf
> CFLAGS+=        -march=i686 -msse -mmmx -mfpmath=sse,387 -Os -pipe
> -ffast-math -finline-functions -fomit-frame-pointer

First off, remember that the kernel doesn't do any floating point in
the first place, so there is no reason to add any of the FP options
you have there to your mk.conf when building a kernel. Second, the
effect of things like -Os and -fomit-frame-pointer might have odd and
even bad effects. I'd start out by building by moving your mk.conf to
the side. (You might, in general, want to avoid fiddling with
optimization until you know what you're doing...)

> ./ -O ../obj -T ../tools -U -u tools

You don't need to rebuild the tools if you are running the kernel
build on NetBSD 4 and are building a NetBSD 4 kernel for the same

Just go into /usr/src/sys/arch/i386, type "config GENERIC", then
"cd ../compile/GENERIC", then type "make depend && make"