# Two Kernel Questions

## SilentGreg

Hey everyone, I have two kernel questions, hopefully they can both be answered.  Both relate to my Dell Inspiron 5100 laptop.

1. After I emerge gentoo-dev-sources, kernel 2.6.9, how do I emerge nitro sources, or patches, however you look at it.  I know that I have to download the .ebuild and place it in /usr/local/portage/sys-kernel/nitro-sources and then running the command: emerge /usr.../whatever.ebuild Is that all? Do I have to emerge the kernel, set /usr/src/linux then emerge the patches?  This is only a guess, I just need some varification.  I assume next I would run the menuconfig and then compile, and lastly copy over the image.

2.  On my laptop, if I boot up with a Knoppix CD and I select the 2.6.x kernel, everything, with the exception of my wireless card works fine. This includes suspension or sleeping to disk and detecting how much battery power I have left.  I can however get my wireless card working with the nitrosources.  Anyway, my question is: how can I, if there is a way, boot into Knoppix and then somehow get the kernel configuation that was used upon boot time?  If I could somehow grab the configuration and then use it when I am compiling my own kernel during the Gentoo install, that would be a HUGE plus.  Thanks!

Greg

----------

## Kompi

@1st question: gentoo-dev-sources is an already patched kernel, portage does this for you. nitro is also a already patched kernel after emerge.

So if you want to use a kernel patched with nitro-patches, you do not need to emerge gentoo-dev-sources. Just emerge nitro-sources. 

If you don't need additional patches, which aren't included in nitro-sources, you can go on setting the link to /usr/src/linux, make menuconfig and so on.

@2st question: Kernels since the 2.6.xx-series support compiled in kernel-configuration. The corresponding options are found in section "General Setup":

 *Quote:*   

> [*] Kernel .config support 
> 
> [*] Enable access to .config through /proc/config.gz

 

Hopefully these options are enabled in your knoppix kernel. Then you should find your configuration in /proc/config.gz.

For details read what the option-help gives us:

 *Quote:*   

> CONFIG_IKCONFIG:                                                                                                                    
> 
> This option enables the complete Linux kernel ".config" file                                                                        
> 
> contents to be saved in the kernel. It provides documentation                                                                       of which kernel options are used in a running kernel or in an                                                                        on-disk kernel.  This information can be extracted from the kernel                                                                    image file with the script scripts/extract-ikconfig and used as                                                                      input to rebuild the current kernel or to build another kernel. It can also be extracted from a running kernel by reading /proc/config.gz if enabled (below). 
> ...

 

----------

## bendagr8

1. 

download nitro-sources*.ebuild, place in /usr/local/portage/sys-kernel/nitro-sources. Go change directory over to there and then add the following line to /etc/make.conf

```

PORTDIR_OVERLAY="/usr/local/portage"

```

then digest the ebuild

```

ebuild ./nitro-sources*.ebuild digest

```

then 

```

emerge ./nitro-sources*/ebuild

```

The nitro-sources ebuild will compile the appropriate kernel and then apply the appropriate patches. Change the symlink in /usr/src to point to the new kernel, and you should be set.

2. I would imagine there should be a .config or some a system-map file on the CD. This should have the info you need. There is probably a better way, but I don't know it.

EDIT: I was kind of in a rush before. The emerging of the nitro sources doesn't compile the kernel in the sense that you get the bzImage. But it should create everything you need to compile it in your /usr/src/nitro-sources* directory.Last edited by bendagr8 on Sun Oct 24, 2004 12:28 am; edited 1 time in total

----------

## SilentGreg

Excellent, this should get me started on converting my laptop over to Gentoo. Now I just need that other factor, TIME.

----------

## seppe

actually, the correct way emerging nitro-sources is like this:

PART 1: EMERGING NITRO-SOURCES

1. download the ebuild

2. add this to /etc/make.conf if it isn't already there:

```

PORTDIR_OVERLAY="/usr/local/portage"

```

3. Make the nitro-sources directory in the portage overlay if you haven't done it before:

```

mkdir -p /usr/local/portage/sys-kernel/nitro-sources

```

4. Move the ebuild from the directory where you've downloaded it to the nitro-sources directory in your portage overlay

```

mv /path/to/nitro-sources-2.6.9-r1.ebuild /usr/local/portage/sys-kernel/nitro-sources

```

note: change the version to the version you've downloaded  :Smile: 

5. Change the directory to nitro-sources in your portage overlay:

```

cd /usr/local/portage/sys-kernel/nitro-sources

```

6. Create the digest file for this nitro-sources release, in this step all the files that are needed for nitro-sources will be downloaded as well (mostly the linux kernel + the nitro-sources patch set itself)

```

ebuild nitro-sources-2.6.9-r1.ebuild digest

```

7. Emerge nitro-sources, in this step will the linux kernel be automaticly installed and patched with the nitro sources patch set

```

emerge nitro-sources

```

Now you have this nitro-sources release ready in /usr/src/linux-2.6.9-nitro1

(note: change version to the one you installed).

Then you to compile this kernel ...

PART 2: COMPILING NITRO-SOURCES

1. Copy over the .config file of your previous kernel. When you do this, you don't need to configure everything again  :Smile: 

```

cd /usr/src/

cp linux/.config linux-2.6.9-nitro1/

```

2. Let the /usr/src/linux symlink point to your nitro-sources kernel:

```

rm linux

ln -sf linux-2.6.9-nitro1 linux

```

note: you still need to be in /usr/src of course  :Wink: 

3. Go in to the kernel directory:

```

cd /usr/src/linux

```

4. Update the config file you've copied, you will be prompted with all the new thingies from nitro-sources where you answer Y, N or M (module):

```

make oldconfig

```

5. Compile:

```

make && make modules_install

```

6. Mount your /boot partition and copy over the kernel image (bzImage) and System.map file:

```

mount /boot

cp arch/i386/boot/bzImage /boot/nitro-sources

cp System.map /boot

```

7. Now edit your grub menu and add a new entry which points to the kernel image (/boot/nitro-sources in this example)

That's it! Correct me if I'm wrong (because I still use another command to compile: make dep && make clean bzImage modules modules_install  => which is actually the old 2.4 way to compile kernels, it's a bad habbit I know but it works  :Smile: )

----------

## tuam

 *seppe wrote:*   

> 
> 
> PART 2: COMPILING NITRO-SOURCES
> 
> 5. Compile:
> ...

 

"make" includes modules. It is OK to

```
make && make modules_install
```

FF,

 Daniel

----------

## SilentGreg

I knew I should have asked the author. Thanks seppe!

Edit// Don't forget that you need to copy over the System.map file.  :Wink: 

----------

## vonloschz

Why you copy system.map and bzimage ...

I use this commande and that make all I need.

make && make modules_install && make install

just need to edit my /etc/grub.conf after.

Iam under FC2 ... maybe is different for gentoo.

----------

## iverson0881

 *tuam wrote:*   

>  *seppe wrote:*   
> 
> PART 2: COMPILING NITRO-SOURCES
> 
> 5. Compile:
> ...

 

You can also mount /boot and run "make install" to install BzImage and things.

----------

## SilentGreg

 *vonloschz wrote:*   

> Why you copy system.map and bzimage ...
> 
> I use this commande and that make all I need.
> 
> make && make modules_install && make install
> ...

 

The bzImage is the compressed kernel image, I'm not 100% sure what the System.map does but it is required under /boot and only takes a small amount of space.

----------

## bendagr8

System.map is not required.

EDIT: I thought I knew its purpose, but I was mistaken. But it's not in my boot partition, so I'm pretty certain you don't need it.

----------

## The Mountain Man

 *vonloschz wrote:*   

> make && make modules_install && make install
> 
> just need to edit my /etc/grub.conf after.

 

Actually, "make install" creates automatic links to your kernel under the name "vmlinuz" and "vmlinuz.old" for your previous kernel.  Just add these names to grub.conf and you won't even have to edit that.  Here's what my grub.conf looks like:

```
default 0

timeout 5

color white/black yellow/blue

title=Gentoo Linux (Current)

root (hd1,0)

kernel /vmlinuz root=/dev/hdb3

title=Windows

root (hd0,0)

rootnoverify (hd0,0)

makeactive

chainloader +1

title=Gentoo Linux (Previous)

root (hd1,0)

kernel /vmlinuz.old root=/dev/hdb3

title=Gentoo Linux (Safe)

root (hd1,0)

kernel /vmlinuz.safe root=/dev/hdb3
```

"vmlinuz.safe" is my own link to a known working kernel just in case I run into trouble.

----------

## SilentGreg

Then what does the System.map do? LOL

BTW, I'm about to reboot into Knoppix and see if the config file is there. Problem: how can I get this config file off of this CD or RAM space. I'm on wireless so no network access, I don't have any USB storage except a 128 meg SM card which is full to the very max.  No floppy. How can I get this config file out of Knoppix?

edit: n/m i'll mount my data drive, which is NTFS and I'll just write to that. Or is that a bad idea?

----------

## SilentGreg

*bump*

Good or bad idea to write to NTFS under Captive (with Knoppix)

 :Wink: 

----------

## Gentree

I dont understand your pb. 

config.gz is only few kb. 

You have room to install a new kernel you can find room for a small text file. 

Why risk writing the NTFS? Just mount a linux partition and save the file.

It seems you are seeing a problem when there isnot one.

 *Quote:*   

> Actually, "make install" creates automatic links to your kernel under the name "vmlinuz" and "vmlinuz.old" for your previous kernel.

 

Which is exactly why I dont use it! 

Especially if you are running fidderent patched kernels it's no help at all if they all get called vmlinuz!

I define a few aliases for swapping around between kernels:

```

alias kn='cd /usr/src && rm linux && ln -s *nitro1 linux && ls -ail linux && cd linux'

alias k266l4='cd /usr/src && rm linux && ln -s *2.6.6-love4 linux && ls -ail linux && cd linux'

alias mmk='cdlin && make menuconfig'

alias mk26='make && make modules modules_install'

alias mknitro=kn && mk26

```

so to do menuconfig on nitro I type: kn && mmk

Then mknitro

That way I know I'm always configgin the right kernel

While the new kernel is emerging I just edit my alias to fit and add a new line to grub.conf.

This way I get meaning full kernel names.

```

alias cpn='cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage-athlonXP-nitro-r1'

```

I'm sure you're all big enough to work out the datails.  :Cool: 

----------

## SilentGreg

 *Gentree wrote:*   

> I dont understand your pb. 
> 
> config.gz is only few kb. 
> 
> You have room to install a new kernel you can find room for a small text file. 
> ...

 

The problem is that there is only one big 40 gigabyte partion which is NTFS.   :Wink: 

----------

## Gentree

 *Quote:*   

>  I can however get my wireless card working with the nitrosources.

 

So where are your nitro-sources and the rest of the linux system?

Either I am not reading your post properly or you are not explaining what you're trying to do.

I think we need you to clarify if you want some help.

Writing to NTFS still seems a bit risky so you're probably best resizing , that probably means finding a copy of partition magic 8 or 9.  :Cool: 

----------

## SilentGreg

 *Gentree wrote:*   

>  *Quote:*    I can however get my wireless card working with the nitrosources. 
> 
> So where are your nitro-sources and the rest of the linux system?
> 
> Either I am not reading your post properly or you are not explaining what you're trying to do.
> ...

 

LOL. I think I really confused a few people.  I plan on moving my laptop over to Linux. Nitro-sources has the acx100 (and a few other optimizations) that I need and like for my notebook. I asked this question prior to the installation so I didn't run into any snags. At this very point in time, my laptop only runs Windows XP Professional SP2, within the next two weeks I hope to rebuild my XP partition and then install Gentoo next to it.  I still have to use Windows for a few things.   :Confused: 

Sorry about the mix-up.

Edit/ I have all the help I need now, I just need time.  :Smile: 

Edit 2/ When did Partition Magic 9 come out? I have 8, but when was 9 released?

----------

## H3g3m0n

Any reason the nitro-sources arn't included in the main portage tree? It would be much eaiser to just type emerge nitro-sources rather than have to download the .ebuild file etc.

----------

## minty

There are a few hints here, but I'm still not sure what System.map does.

I don't copy it over and things are still OK.

Pure guess time: Could it be used for profiling/debugging of the kernel, so is not needed if you don't use these options?

This thread has been very informative regarding getting 'unsupported' ebuilds onto my system.

BTW I love the word 'fidderent', it certainly is different

I've still got to find out about the portage overlay and what it does (bedtime reading), but the gist of things is very helpful.

On another note, if I want to get -mm or -ac sources onto the system

a) Does anyone already do a 'nitro-esque' ebuild for those other alternatives,

b) If I just use the ebuild files from nitro and change the patch lists, is there any hidden portage 'gotcha' to be aware of 

c) what kind of 'gentoo-specific' patches are necessary/desirable ie why aren't the gentoo sources based solely on vanilla kernels + 'vanilla' patches?

----------

## knights

just wondering...

im a n00b...

would genkernel work?

im not v confident compiling the kernel manually...

----------

## SilentGreg

 *H3g3m0n wrote:*   

> Any reason the nitro-sources arn't included in the main portage tree? It would be much eaiser to just type emerge nitro-sources rather than have to download the .ebuild file etc.

 

It's considered unstable, but it isn't.

----------

## desertstalker

I believe that system map allows the kernel crashdumps to be linked to system calls.  So that when you get an oops it can give info an where it occured in understandable format.

It is also used by ksymoops for debugging.

----------

## Guinpen

For compiling this, couldn't I simply use genkernel, newbie-like  :Smile: 

genkernal --kernel-config=whatever all

and be done with it....

EDIT: YES, it does work, and in making it work I think I stumbled upon a genkernel bug. How do I report one?Last edited by Guinpen on Mon Jan 10, 2005 3:01 am; edited 1 time in total

----------

## dsd

 *desertstalker wrote:*   

> I believe that system map allows the kernel crashdumps to be linked to system calls.  So that when you get an oops it can give info an where it occured in understandable format.

 

that is exactly what  kysmoops does, it takes the function addresses reported in an oops, looks them up in system.map, and provides a human-readable code path leading to the crash.

however this sort of functionality is now merged in the kernel - you'll probably notice if you get an oops, the function names in the call trace are listed. ksymoops isn't really needed any more, nor is system.map.

----------

