为RaspberryPi2做BT下载工具aria2的交叉编译 | KaiQ.Gu|KerwinKoo Blog
0.下载aria2源码
aria2源码共享在GitHub 上,clone下来:
git clone https://github.com/tatsuhiro-t/aria2.git
截止本日志编写,可以看到github中有专门为Raspberry写的交叉编译环境,是一个 Dockerfile 从这个文件中,可以看出该Docker镜像Build时需要做的工作:
- step 1:
1 | FROM ubuntu:trusty |
基础镜像为ubuntu:trusty.目前我使用 docloud的镜像加速服务, 因此ubuntu pull时还是蛮快的.
- step 2:
1 | RUN apt-get update && \ |
这里不难理解,ubuntu基础镜像安装完成后,进行安装源的更新和编译环境的配置.但是,由于国内情况,这一步耗时特别长,经常会出现TIME OUT ERROR,针对这个问题,需要对次Dockerfile用拆分法做一下修改.首先将国内源push到ubuntu 64位镜像的对应路径中,然后再执行update.apt-get等命令.
目前在家里搞,网络环境好了,上面的问题突然解决了,有时间再Update下上面的解决思路.
- step 3:
1 | RUN git clone https://github.com/raspberrypi/tools.git --depth=1 /tools |
从GitHub中下载RaspberryPi工具链,由于国内情况,又要折腾一番.没有VPN的情况下, git clone 会出现如下错误:
error: RPC failed; result=56, HTTP code = 200fatal: The remote end hung up unexpectedlyfatal: early EOFfatal: index-pack failedThe command '/bin/sh -c git clone https://github.com/raspberrypi/tools.git --depth=1 /tools' returned a non-zero code: 128