# Build QNAP NAS CDC-ACM Driver
* 安裝Container Station
* 依據QTS版本下載對應的QNAP Kernel source : http://sourceforge.net/projects/qosgpl/
EX: /QNAP NAS GPL Source/QTS 4.4.0/GPL_QTS-4.4.0-20190806_Kernel.tar.gz
* 將下載檔案上傳至目標NAS的Public資料夾
* SSH進入NAS,切換目錄至`/share/Public` :
`cd /share/Public`
* 解壓縮檔案 :
`tar xzf GPL_QTS-4.4.0-20190806_Kernel.tar.gz`
* 進入Docker環境 :
`docker run --rm -ti -v $PWD:/build -w /build ubuntu`
* In the directory GPL_QTS you have the tree "src" with all the OS release
and the tree "kernel_cfg" with the exact compiler configuration file for your QNAP model.
* Copy the compiler configuration file in the right place of the source.
Tricky to understand because X letter signify "any" (ie. TSX31X is suitable for TS231P)
EX : `cp GPL_QTS/kernel_cfg/TS-X41/linux-4.2-arm.config GPL_QTS/src/linux-4.2/.config`
* 切換到 `GPL_QTS/src/linux-4.2/`
* 安裝build tools :
`apt update && apt install -y make gcc g++ libncurses5-dev bc`
* `make menuconfig`
* 切換 **Device Drivers ---> USB support ---> USB Modem (CDC ACM) support**,然後按下`M`加入到kernel module後儲存
* `make prepare`
* `make scripts`
* 開始build kernel module :
`make modules SUBDIRS=drivers/usb/gadget`