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

kaz2100 02-13-2010 05:26 AM

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

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

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 09: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 09:20 AM

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

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

graysky1 08-18-2011 04:45 AM

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


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

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 07:05 AM.