Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compile the 2.6.x kernel
#1

Idiots Guide to 2.6.x kernel compiles

--------------------------------------

 

I am writting this to give a general walkthrough of how

to compile and install the new 2.6 series kernel. Below are

three major selling points of why to upgrade from 2.4

- Bootup time is so much faster

- Alsa support built right into the kernel (sound)

- Your system almost feels like it has a faster CPU in it

 

Ok enough with the good points. Lets get down to the install.

All the shell commands will start with a #. These should be

run in either the console or a console window (xterm)

 

1) Change directories to the standard place for kernel installs. Since

a lot of 3rd party applications look for the kernel source in

/usr/src lets compile in that directory.

# cd /usr/src

 

2) Now lets download the newest kernel. At the time of writting this

2.6.0-test11 is the lastest. This seems to change every 2-3 weeks.

I like to use ncftp but you are free to use any ftp client.

# ncftp ftp.kernel.org

At the ftp prompt send the following commands

ftp> cd pub/linux/kernel/v2.6

ftp> get linux-2.6.0-test11.tar.bz2

wait.. wait.. and wair

 

3) Once it is down downloading. Exit out of the ftp client and lets

un package our new kernel

# tar jxfv linux-2.6.0-test11.tar.bz2

 

4) You will notice it gets un-packaged in /usr/src/linux-2.6.

We want to also put it in /usr/src/linux. So lets create a

symlink

# ln -sf linux-2.6.0-test11 linux

 

5) Now that we have a symlink created Go into that directory and lets

configure our new kernel

# cd linux

There are two options to config the kernel. Open a ncurses window,

which you can do in a console window or if you are using X you can

open a nice GUI window.

# make menuconfig (for the ncurses based)

or

# make xconfig (for the X based)

 

6) This is the part where you have to know something about your system.

Most system, this default config will work just fine. Chances are

You will need to install your network driver and sound driver. I am

going to show you where those are, the rest is up to you to figure

out

 

7) Follow this path to your network driver.

Device Drivers->Networking Support->Ethernet (10 or 100Mbit)

In there you will see a list of chipsets. Select the one that meets

your needs.

* = means compiled into the kernel

M = means as a module

I'd reocmmend compiling them into the kernel

 

8) Lets do the same for your soundcard. From the root menu

Device Drivers->Sound->Advanced Linux Sound Architecture->PCI devices

 

9) Save your kernel. In the xconfig hit the disk icon of file->save.

In the menuconfig just keep selecting exit until you are prompted to

save.

 

10) Lets compile your kernel!

# make

 

11) If you don't see any errors, lets install it

# make install

 

12) Your kernel is installed, but we have to do some moving around

of the kernel files first and then edit the boot loader. So lets

get the files in the right place. make install copies the files

to your root partition (/) so lets move them out of there into the

/boot directory

# cd /

# mv vmlinux /boot/vmlinuz-2.6.0-test11

# mv System.map /boot/System.map-2.6.0-test11

I like to change the name so I can keep my old kernels labeled. Its

always a good idea to keep older kernels, just in case a compile

doesn't load for you. That way you can always go back to the old

kernel and get into your OS.

 

13) We need to change the symlink for the old System.map to point

to the new one.

# ln -sf /boot/System.map-2.6.0-test11 /boot/System.map

 

14) Now we need to make a kernel image. This is because Redhat (Fedora)

used partition labels. If you do now use a kernel ramdisk image

then your kernel will not load. You can get around this by replacing

all occurances of parition labels with their partition, but that is a

pain so lets make a ramdisk image Also the ext3 is built as a module

so your OS will not load if you do not make an ramdisk image

# mkinitrd /boot/initrd-2.6.0-test11.img 2.6.0-test11

 

15) Now lets edit our bootloader.

I like vi, but feel free to use any text editor you like

# vi /etc/lilo.conf

that is for lilo

# vi /boot/grub/grub/conf

that is grub.

Now in there your last line will be something like this

 

 

LILO

-----

image=/boot/vmlinuz-2.4.22-1.2115.nptl

label=2.4.22-1.2115.n

initrd=/boot/initrd-2.4.22-1.2115.nptl.img

read-only

append="root=LABEL=/"

Grub

----

title Fedora Core (2.4.22-1.2115.nptl)

root (hd0,0)

kernel /vmlinuz-2.4.22-1.2115.nptl ro root=LABEL=/

initrd /initrd-2.4.22-1.2115.nptl.img

 

 

That is the standard kernel for fedora core1. So what we do is copy

that whole section and then paste it right below it. Now that we

have two copies of it we need to edit it to look like this

 

LILO

------

image=/boot/vmlinuz-2.6.0-test11

label=2.4.0-test11

initrd=/boot/initrd-2.6.0-test11.img

read-only

append="root=LABEL=/"

 

Grub

------

title 2.6.0-test11

root (hd0,0)

kernel /vmlinuz-2.6.0-test11 ro root=LABEL=/

initrd /initrd-2.6.0-test11.img

 

 

16) If you run grub you can just reboot and you just see the new

kernel in your grub menu. If you use lilo then run the following

command

# lilo

You should see the 2.6.0-test11 listed and then you are good

to go ahead and reboot.

Reply
#2

GREAT post !!

 

i will try this and report all my errors, er i mean, how it went

 

cheers !

 

anyweb

Reply
#3

i tried compiling 2.6.8.1 and got some warnings during the make portion, but no errors. Then i did

make install and came up with this.

 



Code:
-bash-2.05b# make install
make[1]: `arch/i386/kernel/asm-offsets.s' is up to date.
 CHK     include/linux/compile.h
Kernel: arch/i386/boot/bzImage is ready
sh /usr/src/linux-2.6.8.1/arch/i386/boot/install.sh 2.6.8.1 arch/i386/boot/bzImage System.map ""
WARNING: Couldn't open directory /lib/modules/2.6.8.1: No such file or directory
FATAL: Could not open /lib/modules/2.6.8.1/modules.dep.temp for writing: No such file or directory
/lib/modules/2.6.8.1 is not a directory.
mkinitrd failed
make[1]: *** [install] Error 1
make: *** [install] Error 2




 

any ideas on what may have gone wrong and what i can do to make it work ?

Reply
#4

Can you issue this command and post the results:

 

# ls -l /lib/modules

 

Peace...

Reply
#5

did you run make modules then make modules_install

 

it should go something like:

 

make menuconfig

make

make modules

make modules_install

make install

Reply
#6

i have a problem when when trying to do this command

Quote:root@host [/usr/src/linux]# make install  CHK  include/linux/version.h

make[1]: `arch/i386/kernel/asm-offsets.s' is up to date.

  CHK  include/linux/compile.h

  CHK  usr/initramfs_list

Kernel: arch/i386/boot/bzImage is ready

sh /usr/src/linux-2.6.11.7/arch/i386/boot/install.sh 2.6.11.7 arch/i386/boot/bzImage System.map ""

All of your loopback devices are in use.

mkinitrd failed

make[1]: *** [install] Error 1

make: *** [install] Error 2
 

any one know why ?

thanks

Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)