[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#725714: Partial fix using hw-setup for the missing firmware problem in d-i?



Here is another draft patch for hw-detect.  This one is tested, and
find the missing firmware on my X200 test laptop.

This approach keep the non-functioning code and add two new
approaches, one looking at the meta information for loadmed modules,
and one parsing the dmesg output.  The union from all three methods
are then presented as the list of wanted firmware.

diff --git a/check-missing-firmware.sh b/check-missing-firmware.sh
index 60c6ff4..74db55b 100755
--- a/check-missing-firmware.sh
+++ b/check-missing-firmware.sh
@@ -61,6 +61,18 @@ nic_is_configured() {
 	return 1
 }
 
+add_if_fw_missing() {
+    fwfile="$1"
+    if [ ! -e /lib/firmware/$fwfile ] ; then
+        if grep -q "^$fwfile$" $DENIED 2>/dev/null; then
+	    log "listed in $DENIED"
+            continue
+        fi
+        files="${files:+$files }$fwfile"
+        modules="$module${modules:+ $modules}"
+    fi
+}
+
 check_missing () {
 	upnics
 
@@ -117,11 +129,30 @@ check_missing () {
 		done
 	done
 
+        # Workaround for bug #725714, the kernel and udev no longer
+        # let us know via /dev/.udev/firmware-missing and
+        # /run/udev/firmware-missing which firmware files the kernel
+        # drivers look for.  This approach will only find firmware for
+        # the loaded kernel modules.  Modules refusing to
+        # register/load when the firmware is missing will be missed.
+        for module in $(cut -d" " -f1 /proc/modules); do 
+            for fwfile in $(modinfo $module | grep ^firmware: | cut -d: -f2); do
+                log "looking for firmware file $fwfile needed by $module"
+                add_if_fw_missing "$fwfile"
+            done
+        done
+        for fwfile in $(dmesg | grep 'firmware: failed' | sed 's/.*firmware: failed to load //' | cut -d" " -f1); do
+            # Dummy make sure '-n "$modules"' test below find something
+            module=kernel
+            log "looking for firmware file $fwfile requested by kernel"
+            add_if_fw_missing "$fwfile"
+        done
+
 	if [ -n "$modules" ]; then
 		log "missing firmware files ($files) for $modules"
 		return 0
 	else
-		log "no missing firmware in $MISSING"
+		log "no missing firmware for any kernel module"
 		return 1
 	fi
 }

-- 
Happy hacking
Petter Reinholdtsen


Reply to: