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

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



On Tue, 2014-10-14 at 17:07 +0200, Petter Reinholdtsen wrote:
> Here is another draft, this time also providing the module name.  I
> dropped the code looking in /proc/modules, as three ways to find
> firmware seem a bit too much.  I added similar code to the
> isenkram-cli package to install needed firmware packages into
> /target/, and it seem to work well there. :)
> 
> This new version is not yet tested in the udeb, but the key parts
> worked when I tested on the command line.
> 
> diff --git a/check-missing-firmware.sh b/check-missing-firmware.sh
> index 60c6ff4..87f2839 100755
> --- a/check-missing-firmware.sh
> +++ b/check-missing-firmware.sh
> @@ -69,6 +69,29 @@ check_missing () {
>  	
>  	modules=""
>  	files=""
> +
> +	# 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.

Again, this is not a workaround, this is the only fix there will be for
that bug.  The only thing that may change in the kernel to make this
easier is that it will do structured logging so in theory you don't need
to use grep, cut, etc.  In practice, as this is all shell scripts, you
will probably have to do similar grepping to read the structured log
information.

> +	fwlist=/tmp/check-missing-firmware-dmesg.list
> +	dmesg | grep 'firmware: failed to load' \
> +	    | cut -d\] -f2- | cut -d" " -f2,8 > $fwlist

I think this would be clearer as:

dmesg | sed -rn 's/^(\[[^]]*\] )?([^ ]+) [^ ]+: firmware: failed to load ([^ ]+) .*/\2 \3/p' > $fwlist

This avoids using magic numbers; also we don't have to assume that log
timestamps are enabled.

> +	while read module fwfile ; do
> +	    log "looking for firmware file $fwfile requested by $module"
> +	    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
> +	done < $fwlist
> +
> +	# This block looking in $MISSING should be removed when
> +	# hw-detect no longer should support installing using older
> +	# udev and kernel versions.
>  	for missing_dir in $MISSING
>  	do
>  		if [ ! -d "$missing_dir" ]; then
> @@ -121,7 +144,7 @@ check_missing () {
>  		log "missing firmware files ($files) for $modules"
>  		return 0
>  	else
> -		log "no missing firmware in $MISSING"
> +		log "no missing firmware loaded kernel modules"

Keep the 'in'.

Ben.

>  		return 1
>  	fi
>  }
> 

-- 
Ben Hutchings
Horngren's Observation:
                   Among economists, the real world is often a special case.

Attachment: signature.asc
Description: This is a digitally signed message part


Reply to: