我的毕设终于有眉目了 🙂
我的网卡驱动文件是: driver/net/forcedeth.c
最近在读代码过程中,做了一下代码汉字注释,还有一些笔记。就是编译总出现格式不可用。今天在helight的帮助下,终于把经过自己稍微修改的网卡驱动,编译、安装好,现在使用的就是“自己的网卡驱动了”。
1. Install the kernel header files $ sudo apt-get install linux-headers-2.6.27-13-generic 2. Get the source code of forcedeth.c, and modify it kongove@ubuntu:~/code/kernel/force$ ls forcedeth.c Makefile 3. Write the Makefile $ cat Makefile obj-m := forcedeth.o KERNELDIR=/lib/modules/`uname -r`/build #KERNELDIR := /usr/src/linux-headers-2.6.22-14 modules: $(MAKE) -C $(KERNELDIR) M=$(PWD) modules clean: rm -rf *.o *~ core .depend .*.cmd *.ko *.mod.c .tmp_versions 4. Compile the module $ make 5. Remove the module $ sudo rmmod forcedeth 6. Install your module $ sudo insmod ./forcedeth.ko 7. Check if it works $ ifconfig $ ping www.baidu.com
怎么不把为什么格式出错,怎么解决的过程写出来呢?
LikeLike