summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Härdeman <david@hardeman.nu>2007-05-03 18:47:00 +0200
committermaximilian attems <maks@debian.org>2007-05-03 18:47:00 +0200
commitf123993d1c73c906c50bcb8484e8abb5f9dd44f1 (patch)
tree2e0bc1f435bb2df5f0995bf9d7b6f00bf90b03a8
parentaf88873884da184d98fffd08bf96f3b276b187a2 (diff)
downloadinitramfs-tools-f123993d1c73c906c50bcb8484e8abb5f9dd44f1.tar.gz
initramfs-tools-f123993d1c73c906c50bcb8484e8abb5f9dd44f1.zip
hook-functions: add firmware loading support
newer modinfo outputs firmware files corresponding to the modules MODULE_FIRMWARE() field. Take care to add them automaticaly.
-rw-r--r--debian/changelog6
-rw-r--r--hook-functions38
2 files changed, 41 insertions, 3 deletions
diff --git a/debian/changelog b/debian/changelog
index b436b0a..032fa85 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -13,9 +13,11 @@ initramfs-tools (0.88) UNRELEASED; urgency=low
parse /proc/cmdline themselves (even in the Etch version).
* hook-functions: Change copy_exec to use the same source and
destination path if only one argument is given.
- * hook-funcions: document how copy_exec determines the target path.
+ * hook-functions: Document how copy_exec determines the target path.
+ * hook-functions: Add firmware loading support to manual_add_modules().
+ (closes: #355881)
- -- maximilian attems <maks@debian.org> Tue, 01 May 2007 19:31:41 +0200
+ -- maximilian attems <maks@debian.org> Thu, 03 May 2007 18:43:14 +0200
initramfs-tools (0.87b) unstable; urgency=low
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
}