root@Home:/opt/pmbootstrap# ./pmbootstrap.py --as-root init
[13:50:01] Location of the 'work' path. Multiple chroots (native, device arch, device rootfs) will be created in there.
[13:50:01] Work path [/root/.local/var/pmbootstrap]:
[13:50:03] Location of the 'pmaports' path, containing package definitions.
[13:50:03] pmaports path [/root/.local/var/pmbootstrap/cache_git/pmaports]:
[13:50:04] Choose the postmarketOS release channel.
[13:50:04] Available (14):
[13:50:04] * edge: Rolling release / Most devices / Occasional breakage: https://postmarketos.org/edge
[13:50:04] * v26.06: Latest release / Recommended for best stability
[13:50:04] * v25.12: Old release (unsupported)
[13:50:04] Channel [edge]:
[13:50:07] NOTE: pmaports is on main branch, copying git hooks.
[13:50:07] Choose your target device vendor (either an existing one, or a new one for porting).
[13:50:07] 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
[13:50:07] Vendor [xiaomi]:
[13:50:08] 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 (22): alioth (testing), begonia (testing), beryllium (community), cepheus (testing), clover (testing), elish (testing), equuleus (testing), gauguin (testing), ido (downstream), jasmine_sprout (testing), lancelot (testing), lavender (testing), miatoll (testing), mocha (testing), monet (downstream), nabu (testing), pipa (testing), pyxis (testing), scorpio (testing), tulip (testing), vayu (testing), whyred (testing)
[13:50:08] Device codename [alioth]:
[13:50:12] Username [houzai]:
[13:50:13] Available providers for postmarketos-base-ui-audio-backend (2):
[13:50:13] * pulseaudio: Use pulseaudio as the audio backend. (default)
[13:50:13] * pipewire: Use pipewire as the audio backend. (but may not work with all devices)
[13:50:13] Provider [default]:
[13:50:17] Available providers for postmarketos-base-ui-wifi (2):
[13:50:17] * wpa_supplicant: Use wpa_supplicant as the WiFi backend. (default)
[13:50:17] * iwd: Use iwd as the WiFi backend (but may not work with all devices)
[13:50:17] Provider [default]:
[13:50:18] Available providers for postmarketos-usb-moded-default-profile (2):
[13:50:18] * developer: Make 'developer mode' the default usb-moded profile (always enables usb networking) (default)
[13:50:18] * charging: Make 'charging mode' the default usb-moded profile (usb networking must be manually enabled)
[13:50:18] Provider [default]:
[13:50:18] Available user interfaces (30):
[13:50:18] * none: Bare minimum OS image for testing and manual customization. The "console" UI should be selected if a graphical UI is not desired.
[13:50:18] * buffyboard: Plain framebuffer console with modern touchscreen keyboard support
[13:50:18] * cage: (Wayland) Kiosk WM
[13:50:18] * console: Console environment, with no graphical/touch UI
[13:50:18] * cosmic: COSMIC Desktop Environment from System76
[13:50:18] * fbkeyboard: Plain framebuffer console with touchscreen keyboard support
[13:50:18] * gnome: (Wayland) Gnome Shell
[13:50:18] * gnome-mobile: (Wayland) Gnome Shell patched to adapt better to phones (Experimental)
[13:50:18] * i3wm: (X11) Tiling WM (keyboard required)
[13:50:18] * kodi: (GBM) 10-foot UI useful on TV's
[13:50:18] * lomiri: (Wayland) The convergent desktop environment (Experimental)
[13:50:18] * lxqt: (X11) Lightweight Qt Desktop Environment (stylus recommended)
[13:50:18] * mate: (X11) MATE Desktop Environment, fork of GNOME2 (stylus recommended)
[13:50:18] * moonlight: (Wayland) Open Source PC client for NVIDIA GameStream, as used by the NVIDIA Shield
[13:50:18] * niri: (Wayland) A scrollable-tiling compositor (DOES NOT RUN WITHOUT HW ACCELERATION!)
[13:50:18] * openbox: (X11) A highly configurable and lightweight X11 window manager (keyboard required)
[13:50:18] * os-installer: UI for installing postmarketOS
[13:50:18] * phosh: (Wayland) Mobile UI using GNOME components and apps
[13:50:18] * plasma-bigscreen: (Wayland) 10-feet variant of Plasma, made for big screen TVs
[13:50:18] * plasma-desktop: (Wayland) KDE Desktop Environment (works well with tablets)
[13:50:18] * plasma-mobile: (Wayland) Mobile variant of KDE Plasma
[13:50:18] * retroarch: RetroArch in KMS mode
[13:50:18] * shelli: Plain console with touchscreen gesture support
[13:50:18] * sway: (Wayland) Tiling WM, drop-in replacement for i3wm
[13:50:18] * sxmo-de-dwm: Simple Mobile: Mobile environment based on SXMO and running on dwm
[13:50:18] * sxmo-de-i3: Simple Mobile: Mobile environment based on SXMO and running on i3
[13:50:18] * sxmo-de-river: Simple Mobile: Mobile environment based on SXMO and running on river
[13:50:18] * sxmo-de-sway: Simple Mobile: Mobile environment based on SXMO and running on sway
[13:50:18] * weston: (Wayland) Reference compositor (demo, not a phone interface)
[13:50:18] * windowmaker: (X11) Window manager inspired by the NeXTSTEP user interface (stylus recommended)
[13:50:18] * xfce4: (X11) Lightweight desktop (stylus recommended)
[13:50:18] User interface [fbkeyboard]: phosh # 这里可以选择终端 fbkeyboard 或者 gui phosh
[13:50:40] Based on your UI selection, 'default' will result in choosing systemd.
[13:50:40] Which service manager should be used? (default/openrc/systemd) [default]:
[13:50:43] Additional options: extra free space: 0 MB, boot partition size: 512 MB, parallel jobs: 12, ccache per arch: 5G, sudo timer: False, mirror: http://mirror.postmarketos.org/postmarketos/
[13:50:43] Change them? (y/n) [n]:
[13:50:44] Additional packages that will be installed to rootfs. Specify them in a comma separated list (e.g.: vim,file) or "none"
[13:50:44] Extra packages [none]:
[13:50:45] Your host timezone: Asia/Shanghai
[13:50:45] Use this timezone instead of GMT? (y/n) [y]:
[13:50:46] Choose your preferred locale, like e.g. en_US. Only UTF-8 is supported, it gets appended automatically. Use tab-completion if needed.
[13:50:46] Locale [en_US]:
[13:50:47] Device hostname (short form, e.g. 'foo') [xiaomi-alioth]:
[13:50:49] NOTE: No SSH public keys found to copy to the device.
[13:50:49] See https://postmarketos.org/ssh-key-glob for more information.
[13:50:49] After pmaports are changed, the binary packages may be outdated. If you want to install postmarketOS without changes, reply 'n' for a faster installation.
[13:50:49] Build outdated packages during 'pmbootstrap install'? (y/n) [y]:
[13:50:51] Zap existing chroots to apply configuration? (y/n) [y]:
[13:50:52] Unregister qemu binfmt (aarch64)
[13:50:53] DONE!
root@Home:/opt/pmbootstrap# ./pmbootstrap.py --as-root checksum firmware-xiaomi-alioth
[13:51:38] Update package index for x86_64 (1 file(s))
[13:51:39] (native) Creating chroot
[13:51:41] (native) install abuild apk-tools build-base ccache git pigz
[13:51:43] (native) generate checksums for firmware-xiaomi-alioth
[13:51:43] NOTE: chroot is still active (use 'pmbootstrap shutdown' as necessary)
[13:51:43] DONE!
root@Home:/opt/pmbootstrap# ./pmbootstrap.py --as-root build firmware-xiaomi-alioth
[13:51:49] Zapping buildroots (running in strict mode by default, use --lax to skip zap)
[13:51:49] Update package index for aarch64 (1 file(s))
[13:51:51] NOTE: Package 'firmware-xiaomi-alioth' is up to date. Use 'pmbootstrap build firmware-xiaomi-alioth --force' if needed.
[13:51:51] DONE!
root@Home:/opt/pmbootstrap# ./pmbootstrap.py --as-root checksum linux-postmarketos-qcom-sm8250-alioth
[13:51:58] (native) Creating chroot
[13:51:58] (native) install abuild apk-tools build-base ccache git pigz
[13:52:00] (native) generate checksums for linux-postmarketos-qcom-sm8250-alioth
[13:52:01] NOTE: chroot is still active (use 'pmbootstrap shutdown' as necessary)
[13:52:01] DONE!
root@Home:/opt/pmbootstrap# ./pmbootstrap.py --as-root build linux-postmarketos-qcom-sm8250-alioth
[13:52:06] Zapping buildroots (running in strict mode by default, use --lax to skip zap)
[13:52:07] NOTE: Package 'linux-postmarketos-qcom-sm8250-alioth' is up to date. Use 'pmbootstrap build linux-postmarketos-qcom-sm8250-alioth --force' if needed.
[13:52:07] DONE!
root@Home:/opt/pmbootstrap# ./pmbootstrap.py --as-root checksum device-xiaomi-alioth
[13:52:15] (native) Creating chroot
[13:52:16] (native) install abuild apk-tools build-base ccache git pigz
[13:52:18] (native) generate checksums for device-xiaomi-alioth
[13:52:18] NOTE: chroot is still active (use 'pmbootstrap shutdown' as necessary)
[13:52:18] DONE!
root@Home:/opt/pmbootstrap# ./pmbootstrap.py --as-root build device-xiaomi-alioth
[13:52:27] Zapping buildroots (running in strict mode by default, use --lax to skip zap)
[13:52:27] NOTE: Package 'device-xiaomi-alioth' is up to date. Use 'pmbootstrap build device-xiaomi-alioth --force' if needed.
[13:52:27] DONE!
root@Home:/opt/pmbootstrap# ./pmbootstrap.py --as-root install
Choose a password for the user 'houzai':
Confirm password for 'houzai':
[13:52:47] *** (1/4) PREPARE NATIVE CHROOT ***
[13:52:47] (native) Creating chroot
[13:52:48] (native) install cryptsetup util-linux parted
[13:53:19] *** (2/4) CREATE DEVICE ROOTFS ("xiaomi-alioth") ***
[13:53:20] (native) install qemu-aarch64
[13:53:20] Register qemu binfmt (aarch64)
[13:53:20] (rootfs_xiaomi-alioth) Creating chroot
[13:53:25] (rootfs_xiaomi-alioth) install postmarketos-base-systemd
[13:55:00] (rootfs_xiaomi-alioth) install postmarketos-base device-xiaomi-alioth postmarketos-ui-phosh postmarketos-base-nofde sudo-rs phosh-mobile-settings phosh-tour cups decibels firefox-esr flatpak fprintd g4music gnome-calculator gnome-calendar gnome-clocks gnome-console gnome-contacts gnome-maps gnome-text-editor gnome-user-share gnome-weather gst-libav gst-plugins-bad gst-plugins-good gst-plugins-rs-dav1d gvfs-full loupe nautilus papers rygel showtime snapshot tuned-ppd font-droid font-droid-nonlatin font-twemoji lang font-droid font-droid-nonlatin font-twemoji lang calls chatty lpa-gtk mobile-config-firefox postmarketos-tweaks-setting-definitions ttyescape vvmplayer
[14:02:07] (rootfs_xiaomi-alioth) install postmarketos-mkinitfs
[14:02:08] (rootfs_xiaomi-alioth) mkinitfs
[14:02:14] *** SET LOGIN PASSWORD FOR: 'houzai' ***
[14:02:15] NOTE: No valid keymap specified for device
[14:02:32] *** (3/4) PREPARE INSTALL BLOCKDEVICE ***
[14:02:32] (native) create xiaomi-alioth.img (3264M)
[14:02:32] (native) mount /dev/install (xiaomi-alioth.img)
[14:02:32] (native) partition /dev/install (boot: 512M)
[14:02:32] Mounting partitions of /dev/loop0 inside the chroot
[14:02:32] (native) install e2fsprogs
[14:02:32] (native) format /dev/installp2 (pmOS_root, ext4)
[14:02:32] (native) mount /dev/installp2 to /mnt/install
[14:02:32] (native) install e2fsprogs
[14:02:33] (native) format /dev/installp1 (pmOS_boot, ext2)
[14:02:33] (native) create /etc/fstab
[14:02:33] (rootfs_xiaomi-alioth) mkinitfs
[14:02:40] *** (4/4) FILL INSTALL BLOCKDEVICE ***
[14:02:40] (native) copy rootfs_xiaomi-alioth to /mnt/install/
[14:02:44] (native) make sparse rootfs
[14:02:44] (native) install android-tools-img2simg
[14:02:48]
[14:02:48] *** FLASHING INFORMATION ***
[14:02:48] Run the following to flash your installation to the target device:
[14:02:48] * pmbootstrap flasher flash_rootfs
[14:02:48] Flashes the generated rootfs image to your device:
[14:02:48] /root/.local/var/pmbootstrap/chroot_native/home/pmos/rootfs/xiaomi-alioth.img
[14:02:48] (NOTE: This file has a partition table, which contains /boot and / subpartitions. That way we don't need to change the partition layout on your device.)
[14:02:48] * pmbootstrap flasher flash_kernel
[14:02:48] Flashes the kernel + initramfs to your device:
[14:02:48] /root/.local/var/pmbootstrap/chroot_rootfs_xiaomi-alioth/boot
[14:02:48] (NOTE: fastboot also supports booting the kernel/initramfs directly without flashing. Use 'pmbootstrap flasher boot' to do that.)
[14:02:48] * If the above steps do not work, you can also create symlinks to the generated files with 'pmbootstrap export' and flash outside of pmbootstrap.
[14:02:48]
[14:02:48] *** SSH DAEMON INFORMATION ***
[14:02:48] SSH daemon is enabled (disable with --no-sshd).
[14:02:48] Login as 'houzai' with the password given during installation.
[14:02:48]
[14:02:48] *** FIREWALL INFORMATION ***
[14:02:48] Firewall is enabled, but may not work (couldn't determine if kernel supports nftables).
[14:02:48] For more information: https://postmarketos.org/firewall
[14:02:48]
[14:02:48] NOTE: chroot is still active (use 'pmbootstrap shutdown' as necessary)
[14:02:48] DONE!
二 刷机
Windows → USB → WSL2
Windows 安装 usbipd-win
打开 PowerShell(管理员),执行:
winget install --exact --id dorssel.usbipd-win
安装完成后,关闭当前 PowerShell,重新打开一个管理员 PowerShell。
验证:
usbipd --version
手机进入 Fastboot
你的 Xiaomi alioth 手机进入 Fastboot:
关机
↓
按住 音量下 + 电源
↓
进入 FASTBOOT
然后 USB 线连接 Windows。
Windows 查看 USB
管理员 PowerShell:
PS C:\Users\houzai> usbipd --version
5.3.0-54+Branch.master.Sha.aa3db8b82c4cb5071fd31bc54211606c70886912.aa3db8b82c4cb5071fd31bc54211606c70886912
PS C:\Users\houzai> usbipd list
Connected:
BUSID VID:PID DEVICE STATE
1-2 0000:0003 未知 USB 设备(配置描述符请求失败) Not shared
1-8 0b05:19af AURA LED Controller, USB 输入设备 Not shared
1-14 8087:0026 英特尔(R) 无线 Bluetooth(R) Not shared
2-2 1c4f:0002 USB 输入设备 Not shared
2-4 24ae:1100 USB 输入设备 Not shared
3-2 18d1:d00d @oem30.inf,%USB\VID_18D1&PID_D00D.DeviceDescTest% Not shared
Persisted:
GUID DEVICE
PS C:\Users\houzai> usbipd attach --wsl --busid 3-2
usbipd: info: Using WSL distribution 'Ubuntu' to attach; the device will be available in all WSL 2 distributions.
usbipd: info: Loading vhci_hcd module.
usbipd: info: Detected networking mode 'mirrored'.
usbipd: info: Using IP address 127.0.0.1 to reach the host.
PS C:\Users\houzai> usbipd list
Connected:
BUSID VID:PID DEVICE STATE
1-2 0000:0003 未知 USB 设备(配置描述符请求失败) Not shared
1-8 0b05:19af AURA LED Controller, USB 输入设备 Not shared
1-14 8087:0026 英特尔(R) 无线 Bluetooth(R) Not shared
2-2 1c4f:0002 USB 输入设备 Not shared
2-4 24ae:1100 USB 输入设备 Not shared
3-2 18d1:d00d @oem30.inf,%USB\VID_18D1&PID_D00D.DeviceDescTest% Shared