[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-newbie
Subject:    Re: Compiler flags, kernel-complie
From:       Steven Smith <sos22 () cam ! ac ! uk>
Date:       2003-05-31 21:22:57
[Download RAW message or body]

> > > 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.

[Attachment #3 (application/pgp-signature)]
-
To unsubscribe from this list: send the line "unsubscribe linux-newbie" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.linux-learn.org/faqs

[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic