Ubuntu 编译 postmarketOS

目标机器Nexus7,要mosquitto,mpv,nano,tmux,openssh

项目 Nexus7‑2012(一代 grouper) Nexus7‑2013(二代 flo WiFi)
代号 grouper flo(LTE 版 deb)
处理器 NVIDIA Tegra3 4 核 A9 1.3GHz 高通骁龙 S4 Pro APQ8064(Krait300 4 核 1.5GHz)
GPU ULP GeForce Adreno320
内存 1GB DDR3 2GB DDR3L
存储 8/16/32GB eMMC 16/32GB eMMC
屏幕 7 英寸 1280×800(216PPI) 7.02 英寸 1920×1200(323PPI)
摄像头 无后置摄像头,仅前置 120 万 后置 500 万 AF + 前置 120 万
WiFi 2.4G 单频 802.11 b/g/n 2.4G+5G 双频 WiFi
电池 4325mAh 3950mAh,支持 Qi 无线充电
重量厚度 340g,10.45mm 290g,8.65mm(更轻薄)
后盖外观 点状网格橡胶后盖 光滑塑料后盖
扬声器 单扬声器 立体声双扬声器
原厂最高安卓 Android 5.1.1 Android 6.0.1

1、安装依赖

bash 复制代码
sudo apt update
sudo apt upgrade -y
sudo apt install -y git python3 python3-pip android-tools-adb android-tools-fastboot

2、安装 pmbootstrap(Git 方式,官方推荐,版本最新)

bash 复制代码
cd ~
git clone --depth=1 https://gitlab.postmarketos.org/postmarketOS/pmbootstrap.git
mkdir -p ~/.local/bin
ln -s "$PWD/pmbootstrap/pmbootstrap.py" ~/.local/bin/pmbootstrap
echo 'PATH="$HOME/.local/bin:$PATH"' >> ~/.bashrc
source ~/.bashrc
正克隆到 'pmbootstrap'...
remote: Enumerating objects: 280, done.
remote: Counting objects: 100% (280/280), done.
remote: Compressing objects: 100% (261/261), done.
remote: Total 280 (delta 18), reused 156 (delta 10), pack-reused 0 (from 0)
接收对象中: 100% (280/280), 354.59 KiB | 26.00 KiB/s, 完成.
处理 delta 中: 100% (18/18), 完成.
bash 复制代码
pmbootstrap --version
3.11.1
bash 复制代码
sudo apt update
sudo apt install -y multipath-tools
[sudo: authenticate] 密码:              
命中:1 http://archive.ubuntu.com/ubuntu resolute InRelease                                                   
命中:2 http://security.ubuntu.com/ubuntu resolute-security InRelease                              
命中:3 https://packages.microsoft.com/repos/edge-stable stable InRelease
命中:4 http://archive.ubuntu.com/ubuntu resolute-updates InRelease
命中:5 http://archive.ubuntu.com/ubuntu resolute-backports InRelease
有 7 个软件包可以升级。请执行 'apt list --upgradable' 来查看它们。
下列软件包是自动安装的并且现在不需要了:       
  docutils-common  python3-astroid    python3-isort           python3-mccabe           python3-parso           python3-typeshed
  grub-pc-bin      python3-asttokens  python3-jedi            python3-mypy             python3-roman-numerals  xsel
  mypy             python3-dill       python3-librt           python3-mypy-extensions  python3-send2trash
  pylint           python3-docutils   python3-logilab-common  python3-orjson           python3-tomlkit
使用'sudo apt autoremove'来卸载它(它们)。

将要安装:
  multipath-tools

将要安装的依赖:
  kpartx  libaio1t64  libmpathcmd0  libmpathpersist0  libmultipath0  libsgutils2-1.48  sg3-utils  sg3-utils-udev

建议安装:
  multipath-tools-boot

摘要:
  升级:0,安装:9,卸载:0,不升级:7
  下载大小:1,554 kB
  所需的空间:5,258 kB / 149 GB 可用

获取:1 http://archive.ubuntu.com/ubuntu resolute/main amd64 libaio1t64 amd64 0.3.113-8build1 [7,356 B]
获取:2 http://archive.ubuntu.com/ubuntu resolute/main amd64 libmpathcmd0 amd64 0.14.3-2ubuntu1 [13.3 kB]
获取:3 http://archive.ubuntu.com/ubuntu resolute/main amd64 libmultipath0 amd64 0.14.3-2ubuntu1 [166 kB]
获取:4 http://archive.ubuntu.com/ubuntu resolute/main amd64 libmpathpersist0 amd64 0.14.3-2ubuntu1 [18.2 kB]
获取:5 http://archive.ubuntu.com/ubuntu resolute-updates/main amd64 libsgutils2-1.48 amd64 1.48-3ubuntu3.1 [120 kB]
获取:6 http://archive.ubuntu.com/ubuntu resolute-updates/main amd64 sg3-utils amd64 1.48-3ubuntu3.1 [1,020 kB]
获取:7 http://archive.ubuntu.com/ubuntu resolute-updates/main amd64 sg3-utils-udev all 1.48-3ubuntu3.1 [6,610 B]
获取:8 http://archive.ubuntu.com/ubuntu resolute/main amd64 kpartx amd64 0.14.3-2ubuntu1 [32.2 kB]
获取:9 http://archive.ubuntu.com/ubuntu resolute/main amd64 multipath-tools amd64 0.14.3-2ubuntu1 [171 kB]
已下载 1,554 kB,耗时 6秒 (250 kB/s)                                                                                                                 
正在选中未选择的软件包 libaio1t64:amd64。
(正在读取数据库 ... 系统当前共安装有 215573 个文件和目录。)
准备解压 .../0-libaio1t64_0.3.113-8build1_amd64.deb  ...
正在解压 libaio1t64:amd64 (0.3.113-8build1) ...
正在选中未选择的软件包 libmpathcmd0。
准备解压 .../1-libmpathcmd0_0.14.3-2ubuntu1_amd64.deb  ...
正在解压 libmpathcmd0 (0.14.3-2ubuntu1) ...
正在选中未选择的软件包 libmultipath0。
准备解压 .../2-libmultipath0_0.14.3-2ubuntu1_amd64.deb  ...
正在解压 libmultipath0 (0.14.3-2ubuntu1) ...
正在选中未选择的软件包 libmpathpersist0。
准备解压 .../3-libmpathpersist0_0.14.3-2ubuntu1_amd64.deb  ...
正在解压 libmpathpersist0 (0.14.3-2ubuntu1) ...
正在选中未选择的软件包 libsgutils2-1.48:amd64。
准备解压 .../4-libsgutils2-1.48_1.48-3ubuntu3.1_amd64.deb  ...
正在解压 libsgutils2-1.48:amd64 (1.48-3ubuntu3.1) ...
正在选中未选择的软件包 sg3-utils。
准备解压 .../5-sg3-utils_1.48-3ubuntu3.1_amd64.deb  ...
正在解压 sg3-utils (1.48-3ubuntu3.1) ...
正在选中未选择的软件包 sg3-utils-udev。
准备解压 .../6-sg3-utils-udev_1.48-3ubuntu3.1_all.deb  ...
正在解压 sg3-utils-udev (1.48-3ubuntu3.1) ...
正在选中未选择的软件包 kpartx。
准备解压 .../7-kpartx_0.14.3-2ubuntu1_amd64.deb  ...
正在解压 kpartx (0.14.3-2ubuntu1) ...
正在选中未选择的软件包 multipath-tools。
准备解压 .../8-multipath-tools_0.14.3-2ubuntu1_amd64.deb  ...
正在解压 multipath-tools (0.14.3-2ubuntu1) ...
正在设置 libsgutils2-1.48:amd64 (1.48-3ubuntu3.1) ...
正在设置 libaio1t64:amd64 (0.3.113-8build1) ...
正在设置 libmpathcmd0 (0.14.3-2ubuntu1) ...
正在设置 kpartx (0.14.3-2ubuntu1) ...
正在设置 sg3-utils (1.48-3ubuntu3.1) ...
正在设置 sg3-utils-udev (1.48-3ubuntu3.1) ...
update-initramfs: deferring update (trigger activated)
正在设置 libmultipath0 (0.14.3-2ubuntu1) ...
正在设置 libmpathpersist0 (0.14.3-2ubuntu1) ...
正在设置 multipath-tools (0.14.3-2ubuntu1) ...
Created symlink '/etc/systemd/system/sysinit.target.wants/multipathd.service' → '/usr/lib/systemd/system/multipathd.service'.
multipathd-queueing.service is a disabled or a static unit, not starting it.
正在处理用于 libc-bin (2.43-2ubuntu2.3) 的触发器 ...
正在处理用于 man-db (2.13.1-1build1) 的触发器 ...
正在处理用于 dracut (110-11) 的触发器 ...
update-initramfs: Generating /boot/initrd.img-7.0.0-31-generic

3、pmbootstrap init 初始化配置

按照下面逐项回答交互问题(直接回车使用默认的标注【默认】)

  1. Work path:【回车默认】~/.local/var/pmbootstrap

  2. Release channel:输入 edge(asus‑flo 社区设备,只能用 edge 滚动分支)postmarket...

  3. Vendor:asus

  4. Device codename:flo

  5. Username:user【回车默认】

  6. User interface:console(纯控制台无图形)

  7. Extra packages:填入 mosquitto,mpv,nano,tmux,openssh(编译时直接预装,装好系统就有)

  8. Hostname:nexus7-flo

  9. Copy SSH keys:n

  10. Build outdated packages:y

11.Enable background timer to prevent repeated sudo authorization? (y/n) n: y(编译镜像耗时很长,pmbootstrap 内部会频繁调用 sudo。不开这个,长时间编译过程中 sudo 凭证超时,程序就会静默卡住等待密码输入,编译卡死。打开后台计时器就避免这个问题。)

bash 复制代码
pmbootstrap init
[08:18:49] Location of the 'work' path. Multiple chroots (native, device arch, device rootfs) will be created in there.
[08:18:49] Work path [/home/azhu/.local/var/pmbootstrap]: 
[08:18:50] Location of the 'pmaports' path, containing package definitions.
[08:18:50] pmaports path [/home/azhu/.local/var/pmbootstrap/cache_git/pmaports]: 
[08:18:51] Setting up the native chroot and cloning the package build recipes (pmaports)...
[08:18:51] Clone git repository: https://gitlab.postmarketos.org/postmarketOS/pmaports.git
正克隆到 '/home/azhu/.local/var/pmbootstrap/cache_git/pmaports'...
正在更新文件: 100% (8349/8349), 完成.
[08:25:32] Choose the postmarketOS release channel.
[08:25:32] Available (14):
[08:25:32] * edge: Rolling release / Most devices / Occasional breakage: https://postmarketos.org/edge
[08:25:32] * v26.06: Latest release / Recommended for best stability
[08:25:32] * v25.12: Old release (unsupported)
[08:25:32] Channel [edge]: 
[08:25:37] NOTE: pmaports is on main branch, copying git hooks.
[08:25:37] Choose your target device vendor (either an existing one, or a new one for porting).
[08:25:37] Available vendors (107): acer, alcatel, amazon, amediatech, amlogic, apple, ark, arrow, asus, ayaneo, ayn, bananapi, barnesnoble, beelink, blackberry, bq, clockworkpi, cubietech, cutiepi, dell, dongshanpi, epson, essential, fairphone, finepower, fly, fxtec, generic, gigaset, goclever, google, gp, hisense, hp, htc, huawei, inet, infocus, jolla, khadas, klipad, kobo, lark, leeco, lenovo, lg, librecomputer, linksys, lynx, mangopi, medion, meizu, microsoft, mnt, mobvoi, motorola, nextbit, nobby, nokia, nothing, nvidia, odroid, oneplus, oppo, ouya, pine64, planet, pocketbook, postmarketos, powkiddy, purism, qcom, qemu, qualcomm, radxa, raspberry, realme, rockchip, samsung, semc, sharp, shift, sipeed, solidrun, sony, sourceparts, sqfmi, starway, surftab, t2m, thundercomm, tokio, tolino, trekstor, vernee, vivo, volla, wd, wexler, wiko, wileyfox, xiaomi, xunlong, yu, zhihe, zte, zuk
[08:25:37] Vendor [qemu]: asus
[08:26:54] Devices are categorised as follows, from best to worst:
* Main: ports where mostly everything works.
* Community: often mostly usable, but may lack important functionality.
* Testing: anything from "just boots in some sense" to almost fully functioning ports.
* Downstream: ports that use a downstream kernel --- very limited functionality. Not recommended.

Available devices by codename (6): flo (testing), s5507q (testing), sparrow (testing), x00td (testing), z010d (testing), zenfone3 (testing)
[08:26:54] Device codename: flo
[08:27:14] Which kernel do you want to use with your device?
[08:27:14] Available kernels (4):
[08:27:14] * apq8064: Mainline Kernel fork for APQ8064 devices (linux-postmarketos-qcom-apq8064)
[08:27:14] * lts: Long term support (LTS) kernel from Alpine Linux (linux-lts)
[08:27:14] * next: Unstable next kernel (linux-next)
[08:27:14] * stable: Stable kernel from Alpine Linux (linux-stable)
[08:27:14] Kernel [stable]: 
[08:27:33] Username [user]: 
[08:27:40] Available providers for postmarketos-base-ui-audio-backend (2):
[08:27:40] * pulseaudio: Use pulseaudio as the audio backend. (default)
[08:27:40] * pipewire: Use pipewire as the audio backend. (but may not work with all devices)
[08:27:40] Provider [default]: 
[08:28:00] Available providers for postmarketos-base-ui-wifi (2):
[08:28:00] * wpa_supplicant: Use wpa_supplicant as the WiFi backend. (default)
[08:28:00] * iwd: Use iwd as the WiFi backend (but may not work with all devices)
[08:28:00] Provider [default]: 
[08:28:24] Available providers for postmarketos-usb-moded-default-profile (2):
[08:28:24] * developer: Make 'developer mode' the default usb-moded profile (always enables usb networking) (default)
[08:28:24] * charging: Make 'charging mode' the default usb-moded profile (usb networking must be manually enabled)
[08:28:24] Provider [default]: 
[08:29:13] Available user interfaces (25): 
[08:29:13] * none: Bare minimum OS image for testing and manual customization. The "console" UI should be selected if a graphical UI is not desired.
[08:29:13] * buffyboard: Plain framebuffer console with modern touchscreen keyboard support
[08:29:13] * cage: (Wayland) Kiosk WM
[08:29:13] * console: Console environment, with no graphical/touch UI
[08:29:13] * fbkeyboard: Plain framebuffer console with touchscreen keyboard support
[08:29:13] * gnome: (Wayland) Gnome Shell
[08:29:13] * gnome-mobile: (Wayland) Gnome Shell patched to adapt better to phones (Experimental)
[08:29:13] * i3wm: (X11) Tiling WM (keyboard required)
[08:29:13] * kodi: (GBM) 10-foot UI useful on TV's
[08:29:13] * lomiri: (Wayland) The convergent desktop environment (Experimental)
[08:29:13] * lxqt: (X11) Lightweight Qt Desktop Environment (stylus recommended)
[08:29:13] * mate: (X11) MATE Desktop Environment, fork of GNOME2 (stylus recommended)
[08:29:13] * moonlight: (Wayland) Open Source PC client for NVIDIA GameStream, as used by the NVIDIA Shield
[08:29:13] * openbox: (X11) A highly configurable and lightweight X11 window manager (keyboard required)
[08:29:13] * os-installer: UI for installing postmarketOS
[08:29:13] * phosh: (Wayland) Mobile UI using GNOME components and apps
[08:29:13] * plasma-desktop: (Wayland) KDE Desktop Environment (works well with tablets)
[08:29:13] * plasma-mobile: (Wayland) Mobile variant of KDE Plasma
[08:29:13] * retroarch: RetroArch in KMS mode
[08:29:13] * sway: (Wayland) Tiling WM, drop-in replacement for i3wm
[08:29:13] * sxmo-de-dwm: Simple Mobile: Mobile environment based on SXMO and running on dwm
[08:29:13] * sxmo-de-i3: Simple Mobile: Mobile environment based on SXMO and running on i3
[08:29:13] * sxmo-de-sway: Simple Mobile: Mobile environment based on SXMO and running on sway
[08:29:13] * weston: (Wayland) Reference compositor (demo, not a phone interface)
[08:29:13] * windowmaker: (X11) Window manager inspired by the NeXTSTEP user interface (stylus recommended)
[08:29:13] * xfce4: (X11) Lightweight desktop (stylus recommended)
[08:29:13] User interface [console]: 
[08:29:56] Based on your UI selection, 'default' will result in choosing systemd.
[08:29:56] Which service manager should be used? (default/openrc/systemd) [default]: 
[08:30:41] Additional options: extra free space: 0 MB, boot partition size: 512 MB, parallel jobs: 8, ccache per arch: 5G, sudo timer: False, mirror: http://mirror.postmarketos.org/postmarketos/
[08:30:41] Change them? (y/n) [n]: y
[08:31:31] Set extra free space to 0, unless you ran into a 'No space left on device' error. In that case, the size of the rootfs could not be calculated properly on your machine, and we need to add extra free space to make the image big enough to fit the rootfs (pmbootstrap#1904). How much extra free space do you want to add to the image (in MB)?
[08:31:31] Extra space size: 200
[08:32:19] What should be the boot partition size (in MB)?
[08:32:19] Boot size [512]: 
[08:32:53] How many jobs should run parallel on this machine, when compiling?
[08:32:53] Jobs [8]: 
[08:33:25] We use ccache to speed up building the same code multiple times. How much space should the ccache folder take up per architecture? After init is through, you can check the current usage with 'pmbootstrap stats'. Answer with 0 for infinite.
[08:33:25] Ccache size [5G]: 
[08:33:52] pmbootstrap does everything in Alpine Linux chroots, so your host system does not get modified. In order to work with these chroots, pmbootstrap calls 'sudo' internally. For long running operations, it is possible that you'll have to authorize sudo more than once.
[08:33:52] Enable background timer to prevent repeated sudo authorization? (y/n) [n]: y
[08:34:24] Selected mirror: http://mirror.postmarketos.org/postmarketos/
[08:34:25] Change mirror? (y/n) [n]: 
[08:34:34] Additional packages that will be installed to rootfs. Specify them in a comma separated list (e.g.: vim,file) or "none"
[08:34:34] Extra packages [none]: mosquitto,mpv,nano,tmux,openssh
[08:35:51] Your host timezone: Asia/Shanghai
[08:35:51] Use this timezone instead of GMT? (y/n) [y]: 
[08:35:57] Choose your preferred locale, like e.g. en_US. Only UTF-8 is supported, it gets appended automatically. Use tab-completion if needed.
[08:35:57] Locale [en_US]: 
[08:36:14] Device hostname (short form, e.g. 'foo') [asus-flo]: nexus7‑flo
[08:37:20] ERROR: Hostname must only contain letters (a-z), digits (0-9), minus signs (-), or periods (.)
[08:37:20] Device hostname (short form, e.g. 'foo') [asus-flo]: nexus7-mqtt
[08:37:29] SSH public keys found (1):
[08:37:29] * /home/azhu/.ssh/id_rsa.pub
[08:37:29] See https://postmarketos.org/ssh-key-glob for more information.
[08:37:29] Would you like to copy these public keys to the device? (y/n) [n]: 
[08:37:40] After pmaports are changed, the binary packages may be outdated. If you want to install postmarketOS without changes, reply 'n' for a faster installation.
[08:37:40] Build outdated packages during 'pmbootstrap install'? (y/n) [y]: 
[08:38:01] Zap existing chroots to apply configuration? (y/n) [y]: 
[sudo: authenticate] 密码:              
[08:38:18] DONE!

4、开始编译系统镜像

bash 复制代码
pmbootstrap install --no-fde

--no‑fde:**关闭全盘加密**,SSH 登录更省事,不需要开机输密码。

5、Nexus7准备工作

  1. 平板打开 设置 →关于平板,连续点击版本号开启开发者选项。

  2. 打开 **OEM 解锁、USB 调试**。

  3. USB 连接 Ubuntu 电脑。确认 adb 识别设备:

adb devices

  1. 进入 bootloader (fastboot 模式):

adb reboot bootloader

屏幕出现 Fastboot 界面。

  1. 解锁 bootloader(平板上确认确认,全部数据清空)

fastboot oem unlock

6、刷入 postmarketOS

平板保持在 fastboot 模式,USB 连 Ubuntu:

pmbootstrap flasher flash_kernel

pmbootstrap flasher flash_rootfs

刷完重启平板:

fastboot reboot

相关推荐
w01_02_031 小时前
linux, 桌面, 自启动。
linux·运维·服务器
云飞云共享云桌面2 小时前
SolidWorks+AutoCAD,多并发。可以多人共享一台设计服务器吗
运维·服务器·3d·自动化·制造
伩仁2 小时前
WSL2 跑起 Web 服务后,本机和局域网设备怎么都能访问?一套两步法彻底搞懂
运维
从零开始的嵌入式之旅2 小时前
day36
linux·c语言·经验分享·笔记·嵌入式硬件
Doraemomo2 小时前
硬件基础概念
arm开发
吴声子夜歌2 小时前
Linux命令——查找文件
linux·运维·学习
mounter6252 小时前
Linux 内核 binfmt_misc 深度全景解析:历史、架构、安全
linux·安全·linux kernel·kernel
我命由我123452 小时前
Windows 操作系统 - 启用 D 盘虚拟内存
java·运维·服务器·windows·学习·java-ee·运维开发
吴声子夜歌2 小时前
Linux命令——归档与备份
linux·运维·备份·归档