# [SOLVED] recompiling kernel for upgrade

## jtgd

Sorry for asking such a simple question, but I really have searched for the answer.  Probably you can point me to the right doc/forum/wiki page.

I installed 2005.0 in Feb 2005 running 2.6.11-gentoo-r3.  After re-compiling the world per this thread I'd like to get my kernel up to date.  I did emerge gentoo-sources and got  2.6.16.  When I run genkernel, it just compiles 2.6.11 again.  How do I make it compile the new one?  Also, how do I make sure that I can reboot to the old kernel if it doesn't work?

----------

## felicehome

It's because you haven't set the symlink to your new kernel-sources.

I suggest reading this: http://www.gentoo.org/doc/en/kernel-upgrade.xml

cheers felice

----------

## jtgd

Thanks much felicehome, that was the page I was looking for.  Dunno why I couldn't find it in my searches.

I have followed the guide and done the following:

```
cd /usr/src

ls -s linux-2.6.16-gentoo-r2 linux

genkernel all
```

and that seemed to go well (no errors).

Then I followed the link for updating grub and editted my /boot/grub/grub/conf, which was

```
default 0

timeout 30

title=Gentoo linux 2.6.11

root (hd0,0)

kernel /kernel-2.6.11-gentoo-r3 root=/dev/sda3

```

so I added to make it this:

```
default 0

timeout 30

title=Gentoo linux 2.6.11

root (hd0,0)

kernel /kernel-2.6.11-gentoo-r3 root=/dev/sda3

title=Gentoo linux 2.6.16

root (hd0,0)

kernel /kernel-genkernel-x86_64-2.6.16-gentoo-r2 root=/dev/sda3

```

but that just made grub hang and not boot at all, so I figured it either didn't like the blank lines or it didn't like having 2 entries and I changed it to simply:

```
default 0

timeout 30

title=Gentoo linux 2.6.16

root (hd0,0)

kernel /kernel-genkernel-x86_64-2.6.16-gentoo-r2 root=/dev/sda3

```

When that booted I got the error

```
VFS: cannot open root device "sda3" or unknow -block...

please append a correct "root=" boot option
```

I recall having that problem when I installed a year ago but not sure how I fixed it.

I restored the old grub.conf and rebooted ok in the old kernel.

It seems odd that the only change was the name of the kernel and it fails.  Is this a problem in the way I compiled the kernel, or the way I configured grub?  How do I permit booting either kernel (until I am sure the new one is good)?  The grub docs do not describe dual kernels.

----------

## felicehome

Booting to multiple kernels should be possible. I also had problems booting from sata. But I can't recall if I had exactly the same error message you had. Try another syntax (with kernel (hd0,0) in front of your kernel bootline). Mine looks like this: 

```
default 0

timeout 30

#splashimage=(hd0,0)/boot/grub/splash.xpm.gz

#vga=0x31B video=vesafb:mtrr,ywrap

title=Gentoo Linux 2.6.16

kernel (hd0,0)/kernel-2.6.16-opt root=/dev/sda3

title=Last working Kernel

kernel (hd0,0)/backup root=/dev/sda3 

```

cheers felice

----------

## jtgd

Thanks, unfortunately that didn't change anything.

After reading info grub some more I played with the "fallback" stuff some but that didn't work well.  I now am using:

```
default 0

timeout 35

title Gentoo Linux 2.6.16

root (hd0,0)

kernel (hd0,0)/kernel-genkernel-x86_64-2.6.16-gentoo-r2 root=/dev/sda3 real_root=/dev/sda3

title Gentoo Linux 2.6.11

root (hd0,0)

kernel (hd0,0)/kernel-2.6.11-gentoo-r3 root=/dev/sda3 real_root=/dev/sda3

```

and that at least displays a proper grub menu and lets me try to boot into either kernel.  It's the first modified grub.conf that let me get back into the old kernel.  But when booting the new kernel I get this error:

```
VFS: Cannot open root device "sda3" or unknown-block(0,0)

Please append a correct "root=" boot option

Kernel panic - not syncing: VFS: unable to mount root fs on unknown-block(0,0)
```

What do you think they mean by "unknown"?  Is that a clue?

----------

## troymc

```
VFS: Cannot open root device "sda3" or unknown-block(0,0) 
```

I would say that this is indicative of your kernel not having drivers for you HDD interface.

I hand-configure all my kernels, so I don't understand genkernel very well, but you need to make sure that it is including your SCSI or SATA drivers.

Maybe someone who understands genkernel could explain how to do this.

troymc

----------

## wrc1944

Your grub.conf looks correct. It's probably that you don't have sata support compiled into the kernel. Check your kernel config file, and look under SCSI low-level drivers.

This is the old one- it should NOT be set.

# CONFIG_BLK_DEV_IDE_SATA is not set

This is what you need to set now (via is just an example from my system- select support for your own chipset)

# SCSI low-level drivers

CONFIG_SCSI_SATA=y

CONFIG_SCSI_SATA_VIA=y

CONFIG_SCSI_SATA_ACPI=y

Genkernel is not the most reliable method- you really need to compile kernels yourself. It's very easy, but you need to know your hardware.

----------

## a7thson

 *Quote:*   

> title Gentoo Linux 2.6.16
> 
> root (hd0,0)
> 
> kernel (hd0,0)/kernel-genkernel-x86_64-2.6.16-gentoo-r2 root=/dev/sda3 real_root=/dev/sda3 

 

where is the initramfs getting loaded?  it needs to be appended to the grub.conf entry.  I've never used genkernel without having to include the initramfs it creates during the install process.  I would assume you need to copy the initramfs that genkernel has created, and place it somewhere where Grub can find it, such as your /boot which is apparently (hd0,0).  Without this the genkernel will not work, as far as I'm aware.  Rename as appropriate, and place this somewhere where Grub can find it, then tell Grub to append it after booting the genkernel so it can do its autodetection and module loading.

something like:

```

title Gentoo Linux 2.6.16 (genkernel)

kernel (hd0,0)/kernel-genkernel-x86_64-2.6.16-gentoo-r2 root=/dev/ram0 real_root=/dev/sda3

initrd (hd0,0)/initramfs-genkernel-x86_64-2.6.16-gentoo-r2

```

----------

## wrc1944

a7thson is correct, genkernel makes an initrd. Since he didn't show one in grub.conf for his 2.6.11 kernel, I assumed he wasn't using one.

I'd be interested in knowing if "genkernel all" sets proper sata support built in the kernel?

----------

## a7thson

at least as of genkernel 3.3.11d, the default kernel config for x86_64 includes:

```

# CONFIG_BLK_DEV_IDE_SATA is not set

CONFIG_SCSI_SATA=y

CONFIG_SCSI_SATA_SVW=m

CONFIG_SCSI_ATA_PIIX=m

CONFIG_SCSI_SATA_NV=m

CONFIG_SCSI_SATA_PROMISE=m

CONFIG_SCSI_SATA_SX4=m

CONFIG_SCSI_SATA_SIL=m

CONFIG_SCSI_SATA_SIS=m

CONFIG_SCSI_SATA_VIA=m

CONFIG_SCSI_SATA_VITESSE=m

```

and the modules it tries are:

```
MODULES_SATA="sata_promise sata_sil sata_sil24 sata_svw sata_via sata_nv sata_sx4 sata_sis sata_uli sata_vsc sata_qstor ahci ata_piix sata_mv pdc_adma"
```

So I would think 'genkernel all' would work fine from the initrd autodetection script.  But haven't tested it since 2.6.11 over a year ago, several genkernel versions back, on an Inspiron 9300 (SATA-based Dell laptop).

this one:

 *Quote:*   

> CONFIG_SCSI_SATA_ACPI=y 

 

I didn't see at all, I'm assuming it's a newer (>2.15) kernel option?  It's not part of the genkernel default config.

 *Quote:*   

> Since he didn't show one in grub.conf for his 2.6.11 kernel, I assumed he wasn't using one. 

 

Does genkernel work in any cases without one?  I know there's an option to only build the kernel but assumed this is for someone wanting to build a custom init ramdisk on their own.  Am I wrong here?

----------

## sundialsvc4

Personally, I'm not too much of a fan of genkernel:  it may be fine for setting up the initial configuration, but I feel strongly that you ought not continue to rely upon it.  In other words, don't let it remain "a mysterious black box."  The same could be said of kernel-building in general.  It's very tempting to say...   :Shocked:  "ooh, it's the kernel!"  :Shocked:  ... but the kernel is really not fundamentally different from any other program you might build.  

One of the best ways to get familiar with the kernel is to allow genkernel to do its magic as the first pass through the process, then go back and study just what it did.  Learn, then, how to refine it.

----------

## wrc1944

 *Quote:*   

> and the modules it tries are: 
> 
> Code:
> 
>   MODULES_SATA="sata_promise sata_sil sata_sil24 sata_svw sata_via sata_nv sata_sx4 sata_sis sata_uli sata_vsc sata_qstor ahci ata_piix sata_mv pdc_adma"

 When you do it yourself, there's no reason to build any modules you'll never need.

 *Quote:*   

> So I would think 'genkernel all' would work fine from the initrd autodetection script. But haven't tested it since 2.6.11 over a year ago, several genkernel versions back, on an Inspiron 9300 (SATA-based Dell laptop). 

 

You would think so, but it's my experience it doesn't always get everything- I never use it anyway for about three years.

 *Quote:*   

> Quote:
> 
>   CONFIG_SCSI_SATA_ACPI=y 
> 
>    I didn't see at all, I'm assuming it's a newer (>2.15) kernel option? It's not part of the genkernel default config.

 

 yeah- 2.6.16. 

 *Quote:*   

> Does genkernel work in any cases without one? I know there's an option to only build the kernel but assumed this is for someone wanting to build a custom init ramdisk on their own. Am I wrong here?
> 
> 

 

The few times I used it, it made an initrd.

----------

## a7thson

 *Quote:*   

> When you do it yourself, there's no reason to build any modules you'll never need. 

 

Exactly.  I found genkernel most useful when wanting to deal quickly with a new system, but anymore I'd prefer to just boot it into a livecd, Knoppix being great for this as well as a Gentoo LiveCD, then capture the relevant hardware information, and move along to configuring a kernel manually for the system.

 *Quote:*   

> 
> 
> >Does genkernel work in any cases without one? I know there's an option to only build the kernel but assumed 
> 
> > this is for someone wanting to build a custom init ramdisk on their own. Am I wrong here?
> ...

 

Likewise.  I'm assuming it would break without one.  We have yet to hear from the original poster however, so it's probably not useful to speculate too much more until/if we see some feedback.

----------

## jtgd

Thank you everyone for your advice.

I do have the new kernel booting now.  The problem was that when I had run genkernel before I did not do the  --menuconfig  (since the web page I was going by didn't mention it) so it, I guess, used the old config (I recall seeing that message).  So I ran with menuconfig and set some things that I thought reasonable.

The problem I am having at the moment is with nvidia.  It does not work and when I try compiling any of nvidia-kernel, nvidia-gls, nvidia-glx it complains that there is a conflict because nvidia is built into the kernel.  X wil not start saying there is no drivers or something.

So should I remove the nvidia drivers from the kernel and do it the way I did it before (I emerged nvidia-* in my current 2.6.11) or should I do something else to make it work with it compiled into the kernel?

----------

## troymc

 *jtgd wrote:*   

> 
> 
> The problem I am having at the moment is with nvidia.  It does not work and when I try compiling any of nvidia-kernel, nvidia-gls, nvidia-glx it complains that there is a conflict because nvidia is built into the kernel.  X wil not start saying there is no drivers or something.
> 
> So should I remove the nvidia drivers from the kernel and do it the way I did it before (I emerged nvidia-* in my current 2.6.11) or should I do something else to make it work with it compiled into the kernel?

 

Yes, remove the nvidia framebuffer from the kernel and use those nvidia-xxx packages. Use the vesafb for your framebuffer.

```
Device Drivers  --->

      Graphics support  --->

              <*>   VESA VGA graphics support

                    VESA driver type (vesafb)  --->

              < > nVidia Framebuffer Support
```

troymc

----------

## jtgd

AWESOME!

Thanks dude, that did it.  I'm back up.

Hello world from 2.6.16!

I have other issues, but they are for other threads.

----------

