首先修改driver下驱动文件中的Makefile文件:
添加自己的平台,我的平台是hi3518c,具体操作如下:
#add the new platform hi3518c alter by kj
CONFIG_PLATFORM_HI_3518C = y
添加平台的编译选项:
#add the compile option for hi_3518c
ifeq ($(CONFIG_PLATFORM_HI_3518C), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN -DCONFIG_MINIMAL_MEMORY_USAGE
ARCH := arm
CROSS_COMPILE := arm-hisiv100nptl-linux-
KVER
KSRC := /home/kongjun/mywork/develop_kj/Hi3518_SDK_V1.0.3.0/osdrv/kernel/linux-3.0.y
endif
注意:
CONFIG_POWER_SAVING = n(省电模式最好关闭)
下面是官方文档的编译说明:
Introduction
Inthis document, we introduce two ways to compile and
1)
targets
engineers who want to portour Wi-Fi driver ontodifferent platforms.
1.
For
script
network
utilities
please refer to:
document/Quick_Start_Guide_for_Station_Mode.pdf.
If
should readand checkthe followingparagraphs.
2.
The
For example, to decompress rtl8188C_8192C_8192D_usb_linux_v3.3.0_2920.20111123.tar .gz :
root@driver/# tar zxvf rtl8188C_8192C_8192D_usb_linux_v3.3.0_2920.20111123.tar .gz
2
3.
Our
driver
for multiple chiptypes separately .
For compoundrelease driver , you will see make_drvscriptafter you decompress
the driver tar ball locatedin driver folder . Before compiling driver source, executing
the make_drv toselect the target chip type to compile. For example:
4.
4.1.
The default target platform is PC-Linux, if you donot want tocompile driver for
otherplatforms you canskip this section.
T o
Makefile:
should look atthe platform selection section of Makefile:
The
prefix.
CONFIG_PLA TFORM_I386_PC
CONFIG_PLA TFORM_ANDROID_X86
CONFIG_PLA TFORM_ARM_S3C2K4
CONFIG_PLA TFORM_ARM_PXA2XX
CONFIG_PLA TFORM_ARM_S3C6K4
CONFIG_PLA TFORM_MIPS_RMI
CONFIG_PLA TFORM_RTD2880B
CONFIG_PLA TFORM_MIPS_AR9132
CONFIG_PLA TFORM_MT53XX
CONFIG_PLA TFORM_RTK_DMP
root@rtl8188C_8192C_8192D_usb_linux_v3.3.0_2920.20111123#./make_drv
Please select chip type(1/2):
1) RTL8192cu
2) RTL8192du
#?1
You have selected RTL8192cu
3
‘CONFIG_PLA TFORM_I386_PC’
We
example, toadd andselect a new entry , ‘CONFIG_PLA TFORM_NEW’:
Second, you shouldcreateand/or modify the corresponding
settingsection. For example, addingthe following entry
‘CONFIG_PLA TFORM_NEW’
4.2.
l
The
compilation time throughmacro definitions.
Macro
CONFIG_BIG_ENDIAN
CONFIG_LITTLE_ENDIAN
CONFIG_MINIMAL_MEMORY_USAGE
allocate
IO
chance
prevent this situation.
CONFIG_PLA TFORM_ANDROID
defined.
corresponding
For
macro,
will show up
ifeq ($(CONFIG_PLA TFORM_NEW), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
ARCH := arm
CROSS_COMPILE := /opt/new/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
KSRC := /opt /new/kernel
endif
CONFIG_PLA TFORM_I386_PC
CONFIG_PLA TFORM_NEW
4
l
TheARCH is used to specify the architecture of the target platform CPU, such as:
arm, mips, i386, etc.
l
The
compilation.
l
The
compilation
l
Differentmodule name is assigned to drivers for different chips:
If you
here. For example, settingmodule name as ‘wlan’:
4.3.
We still have some compilationsettings couldbe applied. For settings andfurther
informationaboutpowersav
document/HowT o_enable_the_power_saving_functionality .pdf.
If
Chip type
RTL8192CU-series
RTL8192CE-series
RTL8192DU-series
RTL8192DE-series
RTL8723AS-series
RTL8723AU-series
RTL8189ES-series
RTL8188EU-series
ifeq ($(CONFIG_PLA TFORM_NEW), y)
EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN
ARCH := arm
CROSS_COMPILE := /opt/new/toolchain/arm-eabi-4.4.3/bin/arm-eabi-
KSRC := /opt /new/kernel
MODULE_NAME := wlan
endif
5
configuration
modifyfor a specific chip type:
5.
This paragraph is for integrating our driver source into Linux kernel tree and
buildingsystem. If you havenoneedtodo this, simplyskip this paragraph.
For compoundrelease driver source, make_drvshould be execute to select chip
typefor the driver source. Please refer to:
“3. SelectingChip T ypewith make_drvScript (for compound release)”.
For
touse for the integration process:
Assuming
into kernel buildingsystem, go through the followingsteps:
1).
, rtl8192cu.
Chip type
RTL8192CU-series
RTL8192CE-series
RTL8192DU-series
RTL8192DE-series
RTL8723AS-series
RTL8723AU-series
RTL8189ES-series
RTL8188EU-series
Chip type
RTL8192CU-series
RTL8192CE-series
RTL8192DU-series
RTL8192DE-series
RTL8723AS-series
RTL8723AU-series
RTL8189ES-series
RTL8188EU-series
6
2).
is for , rtl8192cuis for :
3).
:
4).
for our driver .
5).
6.
6.1.
For compilingdriver inthe originaldriver source folder , simply cd into the
driver source folder andstart builddriver with ‘make’
If everything goes well, it will produce a MODULE_NAME.ko file. The
MODULE_NAME is specifiedinMakefile. Please refer to:
“MODULE_NAME” in “4.2. Platform SettingSection in Detail”.
6.2.
For compilingdriver under kerneltree, please refer to:
“5. IntegratingDriver Source intoLinux Kernel Tree”.
7.
If you
as 8192cu.ko, you should insert driver module with ‘insmod’
As for driver compiledin kernel, it has no needtodo ‘insmod’ command