环境
系统
Ubuntu 14.04.6
网络
全局
安装依赖
sudo apt-get update
sudo apt-get upgrade -y
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 device-tree-compiler
准备
拉取源码
git clone https://github.com/coolsnowwolf/lede.git && cd lede
#git clone https://github.com/Lienol/openwrt.git && cd openwrt
#git clone https://github.com/openwrt/openwrt.git && cd openwrt
清理下载和生成的文件(可选)
./scripts/feeds clean
拉取 feeds.conf.default 列表源码
./scripts/feeds update -a
安装 feeds.conf.default 列表软件
./scripts/feeds install -a
编译
首次编译
# 进入定制界面
make menuconfig
# 必选项
Target System --> MediaTek Ralik MIPS
Subtarget --> MT7620 based boards
Target Images --> Xiaomi MiWiFi Mini
* 在编译配置界面 * 表示编译写入固件,M 只编译不写入固件,留空 不做任何操作。
* (重要)保存当前 .config,尽少更改选项,让第一次编译成功后再增加选项。
# 预下载 dl 库文件
make download -j2 V=s
* 考验网络下载环境,关系编译成功率。
# 检查文件完整性
find dl -size -1024c -exec ls -l {} \;
# 如不完整删除,重新下载
find dl -size -1024c -exec rm -f {} \;
make download -j2 V=s
# 开始编译
make -j1 V=s # 首次编译必用,否则报错。V=s 为输出详细日志
非首次编译
make menuconfig
make download -j2 V=s
make -j6 V=s # 6 是 CPU 线程数
make -j$(nproc) V=s # 自动获取 CPU 线程数
源码更新后编译
cd openwrt
git pull
./scripts/feeds clean
./scripts/feeds update -a
./scripts/feeds install -a
rm -rf ./tmp
rm -rf .config
make menuconfig
make download -j2 V=s
make -j$(nproc) V=s
生成位置
./bin/***
清理
make clean # 清除 bin,build_dir
make dirclean # 清除 bin,build_dir,staging_dir,toolchain,tmp,logs
make distclean # 清除 OpenWrt 源码以外文件,几乎不用
rm -f .config # 编译新架构前用,如果有改过名字那么就得先 Load 配置
rm -rf tmp # 清除编译缓存
界面参数
主界面
│ Target System (x86) ---> # 设置 CPU 类型
│ Subtarget (x86_64) ---> # 设置 CPU 平台
│ Target Profile (Generic) ---> # 设置镜像档案类型
│ Target Images ---> # 设置编译的格式
│ Global build settings ---> # 全局设置
│ [ ] Advanced configuration options (for developers) ----> # 高级配置选项
│ [ ] Build the OpenWrt Image Builder # 创建 OpenWrt 镜像生成器
│ [ ] Build the OpenWrt SDK # 创建 OpenWrt SDK
│ [ ] Package the OpenWrt-based Toolchain # 打包基于 OpenWrt 的工具链
│ [ ] Image configuration ---> # 镜像配置
│ Base system ---> # 设置基础系统
│ Administration ---> # 管理
│ Boot Loaders ---> # 设置启动加载器
│ Development ---> # 开发相关
│ Extra packages ---> # 设置额外软件包
│ Firmware ---> # 设置固件
│ Fonts ---> # 设置字体
│ Kernel modules ---> # 设置内核模块
│ Languages ---> # 设置语言
│ Libraries ---> # 设置库
│ LuCI ---> # LuCi 设置
│ Mail ---> # 邮件相关
│ Multimedia ---> # 设置多媒体
│ Network ---> # 网络配置
│ Sound ---> # 声音配置
│ Utilities ---> # 设置实用程序
│ Xorg --->
LuCi Applications
LuCI —> Applications —> luci-app-accesscontrol # 访问时间控制
LuCI —> Applications —> luci-app-adblock # ADB 广告过滤
LuCI —> Applications —> luci-app-adbyby-plus # 广告屏蔽大师 Plus +
LuCI —> Applications —> luci-app-adbyby # 广告过滤大师(已弃)
LuCI —> Applications —> luci-app-adkill # 广告过滤(已弃)
LuCI —> Applications —> luci-app-advanced-reboot # Linksys 高级重启
LuCI —> Applications —> luci-app-ahcp # 支持 AHCPd
LuCI —> Applications —> luci-app-aliddns # 阿里 DDNS 客户端
LuCI —> Applications —> luci-app-amule # aMule 下载工具
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 # Bird 4 (未知)
LuCI —> Applications —> luci-app-bird6 # Bird 6 (未知)
LuCI —> Applications —> luci-app-bmx6 # BMX6 路由协议
LuCI —> Applications —> luci-app-bmx7 # BMX7 路由协议
LuCI —> Applications —> luci-app-caldav # 联系人
LuCI —> Applications —> luci-app-cjdns # 加密 IPV6 网络相关
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-dnscrypt-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 组件 索引(未知)
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-kooldns # virtual 服务器 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-mwan # MWAN 负载均衡
LuCI —> Applications —> luci-app-mwan3 # MWAN3 分流助手
LuCI —> Applications —> luci-app-n2n_v2 # N2N 内网穿透 N2N v2 virtual 服务
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 virtual 服务
LuCI —> Applications —> luci-app-olsr # OLSR 配置和状态模块
LuCI —> Applications —> luci-app-olsr-services # OLSR 服务器
LuCI —> Applications —> luci-app-olsr-viz # OLSR 可视化
LuCI —> Applications —> luci-app-ocserv # OpenConnect virtual 服务(已弃)
LuCI —> Applications —> luci-app-openvirtual # Openvirtual 客户端
LuCI —> Applications —> luci-app-openvirtual-server # 易于使用的 Openvirtual 服务器 Web-UI
LuCI —> Applications —> luci-app-oscam # OSCAM 服务器(已弃)
LuCI —> Applications —> luci-app-p910nd # 打印服务器模块
LuCI —> Applications —> luci-app-pagekitee # Pagekite 内网穿透客户端
LuCI —> Applications —> luci-app-polipo # Polipo 代理(是一个小型且快速的网页缓存代理)
LuCI —> Applications —> luci-app-pppoe-relay # PPPoE NAT 穿透 点对点协议(PPP)
LuCI —> Applications —> luci-app-pptp-server # virtual 服务器 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-55 # 55 上网(已弃)
LuCI —> Applications —> luci-app-55-libes # 55-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-simple-softethervirtual # SoftEther virtual 服务器 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-55R-plus # 55R Plus+ 上网
LuCI —> Applications —> luci-app-55R-plus —> Include 55 New Versiong # 新 55 代理
LuCI —> Applications —> luci-app-55R-plus —> Include V2ray # V2Ray 透明代理
LuCI —> Applications —> luci-app-55R-plus —> Include kcp # kcp 代理
LuCI —> Applications —> luci-app-55R-plus —> Include 55R Server # 55R 客户端
LuCI —> Applications —> luci-app-55R-plus —> Include 55R Socks and Tunnel # 55R 代理
——————————————————————————————-
LuCI —> Applications —> luci-app-55R-pro # 55R-Pro
LuCI —> Applications —> luci-app-55Rserver-python # 55R Python 服务器
LuCI —> Applications —> luci-app-statistics # 流量监控工具
LuCI —> Applications —> luci-app-syncdial # 多拨虚拟网卡(原 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-virtualbypass # virtual BypassWebUI 绕过 virtual 设置
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 # virtual** 服务器 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 内网穿透
编译错误
错误 1
configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
# 解决
export FORCE_UNSAFE_CONFIGURE=1
# 或者
sudo make FORCE_UNSAFE_CONFIGURE=1 -j1 V=s
错误 2
Build failed - please re-run with -j1 to see the real error message
# 解决
make -j1 V=s
错误 3
satisfy_dependencies_for: Cannot satisfy the following dependencies for luci-app-flowoffload
# 解决
无
提醒:
- 无论如何都编译失败的,尝试初始化系统,勿修改软件源。
- 同 Target System 架构编译不需执行清理操作,比如本次编译 7620 下次 7621
跨架构未测试。- 已更新:跨架构编译也不用清理。
其它
OpenWrt 编译笔记
https://www.right.com.cn/forum/thread-469400-1-1.html
Github actions 云编译
https://www.right.com.cn/forum/thread-1951291-1-1.html
更新 2019-05-23