openwrt开发笔记一:源码下载与编译

时间:2024-03-10 10:22:24

1.1 环境要求

编译系统:Linux发行版(本文使用Ubuntu)

编译一个可以安装的OpenWrt固件镜像文件(大约8MB大小的),你需要:

  • 一个纯净的OpenWrt编译系统大约需要200MB的空间。
  • 一个包含feeds的OpenWrt编译系统大约需要300MB的空间。
  • 编译feeds中的软件包大约需要2.1GB的空间用于存放下载来的源代码。
  • 构建OpenWrt并生成固件文件需要大约3-4 GB的空间。
  • 编译OpenWrt需要大约1-4 GB的内存。

1.2 下载源码

先确认Ubuntu下已安装git和subversion工具,俗人没有,请使用如下命令安装:

sudo apt-get install git subversion

不同版本的克隆地址

下载命令:

#版本号为chaos_calmer 15.05
git clone git://github.com/openwrt/chaos_calmer.git

#开发版版本号为LEDE 17
git clone https://git.openwrt.org/openwrt/openwrt.git
#gitbub镜像
git clone https://github.com/openwrt/openwrt.git

国内连接github速度较慢,须耐心等待git下载完成.

这里我选择下载 chaos_calmer 版(发现里面没有树莓派3B+)

推荐下载地址:git clone https://gitee.com/greenice897/openwrt.git

1.3 编译

下载完成后进入源码根目录

第一次编译可以参考根目录下面的README文档

cd openwrt
#更新feeds.conf中的种子包
./scripts/feeds update -a
#安装软链接到package/feeds/,这样make menuconfig才能进行相关配置
./scripts/feeds install -a

编译依赖:

安装git以下载OpenWrt源码,feeds中的部分软件包可能只能通过subversion (缩写: svn)或者mercurial下载源代码。

sudo apt-get install gcc g++ binutils patch bzip2 flex bison make autoconf gettext texinfo unzip sharutils subversion libncurses5-dev ncurses-term zlib1g-dev

如果漏安装了 make menuconfig 会给出报错提示

make menuconfig

配置完成然后

make V=s

编译过程缓慢 耐心等候,因为下载很多东西,如果遇到下载404错误,可以手动复制链接用迅雷下载,下载好后丢在dl目录下面,缺少库的话切换到root下面进行安装。

选择LuCI 配置: 常用

选择LuCI 配置:
LuCI ---> Applications ---> luci-app-accesscontrol #访问时间控制
LuCI ---> Applications ---> luci-app-adbyby-plus #广告屏蔽大师Plus +
LuCI ---> Applications ---> luci-app-arpbind #IP/MAC绑定
LuCI ---> Applications ---> luci-app-autoreboot #支持计划重启
LuCI ---> Applications ---> luci-app-ddns #动态域名 DNS(集成阿里DDNS客户端)
LuCI ---> Applications ---> luci-app-filetransfer #文件传输(可web安装ipk包)
LuCI ---> Applications ---> luci-app-firewall #添加防火墙
LuCI ---> Applications ---> luci-app-flowoffload #Turbo ACC网络加速(集成FLOW,BBR,NAT,DNS.. *
LuCI ---> Applications ---> luci-app-frpc #内网穿透 Frp
LuCI ---> Applications ---> luci-app-guest-wifi #WiFi访客网络
LuCI ---> Applications ---> luci-app-ipsec-virtuald #virtual服务器 IPSec
LuCI ---> Applications ---> luci-app-mwan3 #MWAN3负载均衡
LuCI ---> Applications ---> luci-app-mwan3helper #MWAN3分流助手
LuCI ---> Applications ---> luci-app-nlbwmon #网络带宽监视器
LuCI ---> Applications ---> luci-app-p p t p-server #virtual**服务器 p p t p
LuCI ---> Applications ---> luci-app-ramfree #释放内存
LuCI ---> Applications ---> luci-app-samba #网络共享(Samba)
LuCI ---> Applications ---> luci-app-sqm #流量智能队列管理(QOS)
-------------------------------------------------------------------------------------------
LuCI ---> Applications ---> luci-app-S-S R-plus #S-S R兲朝上网Plus+
LuCI ---> Applications ---> luci-app-S-S R-plus ---> Include s-s New Versiong #新SS代理
LuCI ---> Applications ---> luci-app-S-S R-plus ---> Include v2瑞 #透明代理
-------------------------------------------------------------------------------------------
LuCI ---> Applications ---> luci-app-syncdial #多拨虚拟网卡(原macvlan)
LuCI ---> Applications ---> luci-app-unblockmusic #解锁网易云灰色歌曲
LuCI ---> Applications ---> luci-app-upnp #通用即插即用UPnP(端口自动转发)
LuCI ---> Applications ---> luci-app-vlmcsd #KMS服务器设置
LuCI ---> Applications ---> luci-app-vsftpd #FTP服务器
LuCI ---> Applications ---> luci-app-wifischedule #WiFi 计划
LuCI ---> Applications ---> luci-app-wol #WOL网络唤醒
LuCI ---> Applications ---> luci-app-wrtbwmon #实时流量监测
LuCI ---> Applications ---> luci-app-xlnetacc #迅雷快鸟
LuCI ---> Applications ---> luci-app-zerotier #ZeroTier内网穿透
Extra packages ---> ipv6helper #支持 ipv6

以下是全部:
-----------------------------------------------------------------------------------------
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客户端(已弃,集成至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-baidupcs-web #百度网盘管理 *
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(集成阿里DDNS客户端)
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-docker #Docker容器 *
LuCI ---> Applications ---> luci-app-dump1090 #民航无线频率(不确定)
LuCI ---> Applications ---> luci-app-dynapoint #DynaPoint(未知)
LuCI ---> Applications ---> luci-app-e2guardian #Web内容过滤器
LuCI ---> Applications ---> luci-app-familycloud #家庭云盘
LuCI ---> Applications ---> luci-app-filetransfer #文件传输(可web安装ipk包)
LuCI ---> Applications ---> luci-app-firewall #添加防火墙
LuCI ---> Applications ---> luci-app-flowoffload #Turbo ACC网络加速(集成FLOW,BBR,NAT,DNS.. *
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-gfwlist #GFW域名列表(已弃)
LuCI ---> Applications ---> luci-app-haproxy-tcp #HAProxy负载均衡-TCP
LuCI ---> Applications ---> luci-app-hd-idle #硬盘休眠
LuCI ---> Applications ---> luci-app-hnet #Homenet Status家庭网络控制协议
LuCI ---> Applications ---> luci-app-ipsec-virtuald #virtual服务器 IPSec
LuCI ---> Applications ---> luci-app-kodexplorer #KOD可道云私人网盘
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 #多拨虚拟网卡(已弃,移至syncdial)
LuCI ---> Applications ---> luci-app-mwan #MWAN负载均衡(已弃)
LuCI ---> Applications ---> luci-app-mwan3 #MWAN3负载均衡
LuCI ---> Applications ---> luci-app-mwan3helper #MWAN3分流助手
LuCI ---> Applications ---> luci-app-n2n_v2 #N2N内网穿透 N2N v2 virtual服务
LuCI ---> Applications ---> luci-app-netdata #Netdata实时监控(图表) *
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-nps #内网穿透nps *
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-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-pagekitec #Pagekite内网穿透客户端
LuCI ---> Applications ---> luci-app-polipo #Polipo代理(是一个小型且快速的网页缓存代理)
LuCI ---> Applications ---> luci-app-pppoe-relay #PPPoE NAT穿透 点对点协议(PPP)
LuCI ---> Applications ---> luci-app-p p t p-server #virtual服务器 p p t p
LuCI ---> Applications ---> luci-app-privoxy #Privoxy网络代理(带过滤无缓存)
LuCI ---> Applications ---> luci-app-qbittorrent #BT下载工具(qBittorrent)
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网络加速(已弃,移至flowoffload)
LuCI ---> Applications ---> luci-app-s-s #SS兲朝上网(已弃)
LuCI ---> Applications ---> luci-app-s-s-libes #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-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-S-S R-plus #S-S R兲朝上网Plus+
LuCI ---> Applications ---> luci-app-S-S R-plus ---> Include s-s New Versiong #新SS代理
LuCI ---> Applications ---> luci-app-S-S R-plus ---> Include v2瑞 #透明代理
LuCI ---> Applications ---> luci-app-S-S R-plus ---> Include Kcptun #Kcptun代理
LuCI ---> Applications ---> luci-app-S-S R-plus ---> Include s-sR Server #S-S R服务器
LuCI ---> Applications ---> luci-app-S-S R-plus ---> Include s-sR Socks and Tunnel #S-S R代理
-------------------------------------------------------------------------------------------
LuCI ---> Applications ---> luci-app-S-S R-pro #S-S R-Pro(已弃)
LuCI ---> Applications ---> luci-app-S-S Rserver-python #s-sR 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-unblockmusic #解锁网易云灰色歌曲
LuCI ---> Applications ---> luci-app-unbound #Unbound DNS解析器
LuCI ---> Applications ---> luci-app-upnp #通用即插即用UPnP(端口自动转发)
LuCI ---> Applications ---> luci-app-usb-printer #USB 打印服务器
LuCI ---> Applications ---> luci-app-v2瑞-server #服务器
LuCI ---> Applications ---> luci-app-v2瑞-pro #透明代理(已弃,集成S-S R)
LuCI ---> Applications ---> luci-app-verysync #微力同步 *
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内网穿透
---------------------------------------------------------------------------------------------------
支持 iPv6:
Extra packages ---> ipv6helper (选定这个后下面几项自动选择了)
Network ---> odhcp6c
Network ---> odhcpd-ipv6only
LuCI ---> Protocols ---> luci-proto-ipv6
LuCI ---> Protocols ---> luci-proto-ppp

Utilities ---> open-vm-tools #打开适用于VMware的VM Tools