LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (http://www.linuxquestions.org/questions/debian-26/)
-   -   The way to compile kernel with -mtune=native (or -march=native) (http://www.linuxquestions.org/questions/debian-26/the-way-to-compile-kernel-with-mtune%3Dnative-or-march%3Dnative-788865/)

kaz2100 02-13-2010 04:26 AM

The way to compile kernel with -mtune=native (or -march=native)
 
Hya,

I am looking for the way to compile kernel with -mtune=native.

For one of my Debian with atom N270, I would like to use full cpu potential.

As suggested by several other threads, (1, gentoo wiki I think (hope) it works.

So far, I have done
Code:

make menuconfig
export KCFLAGS="-O2 -mtune=native -pipe"
export KPPCFLAGS="-O2 -mtune=native -pipe"
make all

It seems good. However I am not quite sure if this really overrides processor selection in menuconfig.


Am I correct?

Any input will be appreciated.

Happy Penguins!

ozanbaba 02-13-2010 08:03 AM

you are somehow correct,

you are just overriding the c flags for kernel (well adding additional flags to compiler is the right one. i think gcc will use already defined flags, and flags you defined sanely. it's the experience from the other places. however over optimization is not good to think to do. it tent to destabilize the program).


-O2 is pretty safe flag to use. it's the one used by default anyway. -mtune=native should be safe anyway.

ozanbaba 02-13-2010 08:20 AM

i forgot to say that you do not hove to do export the flag variables. just use this
Code:

KCFLAGS="-O2 -mtune=native -pipe" KCPPFLAGS="-O2 -mtune=native -pipe" make all
all of them at the same line

graysky1 08-18-2011 03:45 AM

Very interesting discussion. Shouldn't you substitute "march" for "mtune" though?

Code:

KCFLAGS="-march=native -O2 -pipe" KCPPFLAGS="-march=native -O2 -pipe" make all
Per the gcc manpage:
Quote:

march=cpu-type
Generate instructions for the machine type cpu-type. The choices for cpu-type are the same as for -mtune. Moreover, specifying -march=cpu-type implies -mtune=cpu-type.


All times are GMT -5. The time now is 01:28 AM.