QSDK - QCA Software Development Kits, 基于 openwrt 加入了 QCA 相关的代码库,可以用于使用 qualcomm 芯片的路由器固件开发。本文讲述如何获取 QSDK.

我们通常会使用 git clone 获取开源项目的代码,比如 github, gitlab, coding 等平台,但是 QSDK 并不存放于这些平台,而是有它自己的维护站点,并且需要通过 repo 和 git 共同完成仓库文件的 clone, 下面来看看吧。

install repo

首先来安装 repo 工具,这其实是个 Python 脚本.

curl https://storage.googleapis.com/git-repo-downloads/repo -o repo
chmod +x repo
mv repo ~/bin/

也可以手动下载:https://gerrit.googlesource.com/git-repo/

install qsdk

下载完 repo 后,在 git 已经安装并配置好了基本的 email, username 的情况下就可以开始下载 QSDK 了。

不同型号的芯片对应不同的 manifest 文件,这是一个 xml 文件,有点类似 Android 开发的 mainfest.xml.

关于 QSDK 的 manifest, 可以参考下表,源自 https://wiki.codeaurora.org/xwiki/bin/viewrev/QSDK/WebHome?rev=13.1

OpenWrt Version Kernel Version SoC's Latest Available Release Branch Example Version Notes
15.05 3.14 ipq806x,ipq40xx caf_AU_LINUX_QSDK_NHSS.QSDK.6.1.0.R1_TARGET_ALL.0.1.2028.020.xml with uClibc
15.05 4.4 ipq806x, ipq40xx caf_AU_LINUX_QSDK_NHSS.QSDK.6.1.1.R1_TARGET_ALL.3.0.308.00.1591.020.xml with uClibc
15.05 4.4 ipq806x, ipq40xx, ipq807x, ipq807x_64 caf_AU_LINUX_QSDK_NHSS.QSDK.11.0_TARGET_ALL.11.0.3821.3949.xml with MuslWi-Fi not available

使用 repo 尝试下载:

$ repo init -u git://source.codeaurora.org/quic/cc-qrdk/releases/manifest/qstak -b release -m caf_AU_LINUX_QSDK_NHSS.QSDK.11.0_TARGET_ALL.11.0.3821.3949.xml
Downloading Repo source from https://gerrit.googlesource.com/git-repo
fatal: Cannot get https://gerrit.googlesource.com/git-repo/clone.bundle
fatal: error Tunnel connection failed: 502 Parent proxy unreacheable

fail 了,这是 Google 网络被墙的问题,为此我通过 v2ray + proxychians4 代理解决了。

  • v2ray: 订阅配置,需要梯子,可以网上自行搜索免费的,或者自行购买搭建。
  • proxychains4:可以方便配置 socks5 网络代理,配置说明参考 proxychains4.

在linux系统下,可以使用 Qv2ray 替代 V2rayN, 但是都需要安装 v2ray-core 的支持。关于 Qv2ray 可以参考

方便起见,可以在 .zshrc 或者 .bashrc 中添加一个 proxychains4 的 alias.

alias supro="sudo proxychains4"

网络代理不是本文重点,其目的是保证可以正常访问谷歌网络。下面使用 repo 进行 QSDK 的下载。

supro ~/bin/repo init -u git://codeaurora.org/quic/qsdk/releases/manifest/qstak -b release -m caf_AU_LINUX_QSDK_NHSS.QSDK.11.0_TARGET_ALL.11.0.3821.3949.xml
supro ~/bin/repo sync

下载速度依网络情况而定,毕竟用的代理,访问的是 Google, 所以速度你懂的。而且 sync 数据量非常大,所以下载时间会非常非常非常长。。。先去干别的吧。

➜ supro ~/bin/repo sync
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] Strict chain  ...  127.0.0.1:1080  ...  codeaurora.org:9418  ...  OK
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] Strict chain  ...  127.0.0.1:1080  ...  source.codeaurora.org:443  ...  OK
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
Fetching projects:   1% (1/55) quic/qsdk/oss/tools/meta[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] Strict chain  ...  127.0.0.1:1080  ...  source.codeaurora.org:443  ...  OK
[proxychains] DLL init: proxychains-ng 4.14
remote: Enumerating objects: 101, done.        
remote: Counting objects: 100% (101/101), done.        
remote: Compressing objects: 100% (60/60), done.        
[proxychains] DLL init: proxychains-ng 4.14
remote: Total 4239698 (delta 31), reused 98 (delta 31), pack-reused 4239597        
Receiving objects: 100% (4239698/4239698), 1.04 GiB | 3.38 MiB/s, done.
Resolving deltas: 100% (3317886/3317886), done.
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
Fetching projects:   3% (2/55) quic/qsdk/oss/system/openwrt[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] Strict chain  ...  127.0.0.1:1080  ...  source.codeaurora.org:443  ...  OK
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
Fetching projects:   5% (3/55) quic/qsdk/oss/releases/configs/qca955x[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] Strict chain  ...  127.0.0.1:1080  ...  source.codeaurora.org:443  ...  OK
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
Fetching projects:   7% (4/55) quic/qsdk/oss/releases/configs/qsdk[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] Strict chain  ...  127.0.0.1:1080  ...  source.codeaurora.org:443  ...  OK
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
Fetching projects:   9% (5/55) quic/qsdk/oss/system/feeds/platform/bootloader[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] Strict chain  ...  127.0.0.1:1080  ...  source.codeaurora.org:443  ...  OK
[proxychains] DLL init: proxychains-ng 4.14
[proxychains] DLL init: proxychains-ng 4.14
#...
Checking out projects:  89% (49/55) quic/qsdk/oss/lklm/shortcut-fe[proxychains] DLL init: proxychains-ng 4.14
Updating files: 100% (11323/11323), done.
Checking out projects:  90% (50/55) quic/qsdk/oss/boot/u-boot-2016[proxychains] DLL init: proxychains-ng 4.14
Checking out projects:  92% (51/55) quic/qsdk/oss/wigig-utils[proxychains] DLL init: proxychains-ng 4.14
Checking out projects:  94% (52/55) quic/qsdk/oss/wireshark[proxychains] DLL init: proxychains-ng 4.14
Updating files: 100% (6135/6135), done.
Checking out projects:  96% (53/55) quic/qsdk/oss/wireshark-github[proxychains] DLL init: proxychains-ng 4.14
Checking out projects:  98% (54/55) quic/qsdk/oss/tools/skales[proxychains] DLL init: proxychains-ng 4.14
Checking out projects: 100% (55/55), done.
repo sync has finished successfully.

总算下载完了,来看看根目录有哪些东西。

➜  tree -L 1
.
├── meta-scripts
├── qsdk
├── skales
└── tools

4 directories, 0 files
➜  tree qsdk -L 1
qsdk
├── BSDmakefile
├── config
├── Config.in
├── docs
├── feeds.conf
├── feeds.conf.default
├── include
├── LICENSE
├── Makefile
├── package
├── qca
├── README
├── rules.mk
├── scripts
├── target
├── toolchain
├── tools
├── wireshark-2.4.2-11ax-patches
└── wireshark-github

11 directories, 8 files
➜  qsdk du -h -d2 
496K    ./tools/ubi32-nssmconf
500K    ./tools
36K     ./skales/.git
8.0K    ./skales/initrds
12K     ./skales/atag-fix
52K     ./skales/boards
176K    ./skales
36K     ./meta-scripts/yocto
16K     ./meta-scripts/Parser
40K     ./meta-scripts/.git
56K     ./meta-scripts/ipq806x_deluxe
48K     ./meta-scripts/ipq40xx_premium
20K     ./meta-scripts/ipq806x_open
60K     ./meta-scripts/ipq806x_standard
16K     ./meta-scripts/ipq40xx_standard
332K    ./meta-scripts
516M    ./.repo/projects
7.2M    ./.repo/repo
11G     ./.repo/project-objects
24M     ./.repo/manifests
4.0M    ./.repo/manifests.git
12G     ./.repo
132K    ./qsdk/docs
37M     ./qsdk/target
2.8M    ./qsdk/tools
840K    ./qsdk/.git
1012K   ./qsdk/scripts
225M    ./qsdk/wireshark-github
1.1G    ./qsdk/qca
152K    ./qsdk/wireshark-2.4.2-11ax-patches
320K    ./qsdk/include
48K     ./qsdk/config
1.5M    ./qsdk/toolchain
22M     ./qsdk/package
1.4G    ./qsdk
13G     .

没错,13G,下了快一天。qsdk 目录就是我们所需的了。

➜  qsdk git:(35ebd114e275) ls -F
BSDmakefile         include/   rules.mk      tools/
config/             LICENSE    scripts/      wireshark-2.4.2-11ax-patches/
Config.in           Makefile   staging_dir/  wireshark-github/
docs/               package/   target/
feeds.conf          qca/       tmp/
feeds.conf.default  README     toolchain/

看起来确实和 openwrt 的目录结构挺像的。不过多了两个 wireshark 相关的目录。

关于 QSDK 的下载就讲完了,这里再说明下编译需要一些依赖工具,比如下面这些。

  • ocaml-nox: Objective Caml compiler for GUI of make menuconfig
  • zlib1g-dev: for zlib
  • libssl-dev: for openssl
  • subversion: for svn

具体编译相关的后续再说。

reference