openWrt 常用命令

编译前下载dl库:

1
$ make -j8 download V=s

 

 feed 更新+安装

1
2
3
$ cd lede 或者 cd openwrt19
$ ./scripts/feeds update -a
$ ./scripts/feeds install -a

 

选择要编译项目内容,比如CPU架构、设备型号

1
$ make menuconfig

 

编译:

1
$ make V=99

 

高亮构建错误:

1
$ make V=99 2>&1 | tee build.log | grep -i error

 

编译(多线程):(-jn 后面的 n 是线程数。第一次编译推荐用单线程,国内请尽量全局扶墙上网或者国内白名单)

1
$ make -j1 V=s

 

统计编译所耗时间:

1
$ time make V=99

 

编译完成后固件输出在 /lede/bin/targets 目录下,按 CPU 排列。

 

第二次编译:

1
2
3
4
5
6
7
8
# 更新&&安装Feeds
$ ./scripts/feeds update -a && ./scripts/feeds install -a
 
# 清除编译配置和缓存
$ rm -rf ./tmp && rm -rf .config
 
# 进入编译配置菜单
$ make menuconfig

 

 

编译错误时,重新编译:

1
$ make clean

 或

1
$ make distclean

 

清除编译配置和缓存 

1
$ rm -rf ./tmp && rm -rf .config

 

清理掉已编译好的固件、软件包、命令:

1
$ make dirclean

 

清理掉已编译好的交叉编译工具、固件、软件包:

1
$ make dirclean

 

*清理掉所有内容(包含下载包的dl文件夹,这个清理将返回到OpenWrt的原始状态,首次git clone状态)

1
$ make distclean

 

 

 

menuconfig选项简要说明

详细内容,请查看论坛大佬整理的,原文连接:https://www.right.com.cn/forum/thread-344825-1-1.html

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
Target System (x86) ---> #设置CPU类型(软路由所以选择x86,硬路由根据型号厂家选择自己的cpu)
Subtarget (x86_64) ---> #CPU子选项
Target Profile (Generic) ---> #厂家具体型号
Target Images ---> #设置编译的格式(squashfs,ext4)
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 ---> #设置一些接口模块,如LED,i2c,spi等
Languages ---> #设置语言,如go,lua,node.js,php,Python等等
Libraries ---> #设置库
LuCI ---> #LuCi设置(这里重点开始选择- 3. Applications ->进去编译选择“y”,取消选“n”,说明在下边链接 )
 
1. collections luCI HTTPS支持
2. modules 模块,选中 Minify Lua Sources 压缩 Lua 脚本可增大固件中的可用空间
3. applications 应用
4. themes 主题
5. protocols 支持协议
6. libraries 支持docker json等库
9. freifunk 社区产品
 
Mail ---> mail 相关软件,协议等
Multimedia ---> #设置多媒体,如FFmpeg
Network ---> #网络配置,如bittorrent,firewall,download manager,VPN,ssh等等
Sound ---> #声音配置
Utilities ---> #设置实用程序
Xorg ---> #字体配置

 

 

 

-

参考:

https://www.mianao.info/2020/03/02/%E8.......%BD%BB%E6%9D%nt-page-1

【【韩风Talk】Openwrt编译难么?不太难,主要是细节!-哔哩哔哩】 https://b23.tv/dZc9HsQ 时间:14:19

 书《OpenWrt智能路由系统开放 跟hoowa学智能路由》王伟,孙冰,刘龙著 P204

https://oldwiki.archive.openwrt.org/zh-cn/doc/howto/build

 

posted @   悟透  阅读(2913)  评论(0编辑  收藏  举报
相关博文:
阅读排行:
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· 记一次.NET内存居高不下排查解决与启示
· 白话解读 Dapr 1.15:你的「微服务管家」又秀新绝活了
点击右上角即可分享
微信分享提示