移植MT7620A+MT7610E+MT76X2E到Openwrt trunk(Linux Kernel 3.14

一)MT7620

1)#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)#include "../../../linux-2.6.36/net/nat/hw_nat/ra_nat.h"#include "../../../linux-2.6.36/net/nat/hw_nat/frame_engine.h"#endif

#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)#include "../../../../../../net/nat/hw_nat/ra_nat.h"#include "../../../../../../net/nat/hw_nat/frame_engine.h"#endif

2)trunk/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7620-wifi2716_all_dpa_20130426/rt2860v2/os/linux/rt_linux.c  将:      pOSFSInfo->fsuid = current_fsuid();    pOSFSInfo->fsgid = current_fsgid();  修改为:    pOSFSInfo->fsuid = *(int *)&current_fsuid();    pOSFSInfo->fsgid = *(int *)&current_fsgid();

3)application编译ralink自带的gpio等程序时,可能会出现如下错误。

make[4]: Entering directory `*******/build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/gpio’

staging_dir/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib -o gpio gpio.cgpio.c:28:28: fatal error: linux/autoconf.h: No such file or directory#include <linux/autoconf.h> ^

compilation terminated.make[4]: *** [gpio] Error 1

修改a)

//#include <linux/autoconf.h>#include <generated/autoconf.h>

修改b)可能需要将源码中CONFIG_RALINK_MT7620这样的编译宏修改为CONFIG_SOC_MT7620; 因为autoconf.h只有CONFIG_SOC_MT7620宏定义;

enum {#if defined (CONFIG_RALINK_RT3052)gpio2300,gpio3924,gpio5140,#elif defined (CONFIG_RALINK_RT3883)gpio2300,gpio3924,gpio7140,gpio9572,#elif defined (CONFIG_RALINK_RT3352)gpio2300,gpio3924,gpio4540,#elif defined (CONFIG_RALINK_RT5350)gpio2100,gpio2722,#elif defined (CONFIG_RALINK_RT6855A)gpio1500,gpio3116,#elif defined (CONFIG_RALINK_MT7620)gpio2300,gpio3924,gpio7140,gpio72,#elif defined (CONFIG_RALINK_MT7621)gpio3100,gpio6332,gpio9564,#elif defined (CONFIG_RALINK_MT7628)gpio2300,gpio3924,gpio7140,gpio72,#elsegpio2300,#endif};

解决的一种方法是在gpio的Makefile文件中添加如下的定义ifeq ($(CONFIG_SOC_MT7620),y)EXTRA_CFLAGS += -DCONFIG_RALINK_MT7620endif

修改c)build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/linux-3.14.32/drivers/char/ralink_gpio.h:37:32: fatal error: asm/rt2880/rt_mmap.h: No such file or directory

一种解决办法:创建目录build_dir\target-mipsel_24kec+dsp_uClibc-0.9.33.2\linux-ramips_mt7620\linux-3.14.32\include\asm将原厂SDK中的linux-2.6.36\include\asm\rt2880目录拷贝到该目录中,#include <asm/rt2880/rt_mmap.h>

二)MT76x2e1)build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7612e_mt7602e_LinuxAP_3.0.2.9_iPA_20140103/rlt_wifi_ap/../rlt_wifi/os/linux/rt_linux.c:911:20: error: incompatible types when assigning to type ‘int’ from type ‘kgid_t’ pOSFSInfo->fsgid = current_fsgid();

build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7612e_mt7602e_LinuxAP_3.0.2.9_iPA_20140103/rlt_wifi_ap/../rlt_wifi/os/linux/rt_linux.c 将:      pOSFSInfo->fsuid = current_fsuid();    pOSFSInfo->fsgid = current_fsgid();  修改为:    pOSFSInfo->fsuid = *(int *)&current_fsuid();    pOSFSInfo->fsgid = *(int *)&current_fsgid();

2)build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7612e_mt7602e_LinuxAP_3.0.2.9_iPA_20140103/rlt_wifi_ap/../rlt_wifi/os/linux/rt_linux.c

#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)#include "../../../linux-2.6.36/net/nat/hw_nat/ra_nat.h"#include "../../../linux-2.6.36/net/nat/hw_nat/frame_engine.h"#endif

#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)#include "../../../../../../net/nat/hw_nat/ra_nat.h"#include "../../../../../../net/nat/hw_nat/frame_engine.h"#endif

三)MT7610e1)build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7610e_wifi_v3006_dpa_20130613//os/linux/pci_main_dev.c:43:23: error: expected ‘=’, ‘,’, ‘;’, ‘asm’ or ‘__attribute__’ before ‘rt2860_remove_one’static VOID __devexit rt2860_remove_one(struct pci_dev *pci_dev);

解决方法可以参考以下链接:http://www.tinylab.org/faqs/fixup-compile-error-with-devinit-devexit/如果报错的函数前有 __devinit 或者 __devexit 等宏,那么罪魁祸首的就是这个了。因为这些宏在 Linux Kernel 3.8 之后,就已经移除了;而在3.8.1之前的版本中在linux/init.h中有如下的定义。* Used for HOTPLUG */#define __devinit __div(.devinit.text) __cold notrace#define __devinitdata __div(.devinit.data)#define __devinitconst __constdiv(.devinit.rodata)#define __devexit __div(.devexit.text) __exitused __cold notrace#define __devexitdata __div(.devexit.data)#define __devexitconst __constdiv(.devexit.rodata)

修改后参考代码如下:/* *//* Function declarations *//* *//*extern int rt28xx_close(IN struct net_device *net_dev); *//*extern int rt28xx_open(struct net_device *net_dev); */#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,1)static VOID __exit rt2860_remove_one(struct pci_dev *pci_dev);static INT __init rt2860_probe(struct pci_dev *pci_dev, const struct pci_device_id *ent);#elsestatic VOID __devexit rt2860_remove_one(struct pci_dev *pci_dev);static INT __devinit rt2860_probe(struct pci_dev *pci_dev, const struct pci_device_id *ent);#endif

/* *//* Ralink PCI device table, include all supported chipsets *//* */#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,1)static struct pci_device_id rt2860_pci_tbl[] __initdata =#elsestatic struct pci_device_id rt2860_pci_tbl[] __devinitdata =#endif{#ifdef RT3290{PCI_DEVICE(NIC_PCI_VENDOR_ID, NIC3290_PCIe_DEVICE_ID)},#endif /* RT3290 */

/* *//* Our PCI driver structure *//* */static struct pci_driver rt2860_driver ={ name: RTMP_DRV_NAME, id_table: rt2860_pci_tbl, probe: rt2860_probe,#if LINUX_VERSION_CODE >= 0x20412#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,1) remove: __exit_p(rt2860_remove_one),#else remove: __devexit_p(rt2860_remove_one),#endif#else remove: __devexit(rt2860_remove_one),#endif

/* *//* PCI device probe & initialization function *//* */#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,1)static int __init rt2860_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)#elsestatic int __devinit rt2860_probe(struct pci_dev *pdev, const struct pci_device_id *pci_id)#endif{VOID *pAd = NULL;

#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,8,1)static VOID __exit rt2860_remove_one(struct pci_dev *pci_dev)#elsestatic VOID __devexit rt2860_remove_one(struct pci_dev *pci_dev)#endif{PNET_DEV net_dev = pci_get_drvdata(pci_dev);

2)build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7610e_wifi_v3006_dpa_20130613//os/linux/rt_linux.c:899:20: error: incompatible types when assigning to type ‘int’ from type ‘kuid_t’ pOSFSInfo->fsuid = current_fsuid();

build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7610e_wifi_v3006_dpa_20130613//os/linux/rt_linux.c 将:      pOSFSInfo->fsuid = current_fsuid();    pOSFSInfo->fsgid = current_fsgid();  修改为:    pOSFSInfo->fsuid = *(int *)&current_fsuid();    pOSFSInfo->fsgid = *(int *)&current_fsgid();

3)build_dir/target-mipsel_24kec+dsp_uClibc-0.9.33.2/linux-ramips_mt7620/mt7610e_wifi_v3006_dpa_20130613//os/linux/rt_linux.c

#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)#include "../../../linux-2.6.36/net/nat/hw_nat/ra_nat.h"#include "../../../linux-2.6.36/net/nat/hw_nat/frame_engine.h"#endif

#if defined(CONFIG_RA_HW_NAT) || defined(CONFIG_RA_HW_NAT_MODULE)#include "../../../../../../net/nat/hw_nat/ra_nat.h"#include "../../../../../../net/nat/hw_nat/frame_engine.h"#endif

梦想让我与众不同,奋斗让我改变命运!

移植MT7620A+MT7610E+MT76X2E到Openwrt trunk(Linux Kernel 3.14

相关文章:

你感兴趣的文章:

标签云: