Bear_lele's Blog

  • 首页
  • 友联
  • 服务
    • Minecraft官方服务器核心下载站
    • Google搜索
  • 用户
    • 登录
    • 注册
    • 管理
  • 投食
  • 留言板
  1. 首页
  2. 未分类
  3. 正文

编译OpenWrt/LEDE固件

2022年8月23日 2863点热度 2人点赞 0条评论

前言

Lean的OpenWrt/Lede,是在OpenWrt官方源码的基础上,额外添加多个常用插件,功能可选,基本解决了官方原版固件的不足。

  • 基于OpenWrt最新源码,可自由定制插件功能,生成符合自己需求的个性化固件。
  • 集成多个常用插件,可选安装,比如独有的Adbyby Plus+、ShadowsocksR Plus+(SSR Plus+)。
  • SSR Plus+又集成了常用的科学上网工具:Shadowsokcs/SSR/V2Ray/Trojan/Kcptun路由器客户端。
  • 可选集成OpenVPN、WireGuard路由器客户端。
  • 使用源码:https://github.com/coolsnowwolf/lede

常见问题在最下面

注意事项

1.一台可以访问海外网络的Linux服务器,推荐 Debian11 或 Ubuntu LTS
2.不要用 root 用户进行编译
3.首次编译耗时较长,可能需要2-5个小时耐心等待。首次编译成功后,再次编译的时间会大幅缩短
4.尽量避免使用WSL子系统,出现环境变量问题,自行谷歌禁用windows的环境变量

开始

创建非root用户


1.以root用户登录ssh创建用户user

sudo useradd -m user -d /home/user -s /bin/bash

2.设置新用户密码

sudo passwd user

3.修改用户权限文件为可写

sudo chmod +w /etc/sudoers

4.找到如下位置

# User privilege specification
root ALL=(ALL:ALL) ALL

添加行

user ALL=(ALL:ALL) ALL
# User privilege specification
root ALL=(ALL:ALL) ALL
user ALL=(ALL:ALL) ALL

固件编译流程


1.切换非root用户

su user

2.更新软件包

sudo apt update -y
sudo apt full-upgrade -y

3.安装依赖

sudo apt install -y ack antlr3 asciidoc autoconf automake autopoint binutils bison build-essential bzip2 ccache cmake cpio curl device-tree-compiler fastjar flex gawk gettext gcc-multilib g++-multilib git gperf haveged help2man intltool libc6-dev-i386 libelf-dev libglib2.0-dev libgmp3-dev libltdl-dev libmpc-dev libmpfr-dev libncurses5-dev libncursesw5-dev libreadline-dev libssl-dev libtool lrzsz mkisofs msmtp nano ninja-build p7zip p7zip-full patch pkgconf python2.7 python3 python3-pip libpython3-dev qemu-utils rsync scons squashfs-tools subversion swig texinfo uglifyjs upx-ucl unzip vim wget xmlto xxd zlib1g-dev

4.下载源代码,并更新feeds,进入配置界面

git clone https://github.com/coolsnowwolf/lede 
cd lede 
./scripts/feeds update -a 
./scripts/feeds install -a 
make menuconfig
  • Target System:可以选择路由器的CPU品牌、架构等信息。
  • Subtarget:进一步精确选择,一般可以精确到CPU型号(部分路由器可能不显示此项)。
  • Target Profile:可以选择具体的路由器型号。
  • Luci:可自定义插件,建议首次编译时,先不要修改默认配置,以提高编译成功率。
  • 其它各项:一般无需修改,保持默认即可。

IPv6支持:进入Extra packages项目,使用方向键选中ipv6helper,按y键添加功能。
U盘/移动硬盘支持:如果你的路由器有USB接口,建议选中并添加automount和autosamba功能。

LuCI常用插件功能注释
luci-app-accesscontrol #访问时间控制 luci-app-adbyby-plus #广告屏蔽大师Plus + luci-app-arpbind #IP/MAC绑定 luci-app-autoreboot #支持计划重启 luci-app-ddns #动态域名 DNS(集成阿里DDNS客户端) luci-app-filetransfer #文件传输(该功能支持浏览器安装ipk包) luci-app-firewall #添加防火墙 luci-app-flowoffload #Turbo ACC网络加速(集成FLOW,BBR,NAT,DNS…) luci-app-frpc #内网穿透 Frp客户端 luci-app-guest-wifi #WiFi访客网络 luci-app-ipsec-vpnd #VPN服务器 IPSec luci-app-mwan3 #MWAN3负载均衡 luci-app-mwan3helper #MWAN3分流助手 luci-app-nlbwmon #网络带宽监视器 luci-app-ramfree #释放内存 luci-app-samba #网络共享(Samba) luci-app-sqm #流量智能队列管理(QOS) luci-app-ssr-plus #ShadowsocksR Plus+ —luci-app-ssr-plus —> Include Shadowsocks V2ray Plugin #SS V2Ray插件 —luci-app-ssr-plus —> Include V2Ray #V2ray客户端 —luci-app-ssr-plus —> Include Trojan #Trojan客户端 —luci-app-ssr-plus —> Include redsocks2 #redsocks2代理 —luci-app-ssr-plus —> Include Kcptun #Kcptun加速 —luci-app-ssr-plus —> Include ShadowsocksR Server #SSR服务器 luci-app-syncdial #多拨虚拟网卡(原macvlan) luci-app-unblockmusic #解锁网易云灰色歌曲3合1新版本 luci-app-upnp #通用即插即用UPnP(端口自动转发) luci-app-vlmcsd #KMS服务器 luci-app-vsftpd #FTP服务器 luci-app-wifischedule #WiFi计划任务 luci-app-wirelessregdb #WiFi无线 luci-app-wol #WOL网络唤醒 luci-app-wrtbwmon #实时流量监测 luci-app-xlnetacc #迅雷快鸟 luci-app-zerotier #ZeroTier内网穿透

5.完成选择后即可保存配置,退出配置界面

Exit退出所有界面

6.退出所有界面后下载dl库

make download -j8

7.开始编译

make V=s -j1

-j 后面是线程数,第一次编译推荐用单线程,目的是为了万一出现错误时,可以按顺序查看错误提示,找出问题所在。如果多线程编译的话,错误提示可能是乱序的。

8.编译成功会出现以下提示,固件位于/home/user/lede/bin/targets/

make[2]: Entering directory '/home/user/lede'
make[2]: Leaving directory '/home/user/lede'
make[1]: Leaving directory '/home/user/lede

固件刷写成功后默认配置

  • IP地址:192.168.1.1
  • 登录用户名:root
  • 登录密码:password

常见问题


1.在编译路由器固件过程中,进入Luci-Application菜单后,找不到luci-app-ssr-plus选项?
打开lede目录下的feeds.conf.default文件,在最后一行添加如下代码后再更新一遍feeds即可:

src-git helloworld https://github.com/fw876/helloworld

2.编译时golang提示i/o timeout?
在.bashrc或.bash_profile文件中添加环境变量,修改为国内加速镜像

export GOPROXY="https://goproxy.cn"
本作品采用 知识共享署名 4.0 国际许可协议 进行许可
标签: 暂无
最后更新:2023年9月15日

Bear_lele

Hi~ 欢迎来到我的博客~

点赞
< 上一篇
下一篇 >

文章评论

razz evil exclaim smile redface biggrin eek confused idea lol mad twisted rolleyes wink cool arrow neutral cry mrgreen drooling persevering
取消回复

Bear_lele

Hi~ 欢迎来到我的博客~

最近评论
kite 发布于 2 年前(04月21日) 踩个脚印
Bear_lele 发布于 4 年前(04月08日) |´・ω・)ノ
Moeyukina 发布于 4 年前(04月08日) 乐乐乐乐乐乐乐乐乐乐乐乐乐! :huaji15:
Saki 发布于 5 年前(11月23日) 四哈斯哈
Bear_lele 发布于 5 年前(11月23日) 留个言 :huaji2:
公告

COPYRIGHT © 2024 Bear_lele's Blog. ALL RIGHTS RESERVED.

Theme Kratos Made By Seaton Jiang

看板娘