***********************转载请注明出处**************************
一、更新环境(开发环境使用Ubuntu 14.1以上版本)
1、sudo apt-get upgrade
2、sudo apt-get update
3、sudo apt-get autoclean
二、安装开发工具
1、sudo apt-get install subversion
2、sudo apt-get install git-core
3、sudo apt-get install gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils ncurses-term zlib1g-dev libncurses5-dev gawk
三、下载openwrt源码
1、进入官方指定源码地址
https://github.com/openwrt/openwrt
2、选择自己喜欢的分支下载
3、svn co svn://svn.openwrt.org/openwrt/trunk(svn地址已失效)
4、例如选择openwrt-18.06分支
git clone -b openwrt-18.06 https://github.com/openwrt/openwrt.git(比较慢,官方地址)
git clone -b openwrt-18.06 https://gitee.com/recologypower/openwrt.git(非常快,每天与官方同步一次)
四、配置编译openwrt系统
1、现在并安装所有可用的“feeds”
cd openwrt
./scripts/feeds update -a
./scripts/feeds install -a
2、运行下面的命令(3选1!)让OpenWrt编译系统检查你的编译环境中缺失的软件包
make menuconfig (推荐使用此命令)
或者
make defconfig
或者
make prereq
//如果以上3个命令都运行了,编译会出错!
在菜单里选择你想要编译的软件包和CPU型号。
3、编译
同步包信息
否则luci包找不到,该过程可能比较慢,需要从openwrt网站clone, 执行以下命令
make package/symlinks
make -j 3 编译成功后的固件bin文件在 /openwrt/trunk/bin 目录下
五、烧写固件
***********************转载请注明出处**************************