Powere management - make it conditional, enable on UEFI targets, else disabled

This commit is contained in:
Igor Pecovnik 2025-11-18 09:08:10 +01:00 committed by Igor
parent 23dc0cc27c
commit 39d6bc8148
3 changed files with 25 additions and 10 deletions

View File

@ -63,6 +63,11 @@ If you are unsure about the documentation then invoke `$ grep -r -A5 -B5 "BUILD_
- Values: - Values:
- yes: Include (default) - yes: Include (default)
- no: Do NO include - no: Do NO include
- **POWER_MANAGEMENT_FEATURES** (boolean): Controls whether system sleep functionality (suspend, hibernate, hybrid sleep) is allowed on the built image.
- Values:
- yes: Enable power-management sleep features (allow systemd sleep modes)
- no: Disable all sleep modes (default), as suspend/hibernate are unstable
on most single-board computers
- **HAS_VIDEO_OUTPUT** ( boolean ): defines whether the system has video output such as eye candy, bootsplash, etc.. - **HAS_VIDEO_OUTPUT** ( boolean ): defines whether the system has video output such as eye candy, bootsplash, etc..
- Values: - Values:
- yes: Enable video-related configuration - yes: Enable video-related configuration

View File

@ -10,6 +10,7 @@ declare -g SERIALCON="${SERIALCON:-tty1}" # Consistent serial console
declare -g UEFI_GRUB_TIMEOUT=${UEFI_GRUB_TIMEOUT:-3} # Default 3-seconds timeout for GRUB menu. declare -g UEFI_GRUB_TIMEOUT=${UEFI_GRUB_TIMEOUT:-3} # Default 3-seconds timeout for GRUB menu.
declare -g BOARD_FIRMWARE_INSTALL="-full" # Install full firmware for UEFI boards declare -g BOARD_FIRMWARE_INSTALL="-full" # Install full firmware for UEFI boards
declare -g DISTRO_GENERIC_KERNEL=no declare -g DISTRO_GENERIC_KERNEL=no
declare -g POWER_MANAGEMENT_FEATURES=yes # Suspend and resume might work well in UEFI, elsewhere is disabled by default
case "${BRANCH}" in case "${BRANCH}" in

View File

@ -35,16 +35,25 @@ function install_distribution_specific() {
truncate --size=0 "${SDCARD}"/etc/apt/apt.conf.d/20apt-esm-hook.conf truncate --size=0 "${SDCARD}"/etc/apt/apt.conf.d/20apt-esm-hook.conf
fi fi
# Add power management override # Add power-management override.
# suspend / resume is very fragile on most of those board - lets disable it system wide # Suspend / hibernate / hybrid-sleep are known to be unreliable or completely
mkdir -p "${SDCARD}/etc/systemd/sleep.conf.d" # non-functional on the majority of single board computers due to incomplete
cat <<- EOF > "${SDCARD}/etc/systemd/sleep.conf.d/00-disable.conf" # vendor kernels, broken device drivers, or lack of proper firmware support.
[Sleep] # To avoid random lockups, data loss, or boards failing to wake up, we disable
AllowSuspend=no # all systemd sleep modes by default.
AllowHibernation=no # Users who understand the risks and have hardware that supports stable sleep
AllowHybridSleep=no # states can re-enable them by setting:
AllowSuspendThenHibernate=no # POWER_MANAGEMENT_FEATURES=yes
EOF if [[ "${POWER_MANAGEMENT_FEATURES:-"no"}" != "yes" ]]; then
mkdir -p "${SDCARD}/etc/systemd/sleep.conf.d"
cat <<- EOF > "${SDCARD}/etc/systemd/sleep.conf.d/00-disable.conf"
[Sleep]
AllowSuspend=no
AllowHibernation=no
AllowHybridSleep=no
AllowSuspendThenHibernate=no
EOF
fi
# install our base-files package (this replaces the original from Debian/Ubuntu) # install our base-files package (this replaces the original from Debian/Ubuntu)
if [[ "${KEEP_ORIGINAL_OS_RELEASE:-"no"}" != "yes" ]]; then if [[ "${KEEP_ORIGINAL_OS_RELEASE:-"no"}" != "yes" ]]; then