Web Hosting Talk







View Full Version : Compile 2.6.7 Kernel w/module-init-tools


Steven
06-24-2004, 08:11 PM
Compiling the kernel

cd /usr/src
wget -c http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.7.tar.bz2
tar xvfj linux-2.6.7.tar.bz2
cd linux-2.6.7
make clean && make mrproper

make oldconfig ( or make menuconfig

make bzImage
make modules
make modules_install

( i prefer this method rather then just "make" )


If you get alot of errors about .ko modules when you run make modules_install you need to update your modutils package with module-init-tools, see below.

Now to copy the files over for the kernel itself.

cp .config /boot/config-2.6.7
cp arch/i386/boot/bzImage /boot/vmlinuz-2.6.7
cp System.map /boot/System.map-2.6.7
mkinitrd /boot/initrd-2.6.7.img 2.6.7

You may experience an error such as this:

/dev/mapper/control: open failed: No such file or directory

if you receive that error run the following commands:

rm -rf /boot/initrd-2.6.7.img
mkinitrd --omit-lvm-modules /boot/initrd-2.6.7.img 2.6.7

Now to add it to the grub / lilo configuration.

[Grub]

your config will look something like this. Please note you need to follow the format for your current config.

title Red Hat Linux (2.6.7)
root (hd0,0)
kernel /vmlinuz-2.6.7 ro root=LABEL=/
initrd /initrd-2.6.7.img

Add your new entry to the top of the kernel list. Set the default to your working kernel. NOTE: the first kernel in the list is "0". (ex. default=1)

Now exit. Type "grub" at the bash prompt.

savedefault --default=0 --once


issue that at the grub prompt then use quit to exit. Once your reboot you need to go back in and set the default to the 2.6 kernel by setting default=0

[lilo]

your config will look something like this. Please note you need to follow the format for your current config.

image=/boot/vmlinuz-2.6.7
label=2.6.7
append="root=LABEL=/"
read-only
initrd=/boot/initrd-2.6.7.img

Leave the default as is.

/sbin/lilo -v -v
/sbin/lilo -R 2.6.7

Once it reboots and comes back online you can change the default to be 2.6.7 and /sbin/lilo -v -v



The above tells you how to enable failsafe in your kernels. SO that if the box panics the dc tech does not have to console in he just has to reboot the box.

How to install module-init-tools:

cd /usr/src
wget -c http://www.kernel.org/pub/linux/kernel/people/rusty/modules/module-init-tools-3.0.tar.gz
tar -zxvf module-init-tools-3.0.tar.gz
cd module-init-tools-3.0
./configure --prefix=""
make moveold
make install
./generate-modprobe.conf /etc/modprobe.conf

How to determine what boot loader you are using?

dd if=/dev/hda bs=512 count=1 2>&1 | grep GRUB
dd if=/dev/hda bs=512 count=1 2>&1 | grep LILO

one of them will kick back something like:

root@w00t [~]# dd if=/dev/hda bs=512 count=1 2>&1 | grep GRUB
Binary file (standard input) matches
root@w00t [~]#

which means its using grub.

CArmstrong
06-25-2004, 04:24 AM
Steve, make oldconfig uses what configuration file? And what about options that are new to the kernel that weren't set in the old config? Will it prompt?

Steven
06-25-2004, 04:27 AM
Yes, it will use the old configuration file. On 2.6 it will prompt for the new options aswell as the system archutecture, like is it a opteron or xeon, etc.

CArmstrong
06-25-2004, 04:27 AM
I meant the old configuration file where? In /boot or in the old kernel source tree?

Sheps
06-26-2004, 10:11 PM
It is in /boot

propcgamer
06-27-2004, 09:42 PM
"kernel panic: init not found"

any suggestions?

Steven
06-27-2004, 10:01 PM
Originally posted by propcgamer
"kernel panic: init not found"

any suggestions?



cat /etc/fstab


What does it return?

what does your grub.conf look like?

propcgamer
06-27-2004, 10:06 PM
Originally posted by thelinuxguy
What does it return?

what does your grub.conf look like?

LABEL=/ / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
none /dev/pts devpts gid=5,mode=620 0 0
none /proc proc defaults 0 0
none /dev/shm tmpfs defaults 0 0
/dev/hda3 swap swap defaults 0 0
/dev/cdrom /mnt/cdrom udf,iso9660 noauto,owner,kudzu,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner,kudzu 0 0


I currently am using lilo, here is my lilo.conf:
prompt
timeout=50
default=linux
boot=/dev/hda
map=/boot/map
install=/boot/boot.b
message=/boot/message
linear

image=/boot/vmlinuz-2.6.7
label=2.6.7
append="root=LABEL=/"
read-only
initrd=/boot/initrd-2.6.7.img

image=/boot/vmlinuz-2.4.20-31.9smp
label=2.4.20-31.9smp
initrd=/boot/initrd-2.4.20-31.9smp.img
read-only
append="root=LABEL=/"

image=/boot/vmlinuz-2.4.20-31.9
label=2.4.20-31.9
initrd=/boot/initrd-2.4.20-31.9.img
read-only
append="root=LABEL=/"
image=/boot/vmlinuz-2.4.20-8smp
label=linux.bak
initrd=/boot/initrd-2.4.20-8smp.img
read-only
append="root=LABEL=/"

image=/boot/vmlinuz-2.4.20-8
label=linux-up.bak
initrd=/boot/initrd-2.4.20-8.img
read-only
append="root=LABEL=/"
image=/boot/vmlinuz-2.4.20-31.9smp
label=linux
append="root=LABEL=/"
read-only
initrd=/boot/initrd-2.4.20-31.9smp.img

image=/boot/vmlinuz-2.4.20-31.9
label=linux-up
append="root=LABEL=/"
read-only
initrd=/boot/initrd-2.4.20-31.9.img

Haze
06-28-2004, 12:16 AM
ls -als /boot and paste as well. Did you get any errors on the install ? Did you install module-init-utils ?

propcgamer
06-28-2004, 12:17 AM
Originally posted by Haze
ls -als /boot and paste as well. Did you get any errors on the install ? Did you install module-init-utils ?

total 23333
2 drwxr-xr-x 4 root root 2048 Jun 27 21:32 .
4 drwxr-xr-x 19 root root 4096 Jun 27 21:32 ..
1 -rw-r--r-- 1 root root 512 Apr 26 18:43 boot.0300
6 -rw-r--r-- 1 root root 5824 Jan 25 2003 boot.b
1 -rw-r--r-- 1 root root 612 Jan 25 2003 chain.b
45 -rw-r--r-- 1 root root 44762 Apr 13 18:12 config-2.4.20-31.9
45 -rw-r--r-- 1 root root 44814 Apr 13 18:03 config-2.4.20-31.9smp
45 -rw-r--r-- 1 root root 44309 Mar 13 2003 config-2.4.20-8
45 -rw-r--r-- 1 root root 44361 Mar 13 2003 config-2.4.20-8smp
40 -rw-r--r-- 1 root root 39468 Jun 27 19:17 config-2.6.7
1 drwxr-xr-x 2 root root 1024 Apr 26 19:24 grub
147 -rw-r--r-- 1 root root 149247 Apr 26 19:23 initrd-2.4.20-31.9.img
150 -rw-r--r-- 1 root root 151699 Apr 26 19:24 initrd-2.4.20-31.9smp.img
149 -rw-r--r-- 1 root root 150833 Apr 26 18:13 initrd-2.4.20-8.img
150 -rw-r--r-- 1 root root 151859 Apr 26 18:14 initrd-2.4.20-8smp.img
85 -rw-r--r-- 1 root root 85757 Jun 27 19:17 initrd-2.6.7.img
1 -rw-r--r-- 1 root root 477 Jun 27 21:32 kernel.h
12 drwx------ 2 root root 12288 Apr 26 14:10 lost+found
102 -rw------- 1 root root 103424 Jun 27 19:18 map
24 -rw-r--r-- 1 root root 23108 Feb 24 2003 message
22 -rw-r--r-- 1 root root 21282 Feb 24 2003 message.ja
0 lrwxrwxrwx 1 root root 23 Apr 26 19:23 module-info -> module-info-2.4.20-31.9
17 -rw-r--r-- 1 root root 15438 Apr 13 18:12 module-info-2.4.20-31.9
17 -rw-r--r-- 1 root root 15438 Apr 13 18:03 module-info-2.4.20-31.9smp
17 -rw-r--r-- 1 root root 15436 Mar 13 2003 module-info-2.4.20-8
17 -rw-r--r-- 1 root root 15436 Mar 13 2003 module-info-2.4.20-8smp
1 -rw-r--r-- 1 root root 640 Jan 25 2003 os2_d.b
0 lrwxrwxrwx 1 root root 25 Jun 27 21:32 System.map -> System.map-2.4.20-31.9smp
514 -rw-r--r-- 1 root root 522619 Apr 13 18:12 System.map-2.4.20-31.9
540 -rw-r--r-- 1 root root 548551 Apr 13 18:03 System.map-2.4.20-31.9smp
511 -rw-r--r-- 1 root root 520129 Mar 13 2003 System.map-2.4.20-8
538 -rw-r--r-- 1 root root 546061 Mar 13 2003 System.map-2.4.20-8smp
824 -rw-r--r-- 1 root root 838211 Jun 27 19:17 System.map-2.6.7
3156 -rw-r--r-- 1 root root 3216789 Apr 13 18:12 vmlinux-2.4.20-31.9
3590 -rw-r--r-- 1 root root 3660698 Apr 13 18:03 vmlinux-2.4.20-31.9smp
3133 -rw-r--r-- 1 root root 3193503 Mar 13 2003 vmlinux-2.4.20-8
3568 -rw-r--r-- 1 root root 3637412 Mar 13 2003 vmlinux-2.4.20-8smp
0 lrwxrwxrwx 1 root root 19 Apr 26 19:23 vmlinuz -> vmlinuz-2.4.20-31.9
1114 -rw-r--r-- 1 root root 1134059 Apr 13 18:12 vmlinuz-2.4.20-31.9
1198 -rw-r--r-- 1 root root 1219671 Apr 13 18:03 vmlinuz-2.4.20-31.9smp
1102 -rw-r--r-- 1 root root 1122186 Mar 13 2003 vmlinuz-2.4.20-8
1189 -rw-r--r-- 1 root root 1211291 Mar 13 2003 vmlinuz-2.4.20-8smp
1210 -rw-r--r-- 1 root root 1232881 Jun 27 19:17 vmlinuz-2.6.7

propcgamer
06-28-2004, 12:21 AM
Originally posted by Haze
Did you get any errors on the install ?
No

Originally posted by Haze
Did you install module-init-utils ?
No, i thought you did this after you booted into the new kernel (im still learning about kernel compiling a bit)

Thanks

Steven
06-28-2004, 12:24 AM
OK install modutils and run make modules_install again.

propcgamer
06-28-2004, 12:29 AM
Ok i did that, make modules_install says:
if [ -r System.map ]; then /sbin/depmod -ae -F System.map 2.6.7; fi
WARNING: /lib/modules/2.6.7/kernel/drivers/net/tokenring/tms380tr.ko needs unknown symbol release_firmware
WARNING: /lib/modules/2.6.7/kernel/drivers/net/tokenring/tms380tr.ko needs unknown symbol request_firmware

after doing alot of different Installs of .ko files

LP-Trel
06-28-2004, 12:32 AM
I can say this tutorial works quite well. I tried it yesterday and it works like a gem, without any problems. :)

Steven
06-28-2004, 12:39 AM
Originally posted by propcgamer
Ok i did that, make modules_install says:
if [ -r System.map ]; then /sbin/depmod -ae -F System.map 2.6.7; fi
WARNING: /lib/modules/2.6.7/kernel/drivers/net/tokenring/tms380tr.ko needs unknown symbol release_firmware
WARNING: /lib/modules/2.6.7/kernel/drivers/net/tokenring/tms380tr.ko needs unknown symbol request_firmware

after doing alot of different Installs of .ko files

Is this a p4 2.8 from Servermatrix? If so

start with fresh source

wget http://rack911.com/config-2.6.7-SMp42.8

and rename it to .config and put it in your kernel source directory and make oldconfig.

that box has a few issues, so i had to make a config.

propcgamer
06-28-2004, 12:41 AM
Originally posted by thelinuxguy
Is this a p4 2.8 from Servermatrix? If so

start with fresh source

wget http://rack911.com/config-2.6.7-SMp42.8

and rename it to .config and put it in your kernel source directory and make oldconfig.

that box has a few issues, so i had to make a config.

Nope it is a p4 2.4 with HT from ezzi, its a dell.

cannibal
10-29-2004, 03:27 AM
Can I use this toturial for fedora core 1 ??

Steven
10-29-2004, 01:17 PM
Yes but becareful if you do it wrong with the modutils you will have an unbootable box. DO NOT ATTEMPT THIS IF YOU ARE A NOVICE!

PhilG
12-09-2004, 02:46 AM
will this work using 2.6.9? by just changing the numbers?

I have a RHEL 3 with an outdated kernel and want to get it updated.

PhilG
12-09-2004, 04:18 PM
Okay I tried it and get the following problem:

Mounting root filesystem
mount: error 19 mounting ext3
pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed: 2
Freeing unused kernel membory: 216k freed
kernel panic - not syncing: no init found. Try passing init= option to kernel

PhilG
12-09-2004, 10:40 PM
I solved my problem by building ext3 into the kernel... its now working well.

DennizNL
12-24-2004, 08:51 AM
Originally posted by PhilG
I solved my problem by building ext3 into the kernel... its now working well.

i get almost the same message...

Mounting root filesystem
mount: error 19 mounting ext3
pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed: 2
unmount / initrd/proc failed: 2
Freeing unused kernel membory: 228k freed
kernel panic - not syncing: no init found. Try passing init= option to kernel

how did you build ext3 into kernel?

Steven
12-24-2004, 05:01 PM
Originally posted by DennizNL
i get almost the same message...

Mounting root filesystem
mount: error 19 mounting ext3
pivotroot: pivot_root(/sysroot,/sysroot/initrd) failed: 2
unmount / initrd/proc failed: 2
Freeing unused kernel membory: 228k freed
kernel panic - not syncing: no init found. Try passing init= option to kernel

how did you build ext3 into kernel?

after you make oldconfig

pico .config

then search for ext3 and make all the "m" related to ext3 to "y"

goolex
04-15-2005, 02:31 PM
now i am useing 2.4.21-27.0.2.ELsmp #1 SMP
and my server is a dual xeon 2.4 + 4gig ram
if i upgrade kernal to this version , how much this can improve speed ?

Steven
04-15-2005, 06:18 PM
Dont use the version in this thread, it is vulnerable. You cannot give a number to how much it will improve speed. it all depends on what the server is doing.