Integrate boot and shutdown runtime into new images

This commit is contained in:
Sukecz
2026-10-23 20:28:26 +02:00
parent b7eb4289b7
commit 9c49f58b33
27 changed files with 1087 additions and 80 deletions
+30 -21
View File
@@ -1,8 +1,9 @@
# Building Platina Linux
This is a source-only development port. The candidate kernel builds, but the new
integrated Tianma display still needs its first successful physical boot test.
An image built here is a candidate, not a ready-made stable release.
This is a source-only development port. Integration 0.3.0 and kernel 7.2.12-r1
were physically tested on a Tianma Mi 8 Lite. Source version 0.3.1 integrates
that runtime into newly built images; the new full image still requires its own
hardware acceptance. There is no ready-made stable release.
## Build host
@@ -14,14 +15,14 @@ On Debian/Ubuntu, typical host tools are:
```sh
sudo apt install git python3 make sudo openssh-client e2fsprogs util-linux kmod mtools fastboot
# Optional: only needed for make splash / custom image conversion.
# Required for the versioned boot/shutdown screens included by make images.
sudo apt install python3-pil fonts-dejavu-core
```
`make doctor` reports missing core tools without installing them. Kernel compilers
and package dependencies are installed inside the build chroots by pmbootstrap.
Python's standard library is enough for the basic offline test suite; image
conversion uses Pillow on the build host.
Python's standard library is enough for the basic offline test suite; the image
runtime integration tests and full image builder also need Pillow and DejaVu Sans.
## Personal build inputs
@@ -77,26 +78,33 @@ The builder stops pmbootstrap mounts before copying/hashing filesystem images.
Source revisions are pinned, but external Alpine repositories/toolchain packages
are not fully frozen; bit-for-bit reproducible full builds are not promised.
## Scope initramfs module indexes
## Integrated runtime and initramfs audit
`make images` builds the versioned boot logo and Power off screen, installs the
Python display/shutdown helpers and headless hook, and enables the OpenRC
Power + Volume Up service with the verified three-second policy. The image audit
checks file hashes, decoded frames, permissions and service links without touching
the display or invoking shutdown. No experimental PMIC module is included.
The USB current helper and NetworkManager dispatcher are also included. They are
inert without a separately supplied `/etc/platina/usb-power.json` policy; no host
identity or increased-current allowance is cloned from the development phone.
Wi-Fi credentials and monitoring credentials also remain per-installation inputs.
The mkinitfs version used by this port can copy full-rootfs module indexes into
an initramfs containing only some modules. Before booting or flashing, regenerate
indexes for the modules that are actually included:
an initramfs containing only some modules. The builder automatically regenerates
indexes for the modules actually included in the exported boot image. The final
boot.img and initramfs are hashed only after this correction. The unmodified
pmbootstrap export links are intermediate files, not the accepted output bundle.
```sh
python3 scripts/scope-initramfs-modules.py artifacts/candidate-local/boot.img \
--release 7.2.12-sdm660 --output artifacts/candidate-local-scoped
make verify DIR=artifacts/candidate-local-scoped
```
Use **candidate-local-scoped/boot.img** with **candidate-local/xiaomi-platina.img**.
The scoping tool preserves the kernel, DTB and rootfs command line; it does not
create a second root filesystem and does not flash anything.
Use boot.img and xiaomi-platina.img from the **same final candidate-local bundle**.
For manually exported older images, `scripts/scope-initramfs-modules.py` remains
available. The correction preserves the kernel, DTB and rootfs command line.
Exported files include boot.img, xiaomi-platina.img, initramfs, kernel and DTB.
Keep the manifest and corresponding APKs for your own rollback records.
## Optional display assets
## Separate display asset bundles
```sh
make splash
@@ -104,5 +112,6 @@ python3 scripts/prepare-display-frame.py your-image.png --output artifacts/custo
```
The original logo is preserved; the integration version is added during rendering.
These commands create local bundles. `make images` does not yet install the
versioned splash bundle automatically; see [display setup](DISPLAY.md).
These commands create separate local bundles for review or an explicitly planned
existing-installation update. A fresh `make images` already includes both release
screens. See [display setup](DISPLAY.md) and [shutdown behavior](SHUTDOWN.md).
+21 -10
View File
@@ -5,8 +5,9 @@ has two separate states:
| State | Status |
|---|---|
| Integration 0.1.1 logo with a temporary LCD power/wake helper | 🟢 Physically verified, including automatic start and subsequent backlight shutdown |
| Integrated driver / DT in kernel 7.2.12-r1 | 🟠 Compiled and audited offline; physical boot and power cycles pending |
| Integration 0.1.1 temporary LCD power/wake helper | Historical fallback, superseded on the tested phone |
| Integration 0.2.0, integrated driver / DT in kernel 7.2.12-r1 | 🟢 RAM boot, normal boot, logo, brightness and ten off/on cycles physically verified |
| Complete LCD rail shutdown | 🟠 Driver votes released, but VSP/VSN remain fixed always-on |
The candidate is in `ports/candidate/linux-postmarketos-qcom-sdm660/0030-platina-tianma-panel.patch`.
It adds the panel-specific command sequence, correct regulator names, reset timing,
@@ -14,7 +15,15 @@ DT binding and initialization-error cleanup to the NT36672A driver. The stock
command sequence is recorded in `project/display/tianma-reference.json` and
compared by offline tests. This is not a verified BOE TD4320 configuration.
## Optional controller setup
## Built-in controller and screens
From source version 0.3.1, fresh `make images` builds include the controller,
headless boot hook, versioned boot logo and shutdown screen automatically.
Hardware verification of integration 0.3.0 does not qualify every new full image.
The following manual steps are for an existing installation that lacks those
files; they are not required after installing a newly integrated image.
## Manual controller setup for an existing installation
After testing a successful boot with the integrated driver, install the renderer
and controller on **your phone**. The files listed below are source files from
@@ -27,9 +36,9 @@ sudo install -m755 phone-display.py /usr/local/sbin/platina-display
```
For the logo, run `make splash` on the build host. Transfer its three runtime files
`release.json`, `version` and `frame.bgrx.gz` from `artifacts/platina-linux-0.1.1/`
into a new phone directory `/usr/local/share/platina/releases/0.1.1/`, then create
`/usr/local/share/platina/current` pointing to `releases/0.1.1`. If updating an
`release.json`, `version` and `frame.bgrx.gz` from `artifacts/platina-linux-0.2.0/`
into a new phone directory `/usr/local/share/platina/releases/0.2.0/`, then create
`/usr/local/share/platina/current` pointing to `releases/0.2.0`. If updating an
existing setup, back up its assets/hook first and use a new versioned directory.
The phone renderer uses Python's standard library, without Pillow or a desktop.
@@ -51,7 +60,9 @@ lock. An external SIGKILL cannot run Python cleanup.
`off` requests `FB_BLANK_POWERDOWN` through DRM after clearing the backlight.
A brightness value of zero alone is not proof that the LCD rails are powered off.
Regulator counts and actual repeated wake behavior must be checked on the device.
Tests on the maintainer's phone confirmed all three driver consumer votes return
to zero and vddio is released. VSP/VSN still use inherited fixed always-on
definitions, so full physical rail shutdown and power savings are not established.
Prepare another image on the build host:
@@ -71,9 +82,9 @@ new controller. On the old boot it selects the temporary session only when that
kernel-specific module was explicitly installed. Do not install the old helper
blindly, or auto-load it alongside the integrated driver.
Only install the hook after manual rendering and powerdown have worked. The
current clean-image builder keeps the backlight dark and does not automatically
install a generated splash bundle. SSH must remain independent of splash success.
For a manual existing-installation update, install the hook only after rendering
and powerdown have worked. The clean-image builder installs the full hook and
both screens; SSH remains independent of splash success.
## Hardware acceptance
+5 -4
View File
@@ -1,8 +1,9 @@
# Install Linux on Xiaomi Mi 8 Lite (platina)
**Development port.** The maintainer's existing installation boots and provides
SSH, but the checked-in integrated Tianma display candidate has not yet passed
its physical boot/power-cycle test. There is no supported prebuilt installer.
SSH; kernel 7.2.12-r1 and integration 0.3.0 passed physical Tianma display and
shutdown tests. New full images built from 0.3.1 have a separate acceptance
requirement. There is no supported prebuilt installer.
Build your own images using [BUILDING.md](BUILDING.md).
These steps are for a **fresh installation** on **Mi 8 Lite / platina**.
@@ -51,9 +52,9 @@ The examples below assume these files exist:
```sh
ROOTFS=artifacts/candidate-local/xiaomi-platina.img
BOOT=artifacts/candidate-local-scoped/boot.img
BOOT=artifacts/candidate-local/boot.img
make verify DIR=artifacts/candidate-local
make verify DIR=artifacts/candidate-local-scoped
make audit DIR=artifacts/candidate-local
```
The boot command line must refer to the UUID of that root filesystem. Do not mix
+36
View File
@@ -0,0 +1,36 @@
# Shutdown buttons and screen
The tested Mi 8 Lite uses **Power + Volume Up** for an orderly Linux shutdown.
The OpenRC service `platina-power-chord` is enabled in newly built images.
1. Disconnect USB/the charger so the phone runs on its battery.
2. Hold Power and Volume Up together for at least three seconds.
3. Release both buttons. The Platina logo, version and Power off screen appear
while Linux shuts down. On battery, the tested phone stays off.
With USB power attached, shutdown still runs, but the bootloader starts the phone
again in charger mode and Linux boots normally. This is an accepted limitation.
Reconnecting a charger can also start the phone. There is no automatic waiting
for cable removal and no separate charging-only operating mode.
The service uses both evdev inputs. Short combinations, individual keys, repeats
and lost input events do not request shutdown. It acts only after both keys have
been released. This requires a running kernel and userspace service; it is not
an independent emergency power cut for a frozen phone. Existing long-Power reset
and bootloader key combinations are unchanged.
The screen indicates shutdown is in progress. Physical darkness alone is not
proof that the phone is fully off. Integration 0.3.0 was physically verified;
the 0.3.1 fresh-image packaging is verified separately without flashing a phone.
For diagnosis on a phone running a newly built 0.3.1 image:
```sh
rc-service platina-power-chord status
sudo platina-poweroff --preview
sudo python3 /usr/local/libexec/platina-image-runtime audit
```
Preview only shows the screen for five seconds. The audit reads installed files
and checksums without accessing display/input hardware or requesting shutdown.
The image runtime contains no experimental PMIC module or PMIC autoload rule.