网上关于openwrt的教程五花八门,很多新入门的选手并不清楚如何编译属于自己的openwrt固件,主要针对新手,按部就班进行,应该都是ok的。
因为家里正好有一台极路由3,本教程就以极路由3举例,进行本地编译。编译的版本是最新的openwrt19.07.1
准备工作
1、一个linux系统(可以自己虚拟机,我的系统是centos7,如果有谷歌云可以用谷歌云,毕竟省去翻墙)
2、一个梯子(编译时需要下载包,需要梯子)
第一步:虚拟机安装Centos并本地编译环境的安装
1、在虚拟机搭建一个linux系统(已经装好了可以跳过),这里用的centos7,不要快速安装,硬件按照自己配置选,一般选推荐即可。开进进入选择安装,选择最小安装,打开网络,点击开始安装。输入相应的root密码并创建一个用户,编译一定要在非root账户下进行,安装完成进入系统。




































2、系统的更新,以及依赖包的安装,这部分都在root账号下,可以ssh远程登录,方便复制粘贴指令。mac下终端输入ssh [email protected]地址 即可
yum -y updateyum install -y gcc g++ build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-devel libz-devel patch flex bison make autoconf texinfo unzip sharutils subversion ncurses-term zlib1g-dev ccache upx lib32gcc1 libc6-dev-i386 uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-devel libglib2.0-dev xmlto qemu-utils automake libtool
3、安装最新的python3
因为centos自带的版本是2.7,编译需要python版本大于3.5
先查看你的python在哪里,进入python所在文件夹,查看软连接;
whereis pythoncd /usr/bin/ll python*
可以看到python指向的是python2,python2指向的是python2.7,因此我们可以装个python3,然后将python指向python3,然后python2指向python2.7,那么两个版本的python就能共存了
安装编译Python需要的环境
yum install zlib-devel bzip2-devel openssl-devel ncurses-devel sqlite-devel readline-devel tk-devel
安装pip
#运行这个命令添加epel扩展源yum -y install epel-release#安装pipyum install python-pip
用pip装wget
pip install wget
用wget下载python3的源码包
wget https://www.python.org/ftp/python/3.8.2/Python-3.8.2.tar.xz
编译python3源码包
#解压xz -d Python-3.8.2.tar.xztar -xf Python-3.2.2.tar#进入解压后的目录,依次执行下面命令进行手动编译./configure prefix=/usr/local/python3make && make install
python3安装完毕
#添加python3的软链接ln -s /usr/local/python3/bin/python3.6/usr/bin/python#测试是否安装成功了python -V
第二步:准备工作,一些信息的准备
访问openwrt官网 https://openwrt.org/ ,搜索你的路由器对应的型号,这里极路由3的型号是HC5861,查看你的硬件信息,极路由3是MediaTek MT7620A的平台,其实这里你会发现官方有已经编译完成的固件可以直接下载,咱不是要折腾么,嘿嘿嘿。。。懒得折腾的朋友可以根据自己路由器型号自行搜索,当然前提是你的路由器支持ssh登录刷系统哈,有一些官方的固件也会有问题,所以我们还是尽量选择自己编译。






第三步:下载官方源码
退出root用户,登入其他用户,创建openwrt文件夹,修改权限,进入文件夹,下载源码
mkdir openwrtsudo chmod 777 openwrtcd openwrtgit clone https://github.com/openwrt/openwrt.git source
第四步:更新源码
进入source文件夹,更新软件包,安装最新包
cd source./scripts/feeds update -a./scripts/feeds install -a
第五步:测试编译环境
make defconfig
第六步:开始编译
编译前关于平台、核心、型号的设置(第一二三大项);
make menuconfig












下面LuCI=》Modules=》Translations=》选择语言Chinese;



LuCI=》Applications=》选择需要的插件,这里只选择了ss,后续可以自己选择编译或者直接下载安装
选择完成后保存,开始编译,这里一定要有梯子,便已开始后会自动下载各种包,很多人失败的原因也就是这里。



make v=99
第一次编译耗时非常长也主要是因为要下载各种包(主要取决于网速,我第一次用了半天。。。。),第二次就快很多了
编译完成后的文件地址在/openwrt/source/bin/targets/ramips/mt7620/ 文件夹下,可以scp命令下载或者虚拟机可以共享文件夹直接拷贝,再或者虚拟机接个u盘,都可以
scp -r 用户名@服务器地址:/openwrt/source/bin/targets/ramips/mt7620/本地地址
16 Comments
keto diet for cutting
July 7, 2021 at 9:43 amketo food near me
keto cauliflower recipes
July 6, 2021 at 11:10 pmzucchini keto
free keto recipes
July 6, 2021 at 10:42 pmbest cheese for keto diet
friends with benefits dating sites free
June 26, 2021 at 2:20 pmdisabled dating sites uk free
100 completely free dating
June 24, 2021 at 10:08 amfree dating sites no money
aj and free dating
June 24, 2021 at 6:47 amfree interracial dating sites in south africa
free cougar dating sites uk
June 2, 2021 at 10:36 amportugal dating free
dating websites reviews free
June 2, 2021 at 12:24 amfree spanish online dating
free dating social network sites
June 1, 2021 at 11:42 pmfree wisconsin dating sites
free dating sites in new zealand
June 1, 2021 at 11:09 pmfree filipino dating websites
free online dating for farmers
May 27, 2021 at 2:20 pmfree dating website ireland
mormon dating sites free
May 27, 2021 at 4:05 amfree online anime dating sims
cougar dating free mississippi
May 20, 2021 at 7:44 pmdating ariane free download
free catholic dating sites for seniors
May 20, 2021 at 4:22 amhow to find out if someone is on dating sites for free
free dating site in arab country
May 19, 2021 at 10:22 pmdating sites where everything is free
tinder opening lines to use on guys
May 16, 2021 at 9:51 amtinder opening lines to use on guys
从零开始:编译自己的openwrt超详细教程 – rock funs