Compiling (or recompiling) your Linux kernel

Although the general consensus is that it's difficult to compile a Linux kernel, it's really not that hard, as you will see. After reading this brief tip, I hope you and I will share the title of Kernel Compiler!

What I am going to do is simply run through the steps of the actual compilation of my existing kernel. I won't make any changes (since changes and needs are so unique to each system) but I will walk through all the steps. I will also be approaching this with a path-of-least-resistance approach (read: we're going to do this the easy way).

Just to be safe...

Before I get into the compilation of my kernel I'm going to make a boot floppy just to be on the safe side. To do this, slap a floppy in your drive, su to root, and run the command:

dd if=/boot/bzImage of=/dev/fd0 bs=8192
where bzImage is the kernel image that you need to insert. For example, in my stock Red Hat 7.0 system the kernel image is /boot/vmlinuz-2.2.16-22. For this image, the command would be:
dd if=/boot/vmlinuz-2.2.16-22 of=/dev/fd0 bs=8192

Back to compiling the kernel

The first step is to locate the source code for your particular distribution. Typically, these files are located in /usr/source/linux. (This holds true for most Linux distributions).

Once you've located the source, you are ready to actually start the compilation process.


Author's note
Because I am doing a simple recompile of my current kernel I am leaving out some major steps necessary when compiling a new kernel.

Make xconfig

Since I am going to take the easy route, let's stick with the simplest (and sanest) kernel configuration tool. The xconfig tool is a graphical tool offering simple buttons that, when clicked, present the many kernel configuration choices. The main xconfig window looks like the one shown in Figure A.

Figure A
View
Above, you see the main xconfig window.

Each time you click on a button within the xconfig window, you will be offered a list of choices. In Figure B, you can see where I've chosen the Character Devices button. Each choice will have three selections: yes (y), no (n), and modular (m). The first two choices are obvious: yes means add the module; no means do not add the module. The third choice isn't so obvious. When modularly adding a kernel module, you are, in effect, saying you want the modules available and will load or unload them as you see fit.

Go ahead and run through the other buttons to see what's there. It's quite a hefty assortment of modules (giving you an idea of how complete the Linux kernel really is). Once you've run the gamut, you can click Save And Exit and move on to the next step of the compilation!

Figure B
View
Above you see a small sample of possible options to choose while compiling your kernel. .

Like this article? Click below to send it to your mobile for free!

Advertisement

Talkback 0 comments


Latest Videos

Sponsored content

Power Centre - Content from our premier sponsors

Blogs

  • David Braue Telstra's BT coat doesn't fit
    The vision of the future BT portrayed this week at an Australian conference was so far removed from how Telstra's David Quilty has described the British telco that I wonder if they were talking about the same UK.
  • Array Australian security: the lucky country
    Does anyone seriously believe that Australian businesses and government agencies manage security any better than the US or UK?
  • Array Storage infrastructure on the tender track
    For a large-scale storage project, it's not uncommon to go out to tender for the best deal — but when was the last time you had to put together a tender for a document management room?
  • More blogs »

Tags

Back to top

Featured