RT3070 SoftAP:修改在Linux 3.13.0-32 内核上的编译错误

2970阅读 0评论2016-03-23 fangdikui
分类:嵌入式

1. Rt_linux.c编译时报错
/workspace/git/2010_0203_RT3070_SoftAP_v2.4.0.1_DPA/UTIL/os/linux/../../os/linux/rt_linux.c: In function 'RtmpOSFSInfoChange':
/workspace/git/2010_0203_RT3070_SoftAP_v2.4.0.1_DPA/UTIL/os/linux/../../os/linux/rt_linux.c:991:20:error: incompatible types when assigning to type 'int' from type 'kuid_t'
   pOSFSInfo->fsuid = current_fsuid();
                    ^
/workspace/git/2010_0203_RT3070_SoftAP_v2.4.0.1_DPA/UTIL/os/linux/../../os/linux/rt_linux.c:992:20: error: incompatible types when assigning to type 'int' from type 'kgid_t'
   pOSFSInfo->fsgid = current_fsgid();  
                    ^
修改=============
Rt_linux.c
diff: line 991
-        pOSFSInfo->fsuid = current_fsuid();
+        pOSFSInfo->fsuid = current_fsuid().val;
diff: line 992
-        pOSFSInfo->fsgid = current_fsgid().val;
+        pOSFSInfo->fsgid = current_fsgid().val;        

2. 继续报错:
/home/fang/soft/build/2010_0203_RT3070_SoftAP_v2.4.0.1_DPA/UTIL/os/linux/../../os/linux/rt_usb_util.c:136: error: implicit declaration of function ‘usb_buffer_free’
make[3]: *** [/home/fang/soft/build/2010_0203_RT3070_SoftAP_v2.4.0.1_DPA/UTIL/os/linux/../../os/linux/rt_usb_util.o] 错误 1

以前2.6.32版本并没有出现这样的问题,这次是新版本的,那么就可能是内核版本差异造成的,经过努力发现新内核后, usb_buffer_alloc 和 usb_buffer_free 被替换成 usb_alloc_coherent 和 usb_free_coherent。所以编译才会报错。修改 include/os/rt_linux.h 文件。如下

#define RTUSB_URB_ALLOC_BUFFER(pUsb_Dev, BufSize, pDma_addr) usb_buffer_alloc(pUsb_Dev, BufSize, GFP_ATOMIC, pDma_addr)
#define RTUSB_URB_FREE_BUFFER(pUsb_Dev, BufSize, pTransferBuf, Dma_addr) usb_buffer_free(pUsb_Dev, BufSize, pTransferBuf, Dma_addr)
替换成:
#define RTUSB_URB_ALLOC_BUFFER(pUsb_Dev, BufSize, pDma_addr) usb_alloc_coherent(pUsb_Dev, BufSize, GFP_ATOMIC, pDma_addr)
#define RTUSB_URB_FREE_BUFFER(pUsb_Dev, BufSize, pTransferBuf, Dma_addr) usb_free_coherent(pUsb_Dev, BufSize, pTransferBuf, Dma_addr)

 gedit /home/fang/soft/build/2010_0203_RT3070_SoftAP_v2.4.0.1_DPA/UTIL/os/linux/../../os/linux/rt_usb_util.c
usb_buffer_alloc全部替换为usb_alloc_coherent
上一篇:make modules_install指定ko安装路径
下一篇:[162963.379355] rtutil3070ap: Unknown symbol mcount (err 0)