# Freebsd AMD64 Kernel Configuration



## eric (Apr 11, 2010)

I just registered into Freebsd forum, in order to get expereince and communicate with senior freebsd users and experts. I have been starting to use freebsd (amd64) instead of i386 for more than 3 months, but I curious about the kernel optimization, what I know about kernel optimizations are all about i386 structure, I am wondering if there is an instruction existing. Right now I just disabled unused hardware entries in kernel file and rebuild. Can someone help me?
thanks


----------



## Werner (Apr 13, 2010)

Hi there,

I didn't answer yet, 'cause I thought maybe someone else hat something to say 

Well yesterday I did my first try to create a kernel without any modules...it ran...but PPP/PPPoE didn't work anymore. Yah, I forgot to build-in. but later I realized that I wasn't able to build it in. If I use _options ppp_ or _device ppp_ it won't work. After some time using Google, I read something about _pseudo-device_ but this directive also didn't work. Due to the fact that I didn't found this directive in LINT kernel configuration, I guess it's not in use any longer (if I err please submit reply  ).

But that's not the topic.
First of all I did the same like you. I commented all (for my system) useless lines in GENERIC out (and added some too, 'cause for example _device pf_ or _options ALTQ_ is typically no part of GENERIC kernel configuration, but I need them for pf firewall). 
Then I use `# kldstat` to get a list with all modules loaded and started to add them directly to the kernel or use directive _makeoptions MODULES_OVERRIDE=" "_ to build ONLY modules I specified here.
If you want a kernel configuration with all possible directives in, have a look for `# make LINT` in FreeBSD handbook or google. I for my share didn't use LINT yet, 'cause all comments are cut off :/ and I don't want to google for more then 800 directives (or search for them in NOTES files everywhere).

In my make.conf I specified _CPUTYPE=noncona_ only (Yes, I removed the question mark after CPUTYPE, because I don't ever want to use this kernel on another machine than this one). There is no need for setting any _CFLAGS_, or else 'cause FreeBSD already set optimal build settings in Makefile or most ports and would override your own settings anyway.

Best Regards


----------



## Bunyan (Apr 13, 2010)

eric said:
			
		

> <...> curious about the kernel optimization, <...> I am wondering if there is an instruction existing. <...> Can someone help me?
> thanks


*cp /usr/share/examples/etc/make.conf /etc*

```
#   AMD64 architecture: opteron, athlon64, nocona, prescott, core2
```


```
CPUTYPE?=[your ARCH here]
```


----------



## SirDice (Apr 13, 2010)

@werner, LINT is already done.

Common options/devices for all architectures:
/usr/src/sys/conf/NOTES

Architecture specific options/devices:
/usr/src/sys/<architecture>/conf/NOTES


----------



## chavez243ca (Apr 14, 2010)

Anymore, I rarely see much point in customizing one's kernel.


----------



## oliverh (Apr 14, 2010)

>I rarely see much point in customizing one's kernel.

1.) different options only available while compiling a new kernel
2.) a slim kernel (e.g. for embedded systems, routers etc. pp.)
3.) to solve problems

Points I see once in a while especially while dealing with FreeBSD.


----------



## rihad (Sep 3, 2010)

Hello, guys,

Our CPU is identified as

```
CPU: Intel(R) Xeon(R) CPU           X5650  @ 2.67GHz (2660.01-MHz K8-class CPU)
```

Which CPUTYPE would be the optimal choice for that?

```
#   AMD64 architecture: opteron, athlon64, nocona, prescott, core2
```

TIA


----------



## User23 (Sep 3, 2010)

"core2" builds with "march=nocona" under AMD64. This make option will "only" affect the build of libcrypto and libz, to use the sse3 feature. dunno if it is possible too, to use the SSE4.2 feature your cpu has builtin.

You may also want to build 
	
	



```
device coretemp
```
 for Intel CPUs into your kernel.


----------



## rihad (Sep 3, 2010)

User23 said:
			
		

> "core2" builds with "march=nocona" under AMD64. This make option will "only" affect the build of libcrypto and libz, to use the sse3 feature. dunno if it is possible too, to use the SSE4.2 feature your cpu has builtin.


I already set nocona after some reading of "man gcc" without waiting for replies to this thread. I believe CPUTYPE=core2 is treated specially by FreeBSD (and not simply passed on to gcc) because it isn't listed as one of the -mcpu types in the manpage. Did I miss anything?



> You may also want to build
> 
> 
> 
> ...


I can guess what it does, I guess I'll try this some time.


----------



## User23 (Sep 3, 2010)

rihad said:
			
		

> I already set nocona after some reading of "man gcc" without waiting for replies to this thread. I believe CPUTYPE=core2 is treated specially by FreeBSD (and not simply passed on to gcc) because it isn't listed as one of the -mcpu types in the manpage. Did I miss anything?



"nocona" is correct for your environment. With "core2" it will link to "prescott" if you build FreeBSD i386 and will link to "nocona" if you build FreeBSD AMD64. 



			
				rihad said:
			
		

> I can guess what it does, I guess I'll try this some time.



I monitor the temperatures of at least on core per DIE because mostly it is impossible to monitor the CPU fans.


----------



## rihad (Sep 3, 2010)

User23, I've just rebuilt the kernel w/ CPUTYPE=nocona and rebooted successfully. All is nice, thank you.


----------

