Turning a Redmi K30 Pro / POCO F2 Pro (lmi, Qualcomm SM8250 / Snapdragon 865)
into a native Linux device with postmarketOS. The archived stable baseline
uses the downstream LineageOS 4.19 vendor kernel with Clang/LLVM under
WSL2 + pmbootstrap. The project now tracks two separate version lines:
- Downstream (
D-vNN): LineageOS 4.19 downstream kernel, currently highest artifactD-v46; strongest verified hardware milestoneD-v43with Wi-Fi interfaces and scan working. - Mainline/copydown (
M-rNN): SM8250 mainline/copydown path, currently recorded throughM-r7; host-side builds and guarded writes work, but no observable initramfs/USB milestone is proven.
- ✅ Kernel + DTBs + full image build (Clang/LLVM, pmbootstrap).
- ✅ Rootfs mounts on real hardware from
userdatausing nested GPT loop partitions (/dev/loop0p2as/,/dev/loop0p1as/boot). - ✅ Normal userspace + SSH works on the downstream v27 baseline, including
prior RAM-only
fastboot bootvalidation. - ✅ USB networking works on Windows as RNDIS gadget
(
0525:a4a2 POSTMARKETOS, host172.16.42.2, device172.16.42.1). - ✅ Persistent downstream v27 boot was installed:
bootanduserdataboot into postmarketOS withoutfastboot boot. - ✅ Downstream Wi-Fi bring-up works at
D-v43:wlan0,p2p0, andwifi-aware0appear, CNSS staysONLINEwithcrash_count=0, andiw dev wlan0 scansucceeds. - ⏳ Latest downstream artifact is
D-v46(v46-daemon-status-idempotent); it is a cleanup build after the verified Wi-Fi path, with no separate runtime verification found in this repo. ⚠️ Mainline/copydown reachedM-r7but is not boot-verified.M-r6andM-r7writes were accepted, but reboot testing stopped at the Redmi logo with no postmarketOS USB, telnet, SSH, ADB, or fastboot interface observed.- ⏳ Display userspace takeover — kernel DRM/KGSL and the DSI panel are present, but the screen remains on the Redmi logo because no compositor takes over the continuous splash.
- ⏳ Audio / mic and Bluetooth — next hardware focus. ALSA has no soundcard and Bluetooth remains incomplete; Wi-Fi has a verified downstream bring-up path but still needs service and policy cleanup.
Start with the track index:
docs/tracks/README.md— version-label rules and file placement.docs/tracks/downstream.md— downstreamD-vNNfeatures and progress.docs/tracks/mainline.md— mainline/copydownM-rNNfeatures and progress.
The mainline/copydown release records are still archived under docs/release/.
Large images are not committed; release identity and hardware gates are
documented in:
docs/release/lmi-r6-bootmem-release-manifest-20260624.mddocs/release/lmi-r6-bootmem-execution-checklist-20260624.mddocs/release/lmi-r7-earlydebug-build-result-20260624.md
The lmi-r6-current-handoff-20260624.md file is older than the r6/r7 result
documents; prefer the per-result release records when judging current state.
Static release checks can be run locally with
scripts/59_release_static_ci.sh. A GitHub Actions workflow template is kept at
docs/release/edge-release-checks.workflow.yml;
copy it to .github/workflows/ only with a token that has workflow scope.
To refresh all local r6 release reports and docs, run
scripts/62_refresh_lmi_release_docs.sh --quick.
The reusable host-side automation loop is documented in
docs/mainline-automation-loop-20260624.md.
Use scripts/68_mainline_progress_loop.sh --once --quick for the default
read-only loop, and scripts/69_audit_lmi_resources.sh --network when local
mainline resources need to be compared with remote repository refs.
docs/porting-sm8250-downstream-to-postmarketos.md
— the field log of every non-obvious problem and its fix (SELinux host tools,
kheaders, the LLVM ld config trap, building/installing the qcom overlay DTBs,
deviceinfo_dtb for header-v2 + overlay devices, WSL/usbipd papercuts), plus the
complete working APKBUILD. Most of it applies to any SM8250 / downstream-MSM
device, not just lmi. (中文版)
The postmarketOS packaging that produces a bootable image:
artifacts/wsl-pmaports/linux-xiaomi-lmi/— kernel package (APKBUILD, mergedconfig-xiaomi-lmi.aarch64) withdevtmpfsand configfs RNDIS enabled.artifacts/wsl-pmaports/device-xiaomi-lmi/— device package (deviceinfo,modules-initfs) configured for 4096-byte rootfs image sectors and RNDIS USB networking.
Kernel source: LineageOS/android_kernel_xiaomi_sm8250 @ a5b3099
(matches the stock 4.19.325-cip128-st12-perf-ga5b3099017ae).
# in WSL, with pmbootstrap configured for the downstream v27 xiaomi-lmi baseline
pmbootstrap checksum linux-xiaomi-lmi
pmbootstrap build linux-xiaomi-lmi # ~16 min cold
pmbootstrap checksum device-xiaomi-lmi
pmbootstrap build device-xiaomi-lmi
pmbootstrap install --no-fde
pmbootstrap export # -> /tmp/postmarketOS-export/
fastboot boot /tmp/postmarketOS-export/boot.img # RAM only; writes nothingFor the mainline/copydown r6 route, use the release checklist instead of the
downstream quick recipe. The staged persistent path is documented in
docs/release/lmi-r6-bootmem-execution-checklist-20260624.md.
docs/— the porting write-up (EN + 中文) and the pmaports MR notes.docs/tracks/— current downstream/mainline split, version labels, features, and progress.artifacts/wsl-pmaports/— the device + kernel pmaports packages.artifacts/mainline-pmaports/— imported mainline package references.artifacts/kernel-source/— config fragments and device-tree evidence used to derive the kernel config.artifacts/images/— local image artifacts and manifests; seeartifacts/images/README.md.notes/— compact archive notes for the current v27 baseline, rollback plan, and hardware enablement plan.scripts/— current WSL/device helper scripts for rebuilding v27/v28, checking exported images, collecting hardware evidence, and staging guarded mainline/copydown operations; seescripts/README.md.
The downstream line has moved from boot/rootfs repair into hardware enablement. The immediate targets are:
- display: start a minimal compositor or DRM/KMS test so userspace visibly takes over the panel;
- sound and microphone: restore ADSP/audio firmware/service bring-up until ALSA
exposes real cards instead of
auto_null; - networking: verify
D-v46if it should replace the verifiedD-v43Wi-Fi bring-up, then clean up service status and NetworkManager MAC behavior; - Bluetooth: unblock and initialize BT after WLAN/firmware service dependencies are understood.
The latest downstream Wi-Fi evidence is summarized in
notes/wifi-bringup-live-2026-06-24.md.
The stable v27 baseline remains summarized in
notes/archive-summary-2026-06-23.md.
The hardware enablement workflow is tracked in
docs/hardware-enablement-workflow.md,
docs/hardware-enablement-subagents.md,
and
notes/hardware-enablement-queue-2026-06-23.md.
This project never flashes the phone without an explicit decision and a
confirmed recovery path. userdata rootfs writes were performed only after
explicit confirmation. The v27 boot partition write was also performed only
after explicit confirmation. dtbo, vbmeta, super, modem/EFS, and
calibration partitions have not been written. The install plan and rollback
notes are in
notes/flash-plan-2026-06-17.md and the dated
repair notes under notes/.
Stock/recovery boot images for the device (proprietary third-party binaries), full pmOS images, and rejected flash candidates are not distributed here — they are gitignored. Raw device logs (which contain serial numbers, CPU IDs, bootloader tokens, and MAC addresses) are gitignored too. Only explicitly redacted logs may be committed.
MIT for the original work here (notes, scripts, recipes); the kernel and its derived config are GPL-2.0. See LICENSE and NOTICE.