Source code of LDD3 compiled by Fedora14

Source: Internet
Author: User
Go directly to a directory under example, such as scull to make. A bunch of errors will be reported, indicating that the ora14 header file with the kernel source code (or yuminstallkernel-devel to install these header files) without the source code, however, for examples in ldd3 compilation, these header files are sufficient and the Makefile has specified the correct Kernel Directory # KERNELDIR? =/Lib/modules/$ (shelluname-r)/build. Therefore, make directly to a directory under example, such as scull, and a bunch of errors will occur.
Description: The header file of Fedora14 with the kernel source code (or yum install kernel-devel to install these header files) does not contain the source code. However, for examples of compiling ldd3, these header files are sufficient.
And the Makefile has specified the correct kernel directory.
# KERNELDIR? =/Lib/modules/$ (shell uname-r)/build
These errors are only caused by inconsistent kernel versions.
The ldd3 example is from the 2.6.10 kernel era, while the fc14 kernel version is 2.6.35.6-45.
Some data structures updated in the 2.6.35 kernel, so the ldd3 example written with the 2.6.10 kernel at the time is likely to use the new kernel for compilation and sometimes Error
The solution is to allow the ldd example to adapt to the new kernel version or change to the 2.6.10 kernel for compilation.
Error: 'System _ utsname' undeclared
The new version does not have this stuff. Simply define a char * system_utsname = "x86" in that file, and then remove. machine from the code.


If you want to have a complete kernel source code to replace the built-in fc14 shell, you can do the following:
Go to the following link to download the 14 kernel, which is the kernel-2.6.35.6-45.fc14.src.rpm
Http://download.fedora.RedHat.com/pub/fedora/linux/releases/14/Fedora/source/SRPMS/
In addition, 15
Http://download.fedora.redhat.com/pub/fedora/linux/releases/15/Fedora/source/SRPMS/
13 12 11 10 9 and so on
Http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/
For example
Http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/12/Fedora/source/SRPMS/
This is the case now, but we may move to archives in the next 15 days.
Note: You can go to www.kernel.org to download the kernel source code of a certain version. However, after downloading and compiling, You need to replace (install) The fc14 kernel image,
In this way, the kernel module compiled with the kernel source code of this version will pass smoothly in the insmod of the local machine.
Run

Rpm-uvh kernel-2.6.35.6-45.fc14.src.rpm
Run

Cd/root/rpmbuild/SPECS
Note: fedora14 uses/root/rpmbuild as the main directory of srpm by default (it seems that the previous version is /Usr/src/redhat /)
Refer to http://help.directadmin.com/item.php? Id = 381
Run the following command and an error occurs.
  1. [Root @ localhost SPECS] # rpmbuild-bp -- target $ (uname-m) kernel. spec
  2. Building target platforms: i686
  3. BuildingForTarget i686
  4. Error: Failed build dependencies:
  5. Xmlto is needed by kernel-2.6.35.6-45.fc14.i686
  6. Asciidoc is needed by kernel-2.6.35.6-45.fc14.i686
  7. Elfutils-devel is needed by kernel-2.6.35.6-45.fc14.i686
  8. Perl (ExtUtils: Embed) is needed by kernel-2.6.35.6-45.fc14.i686
Install the missing items separately.
Yum install xmlto
Yum intsall asciidoc
Yum install elfutils-devel
Yum install perl-ExtUtils-Embed.noarch (this refers to http://joysofprogramming.com/install-perl-extutils-embed-fedora-rhel)
Execute the preceding command again,
The source code has been inserted /Root/rpmbuild/BUILD
  1. [Root @ localhost rpmbuild] # ls
  2. BUILD BUILDROOT RPMS SOURCES SPECS SRPMS
  3. [Root @ localhost rpmbuild] # cd BUILD
  4. [Root @ localhost BUILD] # ls
  5. Kernel-2.6.35.fc14
  6. [Root @ localhost BUILD] # ls kernel-2.6.35.fc14/
  7. Linux-2.6.35.i686-vanilla-2.6.35
  8. [Root @ localhost BUILD] # ls kernel-2.6.35.fc14/linux-2.6.35.i686/
  9. Arch config-rhel-generic fs net
  10. Block configs include README
  11. Config-arm config-s390x init REPORTING-BUGS
  12. Config-debug config-sparc64-generic ipc samples
  13. Config-generic config-x86_64-generic Kbuild scripts
  14. Config-i686-PAE config-x86-generic kernel security
  15. Config-ia64-generic COPYING lib sound
  16. Config-nodebug credits maintainers tools
  17. Crypto Makefile usr config-powerpc32-generic
  18. Config-powerpc32-smp Documentation merge. pl virt
  19. Config-powerpc64 drivers mm
  20. Config-powerpc-generic firmware modules. order
  21. [Root @ localhost BUILD] # cd kernel-2.6.35.fc14/linux-2.6.35.i686/
  22. [Root @ localhost linux-2.6.35.i686] #
Run
  1. [Root @ localhost linux-2.6.35.i686] # vi Makefile
  2. /* Change line 4 
  3. EXTRAVERSION =. 6-45.fc14.i686 
  4. Ensure that the result is consistent with that of uname-r. 
  5. */
  6. [Root @ localhost linux-2.6.35.i686] # make mrproper
  7. [Root @ localhost linux-2.6.35.i686] # cp configs/kernel-2.6.35.6-i686.config. config
  8. [Root @ localhost linux-2.6.35.i686] #

You can also use the config file under/boot.
Run
Make

Run
Make Modules
Now we have reached a fully compiled kernel source code,
/Lib/modules/2.6.35.6-45. fc14.i686/build/already exists and connects/Usr/src/kernels/2.6.35.6-45. fc14.i686,
Now connect it to/root/rpmbuild/BUILD/kernel-2.6.35.fc14/linux-2.6.35.i686/
(This does not seem to have to be done by yourself. The link will be automatically corrected when make install is executed)
Run
Make Modules_install
**************************************** *****************************
If you want to install the compiled Kernel
Run
Make install
(The System will copy vmlinuz and System. map to the/boot directory and automatically add the $ (uname-r) suffix,
Modify grub/boot/grub/menu. lst at the same time, and manually copy vmlinuz and System. map versions earlier than 2.6)
Restart to see the new kernel.

For grub. conf (menu. list is only a symbol pointing to it)
  1. # Grub. conf generated by anaconda http://www.linuxidc.com
  2. #
  3. # Note that you do not have to rerun grub after making changes to this file
  4. # NOTICE: You have a/boot partition. This means that
  5. # All kernel and initrd paths are relative to/boot/, eg.
  6. # Root (hd0, 0)
  7. # Kernel/vmlinuz-version ro root =/dev/mapper/VolGroup-LogVol02
  8. # Initrd/initrd-[generic-] version. img
  9. # Boot =/dev/sda
  10. Default= 0
  11. Timeout = 10
  12. Splashimage = (hd0, 0)/grub/splash.xpm.gz
  13. Hiddenmenu
  14. Title Fedora (2.6.35.6-45. fc14.i686)
  15. Root (hd0, 0)
  16. Kernel/vmlinuz-2.6.35.6-45.fc14.i686 ro root =/dev/mapper/VolGroup-LogVol02 rd_LVM_LV = VolGroup/LogVol02 volume = VolGroup/LogVol00 rd_NO_LUKS rd_NO_MD rd_NO_DM LANG = en_US.UTF-8 SYSFONT = latarcyrheb-sun16 KEYTABLE = us rhgb quiet
  17. Initrd/initramfs-2.6.35.6-45.fc14.i686.img
The file indicated by kernel is a kernel image.
Initrd The imgfile is used to direct the hardware to the State in which the actual kernel vmlinuz can take over and continue booting.
System. map is the symbol table exported by the kernel.
All three files exist under/boot.
**************************************** *****************************
It seems that it is quite convenient to reinstall a kernel in ora.

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.