Currently sys_walk_modalias only looks for a modalias in the
grandparent of the given device path. This doesn't match what the
name 'walk' implies.
sys_walk_mod_add calls it for each level of the device hierarchy, but
since it only looks at the grandparent it will miss some modaliases,
e.g. sd_mod or virtio_blk. We explicitly add sd_mod when we see any
SCSI device, so we usually get away with this. However, virtio_blk is
currently not added to a MODULES=dep initramfs if it is modular for
the target kernel but built into the running kernel.
Related-to: #760127
Signed-off-by: Ben Hutchings <ben@decadent.org.uk>
---
hook-functions | 22 ++++++++++++----------
1 file changed, 12 insertions(+), 10 deletions(-)
diff --git a/hook-functions b/hook-functions
index ed22164..edc5de0 100644
--- a/hook-functions
+++ b/hook-functions
@@ -199,8 +199,9 @@ sys_walk_mod_add()
local driver_path module
device_path="$1"
+ sys_walk_modalias "${device_path}"
+
while [ "${device_path}" != "/sys" ]; do
- sys_walk_modalias ${device_path}
driver_path="$(readlink -f ${device_path}/driver/module)"
if [ -e "$driver_path" ]; then
module="$(basename $(readlink -f $driver_path))"
@@ -216,16 +217,17 @@ sys_walk_mod_add()
sys_walk_modalias()
{
local device_path modalias
+ device_path="$1"
- device_path="$(dirname "${1}")"
- device_path="$(dirname "${device_path}")"
- if [ -e "${device_path}/modalias" ]; then
- modalias=$(cat "${device_path}/modalias")
- fi
-
- if [ -n "${modalias}" ]; then
- force_load "${modalias}"
- fi
+ while [ "${device_path}" != "/sys" ]; do
+ if [ -e "${device_path}/modalias" ]; then
+ modalias=$(cat "${device_path}/modalias")
+ if [ -n "${modalias}" ]; then
+ force_load "${modalias}"
+ fi
+ fi
+ device_path="$(dirname ${device_path})"
+ done
}
# find and only copy root relevant modules
--
Ben Hutchings
This sentence contradicts itself - no actually it doesn't.
Attachment:
signature.asc
Description: This is a digitally signed message part