* ide.rc
@ 2004-10-29 14:15 Marco d'Itri
2004-10-30 2:36 ` ide.rc Alexander E. Patrakov
` (4 more replies)
0 siblings, 5 replies; 6+ messages in thread
From: Marco d'Itri @ 2004-10-29 14:15 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 237 bytes --]
I'm attaching a .rc script for hotplug which loads at boot time the
ide-* modules needed by the system (which, as everybody knows by now,
cannot be automatically loaded anymore when using udev).
--
ciao, |
Marco | [8804 tr7xD/mgdubuA]
[-- Attachment #2: ide.rc --]
[-- Type: text/plain, Size: 1503 bytes --]
#!/bin/sh -e
#
# ide.rc loads the modules for IDE devices at boot time, if needed
# it requires a 2.6 kernel
#
# Copyright (C) 2004 Marco d'Itri <md@linux.it>
#
# only 2.6 kernels are supported
[ -d /sys/block/ ] || exit 0
cd /etc/hotplug
. ./hotplug.functions
# XXX this function should be moved to hotplug.functions
is_blacklisted() {
MODULE_EXPR="$(echo $1 | sed -e 's/[-_]/[-_]/g')"
if grep -qs "^${MODULE_EXPR}$" \
$HOTPLUG_DIR/blacklist $HOTPLUG_DIR/blacklist.d/*; then
return 0
fi
return 1
}
ide_boot_events() {
[ "$(echo /proc/ide/*/media)" = "/proc/ide/*/media" ] && return
for drive in /proc/ide/*/media; do
# nothing to do if the device has already been took in charge
unit=${drive#/proc/ide/}; unit=${unit%/media}
[ -d /sys/block/$unit ] && continue
read media < $drive
case "$media" in
disk) MODULE=ide-disk ;;
cdrom) MODULE=ide-cd ;;
tape) MODULE=ide-tape ;;
floppy) MODULE=ide-floppy ;;
*) MODULE=ide-generic ;;
esac
# ignore blacklisted modules
if is_blacklisted $MODULE; then
mesg " $MODULE: blacklisted"
continue
fi
if modprobe --quiet $MODULE; then
mesg " $MODULE: loaded sucessfully"
else
mesg " $MODULE: can't be loaded"
fi
done
}
# See how we were called.
case "$1" in
start|restart)
ide_boot_events
;;
stop)
;;
status)
;;
*)
echo "Usage: $0 {start|stop|status|restart}"
exit 1
esac
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ide.rc
2004-10-29 14:15 ide.rc Marco d'Itri
@ 2004-10-30 2:36 ` Alexander E. Patrakov
2004-10-30 7:14 ` ide.rc Remco
` (3 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Alexander E. Patrakov @ 2004-10-30 2:36 UTC (permalink / raw)
To: linux-hotplug
On Friday 29 October 2004 20:15, Marco d'Itri wrote:
> I'm attaching a .rc script for hotplug which loads at boot time the
> ide-* modules needed by the system (which, as everybody knows by now,
> cannot be automatically loaded anymore when using udev).
This script would be probably a bit wrong for my old server. This server has a
LSI Logic SCSI adapter (with two hard disks attached) and a ServerWorks IDE
adapter with one attached CD-ROM drive. For some strange reason, to use this
CD-ROM, I must have both serverworks, ide_generic and ide_cd modules loaded.
Your script won't load ide_generic. The kernel is 2.6.7-1-686.
ds:~# ls /proc/ide/*/media
/proc/ide/hda/media
ds:~# cat /proc/ide/hda/media
cdrom
Also, your script starts before pci.rc (because "i" is before "p" in the
alphabet) and therefore will not find anything on my old server at all (the
serverworks module is loaded by pci.rc).
--
Alexander E. Patrakov
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id\x12065&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ide.rc
2004-10-29 14:15 ide.rc Marco d'Itri
2004-10-30 2:36 ` ide.rc Alexander E. Patrakov
@ 2004-10-30 7:14 ` Remco
2004-10-30 15:31 ` ide.rc Alexander E. Patrakov
` (2 subsequent siblings)
4 siblings, 0 replies; 6+ messages in thread
From: Remco @ 2004-10-30 7:14 UTC (permalink / raw)
To: linux-hotplug
Alexander E. Patrakov wrote:
> On Friday 29 October 2004 20:15, Marco d'Itri wrote:
>> I'm attaching a .rc script for hotplug which loads at boot time the
>> ide-* modules needed by the system (which, as everybody knows by now,
>> cannot be automatically loaded anymore when using udev).
>
I didn't look at the script so it may be useful, but it doesn't seem needed
to me when it comes to loading additional modules. To load additional
drivers automatically in Linux 2.6 I use the /etc/modprobe.conf file of the
module-init-tools package. You'll have to create a rule for each and every
driver, but that also gives you the flexibility to create customised rules
on a per driver basis.
examples: (see man modprobe.conf)
install atkbd /sbin/modprobe --ignore-install atkbd && { /sbin/modprobe
i8042; }
install psmouse /sbin/modprobe --ignore-install psmouse && { /sbin/modprobe
i8042; /sbin/modprobe mousedev; }
install hid /sbin/modprobe --ignore-install hid && { /sbin/modprobe
mousedev; }
install hpt366 /sbin/modprobe --ignore-install hpt366 && { /sbin/modprobe
ide-cd; /sbin/modprobe ide-disk; }
install pdc202xx_new /sbin/modprobe --ignore-install pdc202xx_new &&
{ /sbin/modprobe ide-cd; /sbin/modprobe ide-disk; }
install pdc202xx_old /sbin/modprobe --ignore-install pdc202xx_old &&
{ /sbin/modprobe ide-cd; /sbin/modprobe ide-disk; }
install piix /sbin/modprobe --ignore-install piix && { /sbin/modprobe
ide-cd; /sbin/modprobe ide-disk; }
install via82cxxx /sbin/modprobe --ignore-install via82cxxx &&
{ /sbin/modprobe ide-cd; /sbin/modprobe ide-disk; }
options aha152x io=0x0140 irq\x11
install aha152x /sbin/modprobe --ignore-install aha152x && { /sbin/modprobe
sd_mod; /sbin/modprobe sr_mod; }
P.S.: the above lines may be wrapped !!!
> This script would be probably a bit wrong for my old server. This server
> has a LSI Logic SCSI adapter (with two hard disks attached) and a
> ServerWorks IDE adapter with one attached CD-ROM drive. For some strange
> reason, to use this CD-ROM, I must have both serverworks, ide_generic and
> ide_cd modules loaded. Your script won't load ide_generic. The kernel is
> 2.6.7-1-686.
I hope the above can help you create a customised rule for your device.
>
> Also, your script starts before pci.rc (because "i" is before "p" in the
> alphabet) and therefore will not find anything on my old server at all
> (the serverworks module is loaded by pci.rc).
>
I think this also counts for the input.rc script. AFAIK input.rc always runs
before the other .rc scripts. So drivers for input devices will always be
loaded after input.rc has run. Therefore it seems to me that input.rc never
really does anything, unless I'm overlooking something.
I guess that running the hotplug rc scripts in alphabetical order will never
be the right thing to do, unless they get sequenced somehow.
e.g.: Maybe by adding some sequence number like udev-rules and
udev-permissions.
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id\x12065&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ide.rc
2004-10-29 14:15 ide.rc Marco d'Itri
2004-10-30 2:36 ` ide.rc Alexander E. Patrakov
2004-10-30 7:14 ` ide.rc Remco
@ 2004-10-30 15:31 ` Alexander E. Patrakov
2004-11-01 1:47 ` ide.rc Marco d'Itri
2004-11-01 3:01 ` ide.rc Alexander E. Patrakov
4 siblings, 0 replies; 6+ messages in thread
From: Alexander E. Patrakov @ 2004-10-30 15:31 UTC (permalink / raw)
To: linux-hotplug
On Saturday 30 October 2004 13:14, Remco wrote:
> Alexander E. Patrakov wrote:
> > On Friday 29 October 2004 20:15, Marco d'Itri wrote:
> >> I'm attaching a .rc script for hotplug which loads at boot time the
> >> ide-* modules needed by the system (which, as everybody knows by now,
> >> cannot be automatically loaded anymore when using udev).
>
> I didn't look at the script so it may be useful, but it doesn't seem needed
> to me when it comes to loading additional modules. To load additional
> drivers automatically in Linux 2.6 I use the /etc/modprobe.conf file of the
> module-init-tools package. You'll have to create a rule for each and every
> driver, but that also gives you the flexibility to create customised rules
> on a per driver basis.
<snip examples>
Just adding ide-generic to /etc/modules (a Debian-specific file that lists
modules to be unconditionally loaded on each boot) is much easier.
> > Also, your script starts before pci.rc (because "i" is before "p" in the
> > alphabet) and therefore will not find anything on my old server at all
> > (the serverworks module is loaded by pci.rc).
>
> I think this also counts for the input.rc script. AFAIK input.rc always
> runs before the other .rc scripts. So drivers for input devices will always
> be loaded after input.rc has run. Therefore it seems to me that input.rc
> never really does anything, unless I'm overlooking something.
> I guess that running the hotplug rc scripts in alphabetical order will
> never be the right thing to do, unless they get sequenced somehow.
> e.g.: Maybe by adding some sequence number like udev-rules and
> udev-permissions.
In fact, if a module has been loaded by one rc script, agents should catch the
resulting hotplug events. So the order _should_ not matter with good agents,
except for the number of duplicate fake hotplug events. The problem is that
there is no "ide.agent" file. Sorry for my initial not-very-correct
description of this ordering problem.
--
Alexander E. Patrakov
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id\x12065&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ide.rc
2004-10-29 14:15 ide.rc Marco d'Itri
` (2 preceding siblings ...)
2004-10-30 15:31 ` ide.rc Alexander E. Patrakov
@ 2004-11-01 1:47 ` Marco d'Itri
2004-11-01 3:01 ` ide.rc Alexander E. Patrakov
4 siblings, 0 replies; 6+ messages in thread
From: Marco d'Itri @ 2004-11-01 1:47 UTC (permalink / raw)
To: linux-hotplug
[-- Attachment #1: Type: text/plain, Size: 1401 bytes --]
On Oct 30, "Alexander E. Patrakov" <patrakov@ums.usu.ru> wrote:
> This script would be probably a bit wrong for my old server. This server has a
> LSI Logic SCSI adapter (with two hard disks attached) and a ServerWorks IDE
> adapter with one attached CD-ROM drive. For some strange reason, to use this
> CD-ROM, I must have both serverworks, ide_generic and ide_cd modules loaded.
> Your script won't load ide_generic. The kernel is 2.6.7-1-686.
As it has been explained, this is probably a bug/feature in the
serverworks driver. The correct solution would be for the debian kernel
package to ship a /etc/modprobe.d/kernel-image-2.6.7-1-686 file
containing something like:
install serverworks /sbin/modprobe --ignore-install serverworks && { /sbin/modprobe ide-generic; /sbin/modprobe ide-cd; }
(Do you mind opening a bug about this in the debian BTS?)
> Also, your script starts before pci.rc (because "i" is before "p" in the
> alphabet) and therefore will not find anything on my old server at all (the
> serverworks module is loaded by pci.rc).
Good point. tsort(1) comes to help, as you can see in the attached
replacement for the main hotplug init script.
There is no ide.agent script because there are no "real" IDE hotplug
events from the kernel. Probably there is no need for them, this is
just a workaround to load the modules for udev.
--
ciao, |
Marco | [8851 soOFdKlIC1OSk]
[-- Attachment #2: hotplug.init --]
[-- Type: text/plain, Size: 1649 bytes --]
#!/bin/sh -e
#
# description: Starts and stops each hotpluggable subsystem.
# On startup, may simulate hotplug events for devices
# that were present at boot time, before filesystems
# used by /sbin/hotplug became available.
PATH=/sbin:/bin:/usr/sbin:/usr/bin
[ -x /sbin/hotplug ] || exit 0
if [ ! -f /proc/sys/kernel/hotplug ]; then
echo "Kernel hotplug support not enabled."
exit 0
fi
[ -e /etc/default/hotplug ] && . /etc/default/hotplug
run_rcs() {
SUBSYSTEMS=$(
{
for RC in /etc/hotplug/*.rc; do
basename=${RC#/etc/hotplug/}
name=${basename%.rc}
echo "$name $name"
done
# follows couples of ordered elements
echo "ide pci"
echo "usb pci"
} | tsort | tac
)
for name in $SUBSYSTEMS; do
printf " %-8s\n" $name
if [ "$(eval echo \$HOTPLUG_RC_$name)" = no ]; then
printf " %-8s [disabled]\n" $name
continue
fi
set +e
/etc/hotplug/$name.rc $1
RC_STATUS=$?
set -e
if [ "$1" = status ]; then
continue
fi
if [ $RC_STATUS = 0 ]; then
printf " %-8s [success]\n" $name
else
printf " %-8s [failed]\n" $name
fi
done
}
case "$1" in
start)
echo "Starting hotplug subsystem:"
echo /sbin/hotplug > /proc/sys/kernel/hotplug
run_rcs $1
echo "done"
;;
stop)
echo "Stopping hotplug subsystem:"
run_rcs $1
echo /bin/true > /proc/sys/kernel/hotplug
echo "done"
;;
restart|force-reload)
echo -n "Restarting hotplug subsystem:"
run_rcs stop
run_rcs start
echo "."
;;
status)
run_rcs $1
;;
*)
echo "Usage: $0 {start|stop|restart|status|force-reload}" >&2
exit 1
;;
esac
exit 0
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: ide.rc
2004-10-29 14:15 ide.rc Marco d'Itri
` (3 preceding siblings ...)
2004-11-01 1:47 ` ide.rc Marco d'Itri
@ 2004-11-01 3:01 ` Alexander E. Patrakov
4 siblings, 0 replies; 6+ messages in thread
From: Alexander E. Patrakov @ 2004-11-01 3:01 UTC (permalink / raw)
To: linux-hotplug
On Monday 01 November 2004 06:47, Marco d'Itri wrote:
> As it has been explained, this is probably a bug/feature in the
> serverworks driver. The correct solution would be for the debian kernel
> package to ship a /etc/modprobe.d/kernel-image-2.6.7-1-686 file
> containing something like:
>
> install serverworks /sbin/modprobe --ignore-install serverworks && {
> /sbin/modprobe ide-generic; /sbin/modprobe ide-cd; }
>
> (Do you mind opening a bug about this in the debian BTS?)
Will do so after experimenting with other IDE controllers.
--
Alexander E. Patrakov
-------------------------------------------------------
This SF.Net email is sponsored by:
Sybase ASE Linux Express Edition - download now for FREE
LinuxWorld Reader's Choice Award Winner for best database on Linux.
http://ads.osdn.com/?ad_idU88&alloc_id\x12065&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-11-01 3:01 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-10-29 14:15 ide.rc Marco d'Itri
2004-10-30 2:36 ` ide.rc Alexander E. Patrakov
2004-10-30 7:14 ` ide.rc Remco
2004-10-30 15:31 ` ide.rc Alexander E. Patrakov
2004-11-01 1:47 ` ide.rc Marco d'Itri
2004-11-01 3:01 ` ide.rc Alexander E. Patrakov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).