From faa9c6f6c4a291bfac2038776f714eca93fc15db Mon Sep 17 00:00:00 2001 From: Douglas Teles Date: Wed, 8 Jul 2026 21:22:34 -0300 Subject: [PATCH] update: stop the linux package from wiping out-of-tree modules Installing the linux package through pacman overwrote modules.dep with the copy generated at kernel build time, which predates every out-of-tree module: the joypad and the WiFi drivers vanished from the index and the console booted with dead input and no network (reproduced on real hardware). Two independent layers fix it: the repo generator no longer ships any depmod-generated index inside packages (modules.builtin*/order stay, they are kernel-owned depmod inputs), and a new alpm hook rebuilds the index over the full overlay tree after any transaction that touches kernel modules. linux goes to rel 3 so updated devices pick the clean package. --- .../sources/pacman-hooks/91-archr-depmod.hook | 11 ++++++++++ .../archr/sources/scripts/archr-depmod | 21 +++++++++++++++++++ projects/ArchR/packages/linux/package.mk | 2 +- scripts/repo/gen-pacman-repo | 20 +++++++++++++++++- 4 files changed, 52 insertions(+), 2 deletions(-) create mode 100644 projects/ArchR/packages/archr/sources/pacman-hooks/91-archr-depmod.hook create mode 100755 projects/ArchR/packages/archr/sources/scripts/archr-depmod diff --git a/projects/ArchR/packages/archr/sources/pacman-hooks/91-archr-depmod.hook b/projects/ArchR/packages/archr/sources/pacman-hooks/91-archr-depmod.hook new file mode 100644 index 0000000000..5ea968dbdb --- /dev/null +++ b/projects/ArchR/packages/archr/sources/pacman-hooks/91-archr-depmod.hook @@ -0,0 +1,11 @@ +[Trigger] +Operation = Install +Operation = Upgrade +Operation = Remove +Type = Path +Target = usr/lib/kernel-overlays/*/lib/modules/* + +[Action] +Description = Rebuilding the kernel module index (full tree)... +When = PostTransaction +Exec = /usr/bin/archr-depmod diff --git a/projects/ArchR/packages/archr/sources/scripts/archr-depmod b/projects/ArchR/packages/archr/sources/scripts/archr-depmod new file mode 100755 index 0000000000..0ebcd1c409 --- /dev/null +++ b/projects/ArchR/packages/archr/sources/scripts/archr-depmod @@ -0,0 +1,21 @@ +#!/bin/sh +# SPDX-License-Identifier: GPL-2.0 +# Copyright (C) 2026-present ArchR (https://github.com/archr-linux/Arch-R) +# +# Regenerate the module dependency index over the FULL module tree after +# a pacman transaction touches kernel modules. The linux package used to +# ship the modules.dep generated at kernel build time, which predates +# every out-of-tree module (joypad, WiFi drivers); installing it wiped +# them from the index and the console came up with dead input and no +# WiFi. The repo no longer ships those index files, and this hook keeps +# the index honest on the device no matter what changed. +set -u +rc=0 +for verdir in /usr/lib/kernel-overlays/*/lib/modules/*/; do + [ -d "${verdir}kernel" ] || continue + base="${verdir%/lib/modules/*}" + ver="$(basename "${verdir}")" + echo "archr-depmod: indexing ${ver} under ${base}" + depmod -a -b "${base}" "${ver}" || rc=1 +done +exit ${rc} diff --git a/projects/ArchR/packages/linux/package.mk b/projects/ArchR/packages/linux/package.mk index 9c0c038c31..ceba8c3e5b 100644 --- a/projects/ArchR/packages/linux/package.mk +++ b/projects/ArchR/packages/linux/package.mk @@ -3,7 +3,7 @@ # Copyright (C) 2017-present Team LibreELEC (https://libreelec.tv) PKG_NAME="linux" -PKG_REV="2" +PKG_REV="3" PKG_LICENSE="GPL" PKG_SITE="http://www.kernel.org" PKG_DEPENDS_HOST="ccache:host openssl:host" diff --git a/scripts/repo/gen-pacman-repo b/scripts/repo/gen-pacman-repo index 00e2a257ed..27252c3dc1 100755 --- a/scripts/repo/gen-pacman-repo +++ b/scripts/repo/gen-pacman-repo @@ -144,7 +144,25 @@ EOF # /.image on every kernel update for nothing. find . -mindepth 1 -maxdepth 1 -not -name '.PKGINFO' -not -name '.image' -printf '%P\n' } > "${filelist}" - tar --zstd -cf "${outfile}" --owner=0 --group=0 -T "${filelist}" + # The depmod-generated indexes are stale by construction inside a + # package (the kernel builds them before any out-of-tree module + # exists); shipping them wiped the joypad and WiFi drivers from + # modules.dep on every linux update. The device rebuilds them via + # the archr-depmod hook; modules.builtin*/order stay (kernel-owned + # depmod inputs). + tar --zstd -cf "${outfile}" --owner=0 --group=0 \ + --exclude='*/modules/*/modules.dep' \ + --exclude='*/modules/*/modules.dep.bin' \ + --exclude='*/modules/*/modules.alias' \ + --exclude='*/modules/*/modules.alias.bin' \ + --exclude='*/modules/*/modules.symbols' \ + --exclude='*/modules/*/modules.symbols.bin' \ + --exclude='*/modules/*/modules.devname' \ + --exclude='*/modules/*/modules.softdep' \ + --exclude='*/modules/*/modules.weakdep' \ + --exclude='*/modules/*/modules.builtin.bin' \ + --exclude='*/modules/*/modules.builtin.alias.bin' \ + -T "${filelist}" rm -f "${filelist}" ) rm -f "${pkginfo}"