아는 것이 좋은 것이다.

[DS718+] 무선랜카드 Linux Driver 설치하기(크로스 컴파일) #1 본문

Synology

[DS718+] 무선랜카드 Linux Driver 설치하기(크로스 컴파일) #1

start0 2020. 8. 24. 14:14

크로스 컴파일을 위한 기본 환경 구성

컴파일 환경 구성
- 도커 컨테이너(debian 10.5) 활용하여 크로스 컴파일
- 시놀로지 커널 다운로드 (Linux NAS 4.4.59+ #25426 SMP PREEMPT Wed Jul 8 03:21:29 CST 2020 x86_64 GNU/Linux synology_apollolake_718+)
- apt-get update && apt-get install -y make bc gcc git vim wget xz-utils libncurses5-dev libncursesw5-dev libssl-dev  # (크로스 컴파일을 위한 설치)
- rtl88x2bu linux driver(rtl8812bu 지원되는 드라이버 - https://github.com/cilynx/rtl88x2BU)

GPL 및 툴체인 다운로드
- GPL Source 다운로드
  https://cfhcable.dl.sourceforge.net/project/dsgpl/Synology%20NAS%20GPL%20Source/24922branch/apollolake-source/linux-4.4.x.txz
- Tool Chain(DSM 6.2.3-25426 Update 2) 다운로드
  https://iweb.dl.sourceforge.net/project/dsgpl/Tool%20Chain/DSM%206.2.2%20Tool%20Chains/Intel%20x86%20Linux%204.4.59%20%28Apollolake%29/apollolake-gcc493_glibc220_linaro_x86_64-GPL.txz

GPL 및 툴체인을 버전에 맞게 다운로드 한다. (Kernel 4.4.59+ and DSM 6.2로 진행)
다운받은 GPL 및 툴체인 압축을 해제한다. export 로 크로스 컴파일 PATH를 지정한다. 그래야 해당 버전으로 컴파일이 되고 버전 오류가 나지 않는다.
/usr/local/linux-4.4.x/Makefile 을 열면 EXTPAVERSION 이 공백으로 되어 있는데 +를 입력한다. (현재 사용되는 버전이 4.4.59+ 버전)
make oldconfig 는 현재 config 설정을 백업하는것 같다. 
make menuconfig 명령어를 실행하면 위와 같은 화면이 나온다. 아래의 설정대로 활성화 시킨다. <M> 으로 활성화하려면 m, <*> 로 활성화하려면 y 로 하면 된다.

# IEEE 802.11 설정
[*] Networking support  --->
    [*] Wireless  --->
        <*>   cfg80211 - wireless configuration API
        [ ]     nl80211 testmode command
        [ ]     enable developer warnings
        [ ]     cfg80211 regulatory debugging
        [ ]     cfg80211 certification onus
        [*]     enable powersave by default
        [ ]     cfg80211 DebugFS entries
        [ ]     use statically compiled regulatory rules database
        [ ]     cfg80211 wireless extensions compatibility
        <*>   Generic IEEE 802.11 Networking Stack (mac80211)
        [*]   Minstrel
        [*]     Minstrel 802.11n support
        [ ]       Minstrel 802.11ac support
              Default rate control algorithm (Minstrel)  --->
        [ ]   Enable mac80211 mesh networking (pre-802.11s) support
        -*-   Enable LED triggers
        [ ]   Export mac80211 internals in DebugFS
        [ ]   Trace all mac80211 debug messages
        [ ]   Select mac80211 debugging features  ----
# WEXT 설정
[*] Networking support  --->
    [*] Wireless  --->
        [*]     cfg80211 wireless extensions compatibility
# 장치 드라이버 활성화
Device Drivers  --->
    [*] Network device support  --->
        [*] Wireless LAN  --->
 
            Select the driver for your Wifi network device, e.g.:
            <M> Broadcom 43xx wireless support (mac80211 stack) (b43)
            [M]    Support for 802.11n (N-PHY) devices
            [M]    Support for low-power (LP-PHY) devices
            [M]    Support for HT-PHY (high throughput) devices
            <M> Intel Wireless WiFi Next Gen AGN - Wireless-N/Advanced-N/Ultimate-N (iwlwifi)
            <M>    Intel Wireless WiFi DVM Firmware support                             
            <M>    Intel Wireless WiFi MVM Firmware support
            <M> Intel Wireless WiFi 4965AGN (iwl4965)
            <M> Intel PRO/Wireless 3945ABG/BG Network Connection (iwl3945)
            <M> Ralink driver support  --->
                <M>   Ralink rt27xx/rt28xx/rt30xx (USB) support (rt2800usb)
 
-*- Cryptographic API --->
    -*- AES cipher algorithms
    -*- AES cipher algorithms (x86_64)
    <*> AES cipher algorithms (AES-NI)
# LED 지원 되는 무선랜카드일 경우 활성화
Device Drivers  --->
    [*] LED Support  --->
        <*>   LED Class Support
 
[*] Networking support  --->
    [*] Wireless  --->
        [*] Enable LED triggers

RTL88x2BU 드라이버를 git을 통해 다운로드 받습니다. (Archer t4u 무선 랜카드 칩셋이 RTL8812BU이기 때문에...)
git clone 으로 받은 소스 경로로 이동하여 make modules 로 드라이버를 컴파일 합니다.
시놀로지의 커널 버전과 크로스 컴파일로 만든 88x2bu.ko 버전이 일치해야 합니다. (4.4.59+ 일치 확인)
도커 컨테이너안에서 크로스 컴파일한 ko파일을 나스로 복사하여 모듈을 로드한다.(docker cp [컨테이너명]:[경로] [호스트 복사 경로] 하면 복사 된다.) 88x2bu.ko 와 cfg80211.ko 를 /lib/modules/ 에 복사 후 로드 하는 것이 좋다.
cfg80211 에러가 뜨는 경우가 있는데 cfg80211.ko를 먼저 모듈 로드를 하면 해결 된다.

 

테스트 연결 완료된 USB 무선 랜카드 : TP-LINK Archer t4u v3, IPTIME A3000U

 

현재 사용중인 나스가 USB3.0 이고 USB 무선랜카드도 3.0 사용이 가능하기 때문에 모듈 로드시 insmod 88x2bu.ko rtw_switch_usb_mode=1 처럼 변수를 설정하여 로드하면 위의 캡쳐처럼 3.0으로 인식하여 5000MBit/s로 인식한다.

 

# 마지막으로 아래의 명령어를 실행해야 시놀로지 GUI에서 인식하고 제어판에서 제어가 가능하다.
# 2357:0115 는 lsusb 에서 나오는 정보를 토대로 입력하면 된다.
echo "(0x2357:0x0115,rtl8812bu)" >> /lib/udev/devicetable/usb.wifi.table

 

시놀로지 GUI 제어판에 위와 같은 무선 항목이 활성화 되고 공유기와 연결이 가능해진다.

Comments