Set up the QNHI Synology NAS development environment, and self compile the network card and other drivers

Little assistant reads articles 00:00 / 00:00

reminder:
The content described in this article is dependent and may differ from the expectation due to different soft and hard conditions, so please take the actual situation as the criterion for reference only.

Yesterday I tried《 Qunhui DSM 7.0 external drive free USB gigabit network card (ASIX AX88179) 》Although the driver was successfully installed, the network card did not work properly. After searching for it, I came to the conclusion that it does not support connecting to the USB 3.0 interface, but my DS218+only has a USB 3.0 interface, which is a bit of a jam.

For the customized system used by Qunhui NAS, the network card manufacturer did not provide the corresponding driver, but only provided the driver source code. In fact, the driver most suitable for the local machine is to compile directly on the local machine. However, there are not many online related resources, so it took a day and night to study how to compile in the Qunhui NAS system, and finally the effort paid off, Let me have a look at the results:

 Network card online successfully.jpg

Test the bandwidth with iperf3:

 root@NAS :~/AX88179_178A_Linux_Driver_v1.20.0_source# iperf3 -c 10.2.0.131 -p 13131 -P 1 -B 10.2.0.15 -R Connecting to host 10.2.0.131, port 13131 Reverse mode, remote host 10.2.0.131 is sending [  5] local 10.2.0.15 port 54277 connected to 10.2.0.131 port 13131 [ ID] Interval            Transfer     Bitrate [  5]   0.00-1.00    sec   109 MBytes   918 Mbits/sec                   [  5]   1.00-2.00    sec   109 MBytes   918 Mbits/sec                   [  5]   2.00-3.00    sec   112 MBytes   938 Mbits/sec                   [  5]   3.00-4.00    sec   110 MBytes   922 Mbits/sec                   [  5]   4.00-5.00    sec   111 MBytes   929 Mbits/sec                   [  5]   5.00-6.00    sec   110 MBytes   926 Mbits/sec                   [  5]   6.00-7.00    sec   110 MBytes   924 Mbits/sec                   [  5]   7.00-8.00    sec   110 MBytes   921 Mbits/sec                   [  5]   8.00-9.00    sec   111 MBytes   928 Mbits/sec                   [  5]   9.00-10.00   sec   112 MBytes   938 Mbits/sec                   - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval            Transfer     Bitrate         Retr [  5]   0.00-10.05   sec  1.08 GBytes   924 Mbits/sec    0             sender [  5]   0.00-10.00   sec  1.08 GBytes   926 Mbits/sec                  receiver iperf Done. root@NAS :~/AX88179_178A_Linux_Driver_v1.20.0_source# iperf3 -c 10.2.0.131 -p 13131 -P 1 -B 10.2.0.15 Connecting to host 10.2.0.131, port 13131 [  5] local 10.2.0.15 port 39466 connected to 10.2.0.131 port 13131 [ ID] Interval            Transfer     Bitrate         Retr  Cwnd [  5]   0.00-1.00    sec   113 MBytes   947 Mbits/sec   46    410 KBytes        [  5]   1.00-2.00    sec   111 MBytes   935 Mbits/sec   27    349 KBytes        [  5]   2.00-3.00    sec   110 MBytes   920 Mbits/sec    7    402 KBytes        [  5]   3.00-4.00    sec   110 MBytes   920 Mbits/sec   26    345 KBytes        [  5]   4.00-5.00    sec   109 MBytes   917 Mbits/sec   13    383 KBytes        [  5]   5.00-6.00    sec   107 MBytes   899 Mbits/sec    2    397 KBytes        [  5]   6.00-7.00    sec   110 MBytes   924 Mbits/sec   50    355 KBytes        [  5]   7.00-8.00    sec   107 MBytes   900 Mbits/sec   16    389 KBytes        [  5]   8.00-9.00    sec   110 MBytes   923 Mbits/sec   17    389 KBytes        [  5]   9.00-10.00   sec   105 MBytes   879 Mbits/sec   10    332 KBytes        - - - - - - - - - - - - - - - - - - - - - - - - - [ ID] Interval            Transfer     Bitrate         Retr [  5]   0.00-10.00   sec  1.07 GBytes   916 Mbits/sec  214             sender [  5]   0.00-10.05   sec  1.07 GBytes   911 Mbits/sec                  receiver

Considering the certain loss of the line, it can be considered that the network card can run full gigabit!

Let's record the compilation process.

Building environment

Qunhui open source file download station: Synology Archive Download Site

Driven vermagic It can be loaded only when it is consistent with the kernel, so the driver compilation needs to be carried out in the DSM kernel. In fact, Qunhui has already provided the key part of the DSM kernel, so we can download it directly. Download address: ds.apollolake-7.0.dev.txz ds.apollolake-7.0.env.txz base_env-7.0.txz

Which version should I download?

Qunhui NAS has many CPU platform architectures. You need to download the kernel environment of the same architecture. The compiled driver can be used on NAS normally. The architecture can be found on the official website: What kind of CPU does my SYNOLOGY NAS use? , you can directly search your NAS model to find the corresponding architecture.

Similarly, compiling tools consistent with the kernel environment are required make and gnu The Qunhui is also available. Download address: apollolake-gcc750_glibc226_x86_64-GPL.txz

Then go to the ASIX official website to download the Linux version driver. The download page address is: File download | AsiaInfo Electronics The latest driver is 1.20.0 released on April 27, 2020: Linux kernel 5.x/4.x/3.x/2.6.x Driver

It should be noted that the folders used by the Qunhui DSM are limited in size (error: Cannot open: No space left on device )Therefore, we cannot build the environment /usr Directory, you can use /tmp Directory, and then through ln -s Command.

The following is the operation command demonstration:

 Connection established. To escape to local shell, press 'Ctrl+Alt+]'. Synology strongly advises you not to run commands as the root user, who has the highest privileges on the system. Doing so may cause major damages to the system. Please note that if you choose to proceed, all consequences are at your own risk. admin@NAS :~$sudo - i # Use root identity root@NAS :~# cd/tmp # Operation to/tmp directory root@NAS :~# mkdir nas&&cd nas/# Create a directory for subsequent processing root@NAS :/tmp/nas# wget -O base_env-7.0.txz  https://cndl.synology.cn/download/ToolChain/toolkit/7.0/base/base_env-7.0.txz #Download the kernel environment --2022-03-25 14:09:52--   https://cndl.synology.cn/download/ToolChain/toolkit/7.0/base/base_env-7.0.txz Resolving cndl.synology.cn (cndl.synology.cn)...  58.254.138.21, 58.254.138.29, 58.254.138.16, ... Connecting to cndl.synology.cn (cndl.synology.cn)|58.254.138.21|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 1100497292 (1.0G) Saving to: ‘base_env-7.0.txz’ base_env-7.0.txz                          100%[==================================================================================>]   1.02G  5.12MB/s     in 3m 36s   2022-03-25 14:13:29 (4.86 MB/s) - ‘base_env-7.0.txz’ saved [1100497292/1100497292] root@NAS :/tmp/nas# wget -O ds.apollolake-7.0.dev.txz  https://cndl.synology.cn/download/ToolChain/toolkit/7.0/apollolake/ds.apollolake-7.0.dev.txz --2022-03-25 14:15:47--   https://cndl.synology.cn/download/ToolChain/toolkit/7.0/apollolake/ds.apollolake-7.0.dev.txz Resolving cndl.synology.cn (cndl.synology.cn)...  58.254.138.135, 58.254.138.136, 58.254.138.139, ... Connecting to cndl.synology.cn (cndl.synology.cn)|58.254.138.135|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 356648716 (340M) Saving to: ‘ds.apollolake-7.0.dev.txz’ ds.apollolake-7.0.dev.txz                 100%[==================================================================================>] 340.13M  7.29MB/s     in 57s      2022-03-25 14:16:45 (5.96 MB/s) - ‘ds.apollolake-7.0.dev.txz’ saved [356648716/356648716] root@NAS :/tmp/nas# wget -O ds.apollolake-7.0.env.txz  https://cndl.synology.cn/download/ToolChain/toolkit/7.0/apollolake/ds.apollolake-7.0.env.txz --2022-03-25 14:21:32--   https://cndl.synology.cn/download/ToolChain/toolkit/7.0/apollolake/ds.apollolake-7.0.env.txz Resolving cndl.synology.cn (cndl.synology.cn)...  58.254.138.29, 58.254.138.16, 58.254.138.21, ... Connecting to cndl.synology.cn (cndl.synology.cn)|58.254.138.29|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 439957764 (420M) Saving to: ‘ds.apollolake-7.0.env.txz’ ds.apollolake-7.0.env.txz                 100%[==================================================================================>] 419.58M  3.60MB/s     in 88s      2022-03-25 14:23:01 (4.78 MB/s) - ‘ds.apollolake-7.0.env.txz’ saved [439957764/439957764] root@NAS :/tmp/nas# wget -O apollolake-gcc750_glibc226_x86_64-GPL.txz  https://cndl.synology.cn/download/ToolChain/toolchain/7.0-41890/Intel%20x86%20Linux%204.4.180%20%28Apollolake%29/apollolake -Gcc750_glibc226_x86_64-GPL. txz # Download command line tool --2022-03-25 14:25:50--   https://cndl.synology.cn/download/ToolChain/toolchain/7.0-41890/Intel%20x86%20Linux%204.4.180%20%28Apollolake%29/apollolake -gcc750_glibc226_x86_64-GPL.txz Resolving cndl.synology.cn (cndl.synology.cn)...  58.254.138.135, 58.254.138.133, 58.254.138.139, ... Connecting to cndl.synology.cn (cndl.synology.cn)|58.254.138.135|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 79940764 (76M) Saving to: ‘apollolake-gcc750_glibc226_x86_64-GPL.txz’ apollolake-gcc750_glibc226_x86_64-GPL.txz 100%[==================================================================================>]  76.24M  8.36MB/s     in 11s      2022-03-25 14:26:02 (6.79 MB/s) - ‘apollolake-gcc750_glibc226_x86_64-GPL.txz’ saved [79940764/79940764] root@NAS :/tmp/nas# tar -xf base_env-7.0.txz && tar -xf ds.apollolake-7.0.env.txz root@NAS :/tmp/nas# tar -xf ds.apollolake-7.0.dev.txz && tar -xf apollolake-gcc750_glibc226_x86_64-GPL.txz root@NAS :/tmp/nas # rm - rf *. txz # Space is limited, and the downloaded files will be deleted after decompression root@NAS :/tmp/nas# wget -O AX88179_178A_LINUX_DRIVER_v1.20.0_SOURCE.tar.bz2 ' https://www.asix.com.tw/cn/support/download/file/120?time=1648188710919 '# Download the source code of the network card driver --2022-03-25 14:29:20--   https://www.asix.com.tw/cn/support/download/file/120?time=1648188710919 Resolving www.asix.com.tw (www.asix.com.tw)...  210.243.224.51, 113.196.140.82 Connecting to www.asix.com.tw (www.asix.com.tw)|210.243.224.51|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 16419 (16K) [application/x-bzip2] Saving to: ‘AX88179_178A_LINUX_DRIVER_v1.20.0_SOURCE.tar.bz2’ AX88179_178A_LINUX_DRIVER_v1.20.0_SOURCE. 100%[==================================================================================>]  16.03K  --.- KB/s    in 0.04s    2022-03-25 14:29:21 (422 KB/s) - ‘AX88179_178A_LINUX_DRIVER_v1.20.0_SOURCE.tar.bz2’ saved [16419/16419] root@NAS :/tmp/nas # tar - xf AX88179_178A_LINUX_DRIVER_v1.20.0_SOURCE.tar.bz2&&rm - rf AX88179_178A_LINUX_DRIVER_v1.20.0_SOURCE.tar.bz2 # The space is limited, and the downloaded files will be deleted after decompression root@NAS :/tmp/nas # ls # Prepared environment files AX88179_178A_Linux_Driver_v1.20.0_source  usr  var  x86_64-pc-linux-gnu root@NAS :/tmp/nas # mkdir/lib/modules/4.4.180+# Link development environment root@NAS :/tmp/nas# ln -s /tmp/nas/usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/lib/modules/DSM-7.0/build /lib/modules/4.4.180+/build

Compilation Driver

After the environment is ready, it is not difficult to compile. Just look at the code demonstration:

 root@NAS :/tmp/nas # cd AX88179_178A_Linux_Driver_v1.20.0_source/# Enter the driver source directory root@NAS :/tmp/nas/AX88179_178A_Linux_Driver_v1.20.0_source# ../ Bin/make ARCH=x86_64 CROSS_COMPILE=/tmp/nas/x86_64-pc-linux-gnu/bin/x86_64-pc-linux-gnu - # Start compiling drivers make -C /lib/modules/4.4.180+/build M=/root/AX88179_178A_Linux_Driver_v1.20.0_source modules make[1]: Entering directory '/tmp/nas/usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/lib/modules/DSM-7.0/build' CC [M]  /tmp/nas/AX88179_178A_Linux_Driver_v1.20.0_source/ax88179_178a.o Building modules, stage 2. MODPOST 1 modules CC      /tmp/nas/AX88179_178A_Linux_Driver_v1.20.0_source/ax88179_178a.mod.o LD [M]  /tmp/nas/AX88179_178A_Linux_Driver_v1.20.0_source/ax88179_178a.ko make[1]: Leaving directory '/tmp/nas/usr/local/x86_64-pc-linux-gnu/x86_64-pc-linux-gnu/sys-root/usr/lib/modules/DSM-7.0/build' root@NAS :/tmp/nas/AX88179_178A_Linux_Driver_v1.20.0_source # ls # Check the compiled file ax88179_178a.c  ax88179_178a.h  ax88179_178a.ko  ax88179_178a.mod.c  ax88179_178a.mod.o  ax88179_178a.o  Makefile  modules.order  Module.symvers  readme root@NAS :/tmp/nas/AX88179_178A_Linux_Driver_v1.20.0_source # modinfo ax88179_178a. ko # Check the driver module information filename:       /tmp/nas/AX88179_178A_Linux_Driver_v1.20.0_source/ax88179_178a.ko license:        GPL description:    ASIX AX88179_178A USB 2.0/3.0 Ethernet Devices author:         David Hollis alias:          usb:v0711p0179d*dc*dsc*dp*ic*isc*ip*in* alias:          usb:v2001p4A00d*dc*dsc*dp*ic*isc*ip*in* alias:          usb:v04E8pA100d*dc*dsc*dp*ic*isc*ip*in* alias:          usb:v0930p0A13d*dc*dsc*dp*ic*isc*ip*in* alias:          usb:v17EFp304Bd*dc*dsc*dp*ic*isc*ip*in* alias:          usb:v0DF6p0072d*dc*dsc*dp*ic*isc*ip*in* alias:          usb:v0B95p178Ad*dc*dsc*dp*ic*isc*ip*in* alias:          usb:v0B95p1790d*dc*dsc*dp*ic*isc*ip*in* depends:        usbnet,usbcore,mii retpoline:      Y vermagic:       4.4.180+ SMP mod_unload  parm:           msg_enable:usbnet msg_enable (int) parm:           bsize:RX Bulk IN Queue Size (int) parm:           ifg:RX Bulk IN Inter Frame Gap (int) parm:           bEEE:EEE advertisement configuration (int) parm:           bGETH:Green ethernet configuration (int) root@NAS :/tmp/nas/AX88179_178A_Linux_Driver_v1.20.0_source# cd ~

Loading drive

The next steps are as follows《 Qunhui DSM 7.0 external drive free USB gigabit network card (ASIX AX88179) 》Same, no more details, just look at the command:

 root@NAS :~# wget -O ax88179_178a-4.4.180plus.tgz  https://github.com/pocopico/rp-ext/raw/main/ax88179_178a/releases/ax88179_178a-4.4.180plus.tgz #Download the driver compiled by others and extract mii.ko --2022-03-25 15:15:41--   https://github.com/pocopico/rp-ext/raw/main/ax88179_178a/releases/ax88179_178a-4.4.180plus.tgz Resolving github.com (github.com)...  20.205.243.166 Connecting to github.com (github.com)|20.205.243.166|:443... connected. HTTP request sent, awaiting response... 302 Found Location:  https://raw.githubusercontent.com/pocopico/rp-ext/main/ax88179_178a/releases/ax88179_178a-4.4.180plus.tgz  [following] --2022-03-25 15:15:44--   https://raw.githubusercontent.com/pocopico/rp-ext/main/ax88179_178a/releases/ax88179_178a-4.4.180plus.tgz Resolving raw.githubusercontent.com (raw.githubusercontent.com)...  185.199.111.133, 185.199.108.133, 185.199.109.133, ... Connecting to raw.githubusercontent.com (raw.githubusercontent.com)|185.199.111.133|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 103399 (101K) [application/octet-stream] Saving to: ‘ax88179_178a-4.4.180plus.tgz’ ax88179_178a-4.4.180plus.tgz              100%[==================================================================================>] 100.98K   463KB/s     in 0.2s     2022-03-25 15:15:45 (463 KB/s) - ‘ax88179_178a-4.4.180plus.tgz’ saved [103399/103399] root@NAS :~# tar - zxf ax88179_178a-4.4.180plus.tgz&&rm - rf ax88179_178a-4.4.180plus.tgz # Decompress the drive package root@NAS :~# mv mii.ko/lib/modules/# Move the driver file to the system directory root@NAS :~# mv /tmp/nas/AX88179_178A_Linux_Driver_v1.20.0_source/ax88179_178a.ko /lib/modules/ root@NAS :~# insmod/lib/modules/mii.ko # Load dependencies and drivers root@NAS :~# insmod /lib/modules/usbnet.ko root@NAS :~# insmod /lib/modules/insmod ax88179_178a.ko root@NAS :~# dmesg | tail # Check whether the loading driver reports any errors [64083.163905] Found invalid EEPROM MAC address value FF-FF-FF-FF-FF-FF [64083.308642] ax88179_178a 2-2:1.0 (unnamed net_device) (uninitialized): Found invalid EEPROM part or non-EEPROM [64083.492960] ax88179_178a 2-2:1.0 (unnamed net_device) (uninitialized): Failed to read reg index 0x0040: -32 [64083.699491] ASIX USB Ethernet Adapter:v1.20.0         http://www.asix.com.tw [64083.706718] ax88179_178a 2-2:1.0 (unnamed net_device) (uninitialized): mtu 1500 [64083.715200] ax88179_178a 2-2:1.0 eth1: register 'ax88179_178a' at usb-0000:00:15.0-2, 00:0e:c6:8e:e6:91 [64083.725983] usbcore: registered new interface driver ax88179_178a root@NAS :~# ifconfig # Check the current network interface information eth0      Link encap:Ethernet  HWaddr 00:00:32:9B:BB:FF   inet addr:10.2.0.111  Bcast:10.2.0.255  Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1 RX packets:2250986 errors:0 dropped:0 overruns:0 frame:0 TX packets:1936287 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000  RX bytes:1422787931 (1.3 GiB)   TX bytes:1903508258 (1.7 GiB) lo        Link encap:Local Loopback inet addr:127.0.0.1  Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING  MTU:65536  Metric:1 RX packets:394 errors:0 dropped:0 overruns:0 frame:0 TX packets:394 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1  RX bytes:106894 (104.3 KiB)   TX bytes:106894 (104.3 KiB) root@NAS :~# ifconfig eth1 up # Enable the network card. This is the second network card, so it is eth1 root@NAS :~# ifconfig # Check the current network interface information again eth0      Link encap:Ethernet  HWaddr 00:00:32:9B:BB:FF   inet addr:10.2.0.111  Bcast:10.2.0.255  Mask:255.255.255.0 UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1 RX packets:2250986 errors:0 dropped:0 overruns:0 frame:0 TX packets:1936287 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000  RX bytes:1422787931 (1.3 GiB)   TX bytes:1903508258 (1.7 GiB) eth1      Link encap:Ethernet  HWaddr 00:0E:C6:8E:E6:91   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) lo        Link encap:Local Loopback inet addr:127.0.0.1  Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING  MTU:65536  Metric:1 RX packets:394 errors:0 dropped:0 overruns:0 frame:0 TX packets:394 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1  RX bytes:106894 (104.3 KiB)   TX bytes:106894 (104.3 KiB)

Configure Interface

Next, log in to the DSM management page to configure the interface:

 Edit interface information.jpg

Startup enable

Similarly, add a startup script to the management page:

Run Command

The user-defined script is as follows:

 insmod /lib/modules/mii.ko  insmod /lib/modules/usbnet.ko  insmod /lib/modules/ax88179_178a.ko  ifconfig eth1 up

 New Trigger Task.jpg


ArmxMod for Typecho
Personalized, adaptive and powerful responsive theme

extension

Continue to browse about course compile Synology NAS DSM Drive free network card drive Synology iperf3 's article

This article was last updated on 2022/03/27 18:18:19 , which may be different from the current situation due to years

Please specify: VirCloud's Blog > experience > Set up the QNHI Synology NAS development environment, and self compile the network card and other drivers

Selected comments

  1.  one
    one reply

    Windows 10 Chrome 102.0.0.0 God from Guangdong

    The key steps are explained one by one, and the website is not allowed to be copied. This tutorial is very impressive

    1.  Owens

      Different environments, direct replication is not recommended

  2.  Roaming Wind
    Roaming Wind reply

    Windows 10 Chrome 121.0.0.0 God from Xinjiang

    Startup task prompt
    insmod: ERROR: could not load module /root/mii.ko: Permission denied
    insmod: ERROR: could not load module /root/usbnet.ko: Permission denied
    insmod: ERROR: could not load module /root/ax88179_178a.ko: Permission denied
    eth1: ERROR while getting interface flags: No such device
    What's the matter? Root has been enabled
    Looking forward to your reply

    1.  Owens

      It should have nothing to do with root. You need to set permissions for these. ko files. It may also be a path problem. You'd better copy the files to the system. ko directory, and then use the ls - l command to see the permissions and attribution of other. ko files. You should set them accordingly