compiling kernel for optimization [newbie question]

Started by
5 comments, last by zaidgs 19 years, 10 months ago
ok, i got redhat 9 if this would matter. i have two questions concerning compiling the kernel. the first one is: when redhat installs on my mashines does the setup automatically recompile kernel for better options, like compiling it for the processor type?? if not could\does\will any distribution automatically re-compile kernel?! the second is: when i type "make xconfig" (for first time), are the settings nessarily\usually are the ones the installed kernel is compiled. for example, when i typed "make xconfig", in the processors section, it says pentum II (the processor of mashing it is installed on), does this mean the the current kernel is already optimized for pentium II, or do i have to save then compile ?!?! [edited by - zaidgs on May 26, 2004 3:32:08 PM]
Advertisement
Ok, don''t take my statement as an insult to RedHat, but it is one of the most idiosyncratic distributions there are. They don''t stick to any standard convention in the Linux/Unix world.

However, they have the most vendor and software development support in the real world (though that usually means diddly, since most of the time it works on any Linux distribution or FreeBSD without changes -- just makes dealing drivers and software a bit easier).

With Rhat, you can probably pull it off by setting the right environment variables or passing the right values into your make commands, but I don''t know anyone who has done this, so you may be in for a tough run.

But yes, you can do this with RedHat, but its not going to be simple or direct. If you really want to optimize, I suggest you pick up FreeBSD 5.2.1 or Gentoo. Both have package and kernel support to use /etc/make.conf, which defines optimization and other compiler flags when building the kernel or software.

Both aren''t as new-user friendly as RHat, but they both have very good documentation that should be more than sufficient to get you up and running with a desktop. Gentoo recently started adding most of the big compile projects as semi-optimized packages on a seperate ISO, so its no long such a hassel to compile your entire desktop environment (use the packages for gnome or kde or fluxbox...or whatever you like).

To answer your second question, I do believe that the .config file in your /usr/src/linux directory for RedHat has the current kernel configuration from RHat, but I rarely work with Rhat anymore, so I can''t say for certain. Hopefully someone else can be more specific.

Interim




just to clear confusion, if any, in my first question
i am asking about during setup compilation,
redhat has the tool to recompile kernel,
but i am asking if the kernel installed immediately after
setup is already optimized, or if i need to use the tool
to do so.
(its not that i dont know how to do it with
the tool, i am just asking)


[edited by - zaidgs on May 26, 2004 4:29:48 PM]
No distribution I''ve used does an automatic kernel compile, though I think Gentoo does.

The settings you see in xconfig are independant of what you''re running. You have to set them up correctly to get a working kernel.

I suggest just running the default one until you''ve got enough of a foundation with linux to know how to recover from a bad kernel.
Gentoo comes with a script called genkernel which will compile a generic kernel for you with support for most hardware however you''re better off compiling your own if you like efficiency, and who doesn''t?

Compiling a kernel is really simple, if you read the help files for each option they normally state something along the lines of "If unsure press Y, otherwise press N" if you''re unsure as to whether or not you need it.

If you fuck up the kernel compilation on Gentoo then to fix it all you need to do is boot the LiveCD, chroot into the environment and reconfigure and recompile the kernel, adjusting the options which were causing you problems before.
Or you could just do what everyone else does and not overwrite the main kernel until you are sure the new one is stable, and keep a second (or eighth) grub entry.

Beats getting the LiveCD out everytime you build a bad kernel. In fact, 2.6''s make install will automatically create a vmlinuz.old symlink, as well as a vmlinuz symlink; grub.conf does not need to be updated after a kernel compile anymore. Just keep those two in grub.conf, as well as a known good (and non-symlinked) kernel.

If you really want to optimize, use Gentoo. Be forewarned: it''s rarely worth it. Most programs have little to no use for compiler optimizations and some, like OpenOffice and Mozilla, are so brittle that the CFLAGS are stripped before compiling. Gentoo is really good, but it''s not the compiler optimizations that make it good.
All genkernel does is copy the stuff to the target location when it''s done and configures your initial ram disk for you. Like all of Gentoo it''s not much different than doing it yourself, just easier.
genkernel all --install --menuconfig

The hard part about building your own kernel is getting all the options right. If you don''t know how a computer works at the low-level, don''t know what hardware your PC has, and the features the Linux kernel provides, it will be a frustrating process.

If you subscribe to Red Hat''s up2date service, and unmask the kernel update, it will update your kernel to one better optimized for your processor. It starts with a i386 kernel, so this is a very good idea. Without up2date you have to track down the rpm''s yourself.

The Red Hat kernel is a heavily patched and modified 2.4 based kernel than incorporates many of the advancements of the 2.6 kernel (essentially everything except the new IO subsystem and the uClinux integration). It''s nice to have these features, but it''s a very non-standard kernel. That''s why you will sometimes see non-RedHat kernel''s recommended by some products (WineX comes to mind).


The options that come up when you do make xconfig are anybody''s guess. Many kernels remember thier config under /proc/config (or /proc/config.gz), so you can load that with the config tool and see how your kernel is configured.
- The trade-off between price and quality does not exist in Japan. Rather, the idea that high quality brings on cost reduction is widely accepted.-- Tajima & Matsubara

This topic is closed to new replies.

Advertisement