Fuente: http://linuxtweaking.blogspot.com/2010/05/how-to-compile-kernel-on-ubuntu-1004.html
The Ubuntu wiki does provide the necessary documentation to allow users to build their own Linux kernel but in a rather disorganised way.
They should restructure it and provide clear detailed steps for each release and not the current mish-mash of old and new.
How about giving each release their own dedicated wiki page?
Original Ubuntu wiki: https://help.ubuntu.com/community/Kernel/Compile
First steps
Install the required tools and packages.
Open a terminal and type the following,
sudo apt-get install fakeroot kernel-wedge build-essential makedumpfile kernel-package libncurses5 libncurses5-dev
Then run the following command,
sudo apt-get build-dep --no-install-recommends linux-image-$(uname -r)
And finally type,
mkdir ~/src
cd ~/src
apt-get source linux-image-$(uname -r)
cd linux-2.6.32
At the time of writing 2.6.32 was the current kernel source, it should remain at this version throughout the life of Ubuntu 10.04
It is a good idea to start with the same .config as the currently running kernel, so type the following,
cp -vi /boot/config-`uname -r` .config
Now we are ready to customize the build and kernel options.
make menuconfig
Once you have finished, save and exit. It is now time to compile. However to speed up the build if you have a dual core processor type,
export CONCURRENCY_LEVEL=3
The general rule is 1 + the number of processor cores.
make-kpkg clean
fakeroot make-kpkg --initrd --append-to-version=-some-string-here kernel-image kernel-headers
Remember to substitute the writing in green for something else, for example -alpha
After a few minutes or hours your kernel compile will be complete. The next step is to install it.
The kernel package will be created in the parent directory of ~/src/linux-2.6.32 (i.e. ~/src)
cd ~/src
sudo dpkg -i linux-image-2.6.32.11+drm33.2-alpha_2.6.32.11+drm33.2-alpha-10.00.Custom_amd64.deb
sudo dpkg -i linux-headers-2.6.32.11+drm33.2-alpha_2.6.32.11+drm33.2-alpha-10.00.Custom_amd64.deb
Please note the text in green must be changed to reflect your version.
We are almost ready, prior to 10.04 the initramfs kernel image was automatically created. The Ubuntu wiki suggests using the scripts to create the image but I have been unsuccessful in using this method, hence the manual approach.
sudo update-initramfs -c -k all
BUG: Please use the alternate method described below as this command fails to create an image for your new kernel. Special thanks to Helios38. - 16/06/2010
Alternatively if you know the kernel version, substitute the word all with the kernel version.
Example, sudo update-initramfs -c -k 2.6.32.11+drm33.2-alpha
Finally we need to add the initramfs image to the grub.cfg file located at /boot/grub/grub.cfg.
For the easy and automatic method as oppose to manually editing the grub.cfg file, just type the following,
sudo update-grub
Now just reboot and your new kernel should automatically load.
How to remove your kernel
sudo dpkg -r linux-headers-2.6.32.11+drm33.2-alpha
sudo dpkg -r linux-image-2.6.32.11+drm33.2-alpha
sudo rm /boot/initrd.img-2.6.32.11+drm33.2-alpha
Enjoy compiling your own kernels.
2 comentarios:
Thanks! I didn't know that the initramfs kernel image wasn't created automatically in ubuntu 10.04. Before doing that I was getting a kernel panic screen.
you're welcome.
Publicar un comentario