From abb534613e9f571c91d0c27ac7cedf3ae0c603bc Mon Sep 17 00:00:00 2001 From: rickpeters Date: Sun, 27 Sep 2026 21:31:57 +0200 Subject: [PATCH] fix: Live power-off module: a fresh build folder per kernel, no clean in the same make (kbuild re-ran itself endlessly) --- build-live-modules.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/build-live-modules.sh b/build-live-modules.sh index f6c496f..9b81ee7 100755 --- a/build-live-modules.sh +++ b/build-live-modules.sh @@ -12,19 +12,21 @@ src=archiso/airootfs/usr/local/share/steamify/steamify-fremont-poweroff.c [[ -f "$src" ]] || { echo "No $src: run steamify-prepare.sh first." >&2; exit 1; } pacman -S --needed --noconfirm base-devel clang llvm lld linux-cachyos-headers linux-cachyos-lts-headers >/dev/null -work="$(mktemp -d)" -cp "$src" "$work/" -echo 'obj-m += steamify-fremont-poweroff.o' > "$work/Makefile" for build in /usr/lib/modules/*/build; do kver="$(basename "$(dirname "$build")")" + # A fresh folder per kernel: `make clean modules` in one call makes + # kbuild re-run itself endlessly for an external module. + work="$(mktemp -d)" + cp "$src" "$work/" + echo 'obj-m += steamify-fremont-poweroff.o' > "$work/Makefile" # CachyOS's kernels differ in compiler (linux-cachyos is clang-built): # build with the one the kernel was built with. llvm=() grep -q '^CONFIG_CC_IS_CLANG=y' "$build/.config" && llvm=(LLVM=1) - make -s -C "$build" M="$work" "${llvm[@]}" clean modules + make -s -C "$build" M="$work" "${llvm[@]}" modules install -Dm644 "$work/steamify-fremont-poweroff.ko" \ "archiso/airootfs/usr/lib/modules/$kver/extra/steamify-fremont-poweroff.ko" + rm -rf "$work" echo "Power-off fix built for $kver." done -rm -rf "$work" install -Dm644 /dev/stdin archiso/airootfs/etc/modules-load.d/steamify-fremont-poweroff.conf <<< 'steamify-fremont-poweroff'