It's been a long time since I compiled a Linux kernel last time. The last one I built was version 3.1.4 on December 3, 2011. I need to build a new kernel so that my Linux system is kept up-to-date. In order to compile a kernel, I made sure that all the necessary packages were installed.
- binutils
- gcc & g++
- libglade2-dev, libqt3-mt-dev or libqt4-dev
- make
- module-init-tools
- patch
- pkg-config
I downloaded the kernel source from kernel.org and unpacked the kernel source package.
tar xjf linux-3.5.4.tar.bz2
cd linux-3.5.4
I copied the config-*
file of my current kernel to the kernel source tree and renamed it to .config
. This makes kernel configuration easier because I only need to set the values for new kernel settings.
cp /boot/config-3.1.4 .config
If you can't find your current kernel config at /boot, you'll find a copy at /proc.
zcat /proc/config.gz > .config
Type one of the following commands to start configuring the kernel.
- If libglade2-dev is installed:
make gconfig
- If libqt3-mt-dev or libqt4-dev is installed:
make xconfig
When you finish configuring the kernel, save the changes by selecting File, Save. To see what changes you made, try the following command:
diff -ub .config.old .config
Optionally, open Makefile with an editor and define EXTRAVERSION if necessary.
VERSION = 3
PATCHLEVEL = 5
SUBLEVEL = 4
EXTRAVERSION = -586mmx
It is useful to set EXTRAVERSION when you are building different kernels for several CPU types. Now let's compile the kernel.
make bzImage
make modules
make install
make modules_install
depmod -e -m -F /boot/System.map-3.5.4 3.5.4
Set the default root device and ramdisk size for the new kernel.
cd /boot
rdev vmlinuz-3.5.4 1,0
ramsize vmlinuz-3.5.4 4096
Here's my config for kernel 3.5.4 if you need it. Make sure to change the processor family to suit your computer before building the kernel.
No comments:
Post a Comment