본문 바로가기
서버/리눅스 서버

라즈베리파이 RTL8811CU 2.4/5G AC 와이파이 드라이버 설치하기

by ㅋㅋ잠자 2019. 5. 8.
반응형

안녕하세요? 


본래 라즈베리파이에 2.4기가 + 블루투스 콤보 모듈이 들어있습니다만, 5기가를 사용하기 위해서는 외장 동글을 꽂아야합니다.


아래의 외장 동글인데요.





5기가 와이파이를 사용하기 위해 한번 드라이버를 올려보겠습니다.





1. 사전 설치 패키지


root@raspberrypi:~# apt install gcc build-essential git dkms raspberrypi-kernel-headers bc


상기 패키지 외에 더 필요할 수 있습니다. 컴파일간 에러로그를 통해 설치하시길 바랍니다 ㅎㅎ..





2. 드라이버 컴파일


일단 기본 이미지에 내장된 커널버전은 아래와 같습니다.


root@raspberrypi:~# uname -r

4.14.98-v7+


커널 소스가 아래에 위치하고 있는지 확인하세요.


root@raspberrypi:/usr/src/linux-headers-4.14.98-v7+# ls

arch   certs   Documentation  firmware include  ipc   kernel  Makefile  Module.symvers  samples  security  tools  virt

block  crypto  drivers       fs init Kconfig  lib   mm     net     scripts  sound     usr


드라이버가 8821CU 와 동일로 사용함으로 아래 드라이버 소스를 기트클론합니다.


root@raspberrypi:~# git clone https://github.com/whitebatman2/rtl8821CU

Cloning into 'rtl8821CU'...

remote: Enumerating objects: 651, done.

remote: Total 651 (delta 0), reused 0 (delta 0), pack-reused 651

Receiving objects: 100% (651/651), 3.30 MiB | 1.10 MiB/s, done.

Resolving deltas: 100% (238/238), done.

root@raspberrypi:~# cd rtl8821CU/

root@raspberrypi:~/rtl8821CU# ls

clean  core  dkms.conf hal  ifcfg-wlan0  include  Kconfig  LICENSE  Makefile  os_dep  platform  README.md  rtl8821c.mk  runwpa  wlan0dhcp


96번째 줄 Makefile 에 RPI에 y 나머지는 n 으로 놓으시길 바랍니다.


root@raspberrypi:~/rtl8821CU# nano Makefile


CONFIG_PLATFORM_I386_PC = n

CONFIG_PLATFORM_ARM_RPI = y

CONFIG_PLATFORM_ARM_RPI3 = n


컴파일 하고 인스톨합니다.


root@raspberrypi:~/rtl8821CU# make -j 4

make ARCH=arm CROSS_COMPILE= -C /lib/modules/4.14.98-v7+/build M=/usr/src/rtl8821CU-5.2.5.3  modules

make[1]: Entering directory '/usr/src/linux-headers-4.14.98-v7+'

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_cmd.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_security.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_debug.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_io.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_ioctl_query.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_ioctl_set.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_ieee80211.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_mlme.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_mlme_ext.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_mi.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_wlan_util.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_vht.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_pwrctrl.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_rf.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_recv.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_sta_mgt.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_ap.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_xmit.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_p2p.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_tdls.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_br_ext.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_iol.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_sreset.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_btcoex_wifionly.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_btcoex.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_odm.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_beamforming.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/efuse/rtw_efuse.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/os_dep/osdep_service.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/os_dep/linux/os_intfs.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/os_dep/linux/usb_intf.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/os_dep/linux/usb_ops_linux.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/os_dep/linux/ioctl_linux.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/os_dep/linux/xmit_linux.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/os_dep/linux/mlme_linux.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/os_dep/linux/recv_linux.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/os_dep/linux/ioctl_cfg80211.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/os_dep/linux/rtw_cfgvendor.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/os_dep/linux/wifi_regd.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/os_dep/linux/rtw_android.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/os_dep/linux/rtw_proc.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/os_dep/linux/ioctl_mp.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/hal/hal_intf.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/hal/hal_com.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/hal/hal_com_phycfg.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/hal/hal_phy.o

  CC [M]  /usr/src/rtl8821CU-5.2.5.3/hal/hal_dm.o

.........................................
  CC [M]  /usr/src/rtl8821CU-5.2.5.3/hal/phydm/rtl8821c/halhwimg8821c_rf.o
  CC [M]  /usr/src/rtl8821CU-5.2.5.3/hal/phydm/rtl8821c/phydm_hal_api8821c.o
  CC [M]  /usr/src/rtl8821CU-5.2.5.3/hal/phydm/rtl8821c/phydm_regconfig8821c.o
  CC [M]  /usr/src/rtl8821CU-5.2.5.3/hal/phydm/rtl8821c/halphyrf_8821c.o
  CC [M]  /usr/src/rtl8821CU-5.2.5.3/hal/phydm/rtl8821c/phydm_iqk_8821c.o
  CC [M]  /usr/src/rtl8821CU-5.2.5.3/platform/platform_ops.o
  CC [M]  /usr/src/rtl8821CU-5.2.5.3/core/rtw_mp.o
  LD [M]  /usr/src/rtl8821CU-5.2.5.3/8821cu.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /usr/src/rtl8821CU-5.2.5.3/8821cu.mod.o
  LD [M]  /usr/src/rtl8821CU-5.2.5.3/8821cu.ko
make[1]: Leaving directory '/usr/src/linux-headers-4.14.98-v7+'


root@raspberrypi:~/rtl8821CU# make install

install -p -m 644 8821cu.ko  /lib/modules/4.14.98-v7+/kernel/drivers/net/wireless/

/sbin/depmod -a 4.14.98-v7+


커널단에 모듈을 올려주고 장치가 올라왔는지 확인합니다.


wlan0 는 내장랜 wlan1 이 방금 올린 와이파이 모듈입니다.


root@raspberrypi:~# modprobe 8821cu

root@raspberrypi:~# ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.0.59  netmask 255.255.255.0  broadcast 192.168.0.255

        inet6 fe80::503a:59a6:d87:85ce  prefixlen 64  scopeid 0x20<link>

        ether b8:27:eb:aa:2d:53  txqueuelen 1000  (Ethernet)

        RX packets 29275  bytes 40076681 (38.2 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 17038  bytes 1456820 (1.3 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


wlan0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether b8:27:eb:ff:78:06  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


wlan1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500

        ether 00:2e:2d:40:12:44  txqueuelen 1000  (Ethernet)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


쓰지 않을 wlan0 는 끕니다.


root@raspberrypi:~# ifconfig wlan0 down

root@raspberrypi:~# ifconfig

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.0.59  netmask 255.255.255.0  broadcast 192.168.0.255

        inet6 fe80::503a:59a6:d87:85ce  prefixlen 64  scopeid 0x20<link>

        ether b8:27:eb:aa:2d:53  txqueuelen 1000  (Ethernet)

        RX packets 29402  bytes 40096053 (38.2 MiB)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 17096  bytes 1464324 (1.3 MiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536

        inet 127.0.0.1  netmask 255.0.0.0

        inet6 ::1  prefixlen 128  scopeid 0x10<host>

        loop  txqueuelen 1000  (Local Loopback)

        RX packets 0  bytes 0 (0.0 B)

        RX errors 0  dropped 0  overruns 0  frame 0

        TX packets 0  bytes 0 (0.0 B)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


wlan1: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500

        inet 192.168.43.99  netmask 255.255.255.0  broadcast 192.168.43.255

        inet6 fe80::f364:da0b:1344:c6be  prefixlen 64  scopeid 0x20<link>

        ether 00:2e:2d:40:12:44  txqueuelen 1000  (Ethernet)

        RX packets 10  bytes 1591 (1.5 KiB)

        RX errors 0  dropped 4  overruns 0  frame 0

        TX packets 34  bytes 5943 (5.8 KiB)

        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0


wpa_supplicant.conf 를 수정하여 연결할 네트워크를 아래와 같이 입력합니다.


root@raspberrypi:~# nano /etc/wpa_supplicant/wpa_supplicant.conf


ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev

update_config=1

country=US


network={

        ssid="POCOPHONE"

        psk="1q2w3e4r"

}


정상적으로 연결되었습니다.


root@raspberrypi:~# iwconfig

wlan0     IEEE 802.11  ESSID:off/any  

          Mode:Managed  Access Point: Not-Associated   

          Retry short limit:7   RTS thr:off   Fragment thr:off

          Encryption key:off

          Power Management:on

          

lo        no wireless extensions.


wlan1     IEEE 802.11AC  ESSID:"POCOPHONE"  Nickname:"<WIFI@REALTEK>"

          Mode:Managed  Frequency:5.745 GHz  Access Point: A4:50:46:8C:37:F1   

          Bit Rate:434 Mb/s   Sensitivity:0/0  

          Retry:off   RTS thr:off   Fragment thr:off

          Encryption key:****-****-****-****-****-****-****-****   Security mode:open

          Power Management:off

          Link Quality=54/100  Signal level=51/100  Noise level=0/100

          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0

          Tx excessive retries:0  Invalid misc:0   Missed beacon:0


eth0      no wireless extensions.





3. 속도 측정


온전한 상태가 아닌 포코폰 핫스팟에서 측정이라 속도가 아래와 같이 측정되었습니다.


root@raspberrypi:~# speedtest-cli

Retrieving speedtest.net configuration...

Testing from Korea Telecom (39.7.15.80)...

Retrieving speedtest.net server list...

Selecting best server based on ping...

Hosted by kdatacenter.com (Seoul) [2.55 km]: 52.761 ms

Testing download speed................................................................................

Download: 46.78 Mbit/s

Testing upload speed....................................................................................................

Upload: 20.61 Mbit/s


AC 와이파이에서 연결하면 최대 250mbps 정도 나올것 같습니다.


여기까지 마치겠습니다.


감사합니다.

반응형

댓글