逆旅 2022-08-04T17:23:28

1 简介

postmarketOS(或称pmOS)是一个针对智能手机开发的自由开源操作系统,基于Alpine Linux发行版。postmarketOS始于2017年5月6日,源代码可于GitLab上获得。postmarketOS可以运行各种基于X和Wayland的用户界面,例如Plasma Mobile、MATE、GNOME 3和Xfce。如果设备对应的内核打开 cgroups 和相关配置的话,也可以运行 Docker。


2 准备




  1. 直接刷入社区的预构建安装镜像
  2. 自己构建安装镜像


3.1 安装pmbootstrap


pip3 install --user pmbootstrap
source ~/.profile
sudo apt install python3-argcomplete
echo 'eval "$(register-python-argcomplete3 pmbootstrap)"' >> ~/.bashrc

3.2 构建镜像

pmbootstrap --mirror-pmOS= --mirror-alpine= init


[22:23:58] Location of the 'work' path. Multiple chroots (native, device arch, device rootfs) will be created in there.
[22:23:58] Work path [/home/zyj/.local/var/pmbootstrap]: 
[22:24:04] NOTE: pmaports path: /home/zyj/.local/var/pmbootstrap/cache_git/pmaports
[22:24:04] Choose the postmarketOS release channel.
[22:24:04] Available (5):
[22:24:04] * edge: Rolling release / Most devices / Occasional breakage:
[22:24:04] * v21.12: Latest release / Recommended for best stability
[22:24:04] * v21.06: Old release (unsupported)
[22:24:04] * v21.03: Old release (unsupported)
[22:24:04] * v20.05: Old release (unsupported)
[22:24:04] Channel [edge]: 
[22:24:14] Choose your target device vendor (either an existing one, or a new one for porting).
[22:24:14] Available vendors (70): acer, alcatel, amazon, apple, ark, arrow, asus, bq, chuwi, cubietech, essential, fairphone, finepower, fly, goclever, google, gp, hisense, htc, huawei, infocus, jolla, klipad, kobo, lark, leeco, lenovo, lg, medion, meizu, microsoft, mobvoi, motorola, nextbit, nobby, nokia, nvidia, odroid, oneplus, oppo, ouya, pegatron, pine64, planet, purism, qemu, raspberry, samsung, semc, sharp, shift, sipeed, sony, sourceparts, surftab, t2m, tablet, teclast, tokio, tolino, trekstor, vernee, wexler, wiko, wileyfox, xiaomi, xunlong, yu, zte, zuk
[22:24:14] Vendor [oneplus]: 
[22:24:16] Available codenames (13): bacon, billie2, cheeseburger, dumpling, enchilada, fajita, guacamole, kebab, lemonade, oneplus2, oneplus3, oneplus3t, onyx
[22:24:16] Device codename [enchilada]: 
[22:24:20] This device has proprietary components, which trade some of your freedom with making more peripherals work.
[22:24:20] We would like to offer full functionality without hurting your freedom, but this is currently not possible for your device.
[22:24:20] device-oneplus-enchilada-nonfree-firmware: Modem, WiFi and GPU Firmware, also needed for osk-sdl
[22:24:20] Enable this package? (y/n) [y]: 
[22:24:23] Username [zyj]: 
[22:24:37] Available user interfaces (20): 
[22:24:37] * none: Bare minimum OS image for testing and manual customization. The "console" UI should be selected if a graphical UI is not desired.
[22:24:37] * asteroid: (Wayland) Smartwatch UI from AsteroidOS
[22:24:37] * console: Console environment, with no graphical/touch UI
[22:24:37] * fbkeyboard: Plain framebuffer console with touchscreen keyboard support
[22:24:37] * framebufferphone: Minimalist framebuffer menu/keyboard UI accessible via touch/volume keys & compatible scripts
[22:24:37] * glacier: (Wayland) Open-source alternative to the SailfishOS UI
[22:24:37] * gnome: (Wayland) Gnome Shell
[22:24:37] * i3wm: (X11) Tiling WM (keyboard required)
[22:24:37] * kodi: (GBM) 10-foot UI useful on TV s
[22:24:37] * lxqt: (X11) Lightweight Qt Desktop Environment (stylus recommended)
[22:24:37] * mate: (X11) MATE Desktop Environment, fork of GNOME2 (stylus recommended)
[22:24:37] * phosh: (Wayland) Mobile UI developed for the Librem 5
[22:24:37] * plasma-bigscreen: (Wayland) 10-feet variant of Plasma, made for big screen TVs
[22:24:37] * plasma-desktop: (X11/Wayland) KDE Desktop Environment (works well with tablets)
[22:24:37] * plasma-mobile: (Wayland) Mobile variant of KDE Plasma (does not run without hardware acceleration)
[22:24:37] * shelli: Plain console with touchscreen gesture support
[22:24:37] * sway: (Wayland) Tiling WM, drop-in replacement for i3wm (DOES NOT RUN WITHOUT HW ACCELERATION!)
[22:24:37] * sxmo-de-dwm: Simple Mobile: Mobile environment based on SXMO and running on dwm
[22:24:37] * sxmo-de-sway: Simple Mobile: Mobile environment based on SXMO and running on sway
[22:24:37] * weston: (Wayland) Reference compositor (demo, not a phone interface)
[22:24:37] * xfce4: (X11) Lightweight desktop (stylus recommended)
[22:24:37] User interface [phosh]: 
[22:24:45] Additional options: extra free space: 0 MB, boot partition size: 256 MB, parallel jobs: 9, ccache per arch: 5G, sudo timer: False, mirror:
[22:24:45] Change them? (y/n) [n]: 
[22:24:47] Additional packages that will be installed to rootfs. Specify them in a comma separated list (e.g.: vim,file) or "none"
[22:24:47] Extra packages [none]: 
[22:24:49] Your host timezone: PRC
[22:24:49] Use this timezone instead of GMT? (y/n) [y]: 
[22:24:50] Available locales (14): C.UTF-8, ch_DE.UTF-8, de_CH.UTF-8, de_DE.UTF-8, en_GB.UTF-8, en_US.UTF-8, es_ES.UTF-8, fr_FR.UTF-8, it_IT.UTF-8, nb_NO.UTF-8, nl_NL.UTF-8, pt_BR.UTF-8, ru_RU.UTF-8, sv_SE.UTF-8
[22:24:50] Choose default locale for installation [C.UTF-8]: 
[22:24:52] Device hostname (short form, e.g. 'foo') [oneplus-enchilada]: oneplus
[22:25:08] After pmaports are changed, the binary packages may be outdated. If you want to install postmarketOS without changes, reply 'n' for a faster installation.
[22:25:08] Build outdated packages during 'pmbootstrap install'? (y/n) [y]: 
[22:25:12] Zap existing chroots to apply configuration? (y/n) [y]: 
[sudo] zyj 的密码: 
[22:25:23] % rm -rf /home/zyj/.local/var/pmbootstrap/chroot_native
[22:25:23] % rm -rf /home/zyj/.local/var/pmbootstrap/chroot_rootfs_oneplus-enchilada
[22:25:23] Cleared up ~2954 MB of space
[22:25:23] WARNING: The chroots and git repositories in the work dir do not get updated automatically.
[22:25:23] Run 'pmbootstrap status' once a day before working with pmbootstrap to make sure that everything is up-to-date.
[22:25:23] DONE!

注意User interface(手机桌面)最好选择 [phosh]

pmbootstrap --mirror-pmOS= --mirror-alpine= install
pmbootstrap export

3.3 刷入镜像

fastboot erase dtbo
fastboot flash boot <date>-<time>-postmarketOS-edge-phosh-6-oneplus-[enchilada|fajita]-boot.img
fastboot flash userdata <date>-<time>-postmarketOS-edge-phosh-6-oneplus-[enchilada|fajita].img

4 成果和遇到的问题



  • 第三方屏幕有可能无法正常显示和触控,只能通过USB网络ssh链接,之后再设置WI-FI。
  • 官方预构建的镜像默认关闭了ssh服务,要是屏幕无法触控,只能用自己构建的镜像。
最后修改: 2022-08-07T20:29:28

版权声明:署名-非商业性使用-相同方式共享 4.0 国际 (CC BY-NC-SA 4.0)

comment 评论

仿 Valine