[CentOS-devel] Areca RAID drivers

Wed Sep 12 20:32:22 UTC 2007
Phil Schaffner <Philip.R.Schaffner at NASA.gov>

On Tue, 2007-09-04 at 23:32 +0100, Karanbir Singh wrote: 
> Hi,
> 
> Phil Schaffner wrote:
> > Karanbir provided driver disk images and indicated that kmod drivers
> > would be in CentOS-5 Extras, but apparently these never materialized.
> > The only src.rpm I could turn up was the last link above, and I did get
> > CentOS-5 x86_64 kmod-style drivers to build from that one.  Found other
> > indications that these drivers MIGHT be in the standard 5.1 kernel.
> 
> Ive been talking to and working with the guys at Areca to get the
> drivers sorted, they are also working with upstream to get the driver
> included in the upstream kernel, for now - use the dd images I pushed,
> that will do-the-right-thing, and follow weak-updates, so you dont need
> kmod's for them with the kernels for c5 ( so far ) - I have half a dozen
> 11xx and 12xx Areca cards in production, and I can tell you that they
> totally rock!

Please pardon the cross-posting to centos-users - in case others may be
interested.

Did a fresh install of CentOS-5 x86_64 on my server with Areca RAID (2
5TB RAID-5 arrays) with the OS on mirrored SCSI disks set up as software
RAID-1 using Karanbir's dd ISO image.  Used custom install and mounted
the existing Areca RAID arrays as /data1 and /data2 (as they were for
CentOS-4 - originally set up by the vendor with RHEL-4).  Install and
reboot went flawlessly, but after update to the latest kernel a reboot
did not find the driver for kernel-2.6.18-8.1.8.el5 and left me in
single-user mode.  Copied /lib/modules/2.6.18-8.el5/updates/arcmsr.ko
created by the original installation to 
/lib/modules/2.6.18-8.1.8.el5/weak-updates/arcmsr.ko 
did "depmod -a" and "modprobe arcmsr" and the Areca devices then
mounted.

I'm a newbie to weak-updates so would appreciate it if anyone could
point out the "right way" [TM] to do this automagically when a new
kernel is installed.  Perhaps my google-foo is off today, or I have not
exercised sufficient diligence to RTFM, but can't seem to find the
recipe.

Meanwhile, back at the ranch...

Wanted to try the dkms approach and the spec file below (based on
RPMforge dkms-r1000.spec) worked for me.  Installing the resulting RPM
created /lib/modules/2.6.18-8.1.8.el5/extra/arcmsr.ko, made a soft link
to it as /lib/modules/2.6.18-8.el5/weak-updates/arcmsr.ko, and removed 
/lib/modules/2.6.18-8.1.8.el5/weak-updates/arcmsr.ko

Should probably have figured out how to use the original ZIP archive
from the vendor

ftp://ftp.areca.com.tw/RaidCards/AP_Drivers/Linux/DRIVER/CentOS/CentOS-5.0/1.20.0X.13/arcmsr.redhat.1.20.0x.13.zip

in the spec, but instead cheated and created a .tgz archive from it to
stay closer to the r1000 spec file's approach:

$ tar ztvf arcmsr.redhat.1.20.0x.13.tgz 
drwxrwxr-x prs/prs           0 2006-12-22 17:52:50 arcmsr.redhat.1.20.0x.13/
drwxrwxr-x prs/prs           0 2006-12-22 17:52:50 arcmsr.redhat.1.20.0x.13/arcmsr/
-rw-rw-r-- prs/prs       96956 2006-11-08 16:59:50 arcmsr.redhat.1.20.0x.13/arcmsr/arcmsr.c
-rw-rw-r-- prs/prs      377113 2006-11-08 16:59:00 arcmsr.redhat.1.20.0x.13/arcmsr/arcmsr.h
-rw-rw-r-- prs/prs         149 2005-07-21 19:10:00 arcmsr.redhat.1.20.0x.13/arcmsr/Makefile

Have yet to have a go at packaging the vendor's binary (CLI and HTTP)
files in an RPM (reference earlier nosrc.rpm discussions in this
thread), but did create a chkconfig-compatible script to set up the
httpd service after a manual install.  See below.

I would hope Areca drivers might appear on RPMforge or CentOS Extras
some day soon.  Comments appreciated.

Phil

------------------- dkms-arcmsr.spec --------------------- 
# $Id$
# Authority: prs
# Dist: nodist

Summary: Driver for Areca RAID
Name: dkms-arcmsr
Version: 1.20.0x.13
Release: 1
License: GPL
Group: System Environment/Kernel
# Need to unzip driver archive and convert to tgz
URL: ftp://ftp.areca.com.tw/RaidCards/AP_Drivers/Linux/DRIVER/CentOS/CentOS-5.0
Source: arcmsr.redhat.%{version}.tgz
BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root
BuildArch: noarch
Requires: gcc
Requires(post): dkms
Requires(preun): dkms

%description
Driver (Linux kernel module) for Areca RAID Controllers.

%prep
%setup -n arcmsr.redhat.%{version}


%build


%install
%{__rm} -rf %{buildroot}

%define dkms_name arcmsr
%define dkms_vers %{version}-%{release}
%define quiet -q

# Kernel module sources install for dkms
%{__mkdir_p} %{buildroot}%{_usrsrc}/%{dkms_name}-%{dkms_vers}/
%{__cp} -a arcmsr/* %{buildroot}%{_usrsrc}/%{dkms_name}-%{dkms_vers}/

# Configuration for dkms
%{__cat} > %{buildroot}%{_usrsrc}/%{dkms_name}-%{dkms_vers}/dkms.conf << 'EOF'
PACKAGE_NAME=%{dkms_name}
PACKAGE_VERSION=%{dkms_vers}
BUILT_MODULE_NAME[0]=%{dkms_name}
DEST_MODULE_LOCATION[0]=/weak_updates
AUTOINSTALL="YES"
EOF


%clean
%{__rm} -rf %{buildroot}


%post
# Add to DKMS registry
dkms add -m %{dkms_name} -v %{dkms_vers} %{?quiet} || :
# Rebuild and make available for the currenty running kernel
dkms build -m %{dkms_name} -v %{dkms_vers} %{?quiet} || :
dkms install -m %{dkms_name} -v %{dkms_vers} %{?quiet} --force || :

%preun
# Remove all versions from DKMS registry
dkms remove -m %{dkms_name} -v %{dkms_vers} %{?quiet} --all || :


%files
%defattr(-, root, root, 0755)
#%doc release_note.txt README
%{_usrsrc}/%{dkms_name}-%{dkms_vers}/


%changelog
* Wed Sep 12 2007 Phil Schaffner <philip.r.schaffner at nasa.gov> 1.20.0X.13
- Initial RPM release.
----------------- end dkms-arcmsr.spec -------------------

----------------------- areca-httpd  ---------------------
#!/bin/sh
#
# areca-httpd:     	Starts the Areca daemon
#
# Author:       Phil Schaffner <philip.r.schaffner at nasa.gov>
#
# chkconfig: 345 40 60
# description: Start the areca application which logs the current state
#              of the Areca RAID 1170 controller card, and then polls
#              for state changes.
#
# processname: areca-httpd
# config: Unknown

# Source function library.
. /etc/rc.d/init.d/functions

RETVAL=0
ARECA_BIN=/root/bin/archttp64
ARECA_PORT="888"

# See how we were called.
case "$1" in
  start)
	echo -n "Starting Areca RAID 1170 HTTP daemon: "
	$ARECA_BIN $ARECA_PORT >&/tmp/ArecaHTTP.log &
	RETVAL=$?
	echo
	[ $RETVAL -eq 0 ] && touch /var/lock/subsys/areca-httpd || RETVAL=1
	;;
  stop)
	echo -n "Stopping Areca RAID 1170 HTTP daemon: "
	killall $ARECA_BIN
	RETVAL=$?
	[ $RETVAL -eq 0 ] && rm -f /var/lock/subsys/areca-httpd
        echo
	sleep 2
	;;
  status)
	ps auxww | grep $ARECA_BIN
	RETVAL=$?
	;;
  restart)
	$0 stop
	$0 start
	RETVAL=$?
	;;
  *)
	echo "Usage: $0 {start|stop|status|restart}"
	exit 1
esac

exit $RETVAL
--------------------- end areca-httpd  -------------------