Implement 0012 72h standby battery optimizations and initramfs depmod hook

- Add patches/kernel/0012-msm8909-standby-wifi-wcd-panel-ldo-bms.patch, rebuild affected kernel/module artifacts and all six device DTS/DTB files (msm8916-wcd-analog s2/bias gating, wcn36xx offload_sync_work and healthy-RSSI screen_off_offload scan short-circuit, pm8916_bms_vm screen_off FORCE_S3 OCV mode, panel-mipi-dbi dc/reset low on blank, spi-qup runtime PM sleep pinctrl, PM8909 l1/l4 LDO seeding, and sdhci-msm vmmc/vqmmc set_load with regulator-allow-set-load on l8/l12), and switch msm8905-cam from direct APSS SPMI LDO6/LDO17 writes to RPM regulator consumer voting.

- Update standby power policy and compiled C daemons (WIFI_LISTEN_INTERVAL=8, WIFI_STANDBY_RAT=gsm with CS verification and fallback, 10-bananarchy-dpm.sh wifi-up/unpark-rat dispatch, 25 s boot QRTR wait and QMI DMS online recovery, pm8916_bms_vm screen_off sync, bananarchy-run-aligned dark-screen skip, bananarchy-dsds --sig-hysteresis, bananarchy-cover-idle wake_blank_timeout = 8, and scripts/test-standby-power-policy.py).

- Add overlay/rootfs/etc/boot-deploy/hooks/10-initramfs-depmod.sh to run depmod -b per staged initramfs cpio archive and eliminate Stage 2 udevd missing-module boot console errors, enforce .ko.zst-only module installs in apply-bananarchy-overlay.sh, stage Alpine 3.24 /usr/lib/{libz,libcrypto}.so* in rebuild-image.sh chroot with failure cleanup, and add initramfs cpio guards plus verified image hashes in scripts/check-rebuild.sh.

- Document all changes under Unreleased in CHANGELOG.md and synchronize AGENTS.md, MANUAL.md, and BATTERY-OPTIMIZATION-ANALYSIS.md.
This commit is contained in:
Luxferre committed 2026-11-15 14:46:50 +02:00
1 parent 9700949b28
commit fc5c4282f5
67 files changed
+67482 -65598

No files matched your search

@@ -4,9 +4,7 @@ level=OFF
[connection]
wifi.powersave=3
[device]
# U8: roam scans are expensive on wcn36xx; 10 min while associated.
wifi.scan-interval=600
# Associated multi-channel background roam scans are suppressed in kernel
# wcn36xx while screen_off_offload=Y and RSSI is healthy.
[connectivity]
enabled=false
@@ -2,6 +2,14 @@
# Ensure the QMI BAM-DMUX data port is open on cellular up; never close it on
# down because unregistering net/wwan0 causes ModemManager (qcom-soc) to drop
# the modem object, and bam-dmux already runtime-suspends in 1000 ms when idle.
# Unpark standby RAT immediately if Wi-Fi drops while the flip is closed.
if [ "$1" = "wlan0" ]; then
case "$2" in
down|pre-down) /usr/bin/bananarchy-power-policy.sh unpark-rat >/dev/null 2>&1 & ;;
up|dhcp4-change) /usr/bin/bananarchy-power-policy.sh wifi-up >/dev/null 2>&1 & ;;
esac
exit 0
fi
[ "$1" = "qrtr0" ] || [ "$1" = "wwan0" ] || exit 0
case "$2" in
up|vpn-up) /usr/bin/bananarchy-dpm.sh open ;;
@@ -6,7 +6,7 @@
# wakeups but delay inbound packets. 0 removes the module option and uses
# the driver default. Applied at module load, so changes need a reboot or
# a wcn36xx module reload.
WIFI_LISTEN_INTERVAL=5
WIFI_LISTEN_INTERVAL=8
# Qualcomm modem DRX mode via AT$QCDRX (0, 6-9). 0 = firmware DSDS paging
# default (avoids competing with ModemManager on open /dev/wwan0at* ports).
@@ -39,5 +39,6 @@ WIFI_SCREEN_OFF_IPV6_MUTE=1
# Opt-in modem RAT parking while the screen is off and wlan0 is up:
# keep = keep current RAT preference (default)
# gsm = park NAS mode preference to GSM after 30 s dark on Wi-Fi, restore on wake
WIFI_STANDBY_RAT=keep
# gsm = park NAS mode preference to GSM after 45 s dark on Wi-Fi (with CS
# registration verification and auto-fallback on 2G-sunset networks)
WIFI_STANDBY_RAT=gsm
@@ -81,6 +81,9 @@ brightness = 160
# Follow Config -> Screen blank (~/.config/sxmo/idle_blank_timeout, default
# 300 s, 0 = never). A numeric value here overrides it for the cover panel.
blank_timeout = auto
# Cap passive closed-flip wakes (BUTTON/WAKE/NOTIFY/SMS) to 8 s so checking
# the outer clock never burns 30+ s of display + X11 power.
wake_blank_timeout = 8
# Optional sysfs node for a separate legacy cover backlight. Empty on the
# shipping image: the kernel backend uses kernel_backlight_path above.
backlight_path =
+166
View File
@@ -0,0 +1,166 @@
#!/bin/sh
set -eu
# Rebuild modules.dep* and modules.alias* inside each initramfs cpio archive
# so udevd does not try to load modules absent from the initramfs image.
resolve_depmod() {
for cand in /tmp/hostbin/depmod /sbin/depmod /usr/sbin/depmod; do
if [ -x "$cand" ]; then
printf '%s\n' "$cand"
return 0
fi
done
if command -v depmod >/dev/null 2>&1; then
command -v depmod
return 0
fi
return 1
}
DEPMOD_BIN=$(resolve_depmod || true)
if [ -z "$DEPMOD_BIN" ]; then
echo "10-initramfs-depmod: depmod not found" >&2
exit 1
fi
collect_targets() {
if [ "$#" -gt 0 ]; then
for arg in "$@"; do
if [ -f "$arg" ]; then
printf '%s\n' "$arg"
fi
done
return 0
fi
if [ -n "${work_dir:-}" ] && [ -d "${work_dir:-}" ]; then
name="${initfs_filename:-initramfs}"
if [ -f "$work_dir/$name" ]; then
printf '%s\n' "$work_dir/$name"
fi
if [ -f "$work_dir/${name}-extra" ]; then
printf '%s\n' "$work_dir/${name}-extra"
fi
return 0
fi
for search_root in "${TMPDIR:-/tmp}" /tmp; do
[ -d "$search_root" ] || continue
for dir in "$search_root"/*; do
[ -d "$dir" ] && [ ! -L "$dir" ] || continue
case "$dir" in
*/hostbin|*/initramfs-depmod.*)
continue
;;
esac
[ -f "$dir/initramfs" ] || continue
has_vmlinuz=0
for kern in "$dir"/vmlinuz*; do
if [ -f "$kern" ]; then
has_vmlinuz=1
break
fi
done
[ "$has_vmlinuz" -eq 1 ] || continue
printf '%s\n' "$dir/initramfs"
if [ -f "$dir/initramfs-extra" ]; then
printf '%s\n' "$dir/initramfs-extra"
fi
done
[ "$search_root" = "/tmp" ] && break
done
}
verify_modules_dep() {
moddir="$1"
depfile="$moddir/modules.dep"
if [ ! -s "$depfile" ]; then
echo "10-initramfs-depmod: empty modules.dep in $moddir" >&2
return 1
fi
while IFS= read -r line; do
[ -n "$line" ] || continue
for tok in $line; do
tok="${tok%:}"
[ -n "$tok" ] || continue
if [ ! -e "$moddir/$tok" ]; then
echo "10-initramfs-depmod: missing module in initramfs: $tok" >&2
return 1
fi
done
done < "$depfile"
}
process_archive() {
case "$1" in
/*)
archive="$1"
;;
*)
archive="$(pwd)/$1"
;;
esac
[ -f "$archive" ] || return 0
work=$(mktemp -d /tmp/initramfs-depmod.XXXXXX)
stage="$work/stage"
out="$work/initramfs.new"
mkdir -p "$stage"
if ! (cd "$stage" && gzip -dc "$archive" | cpio -idm 2>/dev/null); then
rm -rf "$work"
echo "10-initramfs-depmod: failed to unpack $archive" >&2
return 1
fi
repacked=0
for base in "$stage/usr/lib/modules" "$stage/lib/modules"; do
[ -d "$base" ] && [ ! -L "$base" ] || continue
for moddir in "$base"/*; do
[ -d "$moddir/kernel" ] || continue
kver="${moddir##*/}"
if ! "$DEPMOD_BIN" -b "$stage" "$kver"; then
rm -rf "$work"
echo "10-initramfs-depmod: depmod failed for $kver in $archive" >&2
return 1
fi
if ! verify_modules_dep "$moddir"; then
rm -rf "$work"
return 1
fi
repacked=1
done
done
if [ "$repacked" -eq 1 ]; then
if ! (
cd "$stage" &&
find . | sed -e '/^\.$/d' -e 's|^\./||' | LC_ALL=C sort |
cpio -o -H newc 2>/dev/null | gzip -n -6 > "$out"
); then
rm -rf "$work"
echo "10-initramfs-depmod: failed to repack $archive" >&2
return 1
fi
chmod 0644 "$out"
mv -f "$out" "$archive"
fi
rm -rf "$work"
}
targets=$(collect_targets "$@")
if [ -z "$targets" ]; then
if [ "$#" -gt 0 ]; then
echo "10-initramfs-depmod: no readable target archive in arguments" >&2
exit 1
fi
echo "10-initramfs-depmod: no initramfs staging archive found" >&2
exit 1
fi
printf '%s\n' "$targets" | while IFS= read -r target; do
[ -n "$target" ] || continue
process_archive "$target"
done
@@ -12,6 +12,6 @@ depend() {
start() {
ebegin "Selecting UIM slot"
SIM_WAIT_TIME="${sim_wait_time:-4}" timeout 15 /usr/libexec/msm-modem-uim-selection boot >/dev/null 2>&1 || true
SIM_WAIT_TIME="${sim_wait_time:-4}" timeout 25 /usr/libexec/msm-modem-uim-selection boot >/dev/null 2>&1 || true
eend 0
}
@@ -18,7 +18,7 @@ start() {
QMICLI_MODEM=""
count=0
while [ -z "$QMICLI_MODEM" ] && [ "$count" -lt 15 ]; do
while [ -z "$QMICLI_MODEM" ] && [ "$count" -lt 25 ]; do
if timeout 3 qmicli --silent -pd qrtr://0 --uim-noop >/dev/null 2>&1; then
QMICLI_MODEM="timeout 4 qmicli --silent -pd qrtr://0"
break
@@ -1,2 +1,2 @@
# Generated by bananarchy-power-policy.sh from /etc/bananarchy-power-policy.conf
options wcn36xx listen_interval=5
options wcn36xx listen_interval=8