Hi everybody.
I recently started hacking on my new nslu2 running OpenSlug.
There has been successful testing on porting scsi-idle[1] to
OpenEmbedded for kernel 2.6.12 [2]. It allows automatic spindown of usb
harddrives (but also normal SCSI drives, of course) after an idle period.
I made a patch for kernel-2.6.15 and added it to the OpenEmbedded source
tree. This includes a kernel patch as well as the bb file for the
scsi-idle daemon.
I attached the corresponding patch file to this email. Please add it to
the OE source tree in order for the NSLU2 project to add this as a
standard package.
Thanks a lot!
Fred
[1] http://www.lost-habit.com/scsi.html
[2] http://groups.yahoo.com/group/nslu2-linux/message/8282
-- Frederic Wenzel Open Source Lab Oregon State University
#
# old_revision [b4f22b215f311576dceef0b500e3ab90139f3439]
#
# add_file "packages/linux/nslu2-kernel/2.6.12/kernel-patch-scsi-idle.patch"
#
# add_file "packages/linux/nslu2-kernel/2.6.15/scsi-idle.patch"
#
# add_file "packages/scsi-idle/makefile.patch"
#
# add_file "packages/scsi-idle/scsi-idle.init.patch"
#
# add_file "packages/scsi-idle/scsi-idle_2.4.23.bb"
#
# patch "packages/linux/nslu2-kernel/2.6.12/kernel-patch-scsi-idle.patch"
# from []
# to [4cf53a6fd3abc8a6cb2256fd632eaced8bcac385]
#
# patch "packages/linux/nslu2-kernel/2.6.15/scsi-idle.patch"
# from []
# to [ecf9e21a924f28dc485b617a27753009b1f5a141]
#
# patch "packages/linux/nslu2-kernel_2.6.15-rc5.bb"
# from [a4d00e59a6d03e791f6a8d73e51d34e9853b0f0f]
# to [d70c875055c5110782467f200396812e0c84cad9]
#
# patch "packages/scsi-idle/makefile.patch"
# from []
# to [b5fd1b621fc910567df002c56c4bd74a37243a28]
#
# patch "packages/scsi-idle/scsi-idle.init.patch"
# from []
# to [39297822518422577c01a8f6f2f2f179ffd16bfe]
#
# patch "packages/scsi-idle/scsi-idle_2.4.23.bb"
# from []
# to [85a06ac32ef84da5ae8c9175fdcad5559ccb27c9]
#
============================================================
--- packages/linux/nslu2-kernel/2.6.12/kernel-patch-scsi-idle.patch
+++ packages/linux/nslu2-kernel/2.6.12/kernel-patch-scsi-idle.patch 4cf53a6fd3abc8a6cb2256fd632eaced8bcac385
@@ -0,0 +1,44 @@
+diff -ur linux-2.6.12.2/drivers/scsi/sd.c linux-2.6.12.2_scsi-idle/drivers/scsi/sd.c
+--- linux-2.6.12.2/drivers/scsi/sd.c 2005-08-27 06:12:31.000000000 +0200
++++ linux-2.6.12.2_scsi-idle/drivers/scsi/sd.c 2005-08-27 06:26:50.000000000 +0200
+@@ -266,6 +266,9 @@
+ "count=%d\n", disk->disk_name,
+ (unsigned long long)block, this_count));
+
++ /* Update idle-since time */
++ sdp->idle = jiffies;
++
+ if (!sdp || !scsi_device_online(sdp) ||
+ block + rq->nr_sectors > get_capacity(disk)) {
+ SCSI_LOG_HLQUEUE(2, printk("Finishing %ld sectors\n",
+@@ -600,6 +603,8 @@
+ case SCSI_IOCTL_GET_IDLUN:
+ case SCSI_IOCTL_GET_BUS_NUMBER:
+ return scsi_ioctl(sdp, cmd, p);
++ case SCSI_IOCTL_IDLE:
++ return (jiffies - sdp->idle) / HZ + 1;
+ default:
+ error = scsi_cmd_ioctl(filp, disk, cmd, p);
+ if (error != -ENOTTY)
+diff -ur linux-2.6.12.2/include/scsi/scsi_device.h linux-2.6.12.2_scsi-idle/include/scsi/scsi_device.h
+--- linux-2.6.12.2/include/scsi/scsi_device.h 2005-08-27 06:12:44.000000000 +0200
++++ linux-2.6.12.2_scsi-idle/include/scsi/scsi_device.h 2005-08-27 06:27:09.000000000 +0200
+@@ -125,6 +125,7 @@
+ atomic_t ioerr_cnt;
+
+ int timeout;
++ unsigned long idle; /* scsi idle time in jiffers */
+
+ struct device sdev_gendev;
+ struct class_device sdev_classdev;
+diff -ur linux-2.6.12.2/include/scsi/scsi_ioctl.h linux-2.6.12.2_scsi-idle/include/scsi/scsi_ioctl.h
+--- linux-2.6.12.2/include/scsi/scsi_ioctl.h 2005-08-27 06:12:44.000000000 +0200
++++ linux-2.6.12.2_scsi-idle/include/scsi/scsi_ioctl.h 2005-08-28 17:32:17.000000000 +0200
+@@ -7,6 +7,7 @@
+ #define SCSI_IOCTL_SYNC 4 /* Request synchronous parameters */
+ #define SCSI_IOCTL_START_UNIT 5
+ #define SCSI_IOCTL_STOP_UNIT 6
++#define SCSI_IOCTL_IDLE 4746 /* get idle time in jiffies */
+ /* The door lock/unlock constants are compatible with Sun constants for
+ the cdrom */
+ #define SCSI_IOCTL_DOORLOCK 0x5380 /* lock the eject mechanism */
============================================================
--- packages/linux/nslu2-kernel/2.6.15/scsi-idle.patch
+++ packages/linux/nslu2-kernel/2.6.15/scsi-idle.patch ecf9e21a924f28dc485b617a27753009b1f5a141
@@ -0,0 +1,44 @@
+diff -Nru a/drivers/scsi/sd.c b/drivers/scsi/sd.c
+--- a/drivers/scsi/sd.c 2005-12-16 14:13:24.000000000 -0800
++++ b/drivers/scsi/sd.c 2005-12-16 14:14:36.000000000 -0800
+@@ -280,6 +280,9 @@
+ "count=%d\n", disk->disk_name,
+ (unsigned long long)block, this_count));
+
++ /* Update idle-since time */
++ sdp->idle = jiffies;
++
+ if (!sdp || !scsi_device_online(sdp) ||
+ block + rq->nr_sectors > get_capacity(disk)) {
+ SCSI_LOG_HLQUEUE(2, printk("Finishing %ld sectors\n",
+@@ -611,6 +614,8 @@
+ case SCSI_IOCTL_GET_IDLUN:
+ case SCSI_IOCTL_GET_BUS_NUMBER:
+ return scsi_ioctl(sdp, cmd, p);
++ case SCSI_IOCTL_IDLE:
++ return (jiffies - sdp->idle) / HZ + 1;
+ default:
+ error = scsi_cmd_ioctl(filp, disk, cmd, p);
+ if (error != -ENOTTY)
+diff -Nru a/include/scsi/scsi_device.h b/include/scsi/scsi_device.h
+--- a/include/scsi/scsi_device.h 2005-12-16 14:07:35.000000000 -0800
++++ b/include/scsi/scsi_device.h 2005-12-16 14:14:36.000000000 -0800
+@@ -134,6 +134,7 @@
+ atomic_t ioerr_cnt;
+
+ int timeout;
++ unsigned long idle; /* scsi idle time in jiffers */
+
+ struct device sdev_gendev;
+ struct class_device sdev_classdev;
+diff -Nru a/include/scsi/scsi_ioctl.h b/include/scsi/scsi_ioctl.h
+--- a/include/scsi/scsi_ioctl.h 2005-12-16 14:07:35.000000000 -0800
++++ b/include/scsi/scsi_ioctl.h 2005-12-16 14:14:36.000000000 -0800
+@@ -7,6 +7,7 @@
+ #define SCSI_IOCTL_SYNC 4 /* Request synchronous parameters */
+ #define SCSI_IOCTL_START_UNIT 5
+ #define SCSI_IOCTL_STOP_UNIT 6
++#define SCSI_IOCTL_IDLE 4746 /* get idle time in jiffies */
+ /* The door lock/unlock constants are compatible with Sun constants for
+ the cdrom */
+ #define SCSI_IOCTL_DOORLOCK 0x5380 /* lock the eject mechanism */
============================================================
--- packages/linux/nslu2-kernel_2.6.15-rc5.bb a4d00e59a6d03e791f6a8d73e51d34e9853b0f0f
+++ packages/linux/nslu2-kernel_2.6.15-rc5.bb d70c875055c5110782467f200396812e0c84cad9
@@ -27,6 +27,7 @@
file://91-maclist.patch;patch=1 \
file://92-nslu2-maclist.patch;patch=1 \
file://anonymiser.patch;patch=1 \
+ file://scsi-idle.patch;patch=1 \
"
# These options get added to the kernel command line, only put things
============================================================
--- packages/scsi-idle/makefile.patch
+++ packages/scsi-idle/makefile.patch b5fd1b621fc910567df002c56c4bd74a37243a28
@@ -0,0 +1,9 @@
+diff -ur scsi-idle-2.4.23/Makefile scsi-idle-2.4.23~patched/Makefile
+--- scsi-idle-2.4.23/Makefile 2004-01-31 11:34:30.000000000 +0100
++++ scsi-idle-2.4.23~patched/Makefile 2005-08-29 19:21:29.116560624 +0200
+@@ -1,4 +1,4 @@
+-KSRC ?= /usr/src/linux
++KSRC ?= ${QPEDIR}
+ CFLAGS=-Wall -O2 -fomit-frame-pointer -pipe -s -include $(KSRC)/include/scsi/scsi_ioctl.h -include $(KSRC)/include/linux/major.h
+
+ TARGETS = scsi-start scsi-stop scsi-idle
============================================================
--- packages/scsi-idle/scsi-idle.init.patch
+++ packages/scsi-idle/scsi-idle.init.patch 39297822518422577c01a8f6f2f2f179ffd16bfe
@@ -0,0 +1,12 @@
+diff -ur scsi-idle-2.4.23/debian/scsi-idle.init scsi-idle-2.4.23~patched/debian/scsi-idle.init
+--- scsi-idle-2.4.23/debian/scsi-idle.init 2004-01-31 11:47:02.000000000 +0100
++++ scsi-idle-2.4.23~patched/debian/scsi-idle.init 2005-08-31 18:56:46.000000000 +0200
+@@ -21,7 +21,7 @@
+ export BEQUIET
+ if [ "$PAIRS" ] ; then
+ set -- $PAIRS
+- while [ "$#" !=0 ] ; do
++ while [ "$#" != 0 ] ; do
+ PIDFILE=/var/run/$NAME`echo $1 | tr / _`.pid
+ export PIDFILE
+ echo -n " $1"
============================================================
--- packages/scsi-idle/scsi-idle_2.4.23.bb
+++ packages/scsi-idle/scsi-idle_2.4.23.bb 85a06ac32ef84da5ae8c9175fdcad5559ccb27c9
@@ -0,0 +1,38 @@
+HOMEPAGE = "http://packages.debian.org/unstable/admin/scsi-idle"
+MAINTAINER = "Robert Demski <Robert.Demski_at_wp.pl>"
+AUTHOR = "Eduard Bloch <blade_at_debian.org>"
+LICENSE = "GPLv2"
+SECTION = "console/utils"
+PRIORITY = "optional"
+PR = "r1"
+DESCRIPTION = "Description: turn off SCSI disks when idle \
+This package contains small programs to start and stop SCSI disks and a \
+daemon that spins down drives when idle. A kernel patch provided by the \
+kernel-patch-scsi-idle package is required to send spin up/down \
+commands to the SCSI hardware."
+
+SRC_URI = "${DEBIAN_MIRROR}/main/s/scsi-idle/scsi-idle_${PV}-5.tar.gz \
+ file://makefile.patch;patch=1 \
+ file://scsi-idle.init.patch;patch=1"
+
+S = "${WORKDIR}/scsi-idle-${PV}"
+
+inherit autotools
+
+EXTRA_OECONF = ""
+
+do_install() {
+ install -d ${D}${sbindir} ${D}${mandir}/man8 \
+ ${D}${sysconfdir}/default \
+ ${D}${sysconfdir}/init.d \
+ ${D}${sysconfdir}/rcS.d
+
+ install -m 0755 ${S}/scsi-idle ${D}${sbindir}
+ install -m 0755 ${S}/scsi-start ${D}${sbindir}
+ cd ${D}${sbindir} && ln -s scsi-start scsi-stop
+ install -m 0644 ${S}/debian/scsi-idle.default ${D}${sysconfdir}/default/scsi-idle
+ install -m 0755 ${S}/debian/scsi-idle.init ${D}${sysconfdir}/init.d/scsi-idle
+ cd ${D}${sysconfdir}/rcS.d && ln -s ../init.d/scsi-idle S57scsi-idle
+ install -m 0644 ${S}/scsi-idle.8 ${D}${mandir}/man8
+ install -m 0644 ${S}/scsi-start.8 ${D}${mandir}/man8
+}
Received on Fri Dec 16 2005 - 18:23:47 EST
This archive was generated by hypermail 2.2.0 : Fri Dec 16 2005 - 18:38:51 EST