Skip to contentSkip to conversation

Compiler flags, kernel-complie

DISCUSSION Flemming Greve Skovengaard 3 participants 5 messages May 31, 2003

lore
Share & tools
lore
#1 lore raw
Quoted 5 lines

I have set the enviroment variables $CFLAGS and $CXXFLAGS to:

-O2 -march=athlon-xp

Now my question is will this effect my kernel-compile?

Shouldn't do; the kernel doesn't normally inherit CFLAGS and friends from the environment. The correct way to do this is through the ``Processor type'' part of make {x,menu}config.

#2 lore raw
Quoted 9 lines · Steven Smith
Quoted 5 lines

I have set the enviroment variables $CFLAGS and $CXXFLAGS to:

-O2 -march=athlon-xp

Now my question is will this effect my kernel-compile?

Shouldn't do; the kernel doesn't normally inherit CFLAGS and friends from the environment. The correct way to do this is through the ``Processor type'' part of make {x,menu}config.

Well it seems like that $CFLAGS is overwriten in '/usr/src/linux/Makefiles' og exported. But when I compile kernel it compiles with '-march=athlon', how do I change this?

-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

#3 lore raw
Quoted 10 lines
Quoted 6 lines
Quoted 3 lines

I have set the enviroment variables $CFLAGS and $CXXFLAGS to:
-O2 -march=athlon-xp
Now my question is will this effect my kernel-compile?

Shouldn't do; the kernel doesn't normally inherit CFLAGS and friends from the environment. The correct way to do this is through the ``Processor type'' part of make {x,menu}config.

Well it seems like that $CFLAGS is overwriten in '/usr/src/linux/Makefiles' og exported.
But when I compile kernel it compiles with '-march=athlon', how do I change this?

The first thing to point is that you probably don't want to: some compiler flags (e.g. -O3) are known to create broken and buggy kernels, which is why there's no nice way of setting it.

Having said that, if you want to live dangerously, the trick would be to turn the fragment

ifdef CONFIG_K7
CFLAGS += $(shell if $(CC) ... fi)
endif

into

ifdef CONFIG_K7
CFLAGS += -march=athlon-xp
endif

in arch/i386/Makefile. Of course, that'll change it to -march=athlon-xp even if you select plain Athlon in the kernel config, but adding a new menu item is a relative pain. If it really bothers you, have a look in arch/i386/config.in.

Changing the CFLAGS like this will result in a completely unsupported kernel, though, and one which could well be a little unstable. Do it at your own risk. I haven't even tested that the resulting thing compiles, let alone works.

Steven.

#4 lore raw
In reply to Flemming Greve Skovengaard
Quoted 1 line · Flemming Greve Skovengaard

I have set the enviroment variables $CFLAGS and $CXXFLAGS to:

Why bother, if one chooses the correct processor type during configuration of the kernel with make config / xconfig / menuconfig then changing the Topdir Makefile would NOT be nessasary, (afaik) that is.

Quoted 3 lines

-O2 -march=athlon-xp

Now my question is will this effect my kernel-compile?

When you define a processor type during configuration then the variable's get changes accordingly.

Signature · 11 lines
Regards Richard
[email protected]
http://people.zeelandnet.nl/pa3gcu/



-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs