Saturday, February 19, 2011

Compiling Linux

I followed this blogger's instructions on how to compile the latest stable Linux kernel version. http://linuxtweaking.blogspot.com/2011/01/how-to-compile-kernel-from-kernelorg-in.html

First, I made sure I had these packages.
rpmdevtools yum-utils gcc make ncurses-devel


The only one I was missing was ncurses-devel.

Next, I ran
rpmdev-setuptree
.

I later realized that I had run rpmdev-setuptree once before to compile neatx.

I entered the ~/rpmbuild/SOURCES directory and downloaded the source for the latest stable version of Linux there using wget. The latest stable version at the time was 2.6.37.1, so my wget command was
wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-2.6.37.1.tar.bz


I extracted the archive
tar -xf linux-2.6.37.1.tar.bz2


I entered the directory containing the extracted archive.
cd linux-2.6.37.1


Ran make menuconfig and changed none of the settings because I don't know what I need and don't need in the kernel. Ideally, I would have left out all the stuff for hardware that I don't have.

The blogger whose instructions I followed recommended setting CONCURRENCY_LEVEL to one more than the number of cores in my system. I have a single core, so I set CONCURRENCY_LEVEL to 2.
export CONCURRENCY_LEVEL=2


Then I ran make with the rpm option. I also ran time to time how long it would take. I have since lost the output from time because the buffer in my terminal emulator was too small to keep it after the steps I took to install the newly compiled kernel.
time make rpm


I entered the directory where the rpm package was output.
cd ~/rpmbuild/RPMS/i386


I ran
rpm -i kernel-2.6.37.1-1.i386.rpm


There were conflicts with two existing packages: linux-firmware and alsa-firmware

I removed those two packages and tried running
rpm -i kernel-2.6.37.1-1.i386.rpm
again. This time, it installed successfully. I need to reboot now to see if it worked.

NOTE: IntelligentMirror setup at the charter school is still stagnating. No email response from the developer, Kulbir Saini. I wonder if there's another way to contact him.



EDIT: I missed a couple of key steps. After rebooting, I found that grub was missing an entry for the new kernel and there was no initramfs.

So I entered the /boot directory
cd /boot


Then I ran
sudo mkinitrd initramfs-2.6.37.1.img 2.6.37.1


Then I edited /boot/grub/grub.conf by copying the first existing entry an changing it accordingly. The entry I copied looked like this.

title Fedora (2.6.35.11-83.fc14.i686)
root (hd0,0)
kernel /vmlinuz-2.6.35.11-83.fc14.i686 ro root=UUID=8ddc53e1-a301-48f8-9d0e-1aa9abef81b2 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet
initrd /initramfs-2.6.35.11-83.fc14.i686.img



After the edits:

title Fedora (2.6.37.1)
root (hd0,0)
kernel /vmlinuz-2.6.37.1 ro root=UUID=8ddc53e1-a301-48f8-9d0e-1aa9abef81b2 rd_NO_LUKS rd_NO_LVM rd_NO_MD rd_NO_DM LANG=en_US.UTF-8 SYSFONT=latarcyrheb-sun16 KEYBOARDTYPE=pc KEYTABLE=us rhgb quiet
initrd /initramfs-2.6.37.1.img

No comments:

Post a Comment