Compile and install latest linux kernel in ubuntu

2011/02/18

Install dependencies

sudo apt-get install fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge
sudo apt-get build-dep linux
sudo apt-get install git-core libncurses5 libncurses5-dev libelf-dev asciidoc binutils-dev

Checkout the latest sources

In firefox go to http://www.kernel.org and pick the branch you want to build.

cd ~
git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.38.y.git

Configure options for your sustem

cd linux-2.6
make defconfig
lsmod > myModules.txt
lpr myModules.txt
make menuconf (add the modules that you think you need for your hardware, the printout should help)

Make and Install the Kernel
make
sudo su
make modules_install
make install

Make and Install the Init Ramdisk

update-initramfs -c -k 2.6.x.y (whatever the folder is named in /lib/modules

Update GRUB2

update-grub

Reboot and select new kernel

Undo all of this (If things go bad)

If this does not work lets delete the kernel you installed.
At boot hold down shift and grub2 should show you the kernels you can boot from.  Select the old one.
This should get you up and running again.

Delete the new kernel

sudo su
cd /boot
rm *.38 (or whatever the postfix on your kernel is)
cd /lib/modules
rm -r *.38 (or whatever the postfix on your kernel is)
update-grub

Reboot and it will be like you never installed your custom kernel

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: