買了樹莓派2,正好原來有 360wifi2 ,不幸的是樹莓派2不能直接支持,須要本身編譯相關驅動,在網上搜索了很多教程,發現大多數是針對樹莓派1的,就算有些是樹莓派2的,也寫得不是很清楚,因此就把整個編譯過程記錄下來,但願能對有相同需求的朋友增長一點幫助,由於有些細節對於新手很容易出錯,因此本文儘可能詳細,不厭其煩,不作省略,把全部的操做步驟都記錄下來,若是顯示內容太多,但大可能是些沒必要要知道的信息,就用 …… 表示。php
寫在最前面須要注意的事項:Linux軟件版本很重要,每每一樣一個項目,內核版本升級或者gcc版本升級均可能致使編譯不經過,或者就算編譯經過了運行起來也不穩定。html
因此,全部打算參考本文進行操做的朋友,請務必保證你的程序、編譯器、系統版本跟本文的一致!linux
pi@raspberrypi /opt/github/mt7601u-ap $ uname -r 4.1.6-v7+ pi@raspberrypi /opt/github/mt7601u-ap $ uname -a Linux raspberrypi 4.1.6-v7+ #810 SMP PREEMPT Tue Aug 18 15:32:12 BST 2015 armv7l GNU/Linux
pi@raspberrypi /opt/github/mt7601u-ap $ cat /proc/version Linux version 4.1.6-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03) ) #810 SMP PREEMPT Tue Aug 18 15:32:12 BST 2015 pi@raspberrypi /opt/github/mt7601u-ap $
pi@raspberrypi /opt/github/mt7601u-ap $ gcc --version gcc (Raspbian 4.8.4-1) 4.8.4 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. pi@raspberrypi /opt/github/mt7601u-ap $
pi@raspberrypi /opt/github/mt7601u-ap $ git remote -v origin https://github.com/eywalink/mt7601u (fetch) origin https://github.com/eywalink/mt7601u (push) pi@raspberrypi /opt/github/mt7601u-ap $ (這個版本據使用者說能夠支持ap,不過我還沒來得及試驗)
整個編譯過程分兩部分: 第一部分是操做系統更新,包括更新樹莓派固件,下載Linux內核源碼,創建內核模塊庫目錄的符號連接; 第二部分是下載360wifi2的Linux驅動代碼,我下載的驅動文件已經添加對360wifi2(MT7601)的支持,不須要你們手動添加了,到時候直接編譯就行。最後再之內核模塊的形式對已經編譯好的無線網卡驅動模塊進行安裝。ios
正如某位同窗所說,由於 MT7601 比較便宜,因此有很多設備商使用了它,好比小度wifi,小米wifi,騰訊wifi什麼的,對這些網卡的支持也已經加入驅動代碼, 具體修改的地方以下: 在下載了的驅動源碼包裏的文件 src/common/rtusb_dev_id.c 裏面,加入以下內容: 在 {USB_DEVICE(0x148f,0×7601)}, /* MT 6370 */ 下面加入如下內容:c++
{USB_DEVICE(0x148f,0x760b)}, /* 360 Wifi */ {USB_DEVICE(0x2955,0x1001)}, /* baidu Wifi */ {USB_DEVICE(0x2a5f,0x1000)}, /* Tencent WIFI */ {USB_DEVICE(0×2955,0×0001)}, /* XiaoDu Wifi */ {USB_DEVICE(0x2717,0x4106)}, /* Xiaomi Wifi */
下面開始正式的編譯過程:git
一、首先是更新 rpi 固件,執行 rpi-update,記錄以下:github
我最初參照此文(http://www.7forz.com/2470/)編譯過一次,內核用 gcc-4.6 編譯,無線網卡驅動用 gcc-4.8 編譯,雖然能夠正常上網,可是使用一段時間後有可能隨機出現 oop 死機,錯誤信息以下:web
pi@raspberrypi /opt/github $ Message from syslogd@raspberrypi at Aug 20 12:56:15 ... "raspberrypi" 12:56 20-Aug-15 kernel:[50382.924472] Internal error: Oops: 8000000d [#1] PREEMPT SMP ARM
由於我用樹莓派2作服務器的一個目標就是追求穩定可靠,固然不能接受隨機性死機,因此這個問題必須解決。 (補充:寫到最後才發現出錯的緣由可能有兩個:一個是個人gcc版本是 4.8.2,而要求版本是 4.8.3 以上;一個是使用了 ARMv6 的 Module.symvers 文件,應該使用對應於ARMv7 的Module7.symvers)apache
最初決定參照此文(http://www.freemindworld.com/blog/2015/150312_complie_kernel_module_for_raspberry_pi_2.shtml),本身手動安裝,把內核和網卡驅動模塊從新所有在 gcc-4.8 下編譯一遍。c#
查看一下當前的 gcc
執行記錄以下:
pi@raspberrypi ~ $ ls -al /usr/bin/gcc* lrwxrwxrwx 1 root root 16 Aug 19 14:23 /usr/bin/gcc -> /usr/bin/gcc-4.6 -rwxr-xr-x 1 root root 277796 Jan 15 2013 /usr/bin/gcc-4.6 -rwxr-xr-x 1 root root 616708 Sep 6 2014 /usr/bin/gcc-4.8 -rwxr-xr-x 1 root root 24640 Sep 6 2014 /usr/bin/gcc-ar-4.8 -rwxr-xr-x 1 root root 24592 Sep 6 2014 /usr/bin/gcc-nm-4.8 -rwxr-xr-x 1 root root 24596 Sep 6 2014 /usr/bin/gcc-ranlib-4.8 pi@raspberrypi ~ $ sudo rm /usr/bin/gcc pi@raspberrypi ~ $ sudo ln -s /usr/bin/gcc-4.8 /usr/bin/gcc pi@raspberrypi ~ $
更新內核模塊,使用如下命令:
sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade sudo rpi-update
執行記錄以下:
pi@raspberrypi ~ $ sudo apt-get update Get:1 http://mirrordirector.raspbian.org wheezy Release.gpg [490 B] Get:2 http://mirrordirector.raspbian.org wheezy Release [14.4 kB] Hit http://archive.raspberrypi.org wheezy Release.gpg Hit http://raspberrypi.collabora.com wheezy Release.gpg Get:3 http://mirrordirector.raspbian.org wheezy/main armhf Packages [6,905 kB] Hit http://archive.raspberrypi.org wheezy Release Hit http://raspberrypi.collabora.com wheezy Release Hit http://archive.raspberrypi.org wheezy/main armhf Packages Hit http://raspberrypi.collabora.com wheezy/rpi armhf Packages Ign http://archive.raspberrypi.org wheezy/main Translation-en_GB Ign http://raspberrypi.collabora.com wheezy/rpi Translation-en_GB Ign http://archive.raspberrypi.org wheezy/main Translation-en Ign http://raspberrypi.collabora.com wheezy/rpi Translation-en Get:4 http://mirrordirector.raspbian.org wheezy/contrib armhf Packages [23.6 kB] Get:5 http://mirrordirector.raspbian.org wheezy/non-free armhf Packages [49.3 kB] Get:6 http://mirrordirector.raspbian.org wheezy/rpi armhf Packages [592 B] Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en_GB Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en Ign http://mirrordirector.raspbian.org wheezy/main Translation-en_GB Ign http://mirrordirector.raspbian.org wheezy/main Translation-en Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en_GB Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en_GB Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en Fetched 6,993 kB in 4min 7s (28.2 kB/s) Reading package lists... Done pi@raspberrypi ~ $ pi@raspberrypi ~ $ sudo apt-get upgrade Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be upgraded: apache2 apache2-mpm-prefork apache2-utils apache2.2-bin apache2.2-common 5 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. Need to get 1,135 kB of archives. After this operation, 0 B of additional disk space will be used. Do you want to continue [Y/n]? y Get:1 http://mirrordirector.raspbian.org/raspbian/ wheezy/main apache2 armhf 2.2.22-13+deb7u6 [1,440 B] Get:2 http://mirrordirector.raspbian.org/raspbian/ wheezy/main apache2-mpm-prefork armhf 2.2.22-13+deb7u6 [2,342 B] Get:3 http://mirrordirector.raspbian.org/raspbian/ wheezy/main apache2.2-common armhf 2.2.22-13+deb7u6 [292 kB] Get:4 http://mirrordirector.raspbian.org/raspbian/ wheezy/main apache2.2-bin armhf 2.2.22-13+deb7u6 [676 kB] Get:5 http://mirrordirector.raspbian.org/raspbian/ wheezy/main apache2-utils armhf 2.2.22-13+deb7u6 [163 kB] Fetched 1,135 kB in 2s (432 kB/s) (Reading database ... 112842 files and directories currently installed.) Preparing to replace apache2 2.2.22-13+deb7u5 (using .../apache2_2.2.22-13+deb7u6_armhf.deb) ... Unpacking replacement apache2 ... Preparing to replace apache2-mpm-prefork 2.2.22-13+deb7u5 (using .../apache2-mpm-prefork_2.2.22-13+deb7u6_armhf.deb) ... [....] Stopping web server: apache2apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1 for ServerName . ok Unpacking replacement apache2-mpm-prefork ... Preparing to replace apache2.2-common 2.2.22-13+deb7u5 (using .../apache2.2-common_2.2.22-13+deb7u6_armhf.deb) ... Unpacking replacement apache2.2-common ... Preparing to replace apache2.2-bin 2.2.22-13+deb7u5 (using .../apache2.2-bin_2.2.22-13+deb7u6_armhf.deb) ... Unpacking replacement apache2.2-bin ... Preparing to replace apache2-utils 2.2.22-13+deb7u5 (using .../apache2-utils_2.2.22-13+deb7u6_armhf.deb) ... Unpacking replacement apache2-utils ... Processing triggers for man-db ... Setting up apache2.2-bin (2.2.22-13+deb7u6) ... Setting up apache2-utils (2.2.22-13+deb7u6) ... Setting up apache2.2-common (2.2.22-13+deb7u6) ... insserv: warning: current start runlevel(s) (empty) of script `apache2' overrides LSB defaults (2 3 4 5). insserv: warning: current stop runlevel(s) (0 1 2 3 4 5 6) of script `apache2' overrides LSB defaults (0 1 6). Setting up apache2-mpm-prefork (2.2.22-13+deb7u6) ... Setting up apache2 (2.2.22-13+deb7u6) ... pi@raspberrypi ~ $ pi@raspberrypi ~ $ sudo apt-get dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded. pi@raspberrypi ~ $ pi@raspberrypi ~ $ sudo rpi-update *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom *** Performing self-update *** Relaunching after update *** Raspberry Pi firmware updater by Hexxeh, enhanced by AndrewS and Dom ############################################################# WARNING: This update bumps to rpi-4.1.y linux tree Be aware there could be compatibility issues with some drivers Discussion here: https://www.raspberrypi.org/forums/viewtopic.php?f=29&t=113753 ############################################################## Would you like to proceed? (y/N) *** Downloading specific firmware revision (this will take a few minutes) % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 168 0 168 0 0 159 0 --:--:-- 0:00:01 --:--:-- 210 100 47.1M 100 47.1M 0 0 77546 0 0:10:37 0:10:37 --:--:-- 83607 *** Updating firmware *** Updating kernel modules *** depmod 4.1.6+ *** depmod 4.1.6-v7+ *** Updating VideoCore libraries *** Using HardFP libraries *** Updating SDK *** Running ldconfig *** Storing current firmware revision *** Deleting downloaded files *** Syncing changes to disk *** If no errors appeared, your firmware was successfully updated to 7efa19016e080f6e1a0df2995bdee03176f3810d *** A reboot is needed to activate the new firmware pi@raspberrypi ~ $
最後提示這時須要重啓來激活新固件 重啓先後使用以下命令檢查當前系統內核版本號:
uname -a uname -r
執行記錄以下: 重啓前查詢:
pi@raspberrypi ~ $ uname -a Linux raspberrypi 4.1.5-v7+ #809 SMP PREEMPT Thu Aug 13 00:50:56 BST 2015 armv7l GNU/Linux pi@raspberrypi ~ $ uname -r 4.1.5-v7+ pi@raspberrypi ~ $
重啓後查詢:
pi@raspberrypi /opt/software $ uname -a Linux raspberrypi 4.1.6-v7+ #810 SMP PREEMPT Tue Aug 18 15:32:12 BST 2015 armv7l GNU/Linux pi@raspberrypi /opt/software $ uname -r 4.1.6-v7+ pi@raspberrypi /opt/software $
發現咱們的固件版本號已經從原來的 4.1.5 更新到了最新的 4.1.6
接着使用以下命令取得對應版本的內核代碼,這個操做執行起來要花點時間,耐心等待吧。
sudo wget https://github.com/raspberrypi/linux/archive/rpi-4.1.y.tar.gz
執行記錄以下:
pi@raspberrypi /opt/software $ sudo wget https://github.com/raspberrypi/linux/archive/rpi-4.1.y.tar.gz --2015-08-21 11:49:15-- https://github.com/raspberrypi/linux/archive/rpi-4.1.y.tar.gz Resolving github.com (github.com)... 192.30.252.128 Connecting to github.com (github.com)|192.30.252.128|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://codeload.github.com/raspberrypi/linux/tar.gz/rpi-4.1.y [following] --2015-08-21 11:49:21-- https://codeload.github.com/raspberrypi/linux/tar.gz/rpi-4.1.y Resolving codeload.github.com (codeload.github.com)... 192.30.252.144 Connecting to codeload.github.com (codeload.github.com)|192.30.252.144|:443... connected. HTTP request sent, awaiting response... 200 OK Length: unspecified [application/x-gzip] Saving to: `rpi-4.1.y.tar.gz' [ <=> ] 128,360,666 26.8K/s in 34m 51s 2015-08-21 12:24:16 (60.0 KB/s) - `rpi-4.1.y.tar.gz' saved [128360666] pi@raspberrypi /opt/software $
用以下命令解壓:
sudo tar xvfz ./rpi-4.1.v.tar.gz
執行記錄以下:
pi@raspberrypi /opt/software $ sudo tar xvfz ./rpi-4.1.y.tar.gz linux-rpi-4.1.y/ linux-rpi-4.1.y/.gitignore linux-rpi-4.1.y/.mailmap linux-rpi-4.1.y/COPYING linux-rpi-4.1.y/CREDITS linux-rpi-4.1.y/Documentation/ linux-rpi-4.1.y/Documentation/00-INDEX linux-rpi-4.1.y/Documentation/ABI/ linux-rpi-4.1.y/Documentation/ABI/README ...... linux-rpi-4.1.y/virt/kvm/eventfd.c linux-rpi-4.1.y/virt/kvm/irqchip.c linux-rpi-4.1.y/virt/kvm/kvm_main.c linux-rpi-4.1.y/virt/kvm/vfio.c linux-rpi-4.1.y/virt/kvm/vfio.h pi@raspberrypi /opt/software $
接着執行以下命令,先切換到 root(後續的命令就不須要再加 sudo 了,提示符也由 $ 變爲 #),而後移動目錄到 /usr/src
sudo su mv ./linux-rpi-/ /usr/src/
執行記錄以下:
pi@raspberrypi /opt/software $ sudo su root@raspberrypi:/opt/software# mv ./linux-rpi-4.1.y/ /usr/src root@raspberrypi:/opt/software#
執行以下命令,創建軟鏈接(注意,這裏必須是所有路徑,並且不能夠缺乏 「/」,不然會在 /lib/下新建一個名爲 的目錄,這個地方容易被疏忽,編譯時會致使沒法找到而出錯)
ln -s /usr/src/linux-rpi-4.1.y/ /lib/modules/4.1.6-v7+/build
執行記錄以下:
root@raspberrypi:/opt/software# ln -s /usr/src/linux-rpi-4.1.y/ /lib/modules/4.1.6-v7+/build root@raspberrypi:/opt/software#
進入該 build 目錄,執行以下命令清除一下編譯環境:
make mrproper
執行記錄以下:
root@raspberrypi:/opt/software# cd /lib/modules/4.1.6-v7+/build root@raspberrypi:/lib/modules/4.1.6-v7+/build# ls arch CREDITS drivers include Kbuild lib mm REPORTING-BUGS security usr block crypto firmware init Kconfig MAINTAINERS net samples sound virt COPYING Documentation fs ipc kernel Makefile README scripts tools root@raspberrypi:/lib/modules/4.1.6-v7+/build# make mrproper root@raspberrypi:/lib/modules/4.1.6-v7+/build#
執行以下命令,在 /proc 目錄下生成 config.gz 文件,這個命令在樹莓派1是不須要執行的,可是樹莓派2必須執行:
modprobe configs
執行記錄以下:
root@raspberrypi:/lib/modules/4.1.6-v7+/build# modprobe configs root@raspberrypi:/lib/modules/4.1.6-v7+/build# ls /proc 1 174 2452 2730 29 319 4041 47 58 cgroups execdomains kmsg partitions timer_list 10 18 2461 2731 2934 32 4059 48 59 cmdline fb kpagecount sched_debug timer_stats 11 19 2476 2732 3 33 4109 49 5975 config.gz filesystems kpageflags self tty 1118 2 25 2733 30 330 4162 5 6045 consoles fs loadavg slabinfo uptime 12 20 2506 2734 3079 35 4178 50 6051 cpu interrupts locks softirqs vc-cma 14 22 2567 2735 31 36 4197 52 7 cpuinfo iomem meminfo stat version 15 2208 26 2736 3137 37 43 53 8 crypto ioports misc swaps vmallocinfo 1581 2243 2647 2738 3142 378 44 54 9 devices irq modules sys vmstat 16 23 2649 28 3143 3861 445 55 asound device-tree kallsyms mounts sysrq-trigger zoneinfo 1601 2398 2675 2866 317 4039 45 56 buddyinfo diskstats keys net sysvipc 1643 24 27 2894 3189 4040 46 57 bus driver key-users pagetypeinfo thread-self root@raspberrypi:/lib/modules/4.1.6-v7+/build#
接着執行以下命令,把 config.gz 導出到 /build 目錄下,名爲 .config
gzip -dc /proc/config.gz > .config
執行記錄以下:
root@raspberrypi:/lib/modules/4.1.6-v7+/build# gzip -dc /proc/config.gz > .config root@raspberrypi:/lib/modules/4.1.6-v7+/build# ls -a . block CREDITS drivers .gitignore ipc kernel MAINTAINERS net samples sound virt .. .config crypto firmware include Kbuild lib Makefile README scripts tools arch COPYING Documentation fs init Kconfig .mailmap mm REPORTING-BUGS security usr root@raspberrypi:/lib/modules/4.1.6-v7+/build#
執行以下命令,開始模塊編譯準備:
make modules_prepare
執行記錄以下:
root@raspberrypi:/lib/modules/4.1.6-v7+/build# make modules_prepare HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o SHIPPED scripts/kconfig/zconf.tab.c SHIPPED scripts/kconfig/zconf.lex.c SHIPPED scripts/kconfig/zconf.hash.c HOSTCC scripts/kconfig/zconf.tab.o …... Generating include/generated/mach-types.h CC kernel/bounds.s CHK include/generated/bounds.h UPD include/generated/bounds.h CC arch/arm/kernel/asm-offsets.s arch/arm/kernel/asm-offsets.c:54:2: error: #error Your compiler is too buggy; it is known to miscompile kernels #error Your compiler is too buggy; it is known to miscompile kernels ^ arch/arm/kernel/asm-offsets.c:55:2: error: #error and result in filesystem corruption and oopses. #error and result in filesystem corruption and oopses. ^ Kbuild:61: recipe for target 'arch/arm/kernel/asm-offsets.s' failed make[1]: *** [arch/arm/kernel/asm-offsets.s] Error 1 Makefile:990: recipe for target 'prepare0' failed make: *** [prepare0] Error 2 root@raspberrypi:/lib/modules/4.1.6-v7+/build#
很是不幸地出現這個錯誤:#error Your compiler is too buggy; it is known to miscompile kernels,根據後面的報錯提示,應該是 /proc/version 是 gcc-4.8.3,而我當前安裝的是 gcc-4.8.2,因此改變手動安裝策略,乾脆使用 dpi-source 來自動安裝
回到 /opt/software 目錄,下載 rpi-source,增長執行權限,執行
執行記錄以下:
root@raspberrypi:/opt/software# wget https://raw.githubusercontent.com/lifanxi/rpi-source/master/rpi-source --2015-08-21 13:48:50-- https://raw.githubusercontent.com/lifanxi/rpi-source/master/rpi-source Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 103.245.222.133 Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|103.245.222.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 11825 (12K) [text/plain] Saving to: `rpi-source' 100%[==============================================================================================>] 11,825 --.-K/s in 0s 2015-08-21 13:48:53 (28.5 MB/s) - `rpi-source' saved [11825/11825] root@raspberrypi:/opt/software# root@raspberrypi:/opt/software# chmod a+x rpi-source root@raspberrypi:/opt/software# root@raspberrypi:/opt/software# ./rpi-source *** Updating rpi-source --2015-08-21 13:53:04-- https://raw.githubusercontent.com/lifanxi/rpi-source/master/rpi-source Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 103.245.222.133 Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|103.245.222.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 11825 (12K) [text/plain] Saving to: `./rpi-source' 100%[==============================================================================================>] 11,825 --.-K/s in 0.001s 2015-08-21 13:53:07 (21.7 MB/s) - `./rpi-source' saved [11825/11825] *** Set update tag: 94cef917c80502c6638b777f7d5b83467f9da2de *** Restarting rpi-source ERROR: gcc version check: mismatch between gcc (4.8.2) and /proc/version (4.1.6) Skip this check with --skip-gcc Help: https://github.com/notro/rpi-source/wiki root@raspberrypi:/opt/software#
結果再次報錯,檢查一下:
root@raspberrypi:/opt/software# cat /proc/version Linux version 4.1.6-v7+ (dc4@dc4-XPS13-9333) (gcc version 4.8.3 20140303 (prerelease) (crosstool-NG linaro-1.13.1+bzr2650 - Linaro GCC 2014.03) ) #810 SMP PREEMPT Tue Aug 18 15:32:12 BST 2015 root@raspberrypi:/opt/software# gcc --version gcc (Raspbian 4.8.2-21~rpi3rpi1) 4.8.2 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. root@raspberrypi:/opt/software#
很明顯,這個腳本比較錯了,在 /proc/version 下取版本號把 Linux 的版本號給取了,而沒有取 gcc 的版本號,看了下 gthub 上已經有人提這個bug了,做者也改了,可是很明顯,修改無效。
不過先看看個人 gcc 版本,打開這篇文檔(https://github.com/notro/rpi-source/wiki),發現要把 gcc 版本升到 4.8.3,可是我目前的 gcc 版本是 4.8.2,官方源最新版本就是 4.8.2,因而按照該文的提示,作了以下操做:
增長目前處於測試狀態的更新源 jessie,打開文件
sudo nano /etc/apt/sources.list.d/jessie.list,
增長一句
deb http://mirrordirector.raspbian.org/raspbian/ jessie main contrib non-free rpi
保存退出
再次更新:
sudo apt-get update
執行記錄以下
pi@raspberrypi /opt/software $ sudo nano /etc/apt/sources.list.d/jessie.list pi@raspberrypi /opt/software $ sudo apt-get update Get:1 http://mirrordirector.raspbian.org wheezy Release.gpg [490 B] Hit http://raspberrypi.collabora.com wheezy Release.gpg Hit http://archive.raspberrypi.org wheezy Release.gpg Get:2 http://mirrordirector.raspbian.org jessie Release.gpg [490 B] Hit http://raspberrypi.collabora.com wheezy Release Get:3 http://mirrordirector.raspbian.org wheezy Release [14.4 kB] Hit http://archive.raspberrypi.org wheezy Release Hit http://raspberrypi.collabora.com wheezy/rpi armhf Packages Hit http://archive.raspberrypi.org wheezy/main armhf Packages Get:4 http://mirrordirector.raspbian.org jessie Release [14.4 kB] Get:5 http://mirrordirector.raspbian.org wheezy/main armhf Packages [6,905 kB] Ign http://raspberrypi.collabora.com wheezy/rpi Translation-en_GB Ign http://raspberrypi.collabora.com wheezy/rpi Translation-en Ign http://archive.raspberrypi.org wheezy/main Translation-en_GB Ign http://archive.raspberrypi.org wheezy/main Translation-en Get:6 http://mirrordirector.raspbian.org wheezy/contrib armhf Packages [23.6 kB] Get:7 http://mirrordirector.raspbian.org wheezy/non-free armhf Packages [49.3 kB] Get:8 http://mirrordirector.raspbian.org wheezy/rpi armhf Packages [592 B] Get:9 http://mirrordirector.raspbian.org jessie/main armhf Packages [8,961 kB] Get:10 http://mirrordirector.raspbian.org jessie/contrib armhf Packages [37.4 kB] Get:11 http://mirrordirector.raspbian.org jessie/non-free armhf Packages [70.2 kB] Get:12 http://mirrordirector.raspbian.org jessie/rpi armhf Packages [1,356 B] Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en_GB Ign http://mirrordirector.raspbian.org wheezy/contrib Translation-en Ign http://mirrordirector.raspbian.org wheezy/main Translation-en_GB Ign http://mirrordirector.raspbian.org wheezy/main Translation-en Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en_GB Ign http://mirrordirector.raspbian.org wheezy/non-free Translation-en Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en_GB Ign http://mirrordirector.raspbian.org wheezy/rpi Translation-en Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_GB Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en Ign http://mirrordirector.raspbian.org jessie/main Translation-en_GB Ign http://mirrordirector.raspbian.org jessie/main Translation-en Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_GB Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_GB Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en Fetched 16.1 MB in 9min 23s (28.6 kB/s) Reading package lists... Done pi@raspberrypi /opt/software $
而後再執行:
sudo apt-get install -y gcc-4.8 g++-4.8
執行記錄以下:
pi@raspberrypi /opt/software $ sudo apt-get install -y gcc-4.8 g++-4.8 Reading package lists... Done Building dependency tree Reading state information... Done The following package was automatically installed and is no longer required: libgssglue1 Use 'apt-get autoremove' to remove it. The following extra packages will be installed: binutils cpp-4.8 gcc-4.7-base gcc-4.8-base gcc-4.9-base libasan0 libatomic1 libc-bin libc-dev-bin libc6 libc6-dev libgcc-4.8-dev libgcc1 libgfortran3 libgomp1 libgssapi-krb5-2 libk5crypto3 libkeyutils1 libkrb5-3 libkrb5support0 libmpfr4 libnih-dbus1 libnih1 libstdc++-4.8-dev libstdc++6 libtirpc1 locales nfs-common Suggested packages: binutils-doc gcc-4.8-locales gcc-4.8-doc libstdc++6-4.8-dbg libgcc1-dbg libgomp1-dbg libitm1-dbg libatomic1-dbg libasan0-dbg libtsan0-dbg libquadmath-dbg glibc-doc krb5-doc krb5-user libstdc++-4.8-doc open-iscsi watchdog The following NEW packages will be installed: gcc-4.9-base ...... Setting up libgcc-4.8-dev:armhf (4.8.4-1) ... Setting up gcc-4.8 (4.8.4-1) ... Setting up libstdc++-4.8-dev:armhf (4.8.4-1) ... Setting up g++-4.8 (4.8.4-1) ... Setting up libgfortran3:armhf (4.9.2-10) ... Processing triggers for libc-bin ... pi@raspberrypi /opt/software $
接下來執行這幾條命令:
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 20 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 20 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50
執行記錄以下:
pi@raspberrypi /opt/software $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.6 20 update-alternatives: using /usr/bin/gcc-4.6 to provide /usr/bin/gcc (gcc) in auto mode pi@raspberrypi /opt/software $ sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 50 update-alternatives: using /usr/bin/gcc-4.8 to provide /usr/bin/gcc (gcc) in auto mode pi@raspberrypi /opt/software $ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.6 20 update-alternatives: using /usr/bin/g++-4.6 to provide /usr/bin/g++ (g++) in auto mode pi@raspberrypi /opt/software $ sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8 50 update-alternatives: using /usr/bin/g++-4.8 to provide /usr/bin/g++ (g++) in auto mode pi@raspberrypi /opt/software $
檢查下當前的版本,變成了 4.8.4
pi@raspberrypi /opt/software $ gcc --version gcc (Raspbian 4.8.4-1) 4.8.4 Copyright (C) 2013 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. pi@raspberrypi /opt/software $
若是想切換版本,執行這條命令:
sudo update-alternatives --config gcc
執行記錄以下:
pi@raspberrypi /opt/software $ sudo update-alternatives --config gcc There are 2 choices for the alternative gcc (providing /usr/bin/gcc). Selection Path Priority Status ------------------------------------------------------------ * 0 /usr/bin/gcc-4.8 50 auto mode 1 /usr/bin/gcc-4.6 20 manual mode 2 /usr/bin/gcc-4.8 50 manual mode Press enter to keep the current choice[*], or type selection number: pi@raspberrypi /opt/software $
切換回root,從新下載最新的 rpi-source 再次執行
執行記錄以下:
root@raspberrypi:/opt/software# sudo wget https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source -O /usr/bin/rpi-source && sudo chmod +x /usr/bin/rpi-source && /usr/bin/rpi-source -q --tag-update --2015-08-21 14:53:12-- https://raw.githubusercontent.com/notro/rpi-source/master/rpi-source Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 103.245.222.133 Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|103.245.222.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 12424 (12K) [text/plain] Saving to: `/usr/bin/rpi-source' 100%[==============================================================================================>] 12,424 --.-K/s in 0s 2015-08-21 14:53:15 (29.2 MB/s) - `/usr/bin/rpi-source' saved [12424/12424] root@raspberrypi:/opt/software#
執行:
root@raspberrypi:/opt/software# ./rpi-source *** Updating rpi-source --2015-08-21 14:54:49-- https://raw.githubusercontent.com/lifanxi/rpi-source/master/rpi-source Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 103.245.222.133 Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|103.245.222.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 11825 (12K) [text/plain] Saving to: `./rpi-source' 100%[==============================================================================================>] 11,825 --.-K/s in 0s 2015-08-21 14:54:54 (27.3 MB/s) - `./rpi-source' saved [11825/11825] *** Set update tag: 94cef917c80502c6638b777f7d5b83467f9da2de *** Restarting rpi-source ERROR: gcc version check: mismatch between gcc (4.8.4) and /proc/version (4.1.6) Skip this check with --skip-gcc Help: https://github.com/notro/rpi-source/wiki root@raspberrypi:/opt/software#
顯然,版本比較的錯誤仍是會影響編譯,不過我對腳本不是很熟悉,不太會修改,因而再次換回原來的手工操做,由於已經把 gcc 的版本升級了,理論上能夠編譯經過,事實果真如此,
執行記錄以下:
root@raspberrypi:/lib/modules/4.1.6-v7+/build# make mrproper CLEAN . CLEAN .tmp_versions CLEAN scripts/basic CLEAN scripts/dtc CLEAN scripts/genksyms CLEAN scripts/kconfig CLEAN scripts/mod CLEAN scripts CLEAN include/config include/generated arch/arm/include/generated CLEAN .config root@raspberrypi:/lib/modules/4.1.6-v7+/build# gzip -dc /proc/config.gz > .config root@raspberrypi:/lib/modules/4.1.6-v7+/build# make modules_prepare HOSTCC scripts/basic/fixdep HOSTCC scripts/kconfig/conf.o SHIPPED scripts/kconfig/zconf.tab.c SHIPPED scripts/kconfig/zconf.lex.c SHIPPED scripts/kconfig/zconf.hash.c HOSTCC scripts/kconfig/zconf.tab.o HOSTLD scripts/kconfig/conf scripts/kconfig/conf --silentoldconfig Kconfig CHK include/config/kernel.release UPD include/config/kernel.release WRAP arch/arm/include/generated/asm/bitsperlong.h WRAP arch/arm/include/generated/asm/cputime.h WRAP arch/arm/include/generated/asm/current.h WRAP arch/arm/include/generated/asm/emergency-restart.h WRAP arch/arm/include/generated/asm/errno.h WRAP arch/arm/include/generated/asm/exec.h WRAP arch/arm/include/generated/asm/ioctl.h WRAP arch/arm/include/generated/asm/ipcbuf.h WRAP arch/arm/include/generated/asm/irq_regs.h WRAP arch/arm/include/generated/asm/kdebug.h WRAP arch/arm/include/generated/asm/local.h WRAP arch/arm/include/generated/asm/local64.h WRAP arch/arm/include/generated/asm/mcs_spinlock.h WRAP arch/arm/include/generated/asm/msgbuf.h WRAP arch/arm/include/generated/asm/param.h WRAP arch/arm/include/generated/asm/parport.h WRAP arch/arm/include/generated/asm/poll.h WRAP arch/arm/include/generated/asm/preempt.h WRAP arch/arm/include/generated/asm/resource.h WRAP arch/arm/include/generated/asm/rwsem.h WRAP arch/arm/include/generated/asm/scatterlist.h WRAP arch/arm/include/generated/asm/seccomp.h WRAP arch/arm/include/generated/asm/sections.h WRAP arch/arm/include/generated/asm/segment.h WRAP arch/arm/include/generated/asm/sembuf.h WRAP arch/arm/include/generated/asm/serial.h WRAP arch/arm/include/generated/asm/shmbuf.h WRAP arch/arm/include/generated/asm/siginfo.h WRAP arch/arm/include/generated/asm/simd.h WRAP arch/arm/include/generated/asm/sizes.h WRAP arch/arm/include/generated/asm/socket.h WRAP arch/arm/include/generated/asm/sockios.h WRAP arch/arm/include/generated/asm/termbits.h WRAP arch/arm/include/generated/asm/termios.h WRAP arch/arm/include/generated/asm/timex.h WRAP arch/arm/include/generated/asm/trace_clock.h WRAP arch/arm/include/generated/asm/unaligned.h CHK include/generated/uapi/linux/version.h UPD include/generated/uapi/linux/version.h CHK include/generated/utsrelease.h UPD include/generated/utsrelease.h HOSTCC scripts/basic/bin2c Generating include/generated/mach-types.h CC kernel/bounds.s CHK include/generated/bounds.h UPD include/generated/bounds.h CC arch/arm/kernel/asm-offsets.s CHK include/generated/asm-offsets.h UPD include/generated/asm-offsets.h CALL scripts/checksyscalls.sh HOSTCC scripts/dtc/dtc.o HOSTCC scripts/dtc/flattree.o HOSTCC scripts/dtc/fstree.o HOSTCC scripts/dtc/data.o HOSTCC scripts/dtc/livetree.o HOSTCC scripts/dtc/treesource.o HOSTCC scripts/dtc/srcpos.o HOSTCC scripts/dtc/checks.o HOSTCC scripts/dtc/util.o SHIPPED scripts/dtc/dtc-lexer.lex.c SHIPPED scripts/dtc/dtc-parser.tab.h HOSTCC scripts/dtc/dtc-lexer.lex.o SHIPPED scripts/dtc/dtc-parser.tab.c HOSTCC scripts/dtc/dtc-parser.tab.o HOSTLD scripts/dtc/dtc HOSTCC scripts/genksyms/genksyms.o SHIPPED scripts/genksyms/parse.tab.c HOSTCC scripts/genksyms/parse.tab.o SHIPPED scripts/genksyms/lex.lex.c SHIPPED scripts/genksyms/keywords.hash.c SHIPPED scripts/genksyms/parse.tab.h HOSTCC scripts/genksyms/lex.lex.o HOSTLD scripts/genksyms/genksyms CC scripts/mod/empty.o HOSTCC scripts/mod/mk_elfconfig MKELF scripts/mod/elfconfig.h HOSTCC scripts/mod/modpost.o CC scripts/mod/devicetable-offsets.s GEN scripts/mod/devicetable-offsets.h HOSTCC scripts/mod/file2alias.o HOSTCC scripts/mod/sumversion.o HOSTLD scripts/mod/modpost HOSTCC scripts/kallsyms HOSTCC scripts/pnmtologo HOSTCC scripts/conmakehash HOSTCC scripts/recordmcount HOSTCC scripts/sortextable root@raspberrypi:/lib/modules/4.1.6-v7+/build#
接下來取得模塊符號,這裏對於樹莓派1和樹莓派2是有區別的,由於1使用的是ARMv6,2使用的是ARMv7,它們對應的文件分別是: 樹莓派1:https://github.com/raspberrypi/firmware/blob/master/extra/Module.symvers 樹莓派2:https://github.com/raspberrypi/firmware/blob/master/extra/Module7.symvers 不過取回來以後須要更名爲 Module.symvers 保存在 build 目錄下
執行記錄以下:
root@raspberrypi:/lib/modules/4.1.6-v7+/build# wget https://github.com/raspberrypi/firmware/raw/master/extra/Module7.symvers --2015-08-21 15:21:23-- https://github.com/raspberrypi/firmware/raw/master/extra/Module7.symvers Resolving github.com (github.com)... 192.30.252.130 Connecting to github.com (github.com)|192.30.252.130|:443... connected. HTTP request sent, awaiting response... 302 Found Location: https://raw.githubusercontent.com/raspberrypi/firmware/master/extra/Module7.symvers [following] --2015-08-21 15:21:28-- https://raw.githubusercontent.com/raspberrypi/firmware/master/extra/Module7.symvers Resolving raw.githubusercontent.com (raw.githubusercontent.com)... 103.245.222.133 Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|103.245.222.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 586627 (573K) [text/plain] Saving to: `Module7.symvers' 100%[==============================================================================================>] 586,627 316K/s in 1.8s 2015-08-21 15:21:34 (316 KB/s) - `Module7.symvers' saved [586627/586627] root@raspberrypi:/lib/modules/4.1.6-v7+/build# mv ./Module7.symvers ./Module.symvers root@raspberrypi:/lib/modules/4.1.6-v7+/build#
好了,到目前爲止,終於千辛萬苦地完成了第一階段的工做,也就是無線模塊編譯的準備工做。
接下來要開始正式編譯無線模塊了,此次我選擇了一個聽說能支持 AP 功能的驅動,雖然是1年前的
git clone https://github.com/eywalink/mt7601u mt7601u-ap
進入該目錄,查看一下,發現有一個 build.sh 的腳本,看看內容:
root@raspberrypi:/opt/github/mt7601u-ap# ls build.sh doc HISTORY LICENSE Makefile Makefile.inc miwifi_work.sh README.md unload.sh config.mk etc info.sh load.sh Makefile.clean miwifi_build.sh README src root@raspberrypi:/opt/github/mt7601u-ap# cat ./build.sh #!/bin/sh cp -v /lib/modules/$(uname -r)/build/Module.symvers src/os/linux make clean && make all rm -rvf src/os/linux/Module.symvers modprobe --dump-modversions src/os/linux/mtnet7601Usta.ko modprobe --dump-modversions src/os/linux/mtutil7601Usta.ko modprobe --dump-modversions src/os/linux/mt7601Usta.ko root@raspberrypi:/opt/github/mt7601u-ap#
很好,直接運行 build.sh 貌似就能夠了,
執行記錄以下:
root@raspberrypi:/opt/github/mt7601u-ap# ./build.sh `/lib/modules/4.1.6-v7+/build/Module.symvers' -> `src/os/linux/Module.symvers' make -C src/ clean make[1]: Entering directory '/opt/github/mt7601u-ap/src' cp -f os/linux/Makefile.clean os/linux/Makefile make -C os/linux clean make[2]: Entering directory '/opt/github/mt7601u-ap/src/os/linux' rm -f ../../common/*.o rm -f ../../common/.*.cmd .*.flags .*.d rm -f ../../os/linux/*.o *.ko *.mod.o *.mod.c ...... CC [M] /opt/github/mt7601u-ap/src/os/linux/../../os/linux/rt_main_dev.o CC [M] /opt/github/mt7601u-ap/src/os/linux/../../common/rtusb_dev_id.o CC [M] /opt/github/mt7601u-ap/src/os/linux/../../os/linux/usb_main_dev.o LD [M] /opt/github/mt7601u-ap/src/os/linux/rtnet7601Uap.o Building modules, stage 2. MODPOST 1 modules CC /opt/github/mt7601u-ap/src/os/linux/rtnet7601Uap.mod.o LD [M] /opt/github/mt7601u-ap/src/os/linux/rtnet7601Uap.ko make[2]: Leaving directory '/usr/src/linux-rpi-4.1.y' make[1]: Leaving directory '/opt/github/mt7601u-ap/src' removed `src/os/linux/Module.symvers' FATAL: Module src/os/linux/mtnet7601Usta.ko not found. FATAL: Module src/os/linux/mtutil7601Usta.ko not found. FATAL: Module src/os/linux/mt7601Usta.ko not found. root@raspberrypi:/opt/github/mt7601u-ap# ls build.sh doc HISTORY LICENSE Makefile Makefile.inc miwifi_work.sh README.md unload.sh config.mk etc info.sh load.sh Makefile.clean miwifi_build.sh README src root@raspberrypi:/opt/github/mt7601u-ap#
很是不幸又出錯,就沒有消停過一次。。。
好吧,看看是咋回事,原來要用這個腳本 miwifi_build.sh
root@raspberrypi:/opt/github/mt7601u-ap# ./miwifi_build.sh `/lib/modules/4.1.6-v7+/build/Module.symvers' -> `src/os/linux/Module.symvers' make -C src/ clean make[1]: Entering directory '/opt/github/mt7601u-ap/src' cp -f os/linux/Makefile.clean os/linux/Makefile make -C os/linux clean make[2]: Entering directory '/opt/github/mt7601u-ap/src/os/linux' rm -f ../../common/*.o rm -f ../../common/.*.cmd .*.flags .*.d rm -f ../../os/linux/*.o *.ko *.mod.o *.mod.c ...... CC [M] /opt/github/mt7601u-ap/src/os/linux/../../os/linux/rt_main_dev.o CC [M] /opt/github/mt7601u-ap/src/os/linux/../../common/rtusb_dev_id.o CC [M] /opt/github/mt7601u-ap/src/os/linux/../../os/linux/usb_main_dev.o LD [M] /opt/github/mt7601u-ap/src/os/linux/rtnet7601Uap.o Building modules, stage 2. MODPOST 1 modules CC /opt/github/mt7601u-ap/src/os/linux/rtnet7601Uap.mod.o LD [M] /opt/github/mt7601u-ap/src/os/linux/rtnet7601Uap.ko make[2]: Leaving directory '/usr/src/linux-rpi-4.1.y' make[1]: Leaving directory '/opt/github/mt7601u-ap/src' make -C src/ install make[1]: Entering directory '/opt/github/mt7601u-ap/src' make -C /opt/github/mt7601u-ap/src/os/linux -f Makefile.6 install make[2]: Entering directory '/opt/github/mt7601u-ap/src/os/linux' mkdir -pv /etc/Wireless/RT2870AP mkdir: created directory `/etc/Wireless/RT2870AP' cp -v /opt/github/mt7601u-ap/src/../etc/Wireless/RT2870AP/RT2870AP.dat /etc/Wireless/RT2870AP/. `/opt/github/mt7601u-ap/src/../etc/Wireless/RT2870AP/RT2870AP.dat' -> `/etc/Wireless/RT2870AP/./RT2870AP.dat' install -d /lib/modules/4.1.6-v7+/kernel/drivers/net/wireless/ install -m 644 -c mt7601Uap.ko /lib/modules/4.1.6-v7+/kernel/drivers/net/wireless/ /sbin/depmod -a 4.1.6-v7+ make[2]: Leaving directory '/opt/github/mt7601u-ap/src/os/linux' make -C /opt/github/mt7601u-ap/src/os/linux -f Makefile.6.util install make[2]: Entering directory '/opt/github/mt7601u-ap/src/os/linux' install -d /lib/modules/4.1.6-v7+/kernel/drivers/net/wireless/ install -m 644 -c rtutil7601Uap.ko /lib/modules/4.1.6-v7+/kernel/drivers/net/wireless/ /sbin/depmod -a 4.1.6-v7+ make[2]: Leaving directory '/opt/github/mt7601u-ap/src/os/linux' make -C /opt/github/mt7601u-ap/src/os/linux -f Makefile.6.netif install make[2]: Entering directory '/opt/github/mt7601u-ap/src/os/linux' install -d /lib/modules/4.1.6-v7+/kernel/drivers/net/wireless/ install -m 644 -c rtnet7601Uap.ko /lib/modules/4.1.6-v7+/kernel/drivers/net/wireless/ /sbin/depmod -a 4.1.6-v7+ make[2]: Leaving directory '/opt/github/mt7601u-ap/src/os/linux' make[1]: Leaving directory '/opt/github/mt7601u-ap/src' removed `src/os/linux/Module.symvers' root@raspberrypi:/opt/github/mt7601u-ap#
千辛萬苦,終於成功編譯出來而且安裝好了,真不容易 執行 ifconfig 查看一下:
執行記錄以下:
root@raspberrypi:/opt/github/mt7601u-ap# ifconfig eth0 Link encap:Ethernet HWaddr b8:27:eb:be:64:81 inet addr:192.168.99.209 Bcast:192.168.99.255 Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:206521 errors:0 dropped:1 overruns:0 frame:0 TX packets:172373 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:165311832 (157.6 MiB) TX bytes:25304656 (24.1 MiB) lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:63 errors:0 dropped:0 overruns:0 frame:0 TX packets:63 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:11000 (10.7 KiB) TX bytes:11000 (10.7 KiB) wlan0 Link encap:Ethernet HWaddr 00:36:76:56:bd:4f UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) root@raspberrypi:/opt/github/mt7601u-ap#
看來暫時是 OK 了 先進入目錄 /opt/github/mt7601u-ap/src/os/linux/ 查看一下咱們編譯出來的驅動是什麼樣子
執行記錄以下:
pi@raspberrypi /opt/github/mt7601u-ap/src/os/linux $ ls -al *.ko -rw-r--r-- 1 root root 1373192 Aug 21 15:56 mt7601Uap.ko -rw-r--r-- 1 root root 27516 Aug 21 15:56 rtnet7601Uap.ko -rw-r--r-- 1 root root 109552 Aug 21 15:52 rtutil7601Uap.ko pi@raspberrypi /opt/github/mt7601u-ap/src/os/linux $
再用 wicd-curses 看看 執行記錄以下:
Wired Networks > 0 wired-default vvv Wireless Networks C STR ESSID ENCRYPT BSSID MODE CHNL 100% 360WiFi-2 WPA2 EE:EE:EE:EE:EE:EE Master 1 58% FAST_632AO WPA2 EE:EE:EE:EE:EE:EE Master 1 44% TP-LINK-LTC WPA2 EE:EE:EE:EE:EE:EE Master 6 41% QWE-SG2 WPA2 EE:EE:EE:EE:EE:EE Master 11 41% D-Link_DIR-600M WPA2 EE:EE:EE:EE:EE:EE Master 1 41% HiWiFi_26812A WPA2 EE:EE:EE:EE:EE:EE Master 4 41% D-Link_DIR-613 WPA2 EE:EE:EE:EE:EE:EE Master 11 38% FAST_43QWE2 WPA2 EE:EE:EE:EE:EE:EE Master 1 35% 3621101 WPA EE:EE:EE:EE:EE:EE Master 6 35% Tenda_1AB23F WPA EE:EE:EE:EE:EE:EE Master 8 32% ZXM999 WPA2 EE:EE:EE:EE:EE:EE Master 6 32% TP-cheX WPA2 EE:EE:EE:EE:EE:EE Master 6
看來目前爲止是能夠正常搜索到wifi信號了。
若是但願手動安裝/卸載咱們編譯出來的驅動,能夠在本目錄(/opt/github/mt7601u-ap/src/)下執行:
sudo su make install make uninstall
執行記錄以下: 手動安裝
root@raspberrypi:/opt/github/mt7601u-ap# make install make -C src/ install make[1]: Entering directory '/opt/github/mt7601u-ap/src' make -C /opt/github/mt7601u-ap/src/os/linux -f Makefile.6 install make[2]: Entering directory '/opt/github/mt7601u-ap/src/os/linux' mkdir -pv /etc/Wireless/RT2870AP cp -v /opt/github/mt7601u-ap/src/../etc/Wireless/RT2870AP/RT2870AP.dat /etc/Wireless/RT2870AP/. `/opt/github/mt7601u-ap/src/../etc/Wireless/RT2870AP/RT2870AP.dat' -> `/etc/Wireless/RT2870AP/./RT2870AP.dat' install -d /lib/modules/4.1.6-v7+/kernel/drivers/net/wireless/ install -m 644 -c mt7601Uap.ko /lib/modules/4.1.6-v7+/kernel/drivers/net/wireless/ /sbin/depmod -a 4.1.6-v7+ make[2]: Leaving directory '/opt/github/mt7601u-ap/src/os/linux' make -C /opt/github/mt7601u-ap/src/os/linux -f Makefile.6.util install make[2]: Entering directory '/opt/github/mt7601u-ap/src/os/linux' install -d /lib/modules/4.1.6-v7+/kernel/drivers/net/wireless/ install -m 644 -c rtutil7601Uap.ko /lib/modules/4.1.6-v7+/kernel/drivers/net/wireless/ /sbin/depmod -a 4.1.6-v7+ make[2]: Leaving directory '/opt/github/mt7601u-ap/src/os/linux' make -C /opt/github/mt7601u-ap/src/os/linux -f Makefile.6.netif install make[2]: Entering directory '/opt/github/mt7601u-ap/src/os/linux' install -d /lib/modules/4.1.6-v7+/kernel/drivers/net/wireless/ install -m 644 -c rtnet7601Uap.ko /lib/modules/4.1.6-v7+/kernel/drivers/net/wireless/ /sbin/depmod -a 4.1.6-v7+ make[2]: Leaving directory '/opt/github/mt7601u-ap/src/os/linux' make[1]: Leaving directory '/opt/github/mt7601u-ap/src'
手動卸載
root@raspberrypi:/opt/github/mt7601u-ap# make uninstall make -C src/ uninstall make[1]: Entering directory '/opt/github/mt7601u-ap/src' make -C /opt/github/mt7601u-ap/src/os/linux -f Makefile.6 uninstall make[2]: Entering directory '/opt/github/mt7601u-ap/src/os/linux' rm -rvf /etc/Wireless/RT2870AP removed `/etc/Wireless/RT2870AP/RT2870AP.dat' removed directory: `/etc/Wireless/RT2870AP' rm -rvf /lib/modules/4.1.6-v7+/kernel/drivers/net/wireless/mt7601Uap.ko removed `/lib/modules/4.1.6-v7+/kernel/drivers/net/wireless/mt7601Uap.ko' /sbin/depmod -a 4.1.6-v7+ make[2]: Leaving directory '/opt/github/mt7601u-ap/src/os/linux' make[1]: Leaving directory '/opt/github/mt7601u-ap/src' root@raspberrypi:/opt/github/mt7601u-ap#
至於 AP 的設置,我尚未弄,要試驗的話打算參照這篇文檔:[【L】小米隨身WiFi,Linux下AP熱點驅動(開源)] (http://blog.csdn.net/sumang_87/article/details/38168877)
再編譯一個看起來不支持 ap 版本的 (好像聽說也支持,不過我沒試過)
CC [M] /opt/github/mt7601-new/src/os/linux/../../mac/ral_omac.o CC [M] /opt/github/mt7601-new/src/os/linux/../../os/linux/rt_usb_util.o CC [M] /opt/github/mt7601-new/src/os/linux/../../os/linux/usb_main_dev.o CC [M] /opt/github/mt7601-new/src/os/linux/../../common/rtusb_dev_id.o CC [M] /opt/github/mt7601-new/src/os/linux/../../common/frq_cal.o LD [M] /opt/github/mt7601-new/src/os/linux/mt7601Usta.o Building modules, stage 2. MODPOST 1 modules CC /opt/github/mt7601-new/src/os/linux/mt7601Usta.mod.o LD [M] /opt/github/mt7601-new/src/os/linux/mt7601Usta.ko make[1]: Leaving directory '/usr/src/linux-rpi-4.1.y' cp -f /opt/github/mt7601-new/src/os/linux/mt7601Usta.ko /tftpboot 2>/dev/null || : root@raspberrypi:/opt/github/mt7601-new/src#
手動安裝/卸載的方法同上。
以上就是今天花費大半天時間的工做記錄,應該也是目前最新的關於樹莓派2下編譯360wifi2的教程,但願能對正在折騰樹莓派2的朋友有所幫助。
補充:360wifi2目前已經穩定鏈接一夜+一上午,還沒用出現 oops 崩潰,目前看來還比較穩定。