Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[FAQF] KC14: Kernel compiling, CFLAGS and make.conf settings
View unanswered posts
View posts from last 24 hours

Goto page 1, 2  Next  
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Mon Dec 02, 2002 11:44 pm    Post subject: [FAQF] KC14: Kernel compiling, CFLAGS and make.conf settings Reply with quote

Thanks, int1.

If the Gentoo developers wanted to make the make.conf CFLAGS apply to the kernel as well, they could rather easily (lostlogic patches the kernel fairly heavily as it is :)). So I don't think it's really the distribution indpendence that's the reason the kernel CFLAGS are kept separate. I think it's simply the fact that the kernel has its own set of rather demanding restrictions and opinions about which flags it should be compiled with, that are independent of the choices made at the application level. I could certainly be wrong on this point, however.

It's also not necessary to edit Makefiles at all to change kernel CFLAGS, although that is one way to do it. Another way is to define the CFLAGS_KERNEL envariable when you compile.
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
int1
Tux's lil' helper
Tux's lil' helper


Joined: 08 Nov 2002
Posts: 139

PostPosted: Mon Dec 02, 2002 11:50 pm    Post subject: Reply with quote

Didn't know that one. Thanks for the tip!

int1

PS> I can rewrite this with your tip if you'd like.
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Mon Dec 02, 2002 11:59 pm    Post subject: Reply with quote

int1 wrote:
PS> I can rewrite this with your tip if you'd like.

Any time you'd like. If you'd prefer to wait some time for more feedback here, that's OK, too.
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
zypher
Retired Dev
Retired Dev


Joined: 10 Jun 2002
Posts: 416
Location: Cologne, ger.

PostPosted: Fri Dec 06, 2002 6:56 am    Post subject: Reply with quote

BTW: My kernel compilation warns about -malign-functions is obsolete and you should use -falign-functions (on 2.3.18-wolk3.8, which really should be in portage one day...).
Does this mean the function is translated to -falign-functions or is it discarded?
I'll change the Makefile and try it again anyway, just curious.
_________________
linux user 65882
Back to top
View user's profile Send private message
ebrostig
Bodhisattva
Bodhisattva


Joined: 20 Jul 2002
Posts: 3152
Location: Orlando, Fl

PostPosted: Sat Dec 07, 2002 1:30 am    Post subject: Reply with quote

zypher wrote:
BTW: My kernel compilation warns about -malign-functions is obsolete and you should use -falign-functions (on 2.3.18-wolk3.8, which really should be in portage one day...).
Does this mean the function is translated to -falign-functions or is it discarded?
I'll change the Makefile and try it again anyway, just curious.


2.3.18 wow! That is old! LOL

The reason is that the compiler flags changed with the gcc 3.x release and the old 2.3.x series of the kernel is not updated to be aware of this fact. besides, the 2.3.x series was the development series for 2.4.x and should not be used anymore.

Why such an old kernel?

Erik
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Sat Dec 07, 2002 7:14 am    Post subject: Reply with quote

I think it's a typo of 2.4.18. -malign-functions changed names to -falign-functions somewhere between GCC 2.95 and 3.2.
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
Zu`
l33t
l33t


Joined: 26 May 2002
Posts: 716
Location: BE

PostPosted: Mon Dec 09, 2002 8:46 pm    Post subject: Reply with quote

This is interesting, but I wonder if it's worth it ? Especially since the configuration of your kernel (.config) will specify the arch. (-march=athlon in my case, while I compile everthing else with -march=athlon-xp.)

So what's useable? -O3 ? -fomit-frame-pointer ?

Are there any real advantages of compiling the kernel with modified CFLAGS? I.e. noticeable speed increase, or other .. ?

For the ones who have tested this, is it worth bothering with ?

Thanks.
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Mon Dec 09, 2002 9:25 pm    Post subject: Reply with quote

Oh, yeah. Thanks, Zu'. Thanks for reminding me. There should probably also be something in here about the GCC3 patch in recent gentoo-sources, which adds "gcc 3+" options to the processor types config option. That allows another way to change -march. And, just to make sure things are clear, Zu', the point of this FAQ is not to encourage people to mess around with kernel CFLAGS, it's just that there have been several people that got confused by the fact that the kernel is not compiled with the CFLAGS in make.conf. They assumed that the kernel is just like any other software being compiled by portage, but it's not. This confusion has made some kernel compilation threads get confusing, when people start asking about and changing CFLAGS when it doesn't have any effect. That's why this FAQ entry was born.
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
Zu`
l33t
l33t


Joined: 26 May 2002
Posts: 716
Location: BE

PostPosted: Mon Dec 09, 2002 10:36 pm    Post subject: Reply with quote

Thanks for clarifying rac.

I'm using vanilla-sources and I wasn't aware of that patch in the gentoo-sources. I'll have a look at it. I wonder if it just sets the -march or 'forces' even more optimalisation.

About the FAQ, yes I see how it's meant to be used. Still, It'd be interesting to hear from people who have modified their kernel CFLAGS. Nevertheless, this isn't necessarily the right place to discuss this, we better keep FAQ's somewhat clean :)

Regards,

zu
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Mon Dec 09, 2002 10:49 pm    Post subject: Reply with quote

Zu` wrote:
I wonder if it just sets the -march or 'forces' even more optimalisation.
AFAIK, it just sets -march.
Quote:
Nevertheless, this isn't necessarily the right place to discuss this, we better keep FAQ's somewhat clean :)
Don't worry about that. This is a fine place for feedback on this issue. In the end, int1 (or somebody who takes over as maintainer) will just keep editing the first post in this thread, and eventually that first post will be split into its own thread in the FAQ forum. The rest of this discussion will stay here or go somewhere else, but it won't clutter up the eventual FAQ answer.
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
int1
Tux's lil' helper
Tux's lil' helper


Joined: 08 Nov 2002
Posts: 139

PostPosted: Sat Dec 14, 2002 1:29 am    Post subject: Reply with quote

Zu` wrote:
So what's useable? -O3 ? -fomit-frame-pointer ?


The above options I use as an example are my real kernel compile options, so both work plus some others.

PS> I updated the FAQ....

Thanks to all for comments!
int1
Back to top
View user's profile Send private message
int1
Tux's lil' helper
Tux's lil' helper


Joined: 08 Nov 2002
Posts: 139

PostPosted: Sat Jan 25, 2003 6:51 pm    Post subject: Reply with quote

Noticed this still isn't linked in the FAQ. Any specific reason?

int1
Back to top
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Sat Jan 25, 2003 6:56 pm    Post subject: Reply with quote

int1 wrote:
Noticed this still isn't linked in the FAQ. Any specific reason?
Sorry about that. I'll get to it right now.
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
cazze
Apprentice
Apprentice


Joined: 26 Mar 2003
Posts: 155
Location: Brussels - Belgium

PostPosted: Wed Mar 26, 2003 10:33 pm    Post subject: Reply with quote

Hi,

i tried to add -march=i586 for my c3 ezra processor in the Makefile, but with the compile, i got -march=i586 (the one i added) AND -march=i486.

i think it's important to say that if you change something like -march in your Makefile, you have to edit your .config file and deselect all the possible processors.

you can see wich flags are added for your processor in arch/i386(in my case)/Makefile

Hope this will help

kammicazze
Back to top
View user's profile Send private message
bushwacker
n00b
n00b


Joined: 22 Feb 2004
Posts: 37
Location: Tacoma, WA

PostPosted: Sun May 09, 2004 4:00 am    Post subject: Reply with quote

is this information safe to use with the 2.6.x kernel line? I'd like to optimize my kernel a bit, but I dont want to do anything crazy until I know if/what settings can be applied. I have an Athlon XP CPU, so I"d like to use (if possible):
Code:
-03 -march=athlon-xp -pipe -formit-frame-pointer -funroll-loops


I have other options enabled in /etc/make.conf for general apps, most notably -mmmx, -m3dnow, and -msse. Could these safely be added as well?

Thanks.
_________________
Give me $, you insensitive clod!
Back to top
View user's profile Send private message
wdreinhart
Guru
Guru


Joined: 11 Jun 2003
Posts: 569
Location: 4QFJ12345678

PostPosted: Sun May 09, 2004 4:54 am    Post subject: Reply with quote

-mmmx -msse and -m3dnow are implied by -march=athlon-xp. You don't really need them anywhere.
Back to top
View user's profile Send private message
bushwacker
n00b
n00b


Joined: 22 Feb 2004
Posts: 37
Location: Tacoma, WA

PostPosted: Sun May 09, 2004 10:17 pm    Post subject: Reply with quote

right now I'm recompiling some KDE Arts library stuff (kde startup segfault, various apps not running because of missing libs, etc), and its taking *much* longer than it did originally. Is -march=xxxx known to take a lot longer than -mcpu=xxxx to operate?
_________________
Give me $, you insensitive clod!
Back to top
View user's profile Send private message
bushwacker
n00b
n00b


Joined: 22 Feb 2004
Posts: 37
Location: Tacoma, WA

PostPosted: Sat May 15, 2004 12:09 am    Post subject: Reply with quote

applying KERNEL_CFLAGS could be done by putting the following in /etc/make.conf, right?

KERNEL_CFLAGS="MY_COMPILE_PARAMETERS_HERE"

It seems to be going ok, but the new kernel 2.6.x build script doesn't show you the compilation data like the older kernels always did. Is there a way to show this info, too, BTW?

Thanks.
_________________
Give me $, you insensitive clod!
Back to top
View user's profile Send private message
Master_Of_Disaster
l33t
l33t


Joined: 28 Feb 2003
Posts: 610
Location: 15.05072° East, 48.13747° North (aka Mauer), Austria

PostPosted: Sat May 15, 2004 12:18 am    Post subject: Reply with quote

bushwacker wrote:
It seems to be going ok, but the new kernel 2.6.x build script doesn't show you the compilation data like the older kernels always did. Is there a way to show this info, too, BTW?

make V=1
_________________
post tenebras lux, post fenestras tux
Registered Linux User Nr. 312509
Adopt an unanswered post today!
Back to top
View user's profile Send private message
phreaqy
n00b
n00b


Joined: 03 May 2004
Posts: 16
Location: Canada

PostPosted: Mon May 17, 2004 2:49 pm    Post subject: Reply with quote

Nobody seem to post if the kernel CFLAGS actually have a speed increase, so has anybody that tried this noticed a speed increase?
_________________
AMD TBIRD 1.33
256 mb RAM
kenel 2.6.7-love2
Soundblaster 16 PCI
Nvidia GeForce 3 Ti
Back to top
View user's profile Send private message
bushwacker
n00b
n00b


Joined: 22 Feb 2004
Posts: 37
Location: Tacoma, WA

PostPosted: Tue May 18, 2004 6:02 pm    Post subject: Reply with quote

The kernel seems to perform a bit better in terms of task switching/vm/cpu time/etc. I'm not sure if this is just because it's the 2.6x kernel as opposed to the 2.4 though. There seems to be a larger performance boost between stock 2.4 and stock 2.6 than between stock 2.6 and optimized 2.6 kernels.
_________________
Give me $, you insensitive clod!
Back to top
View user's profile Send private message
phreaqy
n00b
n00b


Joined: 03 May 2004
Posts: 16
Location: Canada

PostPosted: Tue May 18, 2004 11:19 pm    Post subject: Reply with quote

Thanks Man :o
_________________
AMD TBIRD 1.33
256 mb RAM
kenel 2.6.7-love2
Soundblaster 16 PCI
Nvidia GeForce 3 Ti
Back to top
View user's profile Send private message
bushwacker
n00b
n00b


Joined: 22 Feb 2004
Posts: 37
Location: Tacoma, WA

PostPosted: Wed May 19, 2004 5:28 am    Post subject: Reply with quote

NP. Let me know if you notice any positive results w/ this.
_________________
Give me $, you insensitive clod!
Back to top
View user's profile Send private message
dj_farid
l33t
l33t


Joined: 14 Jun 2004
Posts: 613

PostPosted: Tue Aug 10, 2004 10:44 pm    Post subject: Reply with quote

Any results? 8)
Back to top
View user's profile Send private message
DRZIN
Tux's lil' helper
Tux's lil' helper


Joined: 15 Feb 2006
Posts: 114

PostPosted: Sun Apr 30, 2006 7:48 am    Post subject: how to edit the make.conf Reply with quote

i belive all my issue that have been having is becouse my make.conf is not set up right please help!
what is differentes between menuconfig and make.conf
_________________
AUDIO ENEGINEERING and trying to take over the world with Techno
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum