编译openwrt系统时,对于选择的第三方软件包,会通过脚本(curl方法)去下载软件压缩包到dl目录中。
但是这个过程呢,因为网站网速限制,导致下载速度特别的慢,经常会出现下载失败导致编译停止的情况。之前我的做法是,编译中时不时关注编译log信息,如果出现软件包下载特别慢的情况,会自己手动下载软件包并放置在dl目录。
这里提供两个网址,上面提供了相当全的软件包,openwrt编译需要的基本都能找到。
https://sources.openwrt.org/ 我现在主要用这个
http://gw.stasoft.net/dl/
但是,这种方式也存在不方便,比如需要经常关注编译过程,否则会出现编译停止的情况。
今天找到了另一种解决的方法,那就是替换软件包下载的url地址。
原始下载方式:
解决方法:
找到 scripts/download.pl 文件,修改 https://sources.cdn.openwrt.org 地址为上面我提到的 https://sources.openwrt.org/ 。
替换之后直接保存,重新开始编译。看一下新的编译中下载过程:
速度对比
自己手动通过curl下载,对比一下两个url的下载速度,简直是一个天一个地
book@ubuntu:/work$ curl -O https://sources.openwrt.org/sed-4.8.tar.xz -Lo /dev/null -skw "time_connect: %{time_connect} s\ntime_namelookup: %{time_namelookup} s\ntime_pretransfer: %{time_pretransfer} s\ntime_starttransfer: %{time_starttransfer} s\ntime_redirect: %{time_redirect} s\nspeed_download: %{speed_download} B/s\ntime_total: %{time_total} s\n\n"
time_connect: 0.489568 s
time_namelookup: 0.004461 s
time_pretransfer: 1.069566 s
time_starttransfer: 1.639455 s
time_redirect: 0.000000 s
speed_download: 91691.000 B/s
time_total: 14.702869 s 看看这个时间,真的是太快了
book@ubuntu:/work$ curl -O https://sources.cdn.openwrt.org/sed-4.8.tar.xz -Lo /dev/null -skw "time_connect: %{time_connect} s\ntime_namelookup: %{time_namelookup} s\ntime_pretransfer: %{time_pretransfer} s\ntime_starttransfer: %{time_starttransfer} s\ntime_redirect: %{time_redirect} s\nspeed_download: %{speed_download} B/s\ntime_total: %{time_total} s\n\n"
time_connect: 1.320761 s
time_namelookup: 0.063656 s
time_pretransfer: 2.013208 s
time_starttransfer: 2.286376 s
time_redirect: 0.000000 s
speed_download: 89.000 B/s
time_total: 273.333858 s