fix(kernel): Handle unreadable module files in selftest.sh

Improve error handling in module discovery by identifying unreadable
`.ko` files and providing detailed error messages. Suggest actions like
unzip or rebuild to resolve issues.
This commit is contained in:
Christian Werner 2026-06-20 05:13:48 +02:00
parent 2881fae5bf
commit 3135a2502b

View File

@ -107,8 +107,14 @@ if [ -z "$KO" ]; then
[ -d "$dir" ] || continue [ -d "$dir" ] || continue
for cand in "$dir"/${MODULE}*.ko; do for cand in "$dir"/${MODULE}*.ko; do
[ -f "$cand" ] || continue [ -f "$cand" ] || continue
vm="$(modinfo -F vermagic "$cand" 2>/dev/null)" if vm="$(modinfo -F vermagic "$cand" 2>/dev/null)" && [ -n "$vm" ]; then
msg="$msg"$'\n'" $cand (built for ${vm%% *})" note="built for ${vm%% *}"
else
# modinfo couldn't read it - usually not an ELF .ko at all
# (e.g. a still-zipped release file). Show what it really is.
note="UNREADABLE: $(file -b "$cand" 2>/dev/null || echo 'not a kernel module') - unzip/rebuild?"
fi
msg="$msg"$'\n'" $cand ($note)"
any=1 any=1
done done
done done