Summary of kernel compilation under FC5 (FedoraCore5)

Source: Internet
Author: User
Summary of kernel compilation under FC5 (FedoraCore5)-General Linux technology-Linux programming and kernel information. The following is a detailed description. Abstract:

Recently, due to work needs, we need to re-compile the Linux kernel and find some problems that we have never encountered before. Some of them will be shared with you.
Test environment and objectives:
FC5 (Fedora Core5)
Compile FC5 (Fedora Core5) kernel and linux kernel 2.4.20 (RedHat9) to test some functions of framebuffer.

Preface

I remember that after installing inux kernel 2.4.20, that is, RedHat9, you can find the kernel source code in the/usr/src directory. However, I recently discovered my FC5 (Fedora Core5) the source code is not found in the corresponding directory. It may be due to a disk installation problem or missing any options during installation. The ghost knows that I do not have the source code of the kernel.

Source code download

Download the kernel to be compiled from the Internet. We recommend the following connection:
Ftp://ftp.kernel.org/pub/linux/kernel
All the versions of the kernel are available :)

Compilation process

To understand each of my steps, I will describe the compilation process in detail as follows:
At first, I want to compile the linux kernel 2.4.20 kernel first, because after all, the linux kernel 2.4.20 kernel is relatively small, but the results lead to many problems, as shown below:

$ Make rmproper
$ Make menuconfig
$ Make dep

The above steps can be successfully passed
$ Make bzImage
The following error occurs in a short time:

/Usr/linux-2.4.20/include/linux/smp. h: 29: error: conflicting types for 'smp _ send_reschedule'
/Usr/linux-2.4.20/include/asm/smp. h: 42: error: previous declaration of 'smp _ send_reschedule 'was here
In file sorted ded from/usr/linux-2.4.20/include/linux/unistd. h: 9,
From init/main. c: 17:
/Usr/linux-2.4.20/include/asm/unistd. h: 375: warning: conflicting types for built-in function '_ exit'
Make: *** [init/main. o] Error 1

I checked it online and found that the GCC version under FC5 is too new (gcc4.1), unable to compile linux-2.4.20 ?????????
A similar problem has also been found on a foreign website. Their suggestion is to use gcc 2.95 or gcc3.2 for compiling (Dave Thompson). Do you want to downgrade the gcc version?
After searching for a while on the internet, I found that a pachage can be installed in FC5 to use gcc3.2 without affecting the current gcc4.1. So I downloaded a package in ftp://rpmfind.net/linux/fedora/c... 2.3-55. fc5.i386. rpm, which is roughly described as: The compatibility GNU Compiler Collection Fedora Core 5 for i386, which will be installed right away

$ Rpm-ivh compat-gcc-32-3.2.3-55.fc5.i386.rpm
Preparing... ######################################## ### [100%]
Package compat-gcc-32-3.2.3-55.fc5 is already installed

As you can see, FC5 has already installed this package by default ~~~~~~~~~~
Modify Makefile immediately and change CC to GCC3.2.

$ Make mrprop *; make clean
$ Make dep
$ Make bzImage

After a long wait (not long, about 15 minutes), the result is:

{Standard input}: receiver messages:
{Standard input }: 936: Error: suffix or operands invalid for 'mov'
{Standard input }: 937: Error: suffix or operands invalid for 'mov'
{Standard input }: 1031: Error: suffix or operands invalid for 'mov'
{Standard input }: 1032: Error: suffix or operands invalid for 'mov'
{Standard input }: 1083: Error: suffix or operands invalid for 'mov'
{Standard input }: 1084: Error: suffix or operands invalid for 'mov'
{Standard input }: 1086: Error: suffix or operands invalid for 'mov'
{Standard input }: 1098: Error: suffix or operands invalid for 'mov'

There is no way to input the error information into google, and many people have encountered similar troubles. The final conclusion: it is a bug of binutils under FC5, so the corresponding patch http://www.kernel.org/pub/linux... nux-2.6-seg-5.patch, patch operations under the root directory of the kernel source code to be compiled (this example is linux-2.4.20:

$ Patch-p0
Or

$ Patch-p1
For details, refer to the patch usage.
/*
Introduction to patch usage

Format

Patch-pnumber
Meaning of parameter p

The easy-to-change part is the 'number' after the '-p' parameter, which defines the path of the extension method that the patch applies:
'-P0' is the full path provided in the application patch file. '-p1' deletes the first slash (slash:/), and so on.
The unspecified '-p' removes all paths. If this patch is only applied to files in the same directory, this will be good.
The common practice is to place the patch file in the upper-level directory of the source code and then run
Patch-p1 */

After the patch is complete, re-compile it again.
$ Make bzImage
After, everything is normal
$ Make modules
$ Make modules_install
And the following information appears:

Cd/lib/modules/2.4.20 ;\
Mkdir-p pcmcia ;\
Find kernel-path '*/pcmcia/*'-name' *. o' | xargs-I-r ln-sf ../{} pcmcia
If [-r System. map]; then/sbin/depmod-AE-F System. map 2.4.20; fi
Version requires old depmod, but couldn't run/sbin/depmod. old: No such file or directory

The following measures are taken:

$ Ln-s/sbin/depmod. old
$ Make modules_install
$ Mkinitrd-f-v/boot/initrd-2.4.20.img 2.4.20

Everything is normal

Modify the corresponding lino or grub and restart.

During compilation, it is found that if FC5 kernel is compiled, its grub will be automatically modified without manual modification.

The compiling process of C5 kernel and kernel 2.4.20 may be slightly different. For detailed steps, see the READERME file in each root directory.

About Author:

Nie Fei (afreez) Beijing. Zhongguancun
Contact: afreez@sina.com
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.