enabling cpu "features" in custom kernel

Alan Somers asomers at freebsd.org
Thu Jun 16 14:34:57 UTC 2016


On Thu, Jun 16, 2016 at 6:35 AM, Da Rock
<freebsd-hackers at herveybayaustralia.com.au> wrote:
> I'm just trying to get my head around kernel building and clang.
>
> If I want to enable certain features available on my cpu which are available
> by clang, how do I enable them? As I understand it using ccflags is a no no
> (ie /etc/make.conf), so how do I go about enabling them? I seem to be
> missing something in my research here...
>
> One thing I did consider was that there might be some "include" or "option"
> somewhere that I missed, but I still can't find it. There must be something
> in the mk files or such, and I'm guessing that its due to the ability to
> build the freebsd with various workarounds for different systems - but how
> would I get around that so I can try testing something out?
>
> Cheers

What features are you talking about?  Instruction set extensions like
AES-NI and AVX2 are already enabled in all the most important places.
If you want to enable them everywhere, you can add "-march=native" to
your CFLAGS.  You can set that in either /etc/make.conf or
/etc/src.conf.  The latter only affects the FreeBSD base system.  The
former also affects ports.  The problem with using "-march" is that
your builds no longer become portable.  You won't be able to run them
on any system older than the one where they were built.

-Alan


More information about the freebsd-hackers mailing list