1. 程式人生 > 實用技巧 >加速openwrt編譯過程中的下載動作

加速openwrt編譯過程中的下載動作

openwrt編譯下載各種原始碼在國內非常費時間,甚至是github上的東西都非常慢,還不用說是SourceForge上面那些,下載openwrt和它的幾個feeds倒是可以用gitee來下

https://gitee.com/openwrt-mirror

這個映象包含了openwrt,packages,luci幾個比較大的東西。具體操作:

  • 克隆openwrt
https://gitee.com/openwrt-mirror/openwrt.git
  • 克隆下來後,修改預設的feeds.conf.default檔案
diff --git a/feeds.conf.default b/feeds.conf.default
index 586e508440..de8f826973 100644
--- a/feeds.conf.default
+++ b/feeds.conf.default
@@ -1,4 +1,4 @@
-src-git packages https://git.openwrt.org/feed/packages.git^2e6bd4cb86682b224803325127d3f777d40b3231
-src-git luci https://git.openwrt.org/project/luci.git^fb2f36306756d0d0782dcab8413a8bb7ec379e54
+src-git packages https://gitee.com/openwrt-mirror/packages.git^2e6bd4cb86682b224803325127d3f777d40b3231
+src-git luci https://gitee.com/openwrt-mirror/luci.git^fb2f36306756d0d0782dcab8413a8bb7ec379e54
 src-git routing https://git.openwrt.org/feed/routing.git^3f8571194c2765ed31aa73459e86c2ebf943d27d
 src-git telephony https://git.openwrt.org/feed/telephony.git^036cd451c35b82b3d8cac519864986894d9f6958

這樣./scripts/feeds update -a過程會快很多,在gitee上好像也找得到其他幾個git倉庫

https://gitee.com/add358/openwrt-routing.git
https://gitee.com/add358/openwrt-telephony.git

在make過程中,還會下載各種開源的原始檔,這個更漫長,gitee也有活雷鋒

https://gitee.com/tody_guo/openwrt-dl.git

我們只需要在openwrt目錄下克隆一下即可

git clone https://gitee.com/tody_guo/openwrt-dl.git dl

可能因為版本差異,有些還是得去國外下載,這時就得合理上網,搭建過程就不介紹。主要是如何在終端下生效,如果是wget,這類工具下載的:

export http_proxy=http://127.0.0.1:12333
export https_proxy=http://127.0.0.1:12333

如果是git下載的

git config --global http.proxy 'socks5://127.0.0.1:1080' 
git config --global https.proxy 'socks5://127.0.0.1:1080'

如果用完了要記得回滾環境,export的直接關了終端就沒了,git設定的在~/.gitconfig下注釋掉即可