Compiling your own Linux kernel
This is very abbreviated and there are many more thorough guides than this, but this works for me.
This guide is for compiling a kernel for Debian linux!
SERIOUS DISCLAIMER: this works for me. I cannot be held responsible if it does not work for you.
Get the version of the kernel you desire from http://kernel.org
Unpack the archive to /usr/src/[your new kernel version]
Remove the old symbolic link to your old kernel source if it exists:
Make sure it is a link you're removing and not your old kernel source! (Unless you want to do this)
rm /usr/src/linux
Link the new kernel source to the new source directory:
ln -s /usr/src/ /usr/src/linux
Change to the new /usr/src/linux directory
Now you'll need to repeat the following for each time you recompile.
First clean up your environment:
make mrproper
make clean
Copy your previous kernel's config to your new kernel source:
cp /boot/.config /usr/src/linux
Now configure your new kernel:
Either make menuconfig (in a console) or make xconfig from a console to launch a GUI session (you'll need QT installed).
Now run make-kpkg kernel_image to create the Debian package containing your new kernel.
Change to the parent directory cd /usr/src
Run DPKG to install the new kernel dpkg -i kernel-image-[your kernelversion]
Now a very cool trick. If you've just compiled your new kernel on a server somewhere in a backroom through a remote session, your nightmare would be a kernel panic locking up the machine and necessitating a hard reboot and manual selection of another kernel on the server console.
This assumes your Debian package has installed your new kernel selection to the GRUB boot loader
You're going to need to edit Grub:
nano /boot/grub/menu.lst
If you look there are a series of repeated lines. Each one of these is a different kernel that can be booted.
***PLEASE NOTE*** You need to modify the root (hdx,x) to match your machines partition configuration. The drive will be different depending on the individual server drive and partition configuration.
Check your Grub file to ensure that your new kernel selection is the first entry on the menu. (Entry O)
Make sure and change the default= one number higher then before since you added one at the very top. If it is 0 and you leave it at 0 and you have trouble with your server you will not be able to boot it.
After that save out and run grub
grub
Once it is done probing the drives enter:
savedefault --default=0 --once
quit
If all goes well (check by typing uname -a and looking at the running kernel number), then go back into the GRUB menu.lst file and set default= to zero.
If things do go wrong, you may still need to perform a hard reset on the server, but the next boot will default to your previous kernel.
Good luck - but everything above is at your own risk!!
This guide is for compiling a kernel for Debian linux!
SERIOUS DISCLAIMER: this works for me. I cannot be held responsible if it does not work for you.
Get the version of the kernel you desire from http://kernel.org
Unpack the archive to /usr/src/[your new kernel version]
Remove the old symbolic link to your old kernel source if it exists:
Make sure it is a link you're removing and not your old kernel source! (Unless you want to do this)
rm /usr/src/linux
Link the new kernel source to the new source directory:
ln -s /usr/src/
Change to the new /usr/src/linux directory
Now you'll need to repeat the following for each time you recompile.
First clean up your environment:
make mrproper
make clean
Copy your previous kernel's config to your new kernel source:
cp /boot/.config /usr/src/linux
Now configure your new kernel:
Either make menuconfig (in a console) or make xconfig from a console to launch a GUI session (you'll need QT installed).
Now run make-kpkg kernel_image to create the Debian package containing your new kernel.
Change to the parent directory cd /usr/src
Run DPKG to install the new kernel dpkg -i kernel-image-[your kernelversion]
Now a very cool trick. If you've just compiled your new kernel on a server somewhere in a backroom through a remote session, your nightmare would be a kernel panic locking up the machine and necessitating a hard reboot and manual selection of another kernel on the server console.
This assumes your Debian package has installed your new kernel selection to the GRUB boot loader
You're going to need to edit Grub:
nano /boot/grub/menu.lst
If you look there are a series of repeated lines. Each one of these is a different kernel that can be booted.
***PLEASE NOTE*** You need to modify the root (hdx,x) to match your machines partition configuration. The drive will be different depending on the individual server drive and partition configuration.
Check your Grub file to ensure that your new kernel selection is the first entry on the menu. (Entry O)
Make sure and change the default= one number higher then before since you added one at the very top. If it is 0 and you leave it at 0 and you have trouble with your server you will not be able to boot it.
After that save out and run grub
grub
Once it is done probing the drives enter:
savedefault --default=0 --once
quit
If all goes well (check by typing uname -a and looking at the running kernel number), then go back into the GRUB menu.lst file and set default= to zero.
If things do go wrong, you may still need to perform a hard reset on the server, but the next boot will default to your previous kernel.
Good luck - but everything above is at your own risk!!
0 Comments:
Post a Comment
<< Home