Correct kernel 2.6.X compilation....

Submitted by Anonymous
on April 5, 2004 - 12:32am

Hi guys,

I have some little doubts concerning the 2.6.X compilation...

I know the first orders:
1- make xconfig
2- make bzImage && make modules && make modules_install
3- cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.4
4 cp System.map /boot/System.map-2.6.4

But from there, there is some different versions..
I have to copy System map to the /boot folder. how Linux recognise the relation with each kenel image and his System.map? with the surname?

some guys also cp .config:
5- cp .config /boot/config-2.6.4

It is necessary?

Regards,

Daniel

My order usually is: 1 - mak

Anonymous
on
April 5, 2004 - 1:48am

My order usually is:
1 - make menuconfig
2 - make && make modules_install
3 - cp arch/i386/boot/bzImage /boot/bzImage-2.6.4
4 - modify Grub config

That's about it. The System.map and .config are not necessary (and iirc not even used) for booting, they're just copied to /boot in case of some system crash.

System.map is used for calculating module dependencies (which is done during 'make modules_install') and .config is used if you have to recompile your kernel some day.

how about initrd ?

Anonymous
on
August 20, 2004 - 12:36am

why nobody is making initrd would the machine boot at all without it?

I dont think so

Here's a step by step if you have redhat 9

mchirico
on
April 5, 2004 - 10:04am

How to Compile 2.6 kernel for RedHat 9/8
Mike Chirico
Last Updated: Mon Apr 5 06:45:59 EDT 2004

The latest version of this document can be found at:
http://prdownloads.sourceforge.net/souptonuts/README_26.txt?download

For configs ref:
http://sourceforge.net/project/showfiles.php?group_id=79320&package_id=1...

STEP 1:

Download the latest version of the kernel and any patches.
This documentation is done with linux-2.6.3, but look for
later versions.
http://www.kernel.org/pub/linux/kernel/v2.6/

Also take a look at
http://www.codemonkey.org.uk/post-halloween-2.5.txt

This has some useful hints on some of the changes needed.

STEP 2:

Download the latest version of module-init-tools
"module-init-tools-3.0.tar.gz" and
"modutils-2.4.21-23.src.rpm"

http://www.kernel.org/pub/linux/kernel/people/rusty/modules/module-init-...
http://www.kernel.org/pub/linux/kernel/people/rusty/modules/modutils-2.4...

STEP 3:

Install module-init-tools. This will replace depmod
[/sbin/depmod] and other tools.

tar -zxvf module-init-tools-3.0.tar.gz
cd module-init-tools-3.0
./configure --prefix=/sbin
make
make install
./generate-modprobe.conf /etc/modprobe.conf

STEP 4:

Install modutils-2.4.21-23.src.rpm. You may get warnings
about user rusty and group rusty not existing. Also, yes,
you'll have to force the install. If you don't do these steps
for both Redhat 9 and Redhat 8, you'll have problems with the
make modules_install.

rpm -i modutils-2.4.21-23.src.rpm
rpmbuild -bb /usr/src/redhat/SPECS/modutils.spec
rpm -Fi /usr/src/redhat/RPMS/i386/modutils-2.4.21-23.i386.rpm

STEP 5:

Install and configure the kernel. Do NOT use the /usr/src/linux
area! Reference the README. I put my files in /home/src/kernel/

gunzip linux-2.6.3.tar.gz tar -xvf linux-2.6.3.tar cd
linux-2.6.3

If you have patches install these now:

bzip2 -dc ../patch-2.6.xx.bz2 | patch -p1

STEP 6:

Copy the appropriate /usr/src/linux-2.4/configs
[kernel-2.4.20-i686.config, kernel-2.4.20-i686-smp.config]
to .config in whatever directory you are installing. In my
case it's /home/src/kernel/linux-2.6.3

cp /usr/src/linux-2.4/configs/kernel-2.4.20-i686.config \
/home/src/kernel/linux-2.6.3/.config

If you don't have the source configs, you can download them
from here:

https://sourceforge.net/project/showfiles.php?group_id=79320&package_id=...

I've also included a file config2.6-chirico which was a 2.6
version for some of my systems. This isn't a bad reference if
you run into trouble.

STEP 7:

Assuming you copied the appropriate kernel-2.4 config to
.config, run the following which will run through necessary
questions for the 2.6 kernel. Or, you might want to use the
config2.6-chirico...this has already been run through make
oldconfig on my system, and I've answered the necessary questions
for a general system.

make oldconfig

STEP 8:

This is very important. Make sure you're .config has the
following in it CONFIG_EXT3_FS=y You'll run into the following
error if you leave this =m instead of =y:

pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed

This is because Redhat 9.0 and 8.0 use the ext3 filesystem
for /boot ...

STEP 9:

Edit the Makefile and add changes to the Extraversion as desired.
Patches will update these values as well.

VERSION = 2
PATCHLEVEL = 6
SUBLEVEL = 3
EXTRAVERSION = -skim-ch6

STEP 10:

make bzImage

STEP 11:

make modules

STEP 12:

make modules_install

STEP 13:

make install

If you come across errors here, what version of "depmod" is
being picked up in your path?

Also, if you get a module not found, say the following:
No module aic7xxx found for kernel 2.6.x
Then, in /lib/modules/2.6.x/kernel/drivers/scsi/aic7xxx/
cp aic7xxx.ko aic7xxx.o

insmod should look for aic7xxx.ko ;but , it looks for aic7xxx.o

If you still have trouble, make the following change in the
.config
CONFIG_BLK_DEV_SD=y
and go back to STEP 10.

You also may want to ref
kernel-2.6.3-i686-smp-chirico-aic7xxx.config
in
http://prdownloads.sourceforge.net/souptonuts/configs-0.3.tar.gz?download

STEP 14:

mkdir /sys

STEP 15:

/etc/rc.sysinit needs to be modified. Look for the following
line:

action $"Mounting proc filesystem: " mount -n -t proc /proc /proc

and after this line enter the following:

action $"Mounting sysfs filesystem: " mount -t sysfs none /sys

Here's my /etc/rc.sysinit for reference:

http://prdownloads.sourceforge.net/souptonuts/rc.sysinit.txt?download

Be very careful at this step. Backup the /etc/rc.sysinit file.

Thomer [http://thomer.com/linux/migrate-to-2.6.html ] also added
changes to /etc/fstab. I only had to do STEP 16 below.

STEP 16:

Add the following to /etc/fstab for usb support.

/proc/bus/usb /proc/bus/usb usbdevfs defaults 0 0

STEP 17 (CHECKING EVERYTHING):

Check the following:

a. The new image file should be installed on boot and there
should be sym link to it. My latest kernel is 2.6.3-skim-ch6,
and I got the "-skim-ch6" from the values I put in the Makefile,
so I see the following:

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.