# Do I need to be an expert to compile my kernel?

## VinzC

Hi all.

Fed up!

This is my third attempt to compile my kernel and it gets even worse with each attempt. At first attempt I did get no compile errors at all. However failed with to boot in a kernel panic (keyboard leds were blinking).

Now I'm getting compile errors. Well, do I really have to be an expert to do this or what? I would just have liked to build my own kernel - first since everybody seems to do it, next to see if I'm able to. Seems I'm not  :Sad:  Finally I'd like to use ALSA for my games because genkernel seems to include OSS support, which I have to remove if I want ALSA.

Is there somewhere a step-by-step guide for the absolute dummy that I could follow? OR are there things to remove or include whatever?

Maybe I don't understand the principles behind make menuconfig... I thought all I have to do is to check what I want and what hardware is in my machine. Seems I have to include everything to make it work?... What's the best guideline to make one's kernel for the noob like me (if you tell me to stick to Genkernel, well, I'd understand)?

Here are the last error mesages I get after typing make bzImage and after I made my choices in menuconfig:

 *Quote:*   

> /include/asm-i386/page.h -Ui386 arch/i386/vmlinux.lds.S >arch/i386/vmlinux.lds
> 
> ld -m elf_i386 -T /usr/src/linux-2.4.25-gentoo-r2/arch/i386/vmlinux.lds -e stext arch/i386/kernel/head.o arch/i386/kernel/init_task.o init/main.o init/version.o init/do_mounts.o \
> 
>         --start-group \
> ...

 

What's going wrong?

Thanks in advance.

----------

## farrioth

Compile errors usually suggest a kernel bug, not a user error.

Which sources are you using?

I'd recomment to use genkernel.  Just set the kernel to use AlSA but not OSS.

I use genkernel myself.

----------

## avendesora

The 2.4 kernel series build process is not all that reliable if you change config options and just rebuild. I've had verious errors of that type.

What you should do is something like this:

```
cd /usr/src/linux

cp .config ../my.config.v22

make mrproper

cp ../my.config.v22 .config

make oldconfig

make dep

make bzImage

make modules

make modules_install
```

As for the options, the install guide is pretty good - you'll get the basics there. Then it's just a matter of experimenting.

Basics:

- compile things you need to boot into the kernel (controler drivers, root filesystem, etc...)

- compile things you need later on as modules if you want

- if you can't figure out what an option does, leave the default setting   :Wink: 

As a side note, I find the 2.6 series easier to manage. menuconfig is a bit more intuitive (I find the layout nicer). make dep doesn't exist anymore and you can safely change options and rebuild without having to clean.

----------

## VinzC

 *Quote:*   

> Which sources are you using?

 

I'm using gentoo-sources.

 *Quote:*   

> I'd recomment to use genkernel. Just set the kernel to use AlSA but not OSS.

 

Ok, then. How can I do this? I thought OSS was built-in with Genkernel? Is there a parameter I can give to Genkernel so it doesn't use OSS?

----------

## VinzC

 *mseigneurin wrote:*   

> As for the options, the install guide is pretty good - you'll get the basics there. Then it's just a matter of experimenting.

 

Well, I've followed the guide... But there are zillions of options. First when should I select a module? When should I select built-in? When do I have to... Well, potentially thousands of possibilities.

What messes me up probably is I don't know what I need absolutely (i.e. which things are required for booting properly. Also, it took me hours to browse the whole config and check/uncheck. Note I like KDE Kernel interface. It shows help at once without requiring you to press "?" each time.

 *mseigneurin wrote:*   

> Basics:
> 
> - compile things you need to boot into the kernel (controler drivers, root filesystem, etc...)
> 
> - compile things you need later on as modules if you want
> ...

 

Looks logical. Think I'll give it one more try...

----------

## farrioth

 *VinzC wrote:*   

>  *Quote:*   Which sources are you using? 
> 
> I'm using gentoo-sources.
> 
>  *Quote:*   I'd recomment to use genkernel. Just set the kernel to use AlSA but not OSS. 
> ...

 

Just select Device Drivers -> Sound -> Advanced Linux Sound Architecture -> Advanced Linux Sound Architecture.

----------

## VinzC

 *farrioth wrote:*   

> Just select Device Drivers -> Sound -> Advanced Linux Sound Architecture -> Advanced Linux Sound Architecture.

 

Huh? I've run genkernel --menuconfig --no-install all I don't see the path you're mentionning. How do you get that? (I'm running Gentoo kernel 2.4.25-r2, if it can help)

----------

## Fly3D

Also important to clean your source tree with make clean. If you don't, after a few recompiles, the errors seem to start showing up. I'd re-emerge fresh sources and give it another try. You'll get it  :Smile: 

----------

## deadaim

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=7

I recommend reading and following those instructions.

----------

## Rainmaker

 *VinzC wrote:*   

>  *farrioth wrote:*   Just select Device Drivers -> Sound -> Advanced Linux Sound Architecture -> Advanced Linux Sound Architecture. 
> 
> Huh? I've run genkernel --menuconfig --no-install all I don't see the path you're mentionning. How do you get that? (I'm running Gentoo kernel 2.4.25-r2, if it can help)

 

He's using 2.4.x

Go to "sound" Select "sound support" and then do not select "OSS".

----------

## farrioth

I'm not sure where the options are in 2.4. I'd suggest using 2.6 anyway.

----------

## lamaistres

Try:

make dep && make clean bzImage modules modules_install

----------

## VinzC

 *deadaim wrote:*   

> http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=7
> 
> I recommend reading and following those instructions.

 

I see there are only a few steps mentionned there. I suppose these are the absolutely necessary options and the remaining options should keep their default values?

 *Fly3D wrote:*   

> Also important to clean your source tree with make clean. If you don't, after a few recompiles, the errors seem to start showing up.

 

I've done that as well but errors still show up. OTOH I've unchecked several options which I believed were related to USB mouse. I didn't get the error I reported. But yet I got another one...

These are probably the errors I'm facing as there are dependencies inside the menu tree. Some are obvious and hinted but some are not  :Sad: .

Is there a blank, valid .config that I could use to overwrite mine in case it's messed up? And what config file does Genkernel use as it seems to use a different one?

 *Fly3D wrote:*   

> I'd re-emerge fresh sources and give it another try.

 

Isn't it what emerge sync && emerge world is supposed to do? Except I've selected packages I wanted with emerge -auD world, none was about the kernel.

----------

## avendesora

No, that won't do it. And you don't really need it.

To get a clean config (I mean, a default config that is known good but might not contain all you need), do this:

```
cd /usr/src/linux

make mrproper # <- this is very important

make defconfig # <- this gives a default config

make menuconfig # <- add the stuff in the install guide plus what you know you really need. nothing else.

make dep && make bzImage && ...
```

That's how I would do it. Only add what you really need (filesystems and IDE/SCSI/SATA drivers). Make the kernel, boot it. If it works, save your config and add more things you like, but do as I posted previously if you change the config (i.e. save config, clean, copy config, make oldconfig, make menuconfug).

Or try a 2.6 with which you don't have to worry about the make clean/make mrproper or make dep.

----------

## VinzC

 *mseigneurin wrote:*   

> [...]
> 
> That's how I would do it. Only add what you really need (filesystems and IDE/SCSI/SATA drivers). Make the kernel, boot it. If it works, save your config and add more things you like, but do as I posted previously if you change the config (i.e. save config, clean, copy config, make oldconfig, make menuconfig).

 

Thanks for your advice. I'll try it this way and we'll see.

----------

## theturner

i recommend using a 2.6 kernel. try mm-sources.

----------

