# Broken Kernel or Recompile

## Lox

I am moderately new to gentoo, moved here from debian and I must confess I have been using debians make-kpkg tools for kernel rebuilds for far too long and have lost the skills to do it manually.. 

I happily built my kernel the first time round (for install), however the second time round when I was compiling to add some extra things as modules I decided to compile ext3 (my filesystem) into the kernel rather than as a module (which it was initially).

I did this:

 *Quote:*   

> 
> 
> make menuconfig
> 
> make dep && make clean bzImage modules modules_install
> ...

 

exactly like I did in the install process. When I went to comy my /boot/bzImage to /boot/bzImage.orig I found that I couldn't mount /boot because there was no longer the ext3 module in the system. 

I rebooted with the install cd, figuring I would mount /boot and / and do the copy from there... Unfortunately the newly compiled bzImage wasn't there  :Sad:  At this point I started from scratch...

In future how should I recompile the kernel? Under debian the deb used to ask me to back up the modules so it didn't overwrite them.. Should I clean out /usr/src/linux before every kernel recompile?

 :Crying or Very sad:  Sorry for the long post[/quote]

----------

## AutoBot

No you shouldn't have to clean anything, this always works for me:

```

su

cd /usr/src/linux

make menuconfig

make && make clean bzImage modules modules_install

mount /boot

mv /boot/bzImage /boot/bzImage.old

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

umount /boot

reboot

```

----------

## rommel

did you run as root the command to mount the partition that you boot is on....like for me 

#mount /dev/hde1

then to see if its mounted you could cd to the /boot dir or just ls /boot and see if you see grub adn bzImage there

it should work but gentoo umounts the boot partition for safty reasons after the system comes up...so it would have to be remounted to cp or mv the bzImage around

----------

## AnimalMachine

I'm guessing that when you did the "make modules_install" part you ended up wiping out your old directory of modules, no? 

See, generally "make modules_install" is safe IFF the version numbers of the kernel changed. When version numbers change, new modules go in a new directory automatically, and old ones stay where they are. If you're compiling just a new patch level of a kernel version, the modules will get installed to the same module directory - but not before the old ones are erased. To be extra safe, you must make a backup copy of "/lib/modules/<version>". I'm not sure how to get a backup bzImage to use something other than the default module directory though ...

For your particular problem, you could try mounting your /boot partition before doing make modules_install ... this way the module is already in memory and locked, so it won't matter if it gets deleted off the fs (unless you've messed up something with the kernel  :Wink: ). But if you've already deleted the ext3 module, just recompile things with ext3 as a module (temporarily), mount /boot, recompile with ext3 built into the kernel, then setup bzImage - grub - modules and reboot.

I use "make dep && make bzImage modules modules_install" for my kernel ... I don't think I ever "make clean" unless I'm trying to save space. This may not be the proper way to do it, but so far it's worked for me.

----------

