Learning about Control of Optimization -- for dummies please

Roland Smith rsmith at xs4all.nl
Wed Aug 5 13:36:58 UTC 2009


On Wed, Aug 05, 2009 at 02:02:05PM +0100, David Southwell wrote:
> > >Additionally, compiler settings for building the kernel can be set with
> > >COPTFLAGS in /etc/make.conf. Using anything other than -O or -O2 is
> > >not guaranteed to work. If you don't know what you are doing, do not use
> > >COPTFLAGS and stick with the defaults that the build system generates.
> >
> >      Right.  -O3 might royally screw a kernel in particular. :-)
> >
> >
> >                                   Scott Bennett, Comm. ASMELG, CFIAG
> Thanks for add more useful info however would you mind elaborating a little 
> more because I do not understand the implications.
> 
> should I have:
> CPUTYPE=nocona 
> in make.conf?

Yes.

> Do I need anything else in make.conf?

If you are building a custom kernel, you can set the name of the kernel
config there. E.g.:

KERNCONF=FOO

You should then put your kernel config in /usr/src/sys/amd64/conf/FOO.

> So far my draft make.conf has these entries:
> 
> CPUTYPE=nocona

OK.

> CFLAGS= -O2 -fno-strict-aliasing -pipe

CFLAGS are used for building userland programs. COPTFLAGS are used for building
the kernel. I think that the values you've listed here are already the
default, so they are superfluous really.

> FORCE_MAKE_JOBS=        true

This is only for ports.

> Incidentally I am also puzzled because it appears necessary to use amd64 
> GENERIC as my starting point when the cpu is actually Intel Quad Core!! 

This is a FAQ. AMD originated the 64-bit extensions to the x86
architecture while intel was chasing the itanium pipedream. This
extended architecture became known as x86_64 or amd64. After itanium
became a dud, intel started making amd64 compatible chips as well,
because the AMD chips had been hugely successfull.

> I presume this means that in drafting a kernconf I need to refer to;
> 
> dns1# pwd
> /usr/src/sys/amd64/conf
> dns1# ls -l
> total 44
> -rw-r--r--  1 root  wheel     13 Jun 20  2005 .cvsignore
> -rw-r--r--  1 root  wheel    482 Apr 15 04:14 DEFAULTS

Some options were moved to a DEFAULT file that is automatically included
in every kernel, so that people can't forget them. Formetting one of
those can result in an unusable kernel.

> -rw-r--r--  1 root  wheel  11968 Apr 15 04:14 GENERIC
> -rw-r--r--  1 root  wheel    818 Apr 15 04:14 GENERIC.hints
> -rw-r--r--  1 root  wheel   1036 Apr 15 04:14 MAC
> -rw-r--r--  1 root  wheel    132 Apr 15 04:14 Makefile
> -rw-r--r--  1 root  wheel  20721 Apr 15 04:14 NOTES

NOTES contains extra options that aren't in the GENERIC kernel.

> It would be great if some logical consistency could be introduced into naming 
> conventions!!! It would really help those of us who know little and make it a 
> trifle easier to climb the greasy pole of knowledge <chuckles>

Just look at the beginning of each file. You'll find a description of
that files purpose.

You should base you kernel configuration on the GENERIC kernel. The
first thing you need to do is change the "ident" line to match the
filename. A kernel config FOO should include "ident FOO". Then remove
devices and options that you don't need. If you don't know what a device
or option is, leave it in. For devices, there is usually a manual
page. E.g. if you see 'device em', you can get information about it with
'man em'.

Look at the dmesg(8) output to see which devices you actually have.

Roland
-- 
R.F.Smith                                   http://www.xs4all.nl/~rsmith/
[plain text _non-HTML_ PGP/GnuPG encrypted/signed email much appreciated]
pgp: 1A2B 477F 9970 BA3C 2914  B7CE 1277 EFB0 C321 A725 (KeyID: C321A725)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
Url : http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20090805/f6a15269/attachment.pgp


More information about the freebsd-questions mailing list