Kernel compilation details

Source: Internet
Author: User
Article Title: Kernel compilation details. Linux is a technology channel of the IT lab in China. Includes basic categories such as desktop applications, Linux system management, kernel research, embedded systems, and open source.
For users, compiling a kernel version requires not only upgrading the kernel and software. In general, the compiled kernel can work well, but some functions (precisely in the system initialization phase, that is, init executes rc) during initialization. sysini and rcx. d) will fail. Failure may vary from person to person. For example, some USB devices, Iptable, and RPM installed on Red Hat 9.0 fail to all, while others fail to install the PCMCIA and FireWire devices.
  
If you find that some software packages cannot work properly, you can download the latest version, recompile and install the old version, or make some corresponding modifications to solve the problem. Note that you must back up the file before the operation. Here we will summarize some common errors.
  
   Typical Problems and Solutions
   RPM Problems
After you enter the compiled kernel, some RPM-related commands cannot be used and the following error occurs:
  
Rpmdb: unable to join the environment
Error: db4 error (11) from dbenv-> open: Resource temporarily unavailable
Error: cannot open Packages index using db3-Resource temporarily unavailable (11)
Error: cannot open Packages database in/var/lib/rpm
No packages
  
The solution is to run the "export LD_ASSUME_KERNEL = 2.2.25" command, or write it to/etc/bashrc.
  
   Glibc Problems
You can upgrade the software package of the Glibc standard library to solve this problem. Some distributions, such as Glibc installed by default on Red Hat 9.0, may have been modified by the Red Hat kernel team. The software package is:
  
Bytes.
  
You can upgrade it together with the following software packages:
  
Ftp://ftp.rpmfind.net/linux/redhat/updates/9/en/ OS /i386/glibc-common-2.3.2-27.9.i386.rpm
  
Ftp://ftp.rpmfind.net/linux/redhat/updates/9/en/ OS /i386/glibc-devel-2.3.2-27.9.i386.rpm
  
Ftp://ftp.rpmfind.net/linux/redhat/updates/9/en/ OS /i386/glibc-utils-2.3.2-27.9.i386.rpm
  
If you fail to use "rpm-Uvh glibc *", run the "rpm-e" command to delete the old Glibc, and then run the "rpm-Uvh -- force glibc *" command to force the installation.
  
   Hotplug (hot swapping) Problems
Kernel support for hot swapping is related to the KMOD kernel thread.
  
The solution is to replace all/proc/ksyms in/etc/rc. sysinit with/proc/kallsyms. Run the following command:
  
# Mv/etc/rc. d/rc. sysinit/etc/rc. d/rc. sysinit. bak
# Sed-e's/\/proc \/ksyms/\/proc \/kallsyms/G'/etc/rc. d/rc. sysinit. bak>/etc/rc. d/rc. sysinit
  
   Sysfs Problems
Solution:
  
◆ Create a directory/sys: # mkdir/sys
  
◆ In the/etc/rc. d/rc. sysinit file, find "mount-f/proc" and add "mount-f/sys" to the next line ".
  
◆ Similarly in/etc/rc. d/rc. in the sysinit file, locate "action $" Mounting proc filesystem: "mount-n-t proc/proc" and add "action $" Mounting sysfs filesystem: "mount-n-t sysfs/sys ".
  
◆ Add "none/sys sysfs defaults 0 0" to the/etc/fstab file ".
  
◆ Find "awk" $2 ~ In the halt_get_remaining function of/etc/init. d/halt ~ /^ \/$ | ^ \/Proc | ^ \/dev/{next} ", changed to" awk '$2 ~ /^ \/$ | ^ \/Proc | ^ \/sys | ^ \/dev/{next }".
  
   USB Problems
Most USB modules used in the new 2.6.0 kernel have been renamed, so you need to modify the code for USB subsystem initialization in/etc/rc. sysinit. Change all "keybdev" in this file to "usbkbd", "mousedev" to "usbmouse", and "/proc/bus/usb" to "/sys/bus/usb ", and in/etc/init. d/halt. In addition, you must find "needusb storage" in/etc/rc. sysinit and make the following changes:
  
Needusbstorage =
If [$ usb = "1"]; then
Needusbstorage = 'lc _ ALL = C grep-e "^ I. * Cls = 08"/sys/bus/usb/devices 2>/dev/null'
Action $ "Initializing USB 1.1 host controller:" modprobe ohci-hcd 2>/dev/null
Action $ "Initializing usb hid interface:" modprobe hid 2>/dev/null
Action $ "Initializing USB keyboard:" modprobe usbkbd 2>/dev/null
Action $ "Initializing USB mouse:" modprobe usbmouse 2>/dev/null
Fi
  
Change "ohci-hcd" to "ehci-hcd" if the USB Bus is 2.0 ".
  
   Sound Problems
The module name of the sound part has also changed. My laptop's original sound card driver is i810_audio and has now changed to snd-intel8x0. Therefore, add the following content to/etc/modprobe. conf:
  
Alias char-major-14 soundcore
Alias sound snd-intel8x0
Alias sound-slot-0 snd-intel8x0
Alias snd-card-0 snd-intel8x0
Alias sound-service-0-0 snd-mixer-oss
Alias sound-service-0-1 snd-seq-oss
Alias sound-service-0-3 snd-pcm-oss
Alias sound-service-0-8 snd-seq-oss
Alias sound-service-0-12 snd-pcm-oss
Install snd-intel8x0/sbin/modprobe -- ignore-install sound-slot-0 &&
{/Bin/aumix-minimal-f/etc/. aumixrc-L>/dev/null 2> & 1;/bin/true ;}
Remove snd-intel8x0
{/Bin/aumix-minimal-f/etc/. aumixrc-S>/dev/null 2> & 1;/bin/true ;};
/Sbin/modprobe-r -- ignore-remove sound-slot-0
  
Then run modprobe sound to load the sound module and run the following command to verify the sound Card Driver:
  
# Cat/proc/asound/cards
  
The result is as follows:
  
0 [SI7012]: ICH-SiS SI7012
SiS SI7012 at 0xdc00, irq 11
  
   VMware Problems
Solution:
  
◆ Replace all "/proc/ksyms" in/usr/bin/vmware-config.pl with "/proc/kallsyms ". Use the "sed" command to achieve this goal.
  
◆ Re-run the script and use the kernel header file to compile the new kernel module. If an error occurs during compilation, enter/usr/lib/vmware/modules/sourceand use the following command to unpack vmnet.tar:
  
# Tar xvf vmnet.tar
  
◆ Enter the vmnet-only directory to modify the bridge. c file. Change "atomic_add (skb-> truesize, & sk-> wmem_alloc);" to "atomic_add (skb-> truesize, & sk-> sk_wmem_alloc );", change "protinfo" to "sk_protinfo" in a similar way ".
  
◆ Replace the vmnet-only command with vmmon.tar:
  
# Tar cvf vmmon.tar vmnet-only.
  
If the above operation still fails, the other solution is.
  
   Other problems
You may encounter other problems, but you can follow these steps to solve them:
  
1. Compile the kernel components into modules as much as possible. Run the following command to quickly reconstruct the kernel:
  
# Make all modules_install install
  
2. most software failures occur because the module name has been changed, and/etc/rc. d/rc. sysinit and/etc/rcX. the script in d/* does not modify these values. Therefore, modifying related entries in turn can be improved, but this requires a lot of background knowledge. If you are in trouble, you can concentrate all the commands for Loading modules in/etc/rc. d/rc. local. For example:
  
Modprobe eth0
Modprobe isofs
Modprobe loop
Modprobe vfat
  
Modify the/etc/modoribe. conf file at the same time. For more information, see "man modoribe. conf.
  
3. if you want to know the name of a module after the change, you can first find this option in "make menuconfig" and select Help to find its configuration name (CONFIG _*), search for CONFIG _ * In makefile of the source code directory _*. Generally, you can find the obj-$ (CONFIG _ *) item. Its value is the name of the module.
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.