 基于3.14內核rtl8188eu驅動移植
							時間:2018-09-21      來源:未知
							基于3.14內核rtl8188eu驅動移植
							時間:2018-09-21      來源:未知 
							近的項目上要(yao)用(yong)到3.14的內核,我(wo)們需要(yao)一個可以使用(yong)wifi連接外網(wang)的文件系統(tong),我(wo)們的wifi模塊使用(yong)的是rtl8188eus,所(suo)以需要(yao)移植(zhi)一個rtl8188eu的驅動。
首先去網上找相關8188eu的驅動(dong)源碼,我這里使用的是(shi)rtl8188EUS_rtl8189ES_linux_v4.1.1_4235.20120606。
還需要使用到linux-3.14內(nei)核的源(yuan)碼,這兩樣(yang)準備(bei)完畢后,源(yuan)碼就齊了。
將rtl8188的(de)驅(qu)動解壓后,需要添加一(yi)個適合于我們平(ping)臺的(de)編(bian)譯選項,操作如下:
vi Makefile
  
將原(yuan)Makefile中關于CONFIG_PLATFORM_I386_PC = y改成 n
根據(ju)其他arm平臺添加一(yi)個 CONFIG_PLATFORM_ARM_SMDK4x12 = y
然后在適當位(wei)置(zhi)添加(jia)如下(356-362行內容):
 
退出保存后(hou),執行make
 
在linux/osdep_service.h下,注釋掉1360行對(dui)應的daemonize(“%s”,”RTKTHREAD);
 
繼續編譯(yi),錯(cuo)誤如下:
 
這個錯誤(wu)的(de)(de)原(yuan)因(yin)是3.14內核(he)不(bu)支(zhi)持這些函(han)數(shu)(shu),這些函(han)數(shu)(shu)的(de)(de)名稱(cheng)被換成了其他(ta)名稱(cheng)的(de)(de)函(han)數(shu)(shu),這里的(de)(de)主(zhu)要功能是實現(xian)proc文件系(xi)統,這里我們選(xuan)擇注釋掉。
vi os_dep/linux/os_intfs.c
注釋掉rtw_proc_init_one()函數內部所有代碼
注釋(shi)掉rtw_proc_remove_one()函數內部所有代(dai)碼(ma)
 
  
 
注釋完成(cheng)后,繼續(xu)編譯
如果(guo)編譯時(shi)(shi)出現這(zhe)種錯誤,是(shi)因為(wei)在配置(zhi)Makefile時(shi)(shi),我們指定的內核(he)在配置(zhi)時(shi)(shi)不(bu)支持802.11的無線設備驅(qu)動(dong)。
../os/linux/sta_ioctl.c:2227: error: unknown field 'private' specified in initializer
../os/linux/sta_ioctl.c:2227: warning: initialization from incompatible pointer type
../os/linux/sta_ioctl.c:2228: error: unknown field 'num_private' specified in initializer
../os/linux/sta_ioctl.c:2228: warning: excess elements in struct initializer
../os/linux/sta_ioctl.c:2228: warning: (near initialization for 'rt28xx_iw_handler_def')
../os/linux/sta_ioctl.c:2229: error: unknown field 'private_args' specified in initializer
../os/linux/sta_ioctl.c:2229: warning: excess elements in struct initializer
../os/linux/sta_ioctl.c:2229: warning: (near initialization for 'rt28xx_iw_handler_def')
../os/linux/sta_ioctl.c:2230: error: unknown field 'num_private_args' specified in initializer
../os/linux/sta_ioctl.c:2230: warning: excess elements in struct initializer
../os/linux/sta_ioctl.c:2230: warning: (near initialization for 'rt28xx_iw_handler_def')
解決辦法(fa):重新配置編譯指定的Linux Kernel,將Device Drivers==>Network deivce support==>Wireless LAN==><*> USB ZD1201 based Wireless device support,編譯即(ji)可(ke)
繼續編譯
如果有以下的錯誤:
error: 'struct net_device' has no member named 'wireless_handlers'
//如下是原因(yin),講到了定(ding)義的地方(fang)
struct net_device is defined in include/linux/netdevice.h, which includes
this ifdef:
#ifdef CONFIG_WIRELESS_EXT
/* List of functions to handle Wireless Extensions (instead of ioctl).
 * See 
const struct iw_handler_def * wireless_handlers; <======== NOTE
/* Instance data managed by the core of Wireless Extensions. */
struct iw_public_data * wireless_data;
#endif
解決方法:在Makefile加上如下(xia)
 
繼續編譯:
  
編譯到后出(chu)現了undefined的情況,是因為現在版(ban)本的內核(he)kernel_thread函數(shu)并沒(mei)有(you)定義它的符(fu)號,我們(men)把這個函數(shu)換成856行的kthread_run(),如(ru)下圖:
  
這個(ge)函數需(xu)要一個(ge)頭文件,這個(ge)頭文件時kthread.h,他可以從3.14內核源(yuan)碼中拷貝,位置(zhi)是include/linux/kthrea.h。
拷(kao)貝到os_dep/linux/下以后,在os_dep/linux/os_intfs.c中(zhong)添(tian)加如下代(dai)碼
  
之后就(jiu)可以編(bian)譯成功(gong)了(le),如下圖
 

