Solved [Solved] make.conf - build kernel question

Hello everyone,

I added the following lines of code in my /etc.make.conf file but I am not sure that the CPUTYPE? is correct.
Code:
CPUTYPE?=core2

CFLAGS= -O3 -pipe -funroll-loops
COPTFLAGS= -O2 -pipe -funroll-loops

NO_PROFILE=true

BUILD_OPTIMIZED=YES
BUILD_STATIC=YES
WITHOUT_DEBUG=YES

#turn off graphic for server
WITHOUT_X11=YES
WITHOUT_FONTCONFIG=YES

My understanding is that 'core2' is for i386 and my CPU is AMD 64.
dmesg | grep -i cpu
Code:
CPU: AMD Athlon(tm) II Neo N36L Dual-Core Processor (1297.87-MHz K8-class CPU)
FreeBSD/SMP: Multiprocessor System Detected: 2 CPUs
 cpu0 (BSP): APIC ID:  0
 cpu1 (AP): APIC ID:  1
cpu0: <ACPI CPU> on acpi0
cpu1: <ACPI CPU> on acpi0
amdtemp0: <AMD CPU On-Die Thermal Sensors> on hostb4
acpi_throttle0: <ACPI CPU Throttling> on cpu0
hwpstate0: <Cool`n'Quiet 2.0> on cpu0
Netvsc initializing... SMP: AP CPU #1 Launched!

Could anyone help please

Thank you
Fred
 
Re: make.conf - build kernel question

fred974 said:
Code:
CFLAGS= -O3 -pipe -funroll-loops
COPTFLAGS= -O2 -pipe -funroll-loops
Remove these. They're not going to improve anything and may even break things. The OS and ports already use the most optimal compiler options. Setting them specifically by hand negates that.
 
Re: make.conf - build kernel question

Well, the solution is really easy (but also very easy to overlook). Start by looking into the make.conf(5) manual page and you'll find a reference to /usr/share/examples/etc/make.conf. Here all is explained:

Code:
# Currently the following CPU types are recognized:
#   Intel x86 architecture:
#       (AMD CPUs)      opteron-sse3 opteron athlon64-sse3 athlon64 athlon-mp
#                       athlon-xp athlon-4 athlon-tbird athlon k8-sse3 k8
#                       geode k6-3 k6-2 k6 k5
#       (Intel CPUs)    core2 core nocona pentium4m pentium4 prescott
#                       pentium3m pentium3 pentium-m pentium2
#                       pentiumpro pentium-mmx pentium i486 i386
#       (Via CPUs)      c3 c3-2
#   AMD64 architecture: opteron, athlon64, nocona, prescott, core2
#   Intel ia64 architecture: itanium2, itanium
#   SPARC-V9 architecture:      v9 (generic 64-bit V9), ultrasparc (default
#                               if omitted), ultrasparc3
#
# (?= allows to buildworld for a different CPUTYPE.)
 
Re: make.conf - build kernel question

@SirDice, Thank you for stopping me breaking my system :)
I looked at the reference to /usr/share/examples/etc/make.conf and my understanding is that I sould be using
Code:
CPUTYPE?=athlon64
Am I right here?
Thank you
 
Last edited by a moderator:
Re: make.conf - build kernel question

Use CPUTYPE?=native. I.e. let the compiler figure it out. It will automagically to the right thing (excerpt from gcc()'s man page):

Using -march=native will enable all instruction subsets supported by
the local machine (hence the result might not run on different machines).
 
fred974 said:
In
Code:
CPUTYPE?=native
is the ? need to be removed?
No. What ?= basically does is set the variable if it hasn't been set previously. A = would set the variable regardless of its current value. Using it prevents you from accidentally overriding something that has already been set through other means. It works more or less like this pseudo-code:
Code:
if exists(CPUTYPE) then
{
  do nothing
} else {
  set CPUTYPE = native
}
 
Back
Top