From f123993d1c73c906c50bcb8484e8abb5f9dd44f1 Mon Sep 17 00:00:00 2001 From: David Härdeman Date: Thu, 3 May 2007 18:47:00 +0200 Subject: hook-functions: add firmware loading support newer modinfo outputs firmware files corresponding to the modules MODULE_FIRMWARE() field. Take care to add them automaticaly. --- hook-functions | 38 +++++++++++++++++++++++++++++++++++++- 1 file changed, 37 insertions(+), 1 deletion(-) (limited to 'hook-functions') diff --git a/hook-functions b/hook-functions index 6c75b5f..b3264ac 100644 --- a/hook-functions +++ b/hook-functions @@ -38,8 +38,11 @@ add_modules_from_file() done } +# Add dependent modules + eventual firmware manual_add_modules() { + local man_x firmwares firmware + for mam_x in $(modprobe --set-version="${version}" --ignore-install \ --show-depends "${1}" 2>/dev/null | awk '/^insmod/ { print $2 }'); do # Prune duplicates @@ -49,9 +52,42 @@ manual_add_modules() mkdir -p "${DESTDIR}/$(dirname "${mam_x}")" ln -s "${mam_x}" "${DESTDIR}/$(dirname "${mam_x}")" - if [ -n "${verbose}" ] && [ "${verbose}" = "y" ]; then + if [ "${verbose}" = "y" ]; then echo "Adding module ${mam_x}" fi + + # Add firmware files if necessary + firmwares=$(modinfo -F firmware "${mam_x}") + if [ -z "${firmwares}" ]; then + continue + fi + for firmware in $firmwares; do + if [ -e "${DESTDIR}/lib/firmware/${firmware}" ]; then + continue + fi + + # Only print warning for missing fw of loaded module + # or forced loaded module + if [ ! -e "/lib/firmware/${firmware}" ]; then + if grep -q "^$(basename "${mam_x}" .ko)" \ + /proc/modules \ + || grep -q "^$(basename "${mam_x}" .ko)" \ + "${CONFDIR}/modules"; then + echo "W: Possible missing firmware /lib/firmware/${firmware} for module $(basename ${mam_x} .ko)" >&2 + fi + continue + fi + + if [ ! -e "${DESTDIR}/lib/udev/firmware.agent" ] \ + && [ -e "/lib/udev/firmware.agent" ]; then + copy_exec /lib/udev/firmware.agent + fi + + copy_exec "/lib/firmware/${firmware}" + if [ "${verbose}" = "y" ]; then + echo "Adding firmware ${firmware}" + fi + done done } -- cgit v1.2.3