As a result of the project, the need to compile the kernel, modify the TUN source support sharing mode, compile the kernel encountered the network card driver lost problem, nonsense, said directly to solve the problem, I understand the bottom of the things very shallow, so the way to solve the problem is very clumsy.
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