E-Mail:

Kernel Fundamentals Part 5

Kernel Fundamentals - Part 5

We’re making great progress in discussing the process of building a new custom Linux kernel. I’ve heard from many of you following along with the kernel series, ready to install this newly-built kernel on your own machines. It’s kind of exciting, huh>

Today’s step is one that had me baffled the first time I recompiled a kernel. That’s really only because it’s one I kept skipping. I couldn’t understand why I was seeing no change to my system, despite having successfully completed the other steps. Referring back to the master list:

7. Move the new kernel image to the /boot directory, or any other directory from which you’d like to boot the system.

It’s funny - this is such a simple step, but I just kept skipping over it. To complete this step, though, you do need to understand a bit more about where your new kernel is located and what it’s called.

Configuring and compiling the kernel, as we’ve seen, is done from within the /usr/src/linux directory. That directory may, in fact, be a symbolic link to /usr/src/linux-2.x.x, where x.x is the kernel revision number. Either way, the /usr/src/linux directory is much deeper than we’ve seen. And, deep within the subdirectories is where you’ll find your new kernel image. The make bzImage command will, in most distributions, create the kernel image in /usr/src/linux/arch/i386/boot. Go ahead, take a look:

    cd /usr/src/linux/arch/i386/boot

You should find a file called bzImage. Recognize that name? Yep — it’s the kernel image you’ve already created during this series.

At this point in the process, I always move this image to the /boot partition. Whether you can do the same depends entirely on whether or not you’ve created this partition in the install process. Because this partition only needs to be marginally bigger than the kernel image itself, I’ve often used it as a way to stay within the bootable limits of Linux. In other words, I can get every necessary piece of code within the boot limits by creating the /boot partition and making it the kernel home. For now, I’ll assume you’ve done the same. We’ll talk about some other options tomorrow.

I’ll also assume that you’re still working within the /usr/src/linux directory. To copy your new kernel image to the /boot partition, issue the following command:

    cp ./arch/i386/boot/bzImage /boot

This command tells Linux to start in the current directory [.] and copy [cp] the image named bzImage from within the /arch/i386/boot subdirectory to the /boot partition. I always copy the image initially, as opposed to moving it, because I like having the original as a backup in case I mess up one of the other steps.

Finally for today, I’ve always renamed these images in the /boot directory to something that helps me keep track of which kernel build I’m using. To do this:

    cd /boot
    mv bzImage vmlinuz-12.26.01

This renames the kernel image to “vmlinuz-12.26.01,” giving me a reference as to which kernel I’m using.

Tomorrow, we’ll talk about making this kernel visible to lilo.

What Do You Think?

 

Want to Start a Blog Here for Free?

Are you an expert in one subject or another? If your goal is to help others and dispense hard-earned information back to the community, stake a claim on your very own Lockergnome blog today! You can write about anything - no matter the topic. Sign-up to start blogging!

64 queries / 1.344 seconds.