Linux教程網
Linux教程網
Linux教程網
您现在的位置: Linux教程網 >> UnixLinux >  >> Linux 程式設計 >> Linux 程式設計

RT3070 WiFi 模組在 ARM Linux 上的移植

軟硬體平台:宿主機 Fedora10(VMware 虛擬機);目標板 tiny6410,Linux 2.6.38;交叉編譯工具 arm-linux- 4.5.1;網卡為 Ralink 3070 模組。

步驟一:編譯 ARM 版內核

從 tiny6410 光碟取得已移植好的內核源碼,解壓後拷入 config_mini6410_n43 作為 .config,執行 make menuconfig,重點開啟:

[*] Networking support
    [*] Wireless
        <*> cfg80211 - wireless configuration API
        [*] Generic IEEE 802.11 Networking Stack (mac80211)
Device Drivers
    [*] Network device support
        [*] Wireless LAN
            <M> Ralink driver support
                <M> Ralink rt27xx/rt28xx/rt30xx (USB) support

make 後在 arch/arm/boot/ 下生成可燒寫的 zImage。

步驟二:編譯 RT3070 驅動

從 Ralink 官網下載 Linux 版驅動並解壓、改名為 rt3070 進入目錄。修改 os/linux/config.mk 開啟 WPA 支援:

HAS_WPA_SUPPLICANT=y
HAS_NATIVE_WPA_SUPPLICANT_SUPPORT=y

再改 Makefile,把芯片類型設為 3070,並在 PLATFORM=PC 分支下指定交叉編譯的內核路徑與工具:

ifeq ($(CHIPSET),)
CHIPSET = 3070
endif
ifeq ($(PLATFORM),PC)
LINUX_SRC = /usr/src/kernels/linux-2.6.38
CROSS_COMPILE = /usr/local/FriendlyARM/toolschain/4.5.1/bin/arm-linux-
endif

直接 make 會報 implicit declaration of function 'RT33xx_Init',這是改動 CHIPSET 所致。修改 chips/rtmp_chip.c 第 470 行,把 RT33xx_Init 呼叫註解掉:

#ifdef RT30xx
    if (IS_RT30xx(pAd)) {
        if (IS_RT3390(pAd))
            ;//RT33xx_Init(pAd);
        else
            RT30xx_Init(pAd);
    }
#endif

再次 make 便通過,於 os/linux/ 下生成 rt3070sta.ko。若發現檔案高達 12m,是包含了大量調試資訊,可用 arm-linux-strip -S rt3070sta.ko 精簡至約 750k(-S 參數不可省,否則加載時會報找不到版本資訊)。

Copyright © Linux教程網 All Rights Reserved