Debug a NIC driver in linux(kernel version 2.4.20-8) which running on VMware workstation version 4.5.2

Debug a NIC driver in linux which run on VMware workstation version 4.5.2

 

Author: Wenxy, [email protected]

Date: 20090220,a.m.

 

1. See NIC type and other infomation

#lspci

or

#ethtools eth0

 

2. Copy file pcnet32.c to linux

 

3. Write a Makefile:

# Makefile for An AMD PCnet32 ethernet driver for linux
# wenxy 20090219, p.m. [email protected]
# Red hat linux 9.0, kernel version 2.4.20-8



dir = /usr/src/linux-2.4/include
modules = wenxy_pcnet32.o
CC = gcc
MODCFLAGS = -Wall -DMODULE -D__KERNEL__ -DLINUX  -I$(dir)

#all : $(modules)

$(modules) : pcnet32.c
    $(CC) $(MODCFLAGS) -c pcnet32.c -o $(modules)
    chmod 711 $@
      
      
.PHONEY : clean run exit
run:
    -ifconfig eth0 down
    -lsmod |grep pcnet32
    -rmmod pcnet32
    -insmod -f $(modules)
  
exit:
    -ifconfig eth0 down
    -lsmod |grep wenxy_pcnet32
    -rmmod wenxy_pcnet32
   
restart:
    -ifconfig eth0 up
  
clean :
    -rm $(modules)
   

# end makefile

 

4. Compile

 

5. Test

#make run

#make exit

#make restart

 

That's all.

 

你可能感兴趣的:(Debug a NIC driver in linux(kernel version 2.4.20-8) which running on VMware workstation version 4.5.2)