一、下载OpenWrt源码
git clone https://github.com/openwrt/openwrt.git #这个是OpenWrt官方提供的最新LEDE版本,内核支持到4.14.x
git clone https://github.com/openwrt/chaos_calmer.git #这个是OpenWrt维护的chaos_calmer版本,一般叫15版本,内核支持到3.18.x
可以选择去OpenWrt的官方github源去选择下载你需要的源码:https://github.com/openwrt
*需要注意下载的源码和你需要编译的OpenWrt所需功能需要版本匹配,不然会有一大堆问题。
*补充:git openwrt源码的目录要更改权限为777
chmod 777 #openwrt的目录
二、在Ubantu下搭建编译环境
sudo apt-get update #安装环境包之前先Update
sudo apt-get install libtool texinfo sharutils subversion libssl-dev autoconf automake gcc-multilib bison screen gcc g++ binutils patch bzip2 flex make gettext unzip libc6 git-core git ncurses-term build-essential lib