• news
  • pics
  • linux
  • windows
  • proxmox
  • game
  • news
  • pics
  • linux
  • windows
  • proxmox
  • game
Home
linux

从零开始:编译自己的openwrt超详细教程

网上关于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/本地地址

Previous article PPTP/L2TP over PPPoE的準確MTU/MRU值
Next article 解决类似 /usr/lib64/libstdc++.so.6: version `GLIBCXX_3.4.21' not found 的问题

therock

16 Comments

  1. keto diet for cutting
    July 7, 2021 at 9:43 am

    keto food near me

  2. keto cauliflower recipes
    July 6, 2021 at 11:10 pm

    zucchini keto

  3. free keto recipes
    July 6, 2021 at 10:42 pm

    best cheese for keto diet

  4. friends with benefits dating sites free
    June 26, 2021 at 2:20 pm

    disabled dating sites uk free

  5. 100 completely free dating
    June 24, 2021 at 10:08 am

    free dating sites no money

  6. aj and free dating
    June 24, 2021 at 6:47 am

    free interracial dating sites in south africa

  7. free cougar dating sites uk
    June 2, 2021 at 10:36 am

    portugal dating free

  8. dating websites reviews free
    June 2, 2021 at 12:24 am

    free spanish online dating

  9. free dating social network sites
    June 1, 2021 at 11:42 pm

    free wisconsin dating sites

  10. free dating sites in new zealand
    June 1, 2021 at 11:09 pm

    free filipino dating websites

  11. free online dating for farmers
    May 27, 2021 at 2:20 pm

    free dating website ireland

  12. mormon dating sites free
    May 27, 2021 at 4:05 am

    free online anime dating sims

  13. cougar dating free mississippi
    May 20, 2021 at 7:44 pm

    dating ariane free download

  14. free catholic dating sites for seniors
    May 20, 2021 at 4:22 am

    how to find out if someone is on dating sites for free

  15. free dating site in arab country
    May 19, 2021 at 10:22 pm

    dating sites where everything is free

  16. tinder opening lines to use on guys
    May 16, 2021 at 9:51 am

    tinder opening lines to use on guys

    从零开始:编译自己的openwrt超详细教程 – rock funs

Meta
  • Log in
  • Entries feed
  • Comments feed
  • WordPress.org
Categories
  • game
  • linux
  • news
  • pics
  • proxmox
  • windows
Recent Posts
  • proxmox7.3直通显卡
  • Proxmox VE 直通显卡方案及解决N卡Code43
  • Linux系统出现:You have new mail in /var/spool/mail/root 的原因及解决办法
  • debian系统解决中文乱码
  • pve添加git和pvetools
Recent Comments
  • EdgarTot on proxmox7.3直通显卡
  • Ashvem on proxmox7.3直通显卡
  • Tedvem on proxmox7.3直通显卡
  • Jackvem on proxmox7.3直通显卡
  • Miavem on proxmox7.3直通显卡
Archives
  • March 2023 (1)
  • December 2022 (4)
  • November 2022 (6)
  • April 2022 (1)
  • February 2022 (5)
  • January 2022 (2)
  • December 2021 (3)
  • November 2021 (1)
  • October 2021 (2)
  • September 2021 (1)
  • August 2021 (1)
  • July 2021 (8)
  • June 2021 (14)
  • May 2021 (2)
  • April 2021 (2)
  • March 2021 (10)
  • January 2021 (4)
  • December 2020 (4)
  • November 2020 (13)
  • April 2020 (276)
  • March 2020 (1)
  • June 2019 (5)
  • May 2019 (10)
  • December 2015 (1)