Firefly开源社区

RS9113无线网卡驱动编译报错

26

积分

0

威望

0

贡献

技术小白

积分
26
发表于 2018-3-15 11:19:21     
本帖最后由 gdzshjw1990 于 2018-3-15 11:19 编辑

在编译RS9113 onebox 驱动时报错。
编译平台 VM虚拟机,linux mint 18.3 64bit
目标平台 RK3399  ubuntu 16.04 内核版本4.4.77
驱动程序的Makefile已经设置了交叉编译工具链的路径和内核源码路径:
  1. CROSS_COMPILE := /home/kavi/firefly-rk3399/prebuilts/gcc/linux-x86/aarch64/aarch64-linux-android-4.9/bin/aarch64-linux-android-
  2. CC=$(CROSS_COMPILE)gcc

  3. #DEF_KERNEL_DIR := /lib/modules/$(shell uname -r)/build
  4. DEF_KERNEL_DIR := /home/kavi/firefly-rk3399/A3_Kubot_Firefly_RK3399_linux_kernel
复制代码
然后编译时会有以下报错:
  1. kavi-virtual-machine host # make
  2. -e Compiling Onebox Mobile Driver...
  3. make EXTRA_CFLAGS="-DWLAN_ENABLE -DONEBOX_DEBUG_ENABLE -DPROGRAMMING_BBP_TA -DPROGRAMMING_SCAN_TA -DRSI_SDIO_MULTI_BLOCK_SUPPORT -DLINUX -Wimplicit -Wstrict-prototypes -DFLASH_BURNING -DRSI_SDIO_MULTI_BLOCK_SUPPORT -DSDIO_COMMANDS -DDYNAMIC_VARIABLES -DRF_8111 -I/home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/common_hal/include/linux/ -I/home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/common_hal/include/common/ -DINET6 -Dnet80211_s -DBGSCAN_SUPPORT -DPWR_SAVE_SUPPORT -DACM_NO_TSPEC_CNFM -DBYPASS_TX_DATA_PATH -DBYPASS_RX_DATA_PATH -DIEEE80211_AMPDU_AGE -DSECURITY_SUPPORT -DAMPDU_AGGR_SUPPORT -DENABLE_P2P_SUPPORT -DRSI_CCX -DUSE_WORKQUEUES -DCHANNEL_UTILIZATION -DONEBOX_CONFIG_WOWLAN -I/home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/wlan/net80211/linux/osd_linux/include/ -I/home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/wlan/net80211/linux/osi_net80211/net80211/ -I/home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/wlan/net80211/linux/osi_net80211/ -I/home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/wlan/wlan_hal/include/linux -DUSE_BLUEZ_BT_STACK -I/home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/bt/include/linux -I/home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/zigbee/include/linux -g -DUSE_USB_INTF" -C /home/kavi/firefly-rk3399/A3_Kubot_Firefly_RK3399_linux_kernel SUBDIRS=/home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host modules
  4. make[1]: Entering directory '/home/kavi/firefly-rk3399/A3_Kubot_Firefly_RK3399_linux_kernel'
  5.   CC [M]  /home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/wlan/wlan_hal/osi_wlan/devdep/rsi_9113/onebox_wlan_osi_init.o
  6. In file included from include/linux/pagemap.h:10:0,
  7.                  from include/linux/blkdev.h:14,
  8.                  from include/linux/mmc/host.h:19,
  9.                  from /home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/common_hal/include/common/onebox_sdio_intf.h:50,
  10.                  from /home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/wlan/wlan_hal/include/linux/wlan_common.h:1008,
  11.                  from /home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/wlan/wlan_hal/osi_wlan/devdep/rsi_9113/onebox_wlan_osi_init.c:34:
  12. include/linux/highmem.h: In function 'kmap_to_page':
  13. include/linux/highmem.h:50:1: error: macro "ALIGN" passed 2 arguments, but takes just 1
  14.   return virt_to_page(addr);
  15. ^
  16. In file included from include/linux/mm.h:66:0,
  17.                  from include/linux/scatterlist.h:7,
  18.                  from include/linux/dmaengine.h:24,
  19.                  from include/linux/netdevice.h:38,
  20.                  from /home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/wlan/wlan_hal/include/linux/wlan_common.h:34,
  21.                  from /home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/wlan/wlan_hal/osi_wlan/devdep/rsi_9113/onebox_wlan_osi_init.c:34:
  22. ./arch/arm64/include/asm/pgtable.h:43:23: error: 'ALIGN' undeclared (first use in this function)
  23. #define VMEMMAP_SIZE  ALIGN((1UL << (VA_BITS - PAGE_SHIFT)) * sizeof(struct page), PUD_SIZE)
  24.                        ^
  25. ./arch/arm64/include/asm/pgtable.h:46:48: note: in expansion of macro 'VMEMMAP_SIZE'
  26. #define VMALLOC_END  (PAGE_OFFSET - PUD_SIZE - VMEMMAP_SIZE - SZ_64K)
  27.                                                 ^
  28. ./arch/arm64/include/asm/pgtable.h:48:25: note: in expansion of macro 'VMALLOC_END'
  29. #define VMEMMAP_START  (VMALLOC_END + SZ_64K)
  30.                          ^
  31. ./arch/arm64/include/asm/pgtable.h:49:35: note: in expansion of macro 'VMEMMAP_START'
  32. #define vmemmap   ((struct page *)VMEMMAP_START - \
  33.                                    ^
  34. include/asm-generic/memory_model.h:53:29: note: in expansion of macro 'vmemmap'
  35. #define __pfn_to_page(pfn) (vmemmap + (pfn))
  36.                              ^
  37. include/asm-generic/memory_model.h:81:21: note: in expansion of macro '__pfn_to_page'
  38. #define pfn_to_page __pfn_to_page
  39.                      ^
  40. ./arch/arm64/include/asm/memory.h:198:29: note: in expansion of macro 'pfn_to_page'
  41. #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
  42.                              ^
  43. include/linux/highmem.h:50:9: note: in expansion of macro 'virt_to_page'
  44.   return virt_to_page(addr);
  45.          ^
  46. ./arch/arm64/include/asm/pgtable.h:43:23: note: each undeclared identifier is reported only once for each function it appears in
  47. #define VMEMMAP_SIZE  ALIGN((1UL << (VA_BITS - PAGE_SHIFT)) * sizeof(struct page), PUD_SIZE)
  48.                        ^
  49. ./arch/arm64/include/asm/pgtable.h:46:48: note: in expansion of macro 'VMEMMAP_SIZE'
  50. #define VMALLOC_END  (PAGE_OFFSET - PUD_SIZE - VMEMMAP_SIZE - SZ_64K)
  51.                                                 ^
  52. ./arch/arm64/include/asm/pgtable.h:48:25: note: in expansion of macro 'VMALLOC_END'
  53. #define VMEMMAP_START  (VMALLOC_END + SZ_64K)
  54.                          ^
  55. ./arch/arm64/include/asm/pgtable.h:49:35: note: in expansion of macro 'VMEMMAP_START'
  56. #define vmemmap   ((struct page *)VMEMMAP_START - \
  57.                                    ^
  58. include/asm-generic/memory_model.h:53:29: note: in expansion of macro 'vmemmap'
  59. #define __pfn_to_page(pfn) (vmemmap + (pfn))
  60.                              ^
  61. include/asm-generic/memory_model.h:81:21: note: in expansion of macro '__pfn_to_page'
  62. #define pfn_to_page __pfn_to_page
  63.                      ^
  64. ./arch/arm64/include/asm/memory.h:198:29: note: in expansion of macro 'pfn_to_page'
  65. #define virt_to_page(kaddr) pfn_to_page(__pa(kaddr) >> PAGE_SHIFT)
  66.                              ^
  67. include/linux/highmem.h:50:9: note: in expansion of macro 'virt_to_page'
  68.   return virt_to_page(addr);
  69.          ^
  70. scripts/Makefile.build:258: recipe for target '/home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/wlan/wlan_hal/osi_wlan/devdep/rsi_9113/onebox_wlan_osi_init.o' failed
  71. make[2]: *** [/home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host/wlan/wlan_hal/osi_wlan/devdep/rsi_9113/onebox_wlan_osi_init.o] Error 1
  72. Makefile:1424: recipe for target '_module_/home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host' failed
  73. make[1]: *** [_module_/home/kavi/firefly-rk3399/RS9113.NBZ.NL.GENR.LNX.1.6.0/source/host] Error 2
  74. make[1]: Leaving directory '/home/kavi/firefly-rk3399/A3_Kubot_Firefly_RK3399_linux_kernel'
  75. Makefile:382: recipe for target 'compile_driver' failed
  76. make: *** [compile_driver] Error 2
复制代码
与RS9113原厂沟通,他们的回复是我们要编译linux系统为什么要用android的工具链,他们觉得这个问题是内核和这套工具链不兼容。


rs9113_reply.png
回复

使用道具 举报

152

积分

0

威望

6

贡献

技术小白

积分
152
发表于 2018-3-15 14:29:11     
本帖最后由 busybee 于 2018-3-15 14:31 编辑

我觉得关键点编译器的出错信息上:
./arch/arm64/include/asm/pgtable.h:43:23: error: 'ALIGN' undeclared (first use in this function)
#define VMEMMAP_SIZE  ALIGN((1UL << (VA_BITS - PAGE_SHIFT)) * sizeof(struct page), PUD_SIZE)

include/linux/highmem.h: In function 'kmap_to_page':
include/linux/highmem.h:50:1: error: macro "ALIGN" passed 2 arguments, but takes just 1
  return virt_to_page(addr);

错误信息是没找到 ALIGN macro, 而 ALIGN macro 在 include/linux/kernel.h 上定义,确实是需要传入两个参数的,而驱动中有没有包含这个头文件呢?
另外可以试试, ubuntu 16.04 本身的 aarch64-linux-gnu-gcc 去编译(sudo apt install gcc-aarch64-linux-gnu) 。

回复

使用道具 举报

26

积分

0

威望

0

贡献

技术小白

积分
26
发表于 2018-3-15 17:39:44     
busybee 发表于 2018-3-15 14:29
我觉得关键点编译器的出错信息上:
./arch/arm64/include/asm/pgtable.h:43:23: error: 'ALIGN' undeclare ...

onebox_wlan_osi_init,c里面已经include kernel.h了
  1. #include <linux/module.h>
  2. #include <linux/kernel.h>
  3. #include "onebox_datatypes.h"
  4. #include "wlan_common.h"

  5. ONEBOX_STATIC int32 onebox_wlan_nongpl_module_init(VOID)
  6. {
  7.         ONEBOX_DEBUG(ONEBOX_ZONE_INIT,(TEXT("onebox_wlan_nongpl_module_init called and registering the wlan nongpl driver\n")));
  8.         return 0;
  9. }

  10. ONEBOX_STATIC VOID onebox_wlan_nongpl_module_exit(VOID)
  11. {
  12.         ONEBOX_DEBUG(ONEBOX_ZONE_INIT,(TEXT("onebox_wlan_nongpl_module_exit called and unregistering the wlan nongpl driver\n")));
  13.         return;
  14. }

  15. module_init(onebox_wlan_nongpl_module_init);
  16. module_exit(onebox_wlan_nongpl_module_exit);
复制代码

交叉编译之前我在linux mint 18.3 64bit系统上直接编译并且可以加载运行,但是使用firefly的linux kernel和交叉编译工具链就会报这个错误。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

友情链接 : 爱板网 电子发烧友论坛 云汉电子社区 粤ICP备14022046号-2
快速回复 返回顶部 返回列表