# how to change kernels

## patientzero

Hi.

Running a gen source kernel and i'm not the best at gentoo... i used to be ok... 

anyways i wanted to change my current kernel to a game kernel. I think i picked some bad options for my nvidia card (geforce3) when i installed it and it doesnt like glx or allow me to use the hardware acceleration of my card (which i have had working in other linux distros) 

This may be a stupid question, but we don't ask because we know- how do i, within my current gentoo install, install another kernel and use it? i understand i'll have to reinstall gnome and alsa and all that- that's fine... i just don't know where to start with the kernel install! 

Thanks so much for your time and help in this matter! (and patience!)

----------

## meowsqueak

Installing an alternative kernel does not require you to recompile Gnome. ALSA probably, since it needs to build modules against the current kernel source. But Gnome/KDE and 99% of all applications do not need recompiling or reinstalling.

Are you able to compile a new kernel? If so, you generally put the file ./arch/<arch>/boot/bzImage into /boot (as vmlinuz usually) and change your bootloader (GRUB or LILO) to reference this new kernel. Keep your old kernel just in case the new one doesn't work.

----------

## coax

edit: nothing new to say

----------

## patientzero

that's great news!! I was expecting to have to do some work... do you bychance have any links to docs to explain about compiling a kernel while having a working running kernel?

That'd be great!

Thanks so much for your help!!

----------

## Fitzsimmons

Installing a new kernel is fairly simple.

Do an

```

# emerge -s sources

# emerge [sources that you want]

# ln -sf /usr/src/linux/linux-[new version] /usr/src/linux

```

Then cd /usr/src/linux and compile as normal, etc.

When it comes to copying the bzImage and configuring the bootloader I would leave the kernel image and an option to boot to it for at least a while in case the new kernel is broken in some way.

The XFree section of the Desktop Configuration Guide has a section on setting up your nvidia hardware acceleration - it is quite easy.

One last thing, which I am curious about: why do you have to recompile Gnome?

----------

## einstein1981

i've been using gentoo for a month now, and started as a total noob(still am!!!)

  but I now have two kernels working, and I just boot into whichever one I want to!

to compile another kernel all you have to do is:

emerge it

change the symlink to it

compile it to your linking

mount /boot

copy the system map and bzimage ( use a diferent name , to have two kernels!!) ie: if you have now working vanillasources-2.4 and want to use gentoo dev sources, all you have to do is :

once you've compiled and changed the symlink ( check chapter 7 of theinstalation handbook)

mount /boot

cp System.map /boot/System.map-2.6 (just an example, use the name you want)

cp arch/i386/boot/bzimage /boot/kernel-2.6 ( again just an example use the name you want)

then to get gnome or kde going

emerge nvidia-kernel

emerge nvidia-glx

add the entry to your grub.conf file

reboot and enjoy!!

hope this helps

----------

## iverson0881

if you running a 2.6 kernel you can just:

mount /boot

make install

that will automatically do all that bzimage and system.map junk for you. so you can do that right after you compile your new kernel.

iverson0881

----------

## Rainmaker

 *iverson0881 wrote:*   

> if you running a 2.6 kernel you can just:
> 
> mount /boot
> 
> make install
> ...

 

you're forgetting make.

For 2.6 kernels:

```

emerge [sources]

cd /usr/src

rm linux

ln -s [sources-directory] linux

cd linux

make menuconfig

make

make install

mount /boot

cp ../arch/i386/boot/bzImage /boot/kernel-yournewname

```

For 2.4:

```

emerge [sources]

cd /usr/src

rm linux

ln -s [sources-directory] linux

cd linux

make mrproper

make menuconfig

make dep

make bzImage && make modules modules_install

cp ../arch/i386/boot/bzImage /boot/kernel-yournewname

```

After these steps, configure your bootloader and reboot

----------

## iverson0881

hehe i was just talking about after the kernel is built =P

----------

## pjp

Moved from Installing Gentoo.

----------

## patientzero

Hi

Ok, when i installed my gentoo box i picked some ati driver options for my kernel and gnome hasn't been able to deal with my nvidia geforce 3 ti at all for any acceleration- i just assumed that since i need to compile a new kernel doing this process:

Code (according to Rainmaker):

emerge [sources] 

cd /usr/src 

rm linux 

ln -s [sources-directory] linux 

cd linux 

make mrproper 

make menuconfig 

make dep 

make bzImage && make modules modules_install 

cp ../arch/i386/boot/bzImage /boot/kernel-yournewname 

Is there anything noobie-ish that was left out of this process... I run lilo for my boot loader so I'd like to be able to run this messed up (3d acceleration-wise) kernel as well as my newly compiled kernel till i get the new one straightened out- i see a "rm linux" command line and i was wondering if they rm's my current kernel's stuff? I'm a little nervous about doing this as my pc had a rough time dealing with the gentoo isntall the first time since i need to dual boot xp as well (until i get this new kernel moving)

Thanks for all your help and patience! Really, you guys rock!

----------

## einstein1981

your current kernel is on /boot/kernelx-y.z ( the name you gave it)

and /boot/System.mapx-y-y

so as long as you don'T overwrite these files, you will still be able to boot it.

the /usr/src/linux

is only a symlink ( which you change to your linking) it's a way of telling your system, that any changes you do ( like emerging kernel specific stuff) will only affect the kernel to which the symlink is pointing to!!

so change the simlink with the command and recompile your new kernel, then DON'T FORGET TO MOUNT /BOOT anc copy the new System.map, and bzimage, with diferent names as the one that you had before...so that you don't overwirte it...

now I don't understand, do you have nvidia or ati???

 *Quote:*   

> ati driver options for my kernel and gnome hasn't been able to deal with my nvidia geforce 3 ti at all for any acceleration-

 

if you have nvidia, don't touch anything from ati

just run the xf86 config script again, create a new file using the generic nvidia drivers,

then emerge nvidia-kernel and nvidia-glx ( this is necesary because it's kernel specific, which means that even if you have a working kernel and want to have another , you need to reemerge the nvidia-kernel and nvidia-glx with the symplink pointing to your new kernel)

then

you must then edit two lines in the config file that was generated by the script:

set glx, on, and dri off,

and change, Driver from "nv " if you used the default n vidia driver in the xf86 srcipt, to

"nvidia" 

that should get the acceleration going

keep us informed, 

if i' m not making myself clear, tell me

----------

## einstein1981

by the way, you only have to edit the config file for xfere once, even if you have a new kernel..

you just have to reemerge nvidia-kernel, nvidia-glx, is optional , you can reemerge both, I like doing both to keep them up to date.

----------

## patientzero

"the /usr/src/linux 

is only a symlink ( which you change to your linking) it's a way of telling your system, that any changes you do ( like emerging kernel specific stuff) will only affect the kernel to which the symlink is pointing to!! "

so if i rm linux and the ln -s linux does that mean my current kernel is out of comission on reboot?

----------

## einstein1981

no, it just means that when you emerge something that get's linked to the kernel it will be linked to the kernel that is referenced by the symlink...

so the only thing that you need to boot your old kernel is the image and system map that are in /boot

----------

## patientzero

hi

after i get through make menuconfig and pick all the right options (like athlon xp processor, etc) i'm supposed to run a make dep then make bzImage && make modules modules_install 

when i do that make bzImage line, it starts and then i get some errors: here they are:

sched.c:461:1: warning: "/*" within comment

sched.c: In function `set_cpus_allowed':

sched.c:1465: error: structure has no member named `cpus_runnable'

sched.c:1468: error: structure has no member named `processor'

sched.c:1475: error: structure has no member named `cpus_runnable'

sched.c: At top level:

sched.c:2122: error: redefinition of `set_cpus_allowed'

sched.c:1454: error: `set_cpus_allowed' previously defined here

make[2]: *** [sched.o] Error 1

make[2]: Leaving directory `/usr/src/linux-2.4.20-gaming-r9/kernel'

make[1]: *** [first_rule] Error 2

make[1]: Leaving directory `/usr/src/linux-2.4.20-gaming-r9/kernel'

make: *** [_dir_kernel] Error 2

Any ideas ??

----------

## einstein1981

check the simetric multiprocesors options! and of course the cpu config, in make menuconfig

----------

## meowsqueak

 *einstein1981 wrote:*   

> no, it just means that when you emerge something that get's linked to the kernel it will be linked to the kernel that is referenced by the symlink...

 

Proper compilation uses the /lib/modules/`uname -r`/build symlink rather than relying on /usr/src/linux - which is obsolete and has been for a while, but I notice some packages still rely on it. The relevant developers should know better...

----------

## patientzero

Ok

so i un-*'d the symmetric processor's option and double checked that my cpu was selected (athlon xp) which it was... i got further through the make bzImage line, but I got errors again:

In file included from /usr/src/linux-2.4.20-gaming-r9/include/linux/interrupt.h:45,

                 from ksyms.c:21:

/usr/src/linux-2.4.20-gaming-r9/include/asm/hardirq.h:41:1: warning: "synchronize_irq" redefined

In file included from /usr/src/linux-2.4.20-gaming-r9/include/linux/modversions.h:131,

                 from /usr/src/linux-2.4.20-gaming-r9/include/linux/module.h:21,                 from ksyms.c:14:

/usr/src/linux-2.4.20-gaming-r9/include/linux/modules/i386_ksyms.ver:102:1: warning: this is the location of the previous definition

make[2]: *** [ksyms.o] Error 1

make[2]: Leaving directory `/usr/src/linux-2.4.20-gaming-r9/kernel'

make[1]: *** [first_rule] Error 2

make[1]: Leaving directory `/usr/src/linux-2.4.20-gaming-r9/kernel'

make: *** [_dir_kernel] Error 2

What have i dont now ? lol

----------

## einstein1981

don't disable it, sorry for that, it's just that I don't know why I though of that, but it's enabled, just check that under it there isn't something like 80, mine is set to 8 and it works fine\

and retry

I really don't understand that error...  :Embarassed:   sorry..

maybe you should emerge unmerge your source , and retry emerging a new one!

----------

## einstein1981

```
Proper compilation uses the /lib/modules/`uname -r`/build symlink rather than relying on /usr/src/linux - which is obsolete and has been for a while, but I notice some packages still rely on it. The relevant developers should know better...
```

didn't know that...  thanks!

----------

## meowsqueak

You could try a 'make mrproper' in your kernel source root directory, but make a backup of .config first, as it will be removed. Then copy your backup of .config back in, and try building again.

You don't need SMP support if you only have a uniprocessor machine.

Edit: sorry, that should be 'make mrproper' not 'make distclean'. Correction made.

----------

## patientzero

make distclean

did the trick... i just cp's my bzImage to /boot/kernel-jim3d and System.map-jim3d

in my lilo.conf do i specify a /boot/initrd-jim3d - if i've named my kernel, kernel-jim3d ?

----------

## einstein1981

you should always change it if you renamed it

----------

## patientzero

now i'm having autoload modules problems...

i've done a modules-update and a update-modules ... 

but things still crap out... more importantly i cant run my netowrk to get my emerge going ... ideas?

I'm running an asus a7n8x delux motherboard with onboard nics... two of them.... the nvidia and 3com...

crud

so close but sofar- although my nvidia works- i saw the logo while running startx...!!

----------

## einstein1981

if you saw the logo , then you are ok!!!

did you copy the netconf when you were doing the live cd?

did you add the support for your network card in the kernel. if so 

did you do it as a module?

if so did you rc-update add eth0 default

you are on your way, great!

----------

## patientzero

Hey

ok

so i'm onlione and in gnome... but the rest of my modules still aren't loading..

grr... how's this work?

----------

## einstein1981

which modules?

whats the ouput of lsmod?

----------

## duderonomy

patientzero: Did you get this sorted out? If so could you post a follow-up?

That'd be cool. 

I came to this thread with similar issues. Looks like the "remerge" of the

two nvidia packages, nvidia-glx and nvidia-kernel is what I need to do. 

However, somewhere along the way (reading forums) I got the impression 

the remerge of the nvidia modules is optional after building new kernel. 

Seems like it would be optional as the shared libraries for the nvidia stuff 

are still in /usr/lib, IIRC.

Also, if there is a discussion about the SystemMap and why it is necessary, 

then please post a link. I'd like to learn more. 

Cheers,

D

----------

## GhostBear

A quick combination of all the steps listed above  :Wink: 

2.4 Kernels:

```

emerge YourKernel

cd /usr/src/linux

cp .config /usr/src/linux-2.4-VersionYouJustEmerged

cd ..

rm linux

ln -s linux-2.4-xx-xxx linux

cd linux

make menuconfig

*Check all the settings now, add anything new that you want. Save & Exit*

make dep && make clean bzImage modules modules_install

*compiling....*

cd /usr/src/linux/arch/i386/boot

mount /dev/hda1 /boot          ** /dev/hda1 is whatever your boot partition is **

cp bzImage /boot         ** this may overwrite your old kernel if it's also named bzImage. Rename it if you want to keep both.*

nano -w /boot/grub/grub.conf            *Update your boot loader (grub here) to load the new kernel file, if the filename has changed*

cd /

umount /boot

reboot

```

2.6 Kernels are almost exactly the same.  Except, instead of typing that monster "make dep...." command, all you need is:

```

make && make modules_install

```

ALSO: If you're upgrading from a 2.4 to a 2.6 kernel DON'T copy the .config file.  The kernel's changed too much for your config to just carry over, you'll have to re-select all your options again.  Once you've successfully rebooted using the new kernel, you'll probably need to re-emerge your video drivers (either nvidia-kernel or ati-drivers depending on your card).  Easily done.  And, check your /etc/modules.autoload.d/kernel-2.X file that all your modules are being correctly loaded on boot.

Rawr   :Cool: 

----------

