LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 06-21-2007, 10:39 AM   #1
Punkie
LQ Newbie
 
Registered: Apr 2003
Location: Montreal, Canada
Distribution: CLFS 1.0.0
Posts: 24

Rep: Reputation: 15
Kernel configuration - How to make your choices?


I recently changed my laptop with a newer model due to the extended warranty from the shop I bought it. I installed Cross-compiled Linux From Scratch (see CLFS), which is a set of instructions on how to build your own "distribution" of Linux from source code. My choice was made because I wanted a bare-minimum OS on which I can learn all programs and choices as I go along. That is not to say I did not try many other distributions (Ubuntu, Knoppix, SuSe are the latest I tried).

This means I have to install all packages myself and configure it all myself.

So, as always, I come to the most dreaded part of this: configuring the kernel. I dread this, because I find the help file grossly outdated, as well as the documentation that comes with it. Turning to the web search engines means reading a lot of guides along the lines:
"How to compile the kernel? It's simple!
Code:
make menuconfig
select your choices here. To help you decide your choices, use lspci
Code:
make
make modules_install
copy the new kernel and boot it! Tadaam!"

Nothing simpler, right? Well, of course it’s simple when you skip over the most complicated part, namely configuring the kernel.

So I keep asking this question to everyone and everyone refers me to the documentation, but nobody can tell me how they decide on what features to add.

How do you decide what features go in the kernel? Help me fill in the blanks here.

To make it simple, I decided to divide the kernel’s configuration in several steps:
  • Machine architecture, processor and memory related choices.
  • Power Management (for laptops, this is crucial).
  • Motherboard related features which further sub-divide into:
    • PCI / PCI-E.
    • Networking devices (wired and wireless).
    • IDE / SATA / RAID controllers and the attached hard drives.
    • Serial/Parallel/USB/FireWire ports.
  • Peripherals * :
    • Mouse.
    • Keyboard.
    • CD-ROM/RW or DVD-ROM/RW.
    • SD/MMC readers.
    • Video.
    • Sound.
    • Other, less important and not absolutely necessary devices which would be nice to see working.
  • Non-hardware related choices (example: file systems, udev, pty, networking protocols, etc.).

Since the big majority of laptops I have seen contain PC-style hardware, I am only referring to them in my division.

lspci -vv tells you a lot of information, but for the beginner, this might as well be in another language. What, other than the possible model of a device, can this program tell you to help configure your machine correctly?

For laptops, lspci is even more cryptic : many times the devices are called "<Brand name> networking device". In the case of my laptop, I tried to refer to the manufacturer’s website, where I was unpleasantly surprised to find similar hardware description: “Integrated 10/100 network card.” Additionally, the hardware included in the laptops is often “stripped” of features that would benefit any OS, since they are always targeted for one specific OS. For example the DSDT code in the BIOS is often buggy and left that way because the Windows version installed on that laptop model manages just fine.

So, let’s go back to the kernel configuration. I took the latest stable kernel at the moment, 2.6.21.5.

The following questions may seem dumb to you, but I sometimes feel my logic is not the same as everyone else’s around me, so bear with me and answer if and what you can. I don’t expect anyone to answer all my questions, feel free to post with what you know.

The first choice I have to make is about the machine I will compile the kernel for. I have an AMD Turion 64 X2 processor. Is that a PC-compatible architecture or EM64T-based one? How do I find out what choice is best for me?

The processor style is somewhat easy to decide: AMD Athlon 64, because there’s no other AMD choice.

Is this an SMP (multi-processor) machine? Since my CPU is dual-core, logic dictates that it is. But is that right? How can I make sure? I know from previous experiences that compiling the kernel as an SMP on a single CPU machine will work, but I never had the certitude that my choice was the best one, in terms of performance. Besides, SMP used to disable most power management features.

Type of memory? Flat? Sparse? Discontiguos? What do they mean and which is best for me?

I disabled the CPU hotplugging option, heck, I don’t plan to take out one of the cores of my single CPU chip. What a mistake that was. Turns out it’s one of the requirements for Suspend2 patches, the one that make a laptop somewhat usable as a laptop. There was no indication on the HOWTO available on their site (which has a section "Kernel support" and "Requirements") of the choices you need to make to enable it. One hour later until I figured out all the choices, I was able to add this one in.

And this is where I felt lost. How do I know that my choice does not disable another, which may be better suited? How do I enable choices that may be better for me when by default (after make mrproper) they are hidden?

And which choices are good for me anyway? Other than the obvious ones I find the information available to be lacking.

I finally found most of the hardware in my laptop had support under this kernel, including the very newly added support for the wireless. Partly, it was sheer luck: since I know nothing of what is inside my laptop, other than the graphic card and the network card being made by Nvidia, and I know they provide drivers at least for the graphic card, I looked at their Linux page. Somewhere inside of it, I found the modules that should support fairly new hardware for the storage and sound and ethernet driver. To my pleasant surprise, they all worked.

I installed Xorg and the latest hardware for the graphic card, which ended up in a big disaster: my computer now freezes, whether in console mode or not, and I have no idea what causes it. It can be the driver, of course, which seems like the most obvious choice, but what if my BIOS does not assign IRQs properly and my graphic card is sharing one with another device and it causes this conflict? Or maybe one of my (seemingly non-related to this problem) choices in the kernel is actually causing all this mess now.

But how do I determine this? By trial-and-error? With hundreds of choices in the kernel, this certainly does not seem like the good approach. So I turn to you to help me understand how to configure my kernel for my machine.

All your answers are much appreciated in advance.

Last edited by Punkie; 06-21-2007 at 10:41 AM.
 
Old 06-21-2007, 11:31 AM   #2
truthfatal
Member
 
Registered: Mar 2005
Location: Winnipeg, MB
Distribution: Raspbian, Debian, Slackware, OS X
Posts: 443
Blog Entries: 9

Rep: Reputation: 32
An excellent guide current as of Kernel 2.6.18 is:
http://www.kroah.com/lkn/ <-- This is the web site for the book, Linux Kernel in a Nutshell, by Greg Kroah-Hartman, published by O'Reilly.

It's very comprehensive, but I'll assume that if you have the patience for CLFS that this won't be much of a problem. As well as the wealth of information available, there are also a few handy scripts in the book to help you find the name of the modules that you want... not JUST lspci and lsmod.

Following the guidelines in that book gave me a very usable and lightweight Kernel, needing only a small amount of "Trial and Error" tweaking afterwards.

Quote:
But how do I determine this? By trial-and-error? With hundreds of choices in the kernel, this certainly does not seem like the good approach. So I turn to you to help me understand how to configure my kernel for my machine.
Essentially, lspci helps a lot, and so does popping in a LiveCd and running lsmod and (with luck) `less /proc/config.gz` to get some more information.

Sorry if this isn't the kind of help you were looking for.

Last edited by truthfatal; 06-21-2007 at 11:52 AM.
 
Old 06-21-2007, 12:12 PM   #3
Punkie
LQ Newbie
 
Registered: Apr 2003
Location: Montreal, Canada
Distribution: CLFS 1.0.0
Posts: 24

Original Poster
Rep: Reputation: 15
At first look, this seems to be the exact guide I wanted to, and if you say it's comprehensive, it should be good for me

Thank you very much, I'll have a go at it tonight and report back.
 
Old 06-26-2007, 09:48 AM   #4
Punkie
LQ Newbie
 
Registered: Apr 2003
Location: Montreal, Canada
Distribution: CLFS 1.0.0
Posts: 24

Original Poster
Rep: Reputation: 15
I have read the whole guide this past weekend and it does offer quite a lot of information. The most important part I found to be the chapter 7 where it explains how to determine the drivers needed for your hardware from scratch. So far, I have only practised with something I knew already, but there's about 15 more devices that I need to do.

The guide goes through the major sections of the kernel, a bit random at times (i.e. configure disks, then configure processor, configure ethernet then bluetooth THEN wireless...), but document structure apart, it's a good beginning guide.

What was not explained in the book was how to determine additional options that would benefit your machine/user experience. For example, while trying to configure Powernow for my AMD CPU (very useful for the laptop), I had disabled an option on which Powernow was dependent (but the kernel's menuconfig let me do it). The option's help mentioned some ACPI specifications for Intel. Another example would be the MTRR option, which seems to speed things up considerably, but it is possible to disable it.

Does anyone know how to identify such features when the Documentation directory doesn't discuss it? Is Google the answer to ALL the thousands of choices?
 
  


Reply

Tags
configuration, configure, hardware, kernel, modules, scratch



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Missing choices in kernel xconfig azazel11998 Linux - Kernel 5 01-29-2007 03:34 PM
RHEL 4 Installer Choices: I want to see the packages associated with these choices. tacoshell Red Hat 2 05-05-2005 04:34 PM
X11 fun - need to make choices.... Laserjock Linux - Software 7 12-11-2004 03:55 PM
grub and two kernel choices aetengoku Linux - Newbie 2 04-04-2003 10:40 AM
Choices, choices ... what shall I start with? rtuckwell Linux - Newbie 5 01-25-2003 06:17 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

All times are GMT -5. The time now is 09:56 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration