Skip to content

通过知识获得解放,通过技术获得自由

Menu
  • 专题目录
  • 液压相关
    • 液压技术
    • 液压相邻技术
    • 液压应用
  • 计算机相关
    • 计算机和软件
    • 网络和网站技术
  • 哲学
  • 关于本站
Menu

使用 GitHub Actions 云编译 OpenWrt[0]

Posted on 2023年11月14日 by

项目地址:

https://github.com/esirplayground/AutoBuild-OpenWrt

https://github.com/P3TERX/Actions-OpenWrt

 

  • 前言

Github Ac­tions 是 Mi­crosoft 收购 GitHub 后推出的 CI/​CD 服务,它提供了性能配置非常不错的虚拟服务器环境(E5 2vCPU/​7G RAM),基于它可以进行构建、测试、打包、部署项目。对于公开仓库可免费无时间限制的使用,且单次使用时间长达 6 个小时,这对于编译 Open­Wrt 来说是非常充足的。不过 GitHub Ac­tions 有一定的使用门槛,首先要了解如何编写 workflow 文件。不过不用担心,博主已经编写好了相关的 work­flow 文件模版,只需要按照教程的步骤来操作即可。

  • 方案特点
  1. 免费
  2. 一键快速编译
  3. 定时自动编译
  4. 客制化编译
  5. 并发编译(可同时进行20个编译任务)
  6. 无需搭建编译环境(在线make menuconfig生成配置文件)
  7. 无需消耗自己的计算机与服务器的计算资源(性感E5在线编译)
  8. 无需担心磁盘空间不足(近60G磁盘空间)
  9. 无需使用清理文件(内核更新不怕 boom )
  10. 编译速度快(编译时间1-2小时)
  11. 编译成功率提升200%(万兆自由网络环境)
  12. 全新环境(杜绝编译环境不干净导致编译失败)

本解决方案是一个开放平台,任何人都可以基于此打造自己专属的编译方案。

  • 准备工作

1)GitHub 账号

2)搭建编译环境,生成.config文件。(可选)

TIPS: 关于编译环境的搭建,推荐去看我之前写的相关文章,Win­dows 10 可以使用 WSL ,ma­cOS、Linux 可以使用 Docker 。

  • 基础使用

1)首先你必须要熟悉整个 Open­Wrt 的编译过程,这会让你非常容易的理解如何使用 GitHub Ac­tions 进行编译,即使你没有成功过。GitHub Ac­tions 服务器由 Mi­crosoft Azure 提供,拥有万兆带宽,可以使编译成功率大大提升。

2)在自己搭建编译环境中使用 Lean’s OpenWrt 源码生成.config文件。(或使用直接 SSH 连接到 Actions 进行操作,后面有说明。)

3)进入 P3TERX/Actions-OpenWrt 项目页面,点击页面中的 Use this template (使用这个模版)按钮。

4)填写仓库名称,然后点击Create repository from template(从模版创建储存库)按钮。

5)经过几秒钟的等待,页面会跳转到新建的仓库,内容和我的项目是相同的。然后点击Create new file(创建新文件)按钮。

6)文件名填写为.config,把生成的.config 文件的内容复制粘贴到下面的文本框中。

7)翻到页面最下方,点击Commit new file(提交新文件)按钮。

8)在 Actions 页面选择Build OpenWrt,然后点击Run Workflow按钮,即可开始编译。(如果需要 SSH 连接则把SSH connection to Actions的值改为true。其它详情参见进阶使用相关章节)

9)在等待编译完成的过程中,你可以进入这个页面点击右上角的star,这是对博主最大的支持,而且还可以加快编译速度

10)最后经过一两个小时的等待,不出意外你就可以在 Actions 页面看到已经打包好的固件目录压缩包。

TIPS: 方案默认引用 Lean 的源码,因为他的 README 影响了我开始学习编译,也就有了这个项目,而且他的源码非常的优秀。有其它需求可自行修改 work­flow 文件,方法后面的进阶使用中有说明。

 

参考资料:

  1. https://p3terx.com/archives/build-openwrt-with-github-actions.html
  2. https://p3terx.com/archives/github-actions-started-tutorial.html

欢迎回来

希望本站对你有所帮助!

如有疑问请联系info@fanlog.org
2023 年 11 月
一二三四五六日
 12345
6789101112
13141516171819
20212223242526
27282930 
« 6 月    

AI辅助 (17)

© 2025 | Powered by Superbs Personal Blog theme
We use cookies on our website to give you the most relevant experience by remembering your preferences and repeat visits. By clicking “Accept All”, you consent to the use of ALL the cookies. However, you may visit "Cookie Settings" to provide a controlled consent.
Cookie SettingsAccept All
Manage consent

Privacy Overview

This website uses cookies to improve your experience while you navigate through the website. Out of these, the cookies that are categorized as necessary are stored on your browser as they are essential for the working of basic functionalities of the website. We also use third-party cookies that help us analyze and understand how you use this website. These cookies will be stored in your browser only with your consent. You also have the option to opt-out of these cookies. But opting out of some of these cookies may affect your browsing experience.
Necessary
Always Enabled
Necessary cookies are absolutely essential for the website to function properly. This category only includes cookies that ensures basic functionalities and security features of the website. These cookies do not store any personal information.
Non-necessary
Any cookies that may not be particularly necessary for the website to function and is used specifically to collect user personal data via analytics, ads, other embedded contents are termed as non-necessary cookies. It is mandatory to procure user consent prior to running these cookies on your website.
SAVE & ACCEPT