HowTo: Building a remote kernel with Debian

October 29, 2006

Hopefully I will coherently explain how to build a remote kernel here. I recently (well if you are reading this in echo date(‘Y’); it was a while ago) recieved an older server from and upgrade a buddy of mine did. I needed to rebuild the kernel for smp (Symetric MultiProcessing) but I was too impatient to wait for the slow processor so I decided to figure out how to build the kernel on my laptop which is 10x faster.

When I configured the kernel originally I was doing it from the server then copying the entire kernel directory over to build it. After doing that a couple times I got smart and just built it all on my laptop. Here’s what I did.

Download the kernel source that you want to use from kernel.org (Or whatever source you choose)

Unpack the tarball to ‘/usr/src’ and enter the newly created directory.

Now we are going to clean up a bit. Note that if you previously built a kernel in this directory it will be erased.

Run ‘make mrproper then ‘ make clean’

Now copy the .config file over from the remote computer. This will probably be in ‘/usr/src/linux’. If you cannot find it there try looking in ‘/boot’ for a file names config-. Some distributions such as Debian will not by default give you the sources so you have to copy the config file from ‘/boot’.

Ok this next step will integrate the config file from the remote computer into the new kernel. Run ‘make oldconfig’. If you upgrading to a new kernel you will be asked about the new features now(It could be a long list. I don’t understand most of what they ask so I just hold down the enter key ;)).

Once that is complete run ‘make menuconfig’. You can now configure the kernel to your liking. Make sure that you set the correct processor type for the remote computer. When you are finished with that press escape till you are asked to save the configuration. Hit yes.

Now is the fun part. We are going to build the kernel. Type ‘make’. Now go grab a cup of coffee and maybe order a pizza. This could take awhile.

So you got that part done and you are still with me? Good. Now we have to install the newly built kernel.

Debian has a really nifty simple way to do this. You will need to apt the kernel-package and libdb3-dev packages.

Still in the kernel source directory run
make-kpkg kernel-image

After scrolling a bunch of jibberish your new kernel will be collected into a debian package one directory up from the kernel source directory.

To install the kernel run ‘dpkg -i kernel-image-*.deb’

Follow any instructions that may come up and reboot.

Note that debian will keep your old kernels so if this one does not work just select your old one to get your system back.

TROUBLESHOOTING
If you are using Debian and you get this error when you boot to your new kernel try adding ‘–initrd’ to your ‘make-kpkg’ options:

VFS: Cannot open root device “hdxX” or unknown-block(X,X)
Please append a correct “root=” boot option
Kernel panic – not syncing: VFS: Unable to mount root fs on unknown-block(X,X)

Leave a Reply

Your email address will not be published. Required fields are marked *