1、openwrt源码下载及其编译
本次操作环境在Ubuntu18.04下进行的
1.1、openwrt源码下载
git clone git://github.com/openwrt/openwrt.git
更新源码:
git pull
参考地址:https://dev.archive.openwrt.org/wiki/GetSource
2.1、安装依赖库
sudo apt-get update //更新
sudo apt install gcc
sudo apt install g++
sudo apt install binutils
sudo apt install patch
sudo apt install bzip2
sudo apt install flex
sudo apt install make
sudo apt install gettext
sudo apt install pkg-config
sudo apt install unzip
sudo apt install zlib1g-dev
sudo apt install libc6-dev
sudo apt install subversion
sudo apt install libncurses5-dev
sudo apt install gawk
sudo apt install sharutils
sudo apt install curl
sudo apt install libxml-parser-perl
sudo apt install ocaml-nox ocaml
sudo apt install ocaml-findlib
sudo apt install libpcre3-dev
sudo apt install python-yaml libgd-dev
sudo apt install multiarch-support
sudo apt install lib32ncurses5 lib32z1
sudo apt install libssl-dev
sudo apt install libfdt-dev
sudo apt install device-tree-compiler
sudo apt install u-boot-tools
sudo apt install libssl1.0-dev
ubuntu16.04的话就不需要最后一个库“ libssl1.0-dev ” .
注意:这些库一定要安装完成否则编译会出错
3.1、更新软件包
进入openwrt的根目录中去
cd openwrt
更新软件包:
./scripts/feeds update -a
./scripts/feeds install -a
3.2、生成配置文件
make defconfig
3.3、进入定制页面
make menuconfig
3.4、编译
第一次编译不要使用多核编译,尽量使用单核编译,避免报错,(多核编译如果报错,再接着编译就可以了),第一次编译他会搭载编译环境,安装交叉编译链等等,会很慢,大家可以去打打游戏,睡个觉吃个饭。需要打印详细编译信息的话V=s,注意是大写的V,在openwrt的根目录下编译哦。
make V=s
接着等待编译完后就OK了。