Compiling Older Linux Kernels- Preparations

All kernel hackers will need to compile kernels sometime for sure… However before compiling a kernel there may be some issues you need to take care of. If you are compiling older kernels, like kernel versions before 2.4.x you’ll need to first prepare your system for it.

the following issues need to be taken care of:

* Older version of gcc

If you compile your old kernel with any other version of gcc, you’ll probably get errors. Most newer Linux distributions ship with gcc 3.x. You can have more than one version of gcc installed on your system. Install gcc 2.95.3, without overwriting your existing gcc installation. You can download an older version here:

http://gcc.gnu.org/mirrors.html

you will find several sites hosting gcc installations. Remember you are not overwriting the current installation, you are just installing multiple versions of gcc. Here’s a tutorial to help you out with that:

http://www.tellurian.com.au/whitepapers/multiplegcc.php

* as86 and ld86

Once you have an older gcc installed, compiling the kernel may give you errors like “as86:command not found” or “ld 86: command not found”. To put it briefly, as86 is the 80*86 assembler and ld86 is the linux loader. You’ll need to make sure these are installed on your system. You’ll get as86 and ld86 here:

http://homepage.ntlworld.com/robert.debath/dev86/

You can just download bin86 from here. That package will suffice to all your requirements.

* Modifying your makefile

Now that you have the older gcc, you will have to alter the makefiles to use the new compiler. Suppose you have installed the additional compiler in /usr/bin/gccold/bin/gcc, then, in your makefile replace all the “gcc”s with the new path, ie, “/usr/bin/gccold/bin/gcc”. Like this:

Once you have taken care of the above three steps, your system is ready to compile older kernels .

This entry was posted in kernel, linux, linux kernel, tutorials. Bookmark the permalink.

3 Responses to Compiling Older Linux Kernels- Preparations

  1. Billy Jean says:

    madame,

    i receive this error during my compilation:

    init:error while loading shared libraries: lib.so.6: cannot stat shared object: operation not permitted

    what can be the cause of this.

    much appreciated

    Merci beaucoup
    Billy Jean

  2. divya says:

    @billy

    hmmm… thats a nasty one… well i’ll help you out just gimme some time… however you could use printk in your code and try some debugging in the meanwhile

  3. thekbpian says:

    i cant install older gcc version,… will you explain process ?
    and given link is not working for installing multiple gcc ………………..?

Leave a reply to divya Cancel reply