How to solve the loss of NIC driver when Linux compiles kernel

Source: Internet
Author: User
Tags bz2

My system OS version:centos 5.9 kernel:2.6.18-402 Update kernel version: 2.6.20

Because yum inside the kernel header file and card package does not have too much source code. C files. So can only download similar version from www.kernel.org, some people must say that you are not next to the latest kernel version, a: such as the kernel version span is relatively large, I worry that there will be a variety of problems, a lot of old compiler options new version of the kernel does not support.

First download the original system development package and header file:
Shell $> Yum Install kernel-devel kernel-headers
Unzip the 2.6.20 Kernel compression Pack and start compiling the kernel
Shell $> MV linux-2.6.20.tar.bz2/usr/src/
Shell $> cd/usr/src/
Shell $> Tar jxvf linux-2.6.20.tar.bz2
Shell $> CD linux-2.6.20
# Modify the source code to change their needs, I modified the Tun related source files.
Shell $> make Mrproper
# Select the options you want and modify the options to remove the unwanted options
Shell $> make Menuconfig
Shell $> Make-j 12
Shell $> make Modules_install
Shell $> make Install

# modified grub.conf with a new kernel to discover the NIC driver did not find! But the driver loaded the
2.6.20 Shell $> lsmod |grep TG3
# View LOG:
2.6.20 Shell $> Vim/var/log/message
# Find TG3 Related logs:

Feb 11:02:01 localhost Kernel:input:PC Speaker as/class/input/input1
Feb 11:02:01 localhost kernel:tg3:Unknown symbol pci_channel_offline
Feb 11:02:01 localhost kernel:intel_rng:Firmware is locked read-only. If you can ' t or
Feb 11:02:01 localhost Kernel:intel_rng:don ' t want to disable this in firmware setup, and if
Feb 11:02:01 localhost kernel:intel_rng:you are certain that your system has a functional
Feb 11:02:01 localhost Kernel:intel_rng:RNG, try using the ' no_fwh_detect ' option.

# See the Pci_channel_offline
# Download the corresponding network card driver, compile the installation to see if there is a mistake:
Shell $> wget http://www.broadcom.com/support/license.php?file=570x/linux-3.136h.zip
Shell $> reboot
2.6.20 Shell $> Unzip Linux-3.137h.zip
2.6.20 Shell $> Tar zxvf tg3-3.136h.tar.gz
2.6.20 Shell $> CD tg3-3.136h
2.6.20 Shell $> Make
# There was no error, but there was a warning:

SH makeflags.sh/lib/modules/2.6.20/source > Tg3_flags.h
Make-c/lib/modules/2.6.20/build subdirs=/data1/software/tg3-3.136h Modules
MAKE[1]: Entering directory '/data1/software/linux-2.6.20 '
CC [M]/data1/software/tg3-3.136h/tg3.o
/data1/software/tg3-3.136h/tg3.c:in function ' Tg3_ape_lock ':
/data1/software/tg3-3.136h/tg3.c:845: Warning: Implicit declaration of function ' Pci_channel_offline '
Building modules, Stage 2.
Modpost 1 Modules
WARNING: "Pci_channel_offline" [/data1/software/tg3-3.136h/tg3.ko] undefined!
cc/data1/software/tg3-3.136h/tg3.mod.o
LD [M]/data1/software/tg3-3.136h/tg3.ko
MAKE[1]: Leaving directory '/data1/software/linux-2.6.20 '

# According to the usual warning we can be ignored, then we update the driver should be no problem, I think the same as you but he still has a problem.
2.6.20 Shell $> make install
2.6.20 Shell $> Rmmod tg3
2.6.20 Shell $> modprobe tg3
# still an error, look at the log or Unknown symbol Pci_channel_offline
# and then I thought, did I compile in the old kernel and see if it went wrong? Results in the old kernel there is no error, I was looking at the old kernel of the pci.h file, found the Pci_channel_offline method:

static inline int pci_channel_offline (struct Pci_dev *pdev)
{
Return (pdev->error_state!= pci_channel_io_normal);
}

# So well, I'm copying this into the pci.h inside the 2.6.20 kernel
2.6.20 Shell $> vim/usr/src/linux-2.6.20/include/linux/pci.h
# Add 183 lines below, in a new build NIC driver
2.6.20 Shell $> Make clean
2.6.20 Shell $> Make
# This time make is right.
2.6.20 Shell $> make install
2.6.20 Shell $> Rmmod tg3
2.6.20 Shell $> modprobe tg3
# Reboot Network card
2.6.20 Shell $>/etc/init.d/network restart

# to solve this!




Linux kernel compile, solve the problem that the NIC drives is missing


>//linux kernel compiles, solves the problem which the network card drives lacks, uses the updated kernel to perfect the drive
Preparatory work
Sorting out system hardware, file system type, network protocol
UNAME-R//View system version number, if the system is the same as the compiled kernel, you need to back up the/lib/modules content
Because future make Modules-install steps will overwrite the contents of the entire path
{Download Linux kernel, address: http://www.kernel.org/pub/linux/kernel/, assuming the name is linux-x-y-z.tar.gz
If the kernel is already installed, there are Linux subdirectories in the/usr/src/directory, kernel-source-2.xx.xx.rpm files are found in the CD drive, such as Redhat linuxde rpm directory
is the/redhat/rpms/directory, using RPM-IVH kernel-source-2.xx.xx.rpm to install the kernel}

Cd/usr/src/linux//Clear the remaining. o files and unnecessary associations when compiling the kernel
Make Mrproper//If you are downloading the kernel code, and is the first time to compile, there is no need to perform this step
Make Xconfig//graphics interface, configure the kernel
{Make Menyconfig//character interface use}
Make DEP//set associated files
Make clean//clear unnecessary files
Make Bzimage//compile a large kernel (for example, SCSI support is required)
{make zimage//compile school kernel}
make modules//compile module, loadable module, kernel option for M option, compile time is related to the number of M options
Make Modules_install//Copy the compiled modules to/lib/modules

A:mv/usr/src/linuxx.x.x/system.map/boot/system.map
B:mv/usr/src/linuxx.x.x/archi/i386/boot/bzimage/boot/vmlinuz//using the new kernel
/etc/lilo.conf//Modify/etc/lilo.conf plus a startup option, starting with the new kernel bzimage or zimage

Boot=/dev/hda
Map=/boot/map
install=/boot/boot.b
Prompt
Timeout=50
Linear
Default=linux-new ### told Lilo to start Linux with the new kernel by default ###
Append= "mem=256m"

image=/boot/vmlinuz-2.2.14-5.0
Label=linux
Read-only
Root=/dev/hda5

Image=/boot/bzimage (Zimage)
Label=linux-new
Read-only
Root=/dev/hda5
Method Two: Modify the grup.conf file
A:mv/usr/src/linuxx.x.x/system.map/boot/system.map
B:mv/usr/src/linuxx.x.x/archi/i386/boot/bzimage/boot/vmlinuz//Replace the kernel

Modify GRUB,/etc/grup.conf
image=/boot/vmlinuz-2.2.14-5.0
Label=linux
Read-only
Root=/dev/hda5

Image=/boot/bzimage (Zimage)
Label=linux-new
Read-only
Root=/dev/hda5

Method Three: Modify the startup configuration file/boot/grub/grub.conf
/* format is as follows:
Title The name that appears on the Startup menu
Root root file system mount partition
Kernel compressed kernel filename
INITRD root file System file name
Such as:
Title My new kernel
Root (hd0,2)
Kernel/boot/vmlinuz-x.y.z
Initrd/boot/initrd-x.y.z.img
*/

MKINITRD initrd-Kernel version number kernel version number command to regenerate RAM disk files
MKINITRD initrd-2.2.14-5.0 2.2.14-5.0
initrd=/boot/initrd-2.2.14-5.0///etc/lilo.conf INITRD point to the newly generated initrd-2.2.14-5.0 file

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.