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!
select your choices here
. To help you decide your choices, use lspci
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
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 * :
- CD-ROM/RW or DVD-ROM/RW.
- SD/MMC readers.
- 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.
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, 18.104.22.168.
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.