Debian中编译OpenWrt流程

/ 0评 / 2

编译预先准备

1、Debian编译环境准备

必须使用非root账户完成如下操作
所有操作务必在翻墙后执行
以lean版本Lede为例
需要大概20G空间编译

sudo apt-get -y install build-essential asciidoc binutils bzip2 gawk gettext git libncurses5-dev libz-dev patch unzip zlib1g-dev lib32gcc1 libc6-dev-i386 subversion flex uglifyjs git-core gcc-multilib p7zip p7zip-full msmtp libssl-dev texinfo libglib2.0-dev xmlto qemu-utils upx libelf-dev autoconf automake libtool autopoint

安装完成后环境即准备完毕。

git clone https://github.com/coolsnowwolf/lede

Openwrt源代码准备完毕

2、选择编译对象

cd lede
./scripts/feeds update -a 
./scripts/feeds install -a

会自动克隆最新版的OpenWrt官方源码,由于源码速度不理想,所以最好全局翻墙保证速度和完整性,大部分克隆失败,编译失败都是没有访问到源码repo的问题。

如果你想自行添加软件包,可以在lede/feeds/packages目录当中用普通用户添加软件包,然后再执行上述命令更新软件包,同样修改软件包也需要在对应的目录当中修改对应的内容。

例如我会手动去更新源码当中的udpxy版本,只需要修改对应的Makefile即可,可以参考文章《 Openwrt编译udpxy流程和相关设置解析》

make menuconfig

需要注意的是,默认的Openwrt不会包含太多的软件包,可能编译出来会缺失一些自己喜欢的功能,下面列出一些常用软件包的目录和解释,来自于山恩论坛

目录 目录 目录 目录
LuCI Applications luci-app-accesscontrol 访问时间控制
LuCI Applications luci-app-adblock ADB广告过滤
LuCI Applications luci-app-adbyby-plus 广告屏蔽大师Plus +
LuCI Applications luci-app-advanced-reboot 高级重启
LuCI Applications luci-app-ahcp 支持AHCPd
LuCI Applications luci-app-aliddns 阿里DDNS客户端
LuCI Applications luci-app-amule aMule是一个跨平台的ED2K/KAD客户端 P2P电驴下载
LuCI Applications luci-app-aria2 Aria2下载
LuCI Applications luci-app-arpbind IP/MAC绑定
LuCI Applications luci-app-asterisk 支持Asterisk电话服务器
LuCI Applications luci-app-attendedsysupgrade 固件更新升级相关
LuCI Applications luci-app-autoreboot 支持计划重启
LuCI Applications luci-app-bcp38 BCP38网络入口过滤(不确定)
LuCI Applications luci-app-bird4 Bird4服务(未知)
LuCI Applications luci-app-bird6 Bird6服务(未知)
LuCI Applications luci-app-bmx6 BMX6路由协议
LuCI Applications luci-app-bmx7 BMX7路由协议
LuCI Applications luci-app-cjdns 加密IPV6网络相关
LuCI Applications luci-app-caldav 联系人
LuCI Applications luci-app-clamav ClamAV杀毒软件
LuCI Applications luci-app-commands Shell命令模块
LuCI Applications luci-app-cshark CloudShark捕获工具
LuCI Applications luci-app-ddns 动态域名 DNS
LuCI Applications luci-app-diag-core core诊断工具
LuCI Applications luci-app-dnscrypt-proxy DNSCrypt解决DNS污染
LuCI Applications luci-app-dnsforwarder DNSForwarder防DNS污染
LuCI Applications luci-app-dnspod DNSPod
LuCI Applications luci-app-dump1090 民航无线频率(不确定)
LuCI Applications luci-app-dynapoint DynaPoint(未知)
LuCI Applications luci-app-e2guardian Web内容过滤器
LuCI Applications luci-app-filetransfer 文件传输
LuCI Applications luci-app-firewall 添加防火墙
LuCI Applications luci-app-flowoffload Turbo ACC FLOW转发加速
LuCI Applications luci-app-freifunk-diagnostics freifunk组件 诊断(未知)
LuCI Applications luci-app-freifunk-policyrouting freifunk组件 策略路由(未知)
LuCI Applications luci-app-freifunk-widgets freifunk组件 Widgets(未知)
LuCI Applications luci-app-frpc 内网穿透 Frp
LuCI Applications luci-app-fwknopd Firewall Knock Operator服务器
LuCI Applications luci-app-guest-wifi WiFi访客网络
LuCI Applications luci-app-hd-idle 硬盘休眠
LuCI Applications luci-app-hnet Homenet Status家庭网络控制协议
LuCI Applications luci-app-ipsec-vpnd VPN服务器 IPSec
LuCI Applications luci-app-kooldns VPN服务器 ddns替代方案
LuCI Applications luci-app-koolproxy KP去广告
LuCI Applications luci-app-lxc LXC容器管理
LuCI Applications luci-app-meshwizard 网络设置向导
LuCI Applications luci-app-minidlna 完全兼容DLNA / UPnP-AV客户端的服务器软件
LuCI Applications luci-app-mjpg-streamer 兼容Linux-UVC的摄像头程序
LuCI Applications luci-app-mmc-over-gpio 添加SD卡操作界面
LuCI Applications luci-app-multiwan 多拨虚拟网卡(已弃)
LuCI Applications luci-app-mwan3 MWAN负载均衡
LuCI Applications luci-app-mwan3helper MWAN3分流助手
LuCI Applications luci-app-n2n_v2 N2N 内网穿透 N2N v2 VPN服务
LuCI Applications luci-app-nft-qos QOS流控 Nftables版
LuCI Applications luci-app-ngrokc Ngrok 内网穿透
LuCI Applications luci-app-nlbwmon 网络带宽监视器
LuCI Applications luci-app-noddos NodDOS Clients 阻止DDoS攻击
LuCI Applications luci-app-ntpc NTP时间同步服务器
LuCI Applications luci-app-ocserv OpenConnect VPN服务
LuCI Applications luci-app-olsr OLSR配置和状态模块
LuCI Applications luci-app-olsr-services OLSR服务器
LuCI Applications luci-app-olsr-viz OLSR可视化
LuCI Applications luci-app-openvpn OpenVPN客户端
LuCI Applications luci-app-openvpn-server 易于使用的 OpenVPN 服务器 Web-UI
LuCI Applications luci-app-oscam OSCAM服务器
LuCI Applications luci-app-p910nd 打印服务器模块
LuCI Applications luci-app-pagekitec Pagekite 内网穿透客户端
LuCI Applications luci-app-polipo Polipo 是一个小型且快速的网页缓存代理。
LuCI Applications luci-app-pppoe-relay PPPoE NAT穿透 点对点协议(PPP)
LuCI Applications luci-app-pptp-server VPN服务器 PPTP
LuCI Applications luci-app-privoxy Privoxy网络代理(带过滤无缓存)
LuCI Applications luci-app-qos 流量服务质量(QoS)流控
LuCI Applications luci-app-radicale CalDAV/CardDAV同步工具
LuCI Applications luci-app-ramfree 释放内存
LuCI Applications luci-app-rp-pppoe-server Roaring Penguin PPPoE Server 服务器
LuCI Applications luci-app-samba 网络共享(samba)
LuCI Applications luci-app-samba4 网络共享(samba4)
LuCI Applications luci-app-sfe Turbo ACC网络加速(开启Fast Path转发加速)
LuCI Applications luci-app-shadowsocks 科学上网
LuCI Applications luci-app-shadowsocks-libev SS-libev服务端
LuCI Applications luci-app-shairplay 支持AirPlay功能
LuCI Applications luci-app-siitwizard SIIT配置向导 SIIT-Wizzard
LuCI Applications luci-app-simple-adblock 简单的广告拦截
LuCI Applications luci-app-softethervpn SoftEther VPN服务器 NAT穿透
LuCI Applications luci-app-splash Client-Splash是无线MESH网络的一个热点认证系统
LuCI Applications luci-app-sqm 流量智能队列管理(QOS)
LuCI Applications luci-app-squid Squid代理服务器
LuCI Applications luci-app-ssr-plus SSR科学上网Plus+
luci-app-ssr-plus Include Shadowsocks New Versiong 新SS代理
Include V2ray V2Ray透明代理
Include Kcptun Kcptun代理
Include ShadowsocksR Server SSR客户端
Include ShadowsocksR Socks and Tunnel SSR代理
LuCI Applications luci-app-ssr-pro SSR科学上网pro
LuCI Applications luci-app-ssrserver-python ShadowsocksR Python服务器
LuCI Applications luci-app-statistics 流量监控工具
LuCI Applications luci-app-syncdial 多拨虚拟WAN(原macvlan)
LuCI Applications luci-app-tinyproxy Tinyproxy是 HTTP(S)代理服务器
LuCI Applications luci-app-transmission BT下载工具
LuCI Applications luci-app-travelmate 旅行路由器
LuCI Applications luci-app-ttyd 网页终端命令行
LuCI Applications luci-app-udpxy udpxy做组播服务器
LuCI Applications luci-app-uhttpd uHTTPd Web服务器
LuCI Applications luci-app-unbound Unbound DNS解析器
LuCI Applications luci-app-upnp 通用即插即用UPnP(端口自动转发)
LuCI Applications luci-app-usb-printer USB 打印服务器
LuCI Applications luci-app-v2ray-pro V2Ray透明代理
LuCI Applications luci-app-vlmcsd KMS服务器(激活工具)
LuCI Applications luci-app-vnstat vnStat网络监控(图表)
LuCI Applications luci-app-vpnbypass VPN BypassWebUI 绕过VPN设置
LuCI Applications luci-app-vsftpd FTP服务器
LuCI Applications luci-app-watchcat 断网检测功能与定时重启
LuCI Applications luci-app-webadmin Web管理
LuCI Applications luci-app-webshell 网页命令行终端
LuCI Applications luci-app-wifischedule WiFi 计划
LuCI Applications luci-app-wireguard VPN服务器 WireGuard状态
LuCI Applications luci-app-wireless-regdb WiFi无线
LuCI Applications luci-app-wol WOL网络唤醒
LuCI Applications luci-app-wrtbwmon 实时流量监测
LuCI Applications luci-app-xlnetacc 迅雷快鸟
LuCI Applications luci-app-zerotier 内网穿透 ZeroTier

3、开始编译

make -j1 V=s

首次编译会编译全部软件包,约2小时,后续编译会仅仅编译重新配置的部分,时间较短,所以尽量在screen当中编译,防止意外ssh掉线。

最终编译出来的软件包在这里
./lede/bin/targets/x86/64/openwrt-x86-64-combined-squashfs.img

4、安装OpenWrt

编译完成后的img文件可以在linux当中通过dd去安装到磁盘,首次安装后后续可以通过OP自带的升级功能来进行升级即可

dd if=/dev/sda of=xxx.img bs=1M

发表评论

电子邮件地址不会被公开。

此站点使用Akismet来减少垃圾评论。了解我们如何处理您的评论数据