Re: [PATCH V2 dracut 2/2] watchdog: install module for active watchdog

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

 



Hi, Pratyush

[snip]
> diff --git a/modules.d/04watchdog/module-setup.sh b/modules.d/04watchdog/module-setup.sh
> index 7ec757aec032..6232afb0d9ca 100755
> --- a/modules.d/04watchdog/module-setup.sh
> +++ b/modules.d/04watchdog/module-setup.sh
> @@ -32,3 +32,36 @@ install() {
>      inst_multiple -o wdctl
>  }
>  
> +installkernel() {
> +    cd /sys/class/watchdog
> +    for dir in */; do
> +	    cd $dir
> +	    active=`[ -f state ] && cat state`
> +	    if [ "$active" =  "active" ]; then
> +		    # applications like kdump need to know that, which
> +		    # watchdog modules have been added into initramfs
> +		    echo `cat identity` >> "$initdir/tmp/active-watchdogs"
> +		    # device/modalias will return driver of this device
> +		    wdtdrv=`cat device/modalias`
> +		    # There can be more than one module represented by same
> +		    # modalias. Currently load all of them.
> +		    # TODO: Need to find a way to avoid any unwanted module
> +		    # represented by modalias
> +		    wdtdrv=`modprobe -R $wdtdrv | tr "\n" "," | sed 's/.$//'`
> +		    instmods $wdtdrv
> +		    # however in some cases, we also need to check that if
> +		    # there is a specific driver for the parent bus/device.
> +		    # In such cases we also need to enable driver for parent
> +		    # bus/device.
> +		    wdtppath="device/..";
> +		    while [ -f "$wdtppath/modalias" ]
> +		    do
> +			    wdtpdrv=`cat $wdtppath/modalias`
> +			    wdtpdrv=`modprobe -R $wdtpdrv | tr "\n" "," | sed 's/.$//'`
> +			    instmods $wdtpdrv
> +			    wdtppath="$wdtppath/.."
> +		    done
> +	    fi
> +	    cd ..
> +    done
> +}

Another thing coming into mind is it possible more than one wdt being active
at the same time? If so it will cause problem because only the first occupies
/dev/watchdog device for systemd use?

How about just break the loop when we find an active wdt? Is it safe?

Thanks
Dave
--
To unsubscribe from this list: send the line "unsubscribe initramfs" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Kernel]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux SCSI]

  Powered by Linux