Posted at

Raspberry Piで、5Ghz帯のWiFiをサポートする

More than 1 year has passed since last update.

この手順に従いました。

https://github.com/abperiasamy/rtl8812AU_8821AU_linux


手順


  • sudo apt-get install linux-image-rpi-rpfv linux-headers-rpi-rpfv dkms build-essential bc

  • /boot/config.txtの変更

  • makefileの変更

  • make, make install, modprobeの実行


詳細

まず、apt-getで必要なアプリをインストールします

ここでハマったのが、/bootの領域。一時的に、60Mbyteくらい使うようで、途中で、領域不足で、止まりました。

うちの環境は、/bootに64Mしか割り当てていなかった

/bootと/の容量変換は、別のLinuxマシン上で、gpartedを実施して、変更して、再度実施

128Mを割り当てたところ、無事に通過

その後、再起動

unameを実施して、カーネルのバージョンを確認

$ uname -a

Linux pisan 4.9.0-4-rpi #1 Raspbian 4.9.51-1+rpi1~jessie (2017-10-12) armv6l GNU/Linux

このバージョンを/boot/config.txtへ記入。参照元は、文末で良さそうでしたが、冒頭に載せました。

当方の環境では、この記入をせずに、makeを実行したところ、異なるライブラリを参照しに行ったので、必要でした。

kernel=vmlinuz-4.9.0-4-rpi

initramfs initrd.img-4.9.0-4-rpi followkernel

再び、再起動

その後、ソースファイルのダウンロード

git clone https://github.com/abperiasamy/rtl8812AU_8821AU_linux

Makefileを書き換えます

CONFIG_PLATFORM_I386_PC = n

CONFIG_PLATFORM_ARM_RPI = y

Raspberry Pi用のオプションへ変更して、make cleanと、makeの実行

$ make

make ARCH=arm CROSS_COMPILE= -C /lib/modules/4.9.0-4-rpi/build M=/home/pi/rtl8812AU_8821AU_linux modules
make[1]: Entering directory '/usr/src/linux-headers-4.9.0-4-rpi'
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_cmd.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_security.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_debug.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_io.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_ioctl_query.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_ioctl_set.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_ieee80211.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_mlme.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_mlme_ext.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_wlan_util.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_vht.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_pwrctrl.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_rf.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_recv.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_sta_mgt.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_ap.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_xmit.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_p2p.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_tdls.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_br_ext.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_iol.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_sreset.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_btcoex.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_beamforming.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_odm.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/efuse/rtw_efuse.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/os_dep/osdep_service.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/os_dep/linux/os_intfs.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/os_dep/linux/usb_intf.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/os_dep/linux/usb_ops_linux.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/os_dep/linux/ioctl_linux.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/os_dep/linux/xmit_linux.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/os_dep/linux/mlme_linux.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/os_dep/linux/recv_linux.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/os_dep/linux/ioctl_cfg80211.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/os_dep/linux/rtw_cfgvendor.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/os_dep/linux/wifi_regd.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/os_dep/linux/rtw_android.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/os_dep/linux/rtw_proc.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/hal_intf.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/hal_com.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/hal_com_phycfg.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/hal_phy.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/hal_dm.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/hal_btcoex.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/hal_hci/hal_usb.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/led/hal_usb_led.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/HalPwrSeqCmd.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/Hal8812PwrSeq.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/Hal8821APwrSeq.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/rtl8812a_xmit.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/rtl8812a_sreset.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/rtl8812a_hal_init.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/rtl8812a_phycfg.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/rtl8812a_rf6052.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/rtl8812a_dm.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/rtl8812a_rxdesc.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/rtl8812a_cmd.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/usb/usb_halinit.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/usb/rtl8812au_led.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/usb/rtl8812au_xmit.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/usb/rtl8812au_recv.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/usb/usb_ops_linux.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/rtl8812a/rtl8812a_mp.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/efuse/rtl8812a/HalEfuseMask8812A_USB.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/efuse/rtl8812a/HalEfuseMask8821A_USB.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm_debug.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm_AntDiv.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm_AntDect.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm_interface.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm_HWConfig.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/HalPhyRf.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm_EdcaTurboCheck.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm_DIG.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm_PathDiv.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm_RaInfo.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm_DynamicBBPowerSaving.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm_PowerTracking.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm_DynamicTxPower.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/PhyDM_Adaptivity.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm_CfoTracking.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm_NoiseMonitor.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/phydm_ACS.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/rtl8812a/HalHWImg8812A_FW.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/rtl8812a/HalHWImg8812A_MAC.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/rtl8812a/HalHWImg8812A_BB.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/rtl8812a/HalHWImg8812A_RF.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/rtl8812a/HalPhyRf_8812A.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/rtl8812a/phydm_RegConfig8812A.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/rtl8812a/phydm_RTL8812A.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/rtl8821a/HalHWImg8821A_FW.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/rtl8821a/HalHWImg8821A_MAC.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/rtl8821a/HalHWImg8821A_BB.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/rtl8821a/HalHWImg8821A_RF.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/rtl8821a/HalPhyRf_8821A.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/rtl8821a/phydm_RegConfig8821A.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/rtl8821a/phydm_RTL8821A.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/hal/OUTSRC/rtl8821a/PhyDM_IQK_8821A.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/platform/platform_ops.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_mp.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_mp_ioctl.o
CC [M] /home/pi/rtl8812AU_8821AU_linux/core/rtw_bt_mp.o
LD [M] /home/pi/rtl8812AU_8821AU_linux/rtl8812au.o
Building modules, stage 2.
MODPOST 1 modules
CC /home/pi/rtl8812AU_8821AU_linux/rtl8812au.mod.o
LD [M] /home/pi/rtl8812AU_8821AU_linux/rtl8812au.ko
make[1]: Leaving directory '/usr/src/linux-headers-4.9.0-4-rpi'

そして、インストール

$ sudo make install

install -p -m 644 rtl8812au.ko /lib/modules/4.9.0-4-rpi/kernel/drivers/net/wireless/
/sbin/depmod -a 4.9.0-4-rpi

最後に、ドライバを登録して、終わり

$ sudo modprobe -a rtl8812au

再起動すると、次のように認識されます

[   19.979481] rtl8812au: loading out-of-tree module taints kernel.

[ 20.478821] RTL871X: module init start
[ 20.478835] RTL871X: rtl8812au v4.3.14_13455.20150212_BTCOEX20150128-51
[ 20.478839] RTL871X: rtl8812au BT-Coex version = BTCOEX20150128-51
[ 20.764421] random: crng init done
[ 20.932216] systemd-journald[176]: Received request to flush runtime journal from PID 1
[ 21.591709] usbcore: registered new interface driver rtl8192cu
[ 22.042452] RTL871X: rtw_ndev_init(wlan0)
[ 22.056043] usbcore: registered new interface driver rtl8812au
[ 22.056064] RTL871X: module init ret=0

無事に、wlan0として認識された

'''

$ ifconfig wlan0

wlan0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX


inet addr:192.168.XX.1 Bcast:192.168.XX.255 Mask:255.255.255.0

inet6 addr: XXXX::XXXX:XXXX:XXXX:XXXX/64 Scope:Link

UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1

RX packets:984 errors:0 dropped:0 overruns:0 frame:0

TX packets:786 errors:0 dropped:0 overruns:0 carrier:0

collisions:0 txqueuelen:1000

RX bytes:186316 (181.9 KiB) TX bytes:505524 (493.6 KiB)

```

いちおう、5Ghz帯も引っかかる。

 $ sudo iwlist wlan0 scan | grep Channel

Frequency:2.412 GHz (Channel 1)
Frequency:2.412 GHz (Channel 1)
Frequency:2.412 GHz (Channel 1)
Frequency:2.412 GHz (Channel 1)
Frequency:2.437 GHz (Channel 6)
Frequency:2.437 GHz (Channel 6)
Frequency:2.437 GHz (Channel 6)
Frequency:2.442 GHz (Channel 7)
Frequency:2.447 GHz (Channel 8)
Frequency:2.462 GHz (Channel 11)
Frequency:2.452 GHz (Channel 9)
Frequency:2.457 GHz (Channel 10)
Frequency:2.457 GHz (Channel 10)
Frequency:2.462 GHz (Channel 11)
Frequency:2.462 GHz (Channel 11)
Frequency:2.462 GHz (Channel 11)
Frequency:2.462 GHz (Channel 11)
Frequency:2.462 GHz (Channel 11)
Frequency:2.462 GHz (Channel 11)
Frequency:2.412 GHz (Channel 1)
Frequency:2.472 GHz (Channel 13)
Frequency:2.472 GHz (Channel 13)
Frequency:2.472 GHz (Channel 13)
Frequency:5.18 GHz (Channel 36)
Frequency:5.18 GHz (Channel 36)
Frequency:5.18 GHz (Channel 36)
Frequency:5.18 GHz (Channel 36)
Frequency:5.22 GHz (Channel 44)
Frequency:5.22 GHz (Channel 44)
Frequency:5.24 GHz (Channel 48)

おしまい