Compiling the Linux kernel

I've always had tons of trouble trying to get kernels compiled. But today I
successfully compiled the 2.4.22 kernel from kernel.org, on my Via EPIA ME6000 mini-itx motherboard, which
has a built-in Via Eden 600MHz fanless processor, and on-board sound, video, networking, USB2,
and Firewire. I also have 256MB of DDR RAM and a 40gig IBM Travelstar notebook hard
drive in the system, and it's running Slackware Linux 8.1.

Here's some more technical info about the chips on the motherboard, from the text printed
on the chips themselves, and/or from the manual:

Note: one common reason to recompile the kernel is when you need to apply a patch to it. To do
that, save the patch to the /usr/src directory (as root), then run zcat <patch-name>.gz | patch
-p0 -E to apply it. After it's done, run find /usr/src/linux -name '*.rej' -print
which will show you any parts of the patch that got rejected. If nothing got rejected,
then the patch was successfully applied, and you can now recompile your kernel. (Source)

download the kernel to /usr/src/linux-2.4.22.tar.bz2, and cd
to /usr/src if you're not already there

tar jzf linux-2.4.22.tar.bz2 to unpack it

rm /usr/src/linux to remove the existing soft-link to
the old kernel source directory (/usr/src/linux-2.4.18)

ln -s /usr/src/linux-2.4.22 /usr/src/linux to create
/usr/src/linux as a soft-link to /usr/src/linux-2.4.22

mv /usr/src/linux/.config /boot/config-old to save the
old .config file, just in case you might want to recompile the old
kernel again with the same options you used before

cd /usr/src/linux

make clean; make mrproper; make clean

make menuconfig and go through the menus to choose the
options you want. If you already have a .config file that you want
to start from, load that (with "Load Alt Config File" towards the
bottom of the options list) before making any changes.

If unsure about any given option, configure it
as "M" (a module) instead of "*" (built-in to the kernel). When
you're done, exit, and it will ask you if you want to save your
configuration -- say yes, and it will save it to /usr/src/linux/.config
for use by the make commands.

Some notes about my specific setup here: I chose i386 as the processor
architecture after reading http://www.viaarena.com/?PageID=193. I specifically
did NOT install any i2c support, because I planned on installing the lmsensors
package later (which allows you to read the temperature/fan/voltage sensors
on your motherboard), and the current version specifically says to leave
i2c out of your kernel, so you can then install the lastest version of it
when you install lmsensors. Other than that, I just made sure to set
my ethernet driver (via-rhine) and sound driver (via82cxxx_audio) as modules,
and to set USB and USB-hid as built-in to the kernel, because I have a USB
keyboard. Oh, and I also had to specifically enable support for my
VIA IDE controller, otherwise I couldn't use DMA-access, so I could only
transfer data at about 3.5 MB/s instead of the ~25MB/s I get with DMA enabled
(using hdparm to set/check transfer rates and the DMA settings). Finally,
in order to get decent fonts and high(ish) resolution at the console, you
need to enable the "Prompt for development and/or incomplete code/drivers"
option, and then enable "Console drivers > Frame-buffer support > VESA VGA
graphics console", as well as any other options under Frame-buffer support
(like specific fonts) you might want.

make dep

make bzImage and make modules can be done simultaneously
in two different consoles. This will create /usr/src/linux/arch/i386/boot/bzImage
and will compile the modules (but not install them).

make modules_install will put the modules into /lib/modules/2.4.22/kernel/
subdirectories.

cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage.myker will
copy the kernel into a place from which it can be loaded at boot.

cp /usr/src/linux/.config /boot/config-anthony-2.4.22 in case I want
to compile the kernel again with these same options, or similar options. (If
I do, then I just repeat the steps on this page, except during the make
menuconfig step, I use its "load alternate configuration" option to load
/boot/config-anthony-2.4.22 before making any changes to the setup.)

I also had to edit the line that said vga=773 and change it to vga=ask, or else I
just got a blank screen after lilo loaded the next time I rebooted. (You can
also just type "myker vga=ask" at the lilo boot prompt when you reboot.)

run lilo one time, to enable the changes you made to lilo.conf.

Reboot, and hold the left-shift key before/while lilo loads. This will
give you a lilo prompt (if you didn't get one already, by default) where you can
type myker <ENTER> to boot your new kernel. You'll then get prompted
to choose a video mode; you should probably type scan <ENTER> which
will automatically check which ones you can use, and present you with a list.
When you find one that you like, set your vga= option in /etc/lilo.conf to it (I set
mine as vga=0xf01).

If your system books ok, then you won. Edit /etc/lilo.conf again, and move
your new section above the existing section(s), to make it the default. Run
lilo again to apply the changes, then reboot, and you're done.

If it doesn't boot properly, then reboot, hold left-shift, and choose your old
kernel. You can try to repeat all these steps again; the problem is most likely
the result of something you set or didn't set during the make menuconfig
step. It might take a little trial and error till you get it right.