• 主页
  • 归档
  • 软件
所有文章 友情链接 关于我

  • 主页
  • 归档
  • 软件

使用github工作流全自动构建postmarketos刷机包

2025-02-13

前言

前几天我在给p maports 提交 PR 的时候偶然浏览了一下 PostmarketOS 的构建工作流的配置文件的时候偶然发现了这行:

1
yes "" | pmbootstrap --aports=$PWD/pmaports -q init

我一直以为 yes 命令就是个不断输出 yes 的奇葩玩意儿,现在看来还可以通过管道符来实现自动输入的操作。

配置文件

让我们看看 pmbootstrap init 的流程:

1
2
3
4
5
6
7
8
9
10
11
12
user@pmos-build ~> pmbootstrap init
[19:23:28] Location of the 'work' path. Multiple chroots (native, device arch, device rootfs) will be created in there.
[19:23:28] Work path [/home/user/.local/var/pmbootstrap]: /home/user/pmwork
[19:23:46] Setting up the native chroot and cloning the package build recipes (pmaports)...
[19:23:46] Clone git repository: https://gitlab.com/postmarketOS/pmaports.git
正克隆到 '/home/user/pmwork/cache_git/pmaports'...
正在更新文件: 100% (6298/6298), 完成.
[19:24:54] NOTE: pmaports path: /usr/share/pmbootstrap/aports
[19:24:54] NOTE: you are using pmbootstrap version 1.50.1, but version 2.3.0 is required.
[19:24:54] ERROR: Please update your pmbootstrap version (with your distribution's package manager, or with pip, depending on how you have installed it). If that is not possible, consider cloning the latest version of pmbootstrap from git.
[19:24:54] See also: <https://postmarketos.org/troubleshooting>
Run 'pmbootstrap log' for details.

稳定的其中一个坏处就是软件包太老,更何况 pmbootstrap 原来是可以通过 pip 安装的:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
user@pmos-build ~> pip install pmbootstrap
error: externally-managed-environment

× This environment is externally managed
╰─> To install Python packages system-wide, try apt install
python3-xyz, where xyz is the package you are trying to
install.

If you wish to install a non-Debian-packaged Python package,
create a virtual environment using python3 -m venv path/to/venv.
Then use path/to/venv/bin/python and path/to/venv/bin/pip. Make
sure you have python3-full installed.

If you wish to install a non-Debian packaged Python application,
it may be easiest to use pipx install xyz, which will manage a
virtual environment for you. Make sure you have pipx installed.

See /usr/share/doc/python3.11/README.venv for more information.

note: If you believe this is a mistake, please contact your Python installation or OS distribution provider. You can override this, at the risk of breaking your Python installation or OS, by passing --break-system-packages.
hint: See PEP 668 for the detailed specification.

虽然可以用 pipx 这样的方式来解决,但是我试过不知道为什么装不了。

或者直接克隆最新的 pmbootstrap 然后复制到 /usr/local/bin 里。

我一直认为 pmbootstrap 初始化后应该会保存配置的。因为你再执行一遍 pmbootstrap 的时候会显示你第一次配置过的选项。

然后我就在折腾管道符的时候知道了 –details-to-stdout 选项:

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
$ ~> printf "%s\n" "edge" "xiaomi" "raphael" "user" "xfce4" "n" "none" "en_US" "xiaomi-raphael" "y" | ./pmbootstrap/pmbootstrap.py -q init
[09:08:51] Location of the 'work' path. Multiple chroots (native, device arch, device rootfs) will be created in there.
[09:08:51] Setting up the native chroot and cloning the package build recipes (pmaports)...
[09:08:51] Clone git repository: https://gitlab.com/postmarketOS/pmaports.git
[09:08:49] Channel [edge]: [09:08:49] Vendor [qemu]: [09:08:49] Device codename [amd64]: [09:08:49] Kernel [lts]: [09:08:49] Username [user]: [09:08:49] Provider [default]: [09:08:50] User interface [console]: [09:08:50] Change them? (y/n) [n]: [09:08:50] Extra packages [none]: [09:08:50] Use this timezone instead of GMT? (y/n) [y]: [09:08:50] Locale [en_US]: [09:08:50] Device hostname (short form, e.g. 'foo') [qemu-amd64]: [09:08:50] Build outdated packages during 'pmbootstrap install'? (y/n) [y]: [09:08:51] Work path [/home/runner/.local/var/pmbootstrap]: Cloning into '/home/runner/work/repo/repo/edge/cache_git/pmaports'...
[09:08:56] Choose the postmarketOS release channel.
[09:08:56] Available (10):
[09:08:56] * edge: Rolling release / Most devices / Occasional breakage: https://postmarketos.org/edge
[09:08:56] * v24.06: Latest release / Recommended for best stability
[09:08:56] * v23.12: Old release (unsupported)
[09:08:56] ERROR: Invalid channel specified, please type in one from the list above.
[09:08:56] ERROR: Invalid channel specified, please type in one from the list above.
[09:08:56] ERROR: Invalid channel specified, please type in one from the list above.
[09:08:56] ERROR: Invalid channel specified, please type in one from the list above.
[09:08:56] ERROR: Invalid channel specified, please type in one from the list above.
[09:08:56] ERROR: Invalid channel specified, please type in one from the list above.
[09:08:56] ERROR: Invalid channel specified, please type in one from the list above.
[09:08:56] ERROR: Invalid channel specified, please type in one from the list above.
[09:08:56] ERROR: Invalid channel specified, please type in one from the list above.
[09:08:56] ERROR: EOF when reading a line
[09:08:56] See also: <https://postmarketos.org/troubleshooting>
[09:08:56] Channel [edge]: [09:08:56] Channel [edge]: [09:08:56] Channel [edge]: [09:08:56] Channel [edge]: [09:08:56] Channel [edge]: [09:08:56] Channel [edge]: [09:08:56] Channel [edge]: [09:08:56] Channel [edge]: [09:08:56] Channel [edge]: [09:08:56] Channel [edge]:
Run 'pmbootstrap log' for details.

Before you report this error, ensure that pmbootstrap is up to date.
Find the latest version here: https://gitlab.com/postmarketOS/pmbootstrap/-/tags
Your version: 3.0.0_alpha

然后使用 –details-to-stdout 选项运行:

1
2
3
4
5
[05:20:52] Pmbootstrap v3.0.0_alpha (Python 3.10.12 (main, Jul 29 2024, 16:56:48) [GCC 11.4.0])
[05:20:52] $ pmbootstrap ./pmbootstrap/pmbootstrap.py --details-to-stdout init
[05:20:52] Location of the 'work' path. Multiple chroots (native, device arch, device rootfs) will be created in there.
[05:20:52] Work path [/home/runner/.local/var/pmbootstrap]: [05:20:52] Work path [/home/runner/.local/var/pmbootstrap]: /home/runner/.local/var/pmbootstrap
[05:20:52] Save config: /home/runner/.config/pmbootstrap_v3.cfg

然后就找到了配置文件:

1
2
3
4
5
6
7
8
9
10
11
[pmbootstrap]
aports = /home/pmos/.local/var/pmbootstrap/cache_git/pmaports
device = xiaomi-raphael
is_default_channel = False
timezone = Asia/Shanghai
ui = xfce4
work = /home/pmos/.local/var/pmbootstrap

[providers]

[mirrors]

于是就有了一个大胆的想法:

我们可以先把配置文件放到指定目录然后再使用 yes 管道符进行全自动确认:

1
2
3
4
5
6
- name: Initialize pmbootstrap
run: |
sudo aria2c https://github.com/username/repo/raw/main/pmbootstrap_v3.cfg
sudo mv pmbootstrap_v3.cfg -v /home/runner/.config/pmbootstrap_v3.cfg
sudo chmod 777 -v /home/runner/.config/pmbootstrap_v3.cfg
yes '' | ./pmbootstrap/pmbootstrap.py --details-to-stdout init

当然这种对于新设备来说是不使用的。

不过我们可以使用下面的方法进行初始化:

1
2
3
4
5
6
7
8
- name: Initialize pmbootstrap
run: |
sudo chmod 777 -v /home/runner/.config/pmbootstrap_v3.cfg
yes '' | ./pmbootstrap/pmbootstrap.py --details-to-stdout init
sudo aria2c https://github.com/username/repo/raw/main/pmbootstrap_v3.cfg
sudo mv pmbootstrap_v3.cfg -v /home/runner/.config/pmbootstrap_v3.cfg
mv *-xiaomi-raphael /home/pmos/.local/var/pmbootstrap/cache_git/pmaports/device/testing/ #假设已经通过 checkout 拉取了 pmos 的设备树
yes '' | ./pmbootstrap/pmbootstrap.py --details-to-stdout init


-------------本文结束感谢您的阅读-------------



  • 手机
  • 刷机
  • Android
  • Root
  • Github
  • CI
  • Linux

扫一扫,分享到微信

微信分享二维码
安卓内核编译速通
PostmarketOS移植常见问题
  1. 1. 前言
  2. 2. 配置文件

预览:

0  字
评论
  • Latest
  • Oldest
  • Hottest
评论区空空荡荡,客官快来评论吧~
Powered by Waline v2.15.8
© 2025 dpkg123
本站已苟活 2 年 141 天 23 小时 25 分钟 45 秒
Hexo Theme Yilia by Litten
萌ICP备20231955号
  • 所有文章
  • 友情链接
  • 关于我

tag:

  • 3DS
  • linux
  • buildroot
  • kernel
  • android
  • makefile
  • OPPO
  • miui
  • coloros
  • 手机
  • PostmarketOS
  • ROM移植
  • 刷机
  • dtb
  • dtc
  • hexo
  • web前端
  • github
  • shell
  • 刷机工具
  • 9008
  • 二次元
  • twrp
  • build
  • Android
  • Root
  • Github
  • CI
  • Linux
  • debian
  • 虚拟化 Android
  • 内核
  • 编译
  • 网页加速
  • 归档
  • 番剧
  • 别当欧尼酱了
  • 哔哩哔哩
  • av10492
  • 猎奇
  • TypeScript
  • Github Actions
  • 网页搭建
  • 速通
  • 教程
  • 奇技淫巧
  • 杂谈
  • android kernel
  • gki
  • 联发科
  • KernelSU
  • kvm
  • alpine
  • 软件源
  • vps
  • kernelSU
  • 移植
  • 内核编译
  • Kernel
  • fastboot

    缺失模块。
    1、请确保node版本大于6.2
    2、在博客根目录(注意不是yilia根目录)执行以下命令:
    npm i hexo-generator-json-content --save

    3、在根目录_config.yml里添加配置:

      jsonContent:
        meta: false
        pages: false
        posts:
          title: true
          date: true
          path: true
          text: false
          raw: false
          content: false
          slug: false
          updated: false
          comments: false
          link: false
          permalink: false
          excerpt: false
          categories: false
          tags: true
    

  • 内核编译排错

    2025-06-25

    #Android#内核#编译

  • 关于高通gunyah虚拟化的一些研究

    2025-03-03

    #虚拟化 Android

  • 安卓内核编译速通

    2025-02-13

    #Android#内核#编译#速通#教程#奇技淫巧

  • 使用github工作流全自动构建postmarketos刷机包

    2025-02-13

    #手机#刷机#Android#Root#Github#CI#Linux

  • PostmarketOS移植常见问题

    2024-08-12

    #linux#android#PostmarketOS#ROM移植#刷机

  • 本地搭建第三方alpine repo

    2024-03-22

    #linux#alpine#软件源

  • 折腾ts action遇到的其中一个问题

    2024-02-11

    #TypeScript#Github Actions

  • dtc编译教程

    2024-01-29

    #linux#android#dtb#dtc

  • OPPO Reno6 ColorOS13.1内核源码编译记录

    2024-01-15

    #kernel#android#OPPO

  • Android boot.img 文件的解包、修改与重打包小记

    2023-12-24

    #linux#android

  • twrp设备树从入门到放弃

    2023-12-10

    #linux#android#twrp#build

  • 3DS折腾linux小记

    2023-10-06

    #3DS#linux#buildroot#kernel

  • 暂停更新博客通知

    2023-08-08

    #杂谈

  • Makefile入门

    2023-08-04

    #linux#makefile

  • linux电脑给手机进行9008刷机

    2023-07-28

    #linux#刷机#9008

  • 浅谈安卓内核的碎片化

    2023-07-19

    #kernel#android#android kernel#gki

  • 哔哩哔哩危险地带部分补档

    2023-06-28

    #哔哩哔哩#av10492#猎奇

  • 使用dh_make快速构建deb

    2023-06-22

    #linux#debian

  • linux解压payload.bin和转换system.new.dat.br

    2023-06-18

    #linux#android#刷机

  • 浅谈联发科设备玩机的可能性

    2023-05-15

    #刷机#联发科#KernelSU#kvm

  • 给OPPO Reno6移植kernelSU

    2023-05-10

    #linux#kernelSU#移植#内核编译#Kernel

  • 别当欧尼酱了12集归档

    2023-05-02

    #归档#番剧#别当欧尼酱了

  • 珍爱生命,远离小众云

    2023-05-01

    #vps

  • fdt转dtb

    2023-04-30

    #android#dtb

  • coloros和miui

    2023-04-30

    #android#miui#coloros#手机

  • linux刷机工具箱

    2023-04-29

    #linux#shell#刷机工具

  • 简单写一个shell刷机脚本之进阶篇

    2023-04-29

    #linux#刷机#shell#fastboot

  • 简单写一个shell刷机脚本

    2023-04-29

    #linux#刷机#shell

  • linux娘

    2023-04-12

    #linux#二次元

  • 使用netlify加快博客访问速度

    2023-04-12

    #hexo#github#网页加速

  • hexo博客源码备份

    2023-04-10

    #hexo#web前端#github

  • 新博客

    2023-04-10

    #hexo#网页搭建

  • Hello World

    1970-01-01

  • note现在暂不考虑申请新的友链
  • 图床
  • 留言板
  • 原来的博客
  • Adminzhangの个人博客
  • cyp0633的blog
  • 小码同学
  • U.M.R-Powered-Blog
  • 秋澪Akimio
  • ialtone的小站
  • PiCpo的阁楼
  • artiga033
  • 柏园猫のBlog
  • 欠陥電気の摸鱼小池
  • 洛仙璃の幻梦
  • 木屐落在水洼了
  • 湛蓝的调色板
  • SakuraKooi的Blog
  • 新世界的大门
  • 沨鸾的小窝
  • Revincx
  • JIPA233の小窝
  • Mufanc
  • Fika
  • Pinpe的物语
  • 残夜的小博客
透明小菜鸡一枚<br><br>目前正在学习C++和C<br>正在移植postmarketOS到k30pro上<br>本博客使用github-page作为网页托管平台,netlify提供cdn加速服务。<br>不知道为啥yilia主题改不了下面的文字。<br>总之欢迎来到这里!