Thursday, October 07, 2004
To complete the requirements for my assignment in CS518 I compiled, installed, and safely booted off of a linux kernel that I compiled myself. Somehow, it's odd to take credit for compiling the kernel as if I had some part in making it, which, in this case, I almost did as I configured it specifically for my box's hardware and changed the banner that printed when the kernel starts.
To perform this feat of geekdom, I largely followed the steps provided by Kwan Lowe in the Kernel Rebuild Guide. Many thanks to Kwan Lowe.
In summary, the steps I followed were
- Get the source
- This was easy because I already had it downloaded for class earlier.
- Modify the source
- Taking the path of least resistance, I modified init/version.c and prefixed the contents of linux_banner to with "Leif's" so that the OS now reports as "Leif's Linux version 18.104.22.168" when it boots.
- Configure the kernel
- Configuring the kernel is vastly easier than it sounds. It ships with a default configuration that is suitable for most any PC; if you don't change anything, it'll probably work. Also, there's a nice graphical config tool that can be started by running
make gconfig. The biggest steps here were selecting the exact CPU that I have and eliminating features I knew I wouldn't use, like NUMA-Q support.
- Make the kernel
make bzImage. The wait time for this was a few minutes.
- Make the modules
make modules. The wait time for this was 18 minutes.
- Install the modules
- As root, run
- Install the kernel
- As root, copy the kernel image and the driver ramdisk image to /boot. Then edit /boot/grub/grub.conf and add an entry for new kernel and ramdisk images; this is mostly a matter of copying and pasting and existing configuration's lines and replacing the names of the kernel and ramdisk images with the new ones. You can set the default kernel image to your new kernel, if you're feeling brave.
And then, if all went well, you'll be able to pick your kernel from the boot list and watch your handiwork, standing on the shoulders of giants.