从亚信官网
https://www.asix.com.tw/cs/download.php?sub=driverdetail&PItemID=86
下载linux驱动文件
AX88772C_772B_772A_760_772_178_Linux_Driver_v4.23.0_Source.tar.bz2
里面包含6个文件如下:
asix.c
asix.h
axusbnet.c
axusbnet.h
Makefile
readme
首先打开readme,
在编译前,说让准备内核源码
Prepare to build the driver, you need the Linux kernel sources installed on the
build machine, and make sure that the version of the running kernel must match
the installed kernel sources. If you don't have the kernel sources, you can get
it from www.kernel.org or contact to your Linux distributor. If you don't know
how to do, please refer to KERNEL-HOWTO.
那么我们是使用F1C100S的linux内核源码吗??
查看让先将内核的USB选项打开
Note: Please make sure the kernel is built with one of the "Support for
Host-side, EHCI, OHCI, or UHCI" option support.
操作过程里面也有写
1. Extract the compressed driver source file to your template directory by the
following command:
解压
[root@localhost template]# tar -xf DRIVER_SOURCE_PACKAGE.tar.bz2
2. Now, the driver source files should be extracted under the current directory.
Executing the following command to compile the driver:
编译
[root@localhost template]# make
3. If the compilation is well, the asix.ko will be created under the current
directory.
4. If you want to use modprobe command to mount the driver, executing the
following command to install the driver into your Linux:
安装
[root@localhost template]# make install
因为是为100S编译,所以得把ko放到板子上执行。安装和卸载的方法
1. If you want to load the driver manually, go to the driver directory and
execute the following commands:
[root@localhost template]# insmod asix.ko
2. If you had installed the driver during driver compilation, then you can use
the following command to load the driver automatically.
[root@localhost anywhere]# modprobe asix
If you want to unload the driver, just executing the following command:
[root@localhost anywhere]# rmmod asix
离线
打开Makefile,应该是需要修改一些参数,以指定100S的内核源码,并且,编译的过程中,要用交叉编译器
Makefile内容如下:
CURRENT = $(shell uname -r)
TARGET = asix
OBJS = asix.o
MDIR = drivers/net/usb
KDIR = /lib/modules/$(CURRENT)/build
SUBLEVEL= $(shell uname -r | cut -d '.' -f 3 | cut -d '.' -f 1 | cut -d '-' -f 1 | cut -d '_' -f 1)
ifneq (,$(filter $(SUBLEVEL),14 15 16 17 18 19 20 21))
MDIR = drivers/usb/net
endif
EXTRA_CFLAGS = -DEXPORT_SYMTAB
PWD = $(shell pwd)
DEST = /lib/modules/$(CURRENT)/kernel/$(MDIR)
obj-m := $(TARGET).o
default:
make -C $(KDIR) SUBDIRS=$(PWD) modules
$(TARGET).o: $(OBJS)
$(LD) $(LD_RFLAG) -r -o $@ $(OBJS)
install:
su -c "cp -v $(TARGET).ko $(DEST) && /sbin/depmod -a"
clean:
$(MAKE) -C $(KDIR) SUBDIRS=$(PWD) clean
.PHONY: modules clean
-include $(KDIR)/Rules.make
离线