Linux

Wednesday, June 22, 2005

modversions.h problem

I was downloading the kernel headers and copying it to /usr/src/..... and using that include directory for compiling the kernel module which turned out to be the wrong way and the best method is to include the one in /lib/modules/'uname -r'/build

There was no modversions.h as specified in .Indeed it was in config/modversions.h and corrected the include method like below that worked out !!

#ifdef CONFIG_MODVERSIONS
#define MODVERSIONS
#include < config/modversions.h >
#endif


Related Links:
[1] http://www.skynet.ie/~mark/home/kernel/symbols.html


Friday, June 03, 2005

Recompiling the kernel

This post is a concise version of [1]
The kernel source can be downloaded from [2]

If the linux source downloaded is a .bz2 (BZIP compressed format) use this command to extract


tar xfvj /path/to/linux-2.6.0-test7.tar.bz2
or if the source is in .gz (GZIP compressed format ) use this command to extract

tar xfvz /path/to/linux-2.6.0-test7.tar.gz

Steps to be followed:

make config /make menuconfig/ make xconfig

select the required options

(save the options to a file in case you want to rebuild this will be easy)

make dep [not required for 2.6.x]
make clean
make bzImage

If everything went correctly then the new kernel should exist in ./arch/$ARCH/boot

make modules
make modules_install (you need to be root to run this command)

Create the initrd from the kernel image
mkinitrd /boot/initrd-2.6.0.img 2.6.0
Some versions of mkinitrd may require other options to specify the location of the new kernel. For example, the following syntax is required in some systems:
mkinitrd -k vmlinux-VERSION -i initrd-VERSION

From the ./linux directory, copy the kernel and System.map file to /boot


Add the kernel to bootloader

GRUB
Once you have copied the bzImage and System.map to /boot, edit the grub configuration file located in /boot/grub/menu.lst. On some distributions /etc/grub.conf is a symbolic link to this file.
Note that you do not have to rerun grub after making changes to this file
title Test Kernel (2.6.0)
root (hd0,1)
kernel /boot/bzImage-2.6.0 ro root=LABEL=/
initrd /boot/initrd-2.6.0.img

default specified as default=0

LILO
configuration file is located in /etc/lilo.conf on most systems. Unlike GrUB, any changes to lilo.conf will not be set until the lilo program is rerun.

image=/boot/bzImage-2.6.0
label=test-2.6.0
root=/dev/hda2
initrd=/boot/initrd-2.6.0.img
read-only


default option specified as
default=[LabelName]
To ensure that the changes are correct please rerun lilo

While upgrading to the 2.6.x kernel from 2.4.x kernel make it sure that the module-init-tools package is also updated

More detailed documentation can be found in the Readme file in Documentation of the kernel package.

For creating the arm-linux kernel follow instruction in [3]

Related Links:
[1] http://www.digitalhermit.com/linux/Kernel-Build-HOWTO.html#BUILDING
[2] http://www.kernel.org/
[3] http://www.arm.linux.org.uk/docs/kerncomp.php