openwrt编译-提升下载第三方软件包速度的方法

    编译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
  • 1
    点赞
  • 10
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值