Topic Contributors
creator avatar  
mreschke
Matthew Reschke
Site Developer
Created: Feb 23rd, 2009
Updated: Jan 18th, 2012
File
Download Selected (zip)
Download Selected (tar.gz)
Edit
Select All
Select None
View
Detail
Detail Preview
Icons
Preview
Show Hidden
Hide Hidden
Full Manager
Reset Defaults
Open In New Tab
Open In New Window
List Archive Contents
Download File
Open
Download Folder (as .zip)
Compiling the Linux Kernel
Post # 135 permalink Topic #135 by mreschke on 2009-02-23 02:07:33 (viewed 676 times)
Table of Contents

http://www.cyberciti.biz/tips/compiling-linux-kernel-26.html

Exclamation3
After building my first LFS system, I realized the LFS project has great kernel docs
See http://www.linuxfromscratch.org/lfs/view/stable/chapter08/kernel.html
which really points to this great doc http://www.linuxfromscratch.org/hints/downloads/files/kernel-configuration.txt
Note unless in a chroot like in LFS, just use make menuconfig instead of all the LANG stuff

Compile Kernel[-][- -][++]

Install needed compilers

Code Snippet
# apt-get install build-essential

Get Your desired kernel version

Code Snippet
$ cd /tmp
$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-x.y.z.tar.bz2
# tar -xjvf linux-2.6.25.tar.bz2 -C /usr/src
# cd /usr/src/linux-2.6.... (the new linux folder)

If you want your current kernels config, you can run # make oldconfig
which should create a .config file in /usr/src/linux2... I believe its the same one as the one in your /boot (current config), but double check that. Or else to be sure you can just copy /boot/config-2..., to /usr/src/linux2.../.config

Now look/edit the config either by editing .config or running

Code Snippet
$ make menuconfig - Text based color menus, radiolists & dialogues. This option also useful on remote server if you wanna compile kernel remotely.
$ make xconfig - X windows (Qt) based configuration tool, works best under KDE desktop
$ make gconfig - X windows (Gtk) based configuration tool, works best under Gnome Desktop.

I use menuconfig, now save and edit

Compile Kernel (make sure still in /usr/src/linux2... folder)

Code Snippet
$ make
$ make modules
$ su - (to become root)
# cd /usr/src/linux2.6...
# make modules_install

Install kernel (installs 3 files to /boot, System.map-xx, config-xx, vmlinux-xx, just kernel stuff, not initramfs yet)

Code Snippet
# make install 

Create initramfs (sometimes the command is mkinitrd ...)

Code Snippet
# cd /boot
# mkinitramfs -o initrd.img-2.6.xx 2.6.xx (sub your kernel version of course)

Now update your grub menu.lst, you can either edit manually, or just run

Code Snippet
# update-grub

which edits menu.lst for you, but you will still need to set menu.lst defaults ...