openwrt 編譯慢原因剖析
1、與硬件有關
高配置的電腦,編譯更快,毫無疑問
2、網絡有關(主因)
剖析
- openwrt 編譯過程會檢查依賴庫在本地是否緩存,如果沒有就會下載,這是首次編譯超級慢的主要原因
- 依賴庫鏡像都是在國外,天朝帝國內,訪問不通暢,下載很慢,經常下載失敗,即使有重試機制,但掛一個晚上也未必編譯成功(當然你可以FQ再編譯)
解決方法
1、 先把 openwrt
源碼克隆到本地
https://gitee.com/harvey520/openwrt.git
每天自動從官方源拉取更新一次,不會存在更新不及時問題
git clone https://gitee.com/harvey520/openwrt.git
2、修改 openwrt
源碼目錄的 feeds.conf.default
文件中的鏡像源
- 將
https://git.openwrt.org/feed/packages.git
改為https://gitee.com/harvey520/packages.git
- 將
https://git.openwrt.org/project/luci.git
改為https://gitee.com/harvey520/luci.git
- 將
https://git.openwrt.org/feed/routing.git
改為https://gitee.com/harvey520/routing.git
- 將
https://git.openwrt.org/feed/telephony.git
改為https://gitee.com/harvey520/telephony.git
https://gitee.com/harvey520
中的鏡像源每天自動從官方源更新一次,不會存在過期或更新不及時問題
3、提前下載依賴庫源碼放到 openwrt
源碼目錄中
國內惟一倉庫,只此一家,別無分號
進入 openwrt
源碼目錄中,執行以下命令
git clone https://e.coding.net/yao7778899/openwrt-dependent-dl.git dl
# 依賴庫源碼總計約850M
4、開始你的編譯
執行以下命令開始你的編譯,能夠多快就看你家的寬帶有多快了
./scripts/feeds update -a
./scripts/feeds install -a
make V=99