openWrt 常用命令


编译前下载dl库:

$ make -j8 download V=s

 feed 更新+安装

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

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

$ make menuconfig

编译:

$ make V=99

 

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

$ make -j1 V=s 

统计编译所耗时间:

$ time make V=99

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

编译错误时,重新编译:

$ make clean

 或

$ make distclean

清除编译配置和缓存 

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

menuconfig选项简要说明

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

    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

相关