Fix unbootable image: restore kernel/module ABI compatibility

The previous battery pass rebuilt the kernel image from a retuned config and
produced an image stuck on the lk2nd logo. Two incompatibilities with the
linux-postmarketos-qcom-msm8916 module tree (which this repo does not rebuild)
were identified:

1. Vermagic: CONFIG_PREEMPT_VOLUNTARY removes CONFIG_PREEMPT_BUILD, so the
   rebuilt kernel reported "6.12.1-msm8916 SMP mod_unload ARMv7 p2v8" while
   every package module reports "6.12.1-msm8916 SMP preempt mod_unload ARMv7
   p2v8". modprobe refuses all of them, including panel-mipi-dbi, so the
   display never initialises.
2. Struct layout: CONFIG_SUSPEND selects CONFIG_PM_SLEEP, which adds fields to
   struct dev_pm_info. Modules built without it use wrong dev->power offsets,
   so matching vermagic alone is not enough.

Restored the known-good kernel config, the serial-console cmdline and the DTB
wakeup-source additions. The kernel image is still cross-compiled by
build-kernel-audio.sh but from the original config, so vermagic and struct
layouts match every module in the rootfs. Reverted the config-level items K1,
K6, K7, K8, K13 and K14; implementing them requires vendoring and rebuilding
the entire pmaports kernel module tree.

Kept: K2 clock-latency-ns, K3/K4/K5 via patch 0006 (rebuilt with the original
config), K10 IPv6 sysctl, and all U1-U14 userspace changes.

Rebuilt the kernel image/modules/DTBs and images/bananarchy-nokia-argon.img
with --mkinitfs. Verified: all modules (package + rebuilt) now report identical
vermagic, boot.img contains the new zImage + DTB byte-for-byte, the console
cmdline is restored, check-rebuild.sh passes and artifact drift is 0.

Docs: CHANGELOG.md (recovery section), MANUAL.md, README.md, AGENTS.md,
BATTERY-OPTIMIZATION-ANALYSIS.md (section 11).
This commit is contained in:
Bantam committed 2026-11-07 17:32:03 +02:00
1 parent ad3461babf
commit 0dbb37fba3
127 files changed
+190712 -136883

No files matched your search

+48
View File
@@ -9,6 +9,54 @@ Release versions follow the `<year-letter><MM><DD>` format (where `2026` is `a`,
---
## Unreleased — recovery: restore the known-good kernel (module ABI)
**The previous battery pass produced an unbootable image.** Two independent incompatibilities
between a custom-built kernel and the `linux-postmarketos-qcom-msm8916` package module tree were
found and are the reason for this revert:
- **Vermagic**: switching `CONFIG_PREEMPT=y` -> `CONFIG_PREEMPT_VOLUNTARY=y` removes
`CONFIG_PREEMPT_BUILD`, changing module vermagic from
`6.12.1-msm8916 SMP preempt mod_unload ARMv7 p2v8` to
`6.12.1-msm8916 SMP mod_unload ARMv7 p2v8`. Every module shipped by the pmaports kernel
package (`panel-mipi-dbi`, `qrtr`, `bam_dmux`, `rpmsg_wwan_ctrl`, `gpio-keys`, ...) then
fails to load, so the display never initialises and the phone stays on the lk2nd logo.
- **Struct layout**: `CONFIG_SUSPEND=y` selects `CONFIG_PM_SLEEP`, which adds fields to
`struct dev_pm_info` (embedded in `struct device`). Modules built without it have wrong
`dev->power.*` offsets, so matching vermagic alone is not enough.
Therefore the kernel config, the serial-console cmdline and the DTB `wakeup-source` additions
were restored to the known-good `a1105` state. The kernel image is still cross-compiled from
`config-bananarchy-msm8909.armv7` by `build-kernel-audio.sh`, but with the original config, so
its vermagic and struct layouts match every module in the rootfs. **K1, K6, K7, K8, K13 and
K14 (config-level) are reverted**; implementing them properly requires vendoring and rebuilding
the *entire* kernel module tree, not just the ~32 modules this repo builds.
Kept (verified safe, no kernel-config dependency):
- K2 `clock-latency-ns` in all 5 device trees (fixes `CPUFREQ_ETERNAL` at its source).
- K3/K4/K5 via `patches/kernel/0006` (wcn36xx keep-alive/listen interval, VM-BMS sample
interval and uevent throttling, GPU devfreq polling) — rebuilt with the original config, so
module ABI matches.
- K10 IPv6 sysctl, K12 deferred, all U1-U14 userspace changes (deployed and tested on the
phone before the reflash).
- `overlay/rootfs/boot/{vmlinuz,config,System.map}` are regenerated from the known-good config.
Deep standby (U2) remains shipped disabled via `/etc/bananarchy-no-deep-standby` and is inert
on this kernel because `/sys/power/state` has no sleep states.
Verification of the recovery build:
- `modinfo` on a rebuilt module, on an untouched package module and on the regenerated kernel
all report `6.12.1-msm8916 SMP preempt mod_unload ARMv7 p2v8` (previously the rebuilt kernel
reported `SMP mod_unload ARMv7 p2v8`).
- Rebuilt `images/bananarchy-nokia-argon.img` (1.6 GiB) with `--mkinitfs`; the regenerated
`boot.img` contains the new `zImage` + DTB byte-for-byte and the restored
`earlycon console=ttyMSM0,115200` cmdline. `check-rebuild.sh` passes and artifact drift is 0.
- Boot-testing over `fastboot boot` was attempted on the connected device (lk2nd fastboot,
`18d1:d00d`) but lk2nd stalled during the 18 MB download, so the fix still needs a full
reflash to confirm on hardware.
---
## Unreleased — measurement-corrected battery optimization pass
Analysis: `BATTERY-OPTIMIZATION-ANALYSIS.md` (corrected against the connected `nokia-argon`,