Ubuntu 12.04 修补b43驱动程序编译错误

Ubuntu 12.04 修补b43驱动程序编译错误

我试过这个如何安装此修补的 b43 驱动程序?在带有 3.2.0-31-generic 内核的 Ubuntu 12.04 上安装修补的 b43 驱动程序的指南,但我无法通过编译阶段。这是我所做的:

获得http://www.orbit-lab.org/kernel/compat-wireless-3-stable/v3.1/compat-wireless-3.1.1-1.tar.bz2 cd 兼容无线-3.1.1-1/

脚本/驱动程序选择 b43

制作

make -C /lib/modules/3.2.0-31-generic/build M=/home/marco/compat-wireless-3.1.1-1 modules
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-31-generic'
  CC [M]  /home/marco/compat-wireless-3.1.1-1/compat/main.o
In file included from /home/marco/compat-wireless-3.1.1-1/include/linux/compat-2.6.29.h:5:0,
                 from /home/marco/compat-wireless-3.1.1-1/include/linux/compat-2.6.h:24,
                 from <command-line>:0:
include/linux/netdevice.h:1153:5: warning: "IS_ENABLED" is not defined [-Wundef]
include/linux/netdevice.h:1153:15: error: missing binary operator before token "("
include/linux/netdevice.h: In function ‘netdev_uses_dsa_tags’:
include/linux/netdevice.h:1421:9: error: ‘struct net_device’ has no member named ‘dsa_ptr’
include/linux/netdevice.h:1422:31: error: ‘struct net_device’ has no member named ‘dsa_ptr’
include/linux/netdevice.h: In function ‘netdev_uses_trailer_tags’:
include/linux/netdevice.h:1431:9: error: ‘struct net_device’ has no member named ‘dsa_ptr’
include/linux/netdevice.h:1432:35: error: ‘struct net_device’ has no member named ‘dsa_ptr’
make[3]: *** [/home/marco/compat-wireless-3.1.1-1/compat/main.o] Error 1
make[2]: *** [/home/marco/compat-wireless-3.1.1-1/compat] Error 2
make[1]: *** [_module_/home/marco/compat-wireless-3.1.1-1] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-31-generic'
make: *** [modules] Error 2

为了修复该错误,我将其添加#include <linux/kconfig.h>到 /usr/src/linux-headers-3.2.0-31-generic/include/linux/netdevice.h,但现在我得到了其他东西

制作

make -C /lib/modules/3.2.0-31-generic/build M=/home/marco/compat-wireless-3.1.1-1 modules
make[1]: Entering directory `/usr/src/linux-headers-3.2.0-31-generic'
  CC [M]  /home/marco/compat-wireless-3.1.1-1/compat/main.o
  LD [M]  /home/marco/compat-wireless-3.1.1-1/compat/compat.o
  CC [M]  /home/marco/compat-wireless-3.1.1-1/drivers/bcma/main.o
In file included from /home/marco/compat-wireless-3.1.1-1/include/linux/bcma/bcma.h:9:0,
                 from /home/marco/compat-wireless-3.1.1-1/drivers/bcma/bcma_private.h:8,
                 from /home/marco/compat-wireless-3.1.1-1/drivers/bcma/main.c:8:
/home/marco/compat-wireless-3.1.1-1/include/linux/ssb/ssb.h: In function ‘ssb_driver_register’:
/home/marco/compat-wireless-3.1.1-1/include/linux/ssb/ssb.h:236:36: error: ‘THIS_MODULE’ undeclared (first use in this function)
/home/marco/compat-wireless-3.1.1-1/include/linux/ssb/ssb.h:236:36: note: each undeclared identifier is reported only once for each function it appears in
In file included from /home/marco/compat-wireless-3.1.1-1/drivers/bcma/bcma_private.h:8:0,
                 from /home/marco/compat-wireless-3.1.1-1/drivers/bcma/main.c:8:
/home/marco/compat-wireless-3.1.1-1/include/linux/bcma/bcma.h: In function ‘bcma_driver_register’:
/home/marco/compat-wireless-3.1.1-1/include/linux/bcma/bcma.h:170:37: error: ‘THIS_MODULE’ undeclared (first use in this function)
/home/marco/compat-wireless-3.1.1-1/drivers/bcma/main.c: At top level:
/home/marco/compat-wireless-3.1.1-1/drivers/bcma/main.c:12:20: error: expected declaration specifiers or ‘...’ before string constant
/home/marco/compat-wireless-3.1.1-1/drivers/bcma/main.c:13:16: error: expected declaration specifiers or ‘...’ before string constant
/home/marco/compat-wireless-3.1.1-1/drivers/bcma/main.c:182:1: warning: data definition has no type or storage class [enabled by default]
/home/marco/compat-wireless-3.1.1-1/drivers/bcma/main.c:182:1: warning: type defaults to ‘int’ in declaration of ‘EXPORT_SYMBOL_GPL’ [-Wimplicit-int]
/home/marco/compat-wireless-3.1.1-1/drivers/bcma/main.c:182:1: warning: parameter names (without types) in function declaration [enabled by default]
/home/marco/compat-wireless-3.1.1-1/drivers/bcma/main.c:188:1: warning: data definition has no type or storage class [enabled by default]
/home/marco/compat-wireless-3.1.1-1/drivers/bcma/main.c:188:1: warning: type defaults to ‘int’ in declaration of ‘EXPORT_SYMBOL_GPL’ [-Wimplicit-int]
/home/marco/compat-wireless-3.1.1-1/drivers/bcma/main.c:188:1: warning: parameter names (without types) in function declaration [enabled by default]
make[3]: *** [/home/marco/compat-wireless-3.1.1-1/drivers/bcma/main.o] Error 1
make[2]: *** [/home/marco/compat-wireless-3.1.1-1/drivers/bcma] Error 2
make[1]: *** [_module_/home/marco/compat-wireless-3.1.1-1] Error 2
make[1]: Leaving directory `/usr/src/linux-headers-3.2.0-31-generic'
make: *** [modules] Error 2

有什么建议下一步该尝试什么吗?

答案1

面对同样的问题,我不得不编辑许多文件来修复。

/usr/src/linux-headers-3.2.0-31-generic/include/linux/netdevice.h
bcm4331/compat-wireless-2011-08-27/include/linux/compat-2.6.h
bcm4331/compat-wireless-2011-08-27/drivers/net/wireless/b43/main.c
bcm4331/compat-wireless-2011-08-27/drivers/net/wireless/b43legacy/main.c
bcm4331/compat-wireless-2011-08-27/drivers/net/wireless/b43/pio.c
bcm4331/compat-wireless-2011-08-27/net/mac80211/mlme.c
bcm4331/compat-wireless-2011-08-27/net/mac80211/rate.c
bcm4331/compat-wireless-2011-08-27/net/wireless/core.c
bcm4331/compat-wireless-2011-08-27/net/wireless/util.c
bcm4331/compat-wireless-2011-08-27/net/wireless/reg.c
bcm4331/compat-wireless-2011-08-27/net/wireless/nl80211.c

主要添加

+#include <linux/module.h>
+#include <linux/export.h>

当问题由字符串引起时,我注释掉了/usr/src/linux-headers-3.2.0-31-generic/include/linux/netdevice.h和其他文件中的函数。

//#if IS_ENABLED(CONFIG_NET_DSA)
//      struct dsa_switch_tree  *dsa_ptr;       /* dsa specific data */
//#endif

//#ifdef CONFIG_NET_DSA_TAG_DSA
//      if (dev->dsa_ptr != NULL)
//              return dsa_uses_dsa_tags(dev->dsa_ptr);
//#endif

//#ifdef CONFIG_NET_DSA_TAG_TRAILER
//      if (dev->dsa_ptr != NULL)
//              return dsa_uses_trailer_tags(dev->dsa_ptr);
//#endif

或者adding = false在一个文件中一个变量的声明语句中。

我不是 C 开发人员而是 PHP 开发人员,但只需按照 make debug 就可以了:

sudo ./b43-fwcutter -w "$FIRMWARE_INSTALL_DIR" ../broadcom-wl-5.100.138/linux/wl_apsta

相关内容