Re: [Thinstation-developer] Patch to add scsi/sata device support to Thinstation.
Brought to you by:
doncuppjr
From: Francis S. <fra...@ap...> - 2007-06-20 09:03:41
|
Hello, You need the patch bellow to add the scsi support to udev, and the script ".../packages/base/etc/udev/scripts/scsi.sh" to mount automatically at the boot the partition and activate swap space. #####BEGIN PATCH --- Thinstation-2.2.orig/packages/base/etc/udev/rules.d/10-udev.rules 2005-08-27 12:46:41.000000000 +0200 +++ Thinstation-2.2/packages/base/etc/udev/rules.d/10-udev.rules 2007-05-09 08:47:17.000000000 +0200 @@ -7,11 +7,13 @@ # Note you must use the RUN option if trying to use actual device in script -BUS="ide", KERNEL="hd*", RUN+="/etc/udev/scripts/ide.sh" KERNEL="fd[0-9]*", SYMLINK="floppy/%n", RUN+="/etc/udev/scripts/floppy.sh" KERNEL="lp[0-9]*", SYMLINK="printers/%n" #Usb Keys -KERNEL=="sd*", ACTION="add", BUS="usb", RUN+="/etc/udev/scripts/usb.sh" -KERNEL=="sd*", ACTION="remove", RUN+="/etc/udev/scripts/usb.sh" +KERNEL=="sd*", ACTION="add", BUS="usb", RUN+="/etc/udev/scripts/usb.sh", OPTIONS="last_rule" +KERNEL=="sd*", ACTION="remove", RUN+="/etc/udev/scripts/usb.sh", OPTIONS="last_rule" + +BUS="ide", KERNEL="hd*", RUN+="/etc/udev/scripts/ide.sh" +BUS="scsi", KERNEL="sd*|sr*", RUN+="/etc/udev/scripts/scsi.sh" ##### END PATCH ##### BEGIN SCRIPT #! /bin/sh # # Mount Hotplug Device # . /etc/thinstation.env . $TS_GLOBAL if [ ! -e /mnt/disc ]; then mkdir /mnt/disc fi devpath=`basename $DEVPATH` name=`echo $devpath | sed -e "s/[0-9]*//g"` node=`echo $devpath | sed -e "s/[a-z]*//g"` RESULT=`echo $name | cut -c 1-2` if [ "$RESULT" = "sr" ] ; then case $ACTION in add) if [ -e /proc/sys/dev/cdrom ] ; then echo 0 > /proc/sys/dev/cdrom/autoclose fi if check_module supermount ; then while true do if [ ! -e /mnt/cdrom$x ] ; then mkdir /mnt/cdrom$x mount -t supermount -o fs=auto,dev=/dev/$devpath /mnt/cdrom$x /mnt/cdrom$x break 1 fi let x=x+1 done fi esac else case $ACTION in add) if vol_id /dev/$devpath > /tmp/volumeinfo ; then # Check to see if filesystem module is already loaded, if not then loads it . /tmp/volumeinfo if ! check_module $ID_FS_TYPE ; then modprobe $ID_FS_TYPE fi if [ ! -e /mnt/disc/$name ] ; then mkdir /mnt/disc/$name fi if [ -z "$node" ] ; then mkdir /mnt/disc/$name/$name mount -t auto /dev/$devpath /mnt/disc/$name/$name else mkdir /mnt/disc/$name/part$node mount -t auto /dev/$devpath /mnt/disc/$name/part$node fi [ $? != 0 ] && swapon /dev/$devpath >/dev/null 2>&1 fi rm /tmp/volumeinfo ;; esac fi exit 0 ##### END SCRIPT I hope this help you. Best regards. Francis S. J. van Harmelen wrote: > Hello Francis, > > Could you help me getting SATA disk support for my 2.2 or 2.2.1 clients? > I saw your patch but I'm not sure how to add the patch. > > I understand I need to recompile the kernel to support SCSI/SATA disks. > This is no problem. My question is only for how to add the right patch > and to which file. > > Regards, > > Sander > > > On Fri, 2007-05-11 at 08:36 +0200, Francis SOUYRI wrote: > >> Hello, >> >> Thank you Miles and Nikolai. At the moment it is not easy for me to test >> the 2.3... I have lot of tweaks in my 2.2 tree to migrate to a 2.3 tree >> >> Miles is it possible to download the 2.3 ? >> >> Best regards. >> >> Francis >> >> Miles Roper wrote: >> >>> fyi, udev 110 will be in 2.3 >>> >>> Nikolai V. Ivanyushin wrote: >>> >>>> Francis, guess you could try the latest udev-110. >>>> >>>> Francis SOUYRI wrote: >>>> >>>>> Nikolai, >>>>> >>>>> Yes, you are right, normally udev work like you say, but when I >>>>> inserted an USB key, the scsi rules are applied, and this is the >>>>> same if I do not use OPTIONS="last_rule" (for the add). I do not >>>>> know why.... >>>>> >>>>> Best regards. >>>>> >>>>> Francis >>>>> >>>>> Nikolai V. Ivanyushin wrote: >>>>> >>>>>> Francis SOUYRI wrote: >>>>>> >>>>>>> Hello, >>>>>>> >>>>>>> The problem is not to combine two rules in a single (but this >>>>>>> is interesting) the problem is that "an usb disk is a scsi disk" >>>>>>> so when an usb key (a disk) are inserted the scsi rule are applied. >>>>>>> >>>>>> Yes, you are right "an usb disk is a scsi disk" but it locates on >>>>>> USB(!) bus (see BUS="usb" on your rule) not scsi. The real scsi >>>>>> device is using BUS="scsi". So kernel treat them differently. >>>>>> And last but not least, you even don't need OPTIONS="last_rule" >>>>>> because of udev is using $DEVNAME variable to say to usb.sh script >>>>>> which device is really removed. >>>>>> >>>>>> >>>>>>> I just finished to test this fix: >>>>>>> >>>>>>> ##### BEGIN FIX >>>>>>> >>>>>>> --- >>>>>>> Thinstation-2.2.orig/packages/base/etc/udev/rules.d/10-udev.rules >>>>>>> 2005-08-27 12:46:41.000000000 +0200 >>>>>>> +++ >>>>>>> Thinstation-2.2/packages/base/etc/udev/rules.d/10-udev.rules >>>>>>> 2007-05-09 08:47:17.000000000 +0200 >>>>>>> @@ -7,11 +7,13 @@ >>>>>>> >>>>>>> # Note you must use the RUN option if trying to use actual device >>>>>>> in script >>>>>>> >>>>>>> -BUS="ide", KERNEL="hd*", RUN+="/etc/udev/scripts/ide.sh" >>>>>>> KERNEL="fd[0-9]*", SYMLINK="floppy/%n", >>>>>>> RUN+="/etc/udev/scripts/floppy.sh" >>>>>>> >>>>>>> KERNEL="lp[0-9]*", SYMLINK="printers/%n" >>>>>>> >>>>>>> #Usb Keys >>>>>>> -KERNEL=="sd*", ACTION="add", BUS="usb", >>>>>>> RUN+="/etc/udev/scripts/usb.sh" >>>>>>> -KERNEL=="sd*", ACTION="remove", RUN+="/etc/udev/scripts/usb.sh" >>>>>>> +KERNEL=="sd*", ACTION="add", BUS="usb", >>>>>>> RUN+="/etc/udev/scripts/usb.sh", OPTIONS="last_rule" >>>>>>> +KERNEL=="sd*", ACTION="remove", RUN+="/etc/udev/scripts/usb.sh", >>>>>>> OPTIONS="last_rule" >>>>>>> + >>>>>>> +BUS="ide", KERNEL="hd*", RUN+="/etc/udev/scripts/ide.sh" >>>>>>> +BUS="scsi", KERNEL="sd*|sr*", RUN+="/etc/udev/scripts/scsi.sh" >>>>>>> >>>>>>> ##### END FIX >>>>>>> >>>>>>> Best regards. >>>>>>> >>>>>>> Francis >>>>>>> >>>>>>> Nikolai V. Ivanyushin wrote: >>>>>>> >>>>>>>> Forgot to say it is possible to combine two rules in single one: >>>>>>>> BUS="scsi", KERNEL="sd*|sr*", RUN+="/etc/udev/scripts/scsi.sh" >>>>>>>> >>>>>>>> Miles Roper wrote: >>>>>>>> >>>>>>>>> do you have a fix? >>>>>>>>> >>>>>>>>> Francis SOUYRI wrote: >>>>>>>>> >>>>>>>>>> Hello, >>>>>>>>>> >>>>>>>>>> There is a conflict between my patch below and the usb key >>>>>>>>>> support, the file "10-udev.rules" are bad... sorry. >>>>>>>>>> >>>>>>>>>> Best regards. >>>>>>>>>> >>>>>>>>>> Francis >>>>>>>>>> >>>>>>>>>> Francis SOUYRI wrote: >>>>>>>>>> >>>>>>>>>>> Hello, >>>>>>>>>>> >>>>>>>>>>> This is a little patch to add the scsi/sata device support to >>>>>>>>>>> the thinstation, if you have created a kernel with the >>>>>>>>>>> scsi/sata support... >>>>>>>>>>> >>>>>>>>>>> ##### BEGIN modification of the udev rules. >>>>>>>>>>> >>>>>>>>>>> --- >>>>>>>>>>> Thinstation-2.2.orig/packages/base/etc/udev/rules.d/10-udev.rules >>>>>>>>>>> 2005-08-27 12:46:41.000000000 +0200 >>>>>>>>>>> +++ >>>>>>>>>>> Thinstation-2.2/packages/base/etc/udev/rules.d/10-udev.rules >>>>>>>>>>> 2007-03-28 15:00:42.000000000 +0200 >>>>>>>>>>> @@ -8,6 +8,8 @@ >>>>>>>>>>> # Note you must use the RUN option if trying to use actual >>>>>>>>>>> device in script >>>>>>>>>>> >>>>>>>>>>> BUS="ide", KERNEL="hd*", RUN+="/etc/udev/scripts/ide.sh" >>>>>>>>>>> +BUS="scsi", KERNEL="sd*", RUN+="/etc/udev/scripts/scsi.sh" >>>>>>>>>>> +BUS="scsi", KERNEL="sr*", RUN+="/etc/udev/scripts/scsi.sh" >>>>>>>>>>> KERNEL="fd[0-9]*", SYMLINK="floppy/%n", >>>>>>>>>>> RUN+="/etc/udev/scripts/floppy.sh" >>>>>>>>>>> >>>>>>>>>>> KERNEL="lp[0-9]*", SYMLINK="printers/%n" >>>>>>>>>>> >>>>>>>>>>> ##### END >>>>>>>>>>> >>>>>>>>>>> New script to add in the base package "/etc/udev/scripts/scsi.sh" >>>>>>>>>>> >>>>>>>>>>> ##### BEGIN >>>>>>>>>>> >>>>>>>>>>> #! /bin/sh >>>>>>>>>>> # >>>>>>>>>>> # Mount Hotplug Device >>>>>>>>>>> # >>>>>>>>>>> >>>>>>>>>>> . /etc/thinstation.env >>>>>>>>>>> . $TS_GLOBAL >>>>>>>>>>> >>>>>>>>>>> if [ ! -e /mnt/disc ]; then >>>>>>>>>>> mkdir /mnt/disc >>>>>>>>>>> fi >>>>>>>>>>> devpath=`basename $DEVPATH` >>>>>>>>>>> name=`echo $devpath | sed -e "s/[0-9]*//g"` >>>>>>>>>>> node=`echo $devpath | sed -e "s/[a-z]*//g"` >>>>>>>>>>> >>>>>>>>>>> RESULT=`echo $name | cut -c 1-2` >>>>>>>>>>> if [ "$RESULT" = "sr" ] ; then >>>>>>>>>>> case $ACTION in >>>>>>>>>>> add) >>>>>>>>>>> if [ -e /proc/sys/dev/cdrom ] ; then >>>>>>>>>>> echo 0 > /proc/sys/dev/cdrom/autoclose >>>>>>>>>>> fi >>>>>>>>>>> if check_module supermount ; then >>>>>>>>>>> while true >>>>>>>>>>> do >>>>>>>>>>> if [ ! -e /mnt/cdrom$x ] ; then >>>>>>>>>>> mkdir /mnt/cdrom$x >>>>>>>>>>> mount -t supermount -o >>>>>>>>>>> fs=auto,dev=/dev/$devpath /mnt/cdrom$x /mnt/cdrom$x >>>>>>>>>>> break 1 >>>>>>>>>>> fi >>>>>>>>>>> let x=x+1 >>>>>>>>>>> done >>>>>>>>>>> fi >>>>>>>>>>> esac >>>>>>>>>>> else >>>>>>>>>>> case $ACTION in >>>>>>>>>>> add) >>>>>>>>>>> if vol_id /dev/$devpath > /tmp/volumeinfo ; then >>>>>>>>>>> # Check to see if filesystem module is already >>>>>>>>>>> loaded, if not then loads it >>>>>>>>>>> . /tmp/volumeinfo >>>>>>>>>>> if ! check_module $ID_FS_TYPE ; then >>>>>>>>>>> modprobe $ID_FS_TYPE >>>>>>>>>>> fi >>>>>>>>>>> if [ ! -e /mnt/disc/$name ] ; then >>>>>>>>>>> mkdir /mnt/disc/$name >>>>>>>>>>> fi >>>>>>>>>>> if [ -z "$node" ] ; then >>>>>>>>>>> mkdir /mnt/disc/$name/$name >>>>>>>>>>> mount -t auto /dev/$devpath >>>>>>>>>>> /mnt/disc/$name/$name >>>>>>>>>>> else >>>>>>>>>>> mkdir /mnt/disc/$name/part$node >>>>>>>>>>> mount -t auto /dev/$devpath >>>>>>>>>>> /mnt/disc/$name/part$node >>>>>>>>>>> fi >>>>>>>>>>> [ $? != 0 ] && swapon /dev/$devpath >>>>>>>>>>> 2>/dev/null 2>&1 >>>>>>>>>>> fi >>>>>>>>>>> rm /tmp/volumeinfo >>>>>>>>>>> ;; >>>>>>>>>>> esac >>>>>>>>>>> fi >>>>>>>>>>> >>>>>>>>>>> exit 0 >>>>>>>>>>> >>>>>>>>>>> ##### END >>>>>>>>>>> >>>>>>>>>>> Best regards. >>>>>>>>>>> >>>>>>>>>>> Francis >>>>>>>>>>> >>>>>>>>>>> ------------------------------------------------------------------------- >>>>>>>>>>> >>>>>>>>>>> Take Surveys. Earn Cash. Influence the Future of IT >>>>>>>>>>> Join SourceForge.net's Techsay panel and you'll get the chance >>>>>>>>>>> to share your >>>>>>>>>>> opinions on IT & business topics through brief surveys-and >>>>>>>>>>> earn cash >>>>>>>>>>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >>>>>>>>>>> >>>>>>>>>>> _______________________________________________ >>>>>>>>>>> Thinstation-developer mailing list >>>>>>>>>>> Thi...@li... >>>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/thinstation-developer >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>> ------------------------------------------------------------------------- >>>>>>>>>> >>>>>>>>>> This SF.net email is sponsored by DB2 Express >>>>>>>>>> Download DB2 Express C - the FREE version of DB2 express and take >>>>>>>>>> control of your XML. No limits. Just data. Click to get it now. >>>>>>>>>> http://sourceforge.net/powerbar/db2/ >>>>>>>>>> _______________________________________________ >>>>>>>>>> Thinstation-developer mailing list >>>>>>>>>> Thi...@li... >>>>>>>>>> https://lists.sourceforge.net/lists/listinfo/thinstation-developer >>>>>>>>>> >>>>>>>>>> >>>>>>>>> ------------------------------------------------------------------------- >>>>>>>>> >>>>>>>>> This SF.net email is sponsored by DB2 Express >>>>>>>>> Download DB2 Express C - the FREE version of DB2 express and take >>>>>>>>> control of your XML. No limits. Just data. Click to get it now. >>>>>>>>> http://sourceforge.net/powerbar/db2/ >>>>>>>>> _______________________________________________ >>>>>>>>> Thinstation-developer mailing list >>>>>>>>> Thi...@li... >>>>>>>>> https://lists.sourceforge.net/lists/listinfo/thinstation-developer >>>>>>>>> >>>>>>> ------------------------------------------------------------------------- >>>>>>> >>>>>>> This SF.net email is sponsored by DB2 Express >>>>>>> Download DB2 Express C - the FREE version of DB2 express and take >>>>>>> control of your XML. No limits. Just data. Click to get it now. >>>>>>> http://sourceforge.net/powerbar/db2/ >>>>>>> _______________________________________________ >>>>>>> Thinstation-developer mailing list >>>>>>> Thi...@li... >>>>>>> https://lists.sourceforge.net/lists/listinfo/thinstation-developer >>>>>>> >>>>>> >>>> >>> >> ------------------------------------------------------------------------- >> This SF.net email is sponsored by DB2 Express >> Download DB2 Express C - the FREE version of DB2 express and take >> control of your XML. No limits. Just data. Click to get it now. >> http://sourceforge.net/powerbar/db2/ >> _______________________________________________ >> Thinstation-developer mailing list >> Thi...@li... >> https://lists.sourceforge.net/lists/listinfo/thinstation-developer >> > > > |