# kernel compiling

## whitenoise

I need to recompile kernel to include some thing that I exclude during first time install.

I have to do:

make xconfig

make dep

make bzImage

make modules

make modules_install

cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage

Is OK?

Thanks in advance.

----------

## lx

well my choice is make menuconfig instead of xconfig, but its oke.  (well you can do a make clean after dep, but it ain't needed) 

Remember to mount /boot before copying!!!!.  And for recompiling you need to backup the .config file do a make mrproper and copy the config file back, this will take care of some strange errors and dependency problems.

Enjoy, lX   :Wink: 

----------

## leej

Things I would consider doing before, during and in addition too...

Copy your kernel .config file to ~/  Eg.

```
cp /usr/src/linux/.config ~/
```

Then clean your source tree:

```
make mrproper
```

Also, move your /lib/modules/2.* to prevent any unresolved dependencies.  Ie. I'm using the xfs-sources, so I'd have to backup /lib/modules/2.4.18-xfs.  Eg.

```
mv 2.4.18-xfs 2.4.18-xfs.old
```

Now copy your ~/.config back to your source directory.

```
cp ~/.config /usr/src/linux
```

Then proceed....

 *Quote:*   

> 
> 
> make xconfig 
> 
> 

 

Then...

```
make dep && make clean bzImage modules modules_install
```

Before copying over your bzImage, make sure the /boot partition is mounted (it isn't in the default Gentoo fstab file).

Eg. my boot partition is on hda1 so...

```
mount /dev/hda1
```

If you do a 

```
ls /boot -al
```

 you should now see the existing bzImage, grub directory and /boot symlink.

 *Quote:*   

> 
> 
> cp /usr/src/linux/arch/i386/boot/bzImage /boot/bzImage
> 
> 

 

Correct!  Remember to reinstall alsa-driver and nvidia-kernel if you're using them (along with any other kernel drivers you had to install separately).

HTH

----------

## whitenoise

thank you!!!

I'm going.....

----------

## whitenoise

booted!!!! thank you!!!

Gio

----------

## strife

Is this a known issue or *not an issue* that you have to emerge nvidia drivers after every kernel re-compile?   It is becoming quite the annoyance to keep doing this when you want to tinker with the kernel.

----------

## Xaanin

Strife: It's well known that you have to do that. Not sure why but you just have to =)

----------

## leej

 *strife wrote:*   

> Is this a known issue or *not an issue* that you have to emerge nvidia drivers after every kernel re-compile?   It is becoming quite the annoyance to keep doing this when you want to tinker with the kernel.

 

It's not an issue at all.  When you rebuild the kernel you're indulging in a pretty low level task.  If you change any modules, any modules installed separately may no longer be correctly linked.  If you've installed a brand new kernel, they definitely wont be correctly linked anymore because they weren't built against the new kernel.  Therefore any kernel-level module (eg. alsa-driver, nvidia-kernel, etc.) has to therefore be remerged after you've built your kernel.

Doesn't matter whether you're using Suse, Red Hat, Gentoo or Slackware.  If you rebuild the kernel, you have to reinstall any additional kernel-modules afterwards.   :Smile: 

In the case of Suse & Red Hat though, Yast or Up2date will generally look after the user and do all of this for them.  In Gentoo of course, we opted to build our machines from the base up and this is the kind of basic package maintenance I think we have to expect to do.

Of course, it would be nice if Portage made a list of kernel-level drivers and told us to reinstall them...although of course that would be difficult considering Portage doesn't actually rebuild your kernel.  It just provides the sources.

Perhaps a kernel-module-update script is in order to remind users what kernel-level modules installed will need reemerging afterwards?  :Smile: 

----------

