Compile o módulo rr62x (RocketRaid) em qualquer kernel

De Wiki Hackstore

Rocket-RAID620-modulo-rr62x.jpg

Caso possua uma controladora RAID RocketRaid 620, 622, 640 or 644 e queira usar em um sistema Linux, utilize o patch criado para qualquer sistema:

diff -rupN rr62x-linux-src-v1.1/dkms.conf rr62x-linux-src-v1.1-modificado//dkms.conf
--- rr62x-linux-src-v1.1/dkms.conf	1969-12-31 21:00:00.000000000 -0300
+++ rr62x-linux-src-v1.1-modificado//dkms.conf	2012-07-17 11:02:58.000000000 -0300
@@ -0,0 +1,9 @@
+MAKE="make -C product/rr62x/linuxla/ KERNELDIR=/lib/modules/${kernelver}/build"
+CLEAN="make -C product/rr62x/linuxla/ clean"
+BUILT_MODULE_NAME=rr62x
+DEST_MODULE_LOCATION=/kernel/drivers/scsi/
+BUILT_MODULE_LOCATION=product/rr62x/linuxla/
+PACKAGE_NAME=rr62xla
+PACKAGE_VERSION=1.O
+AUTOINSTALL=yes
+REMAKE_INITRD=yes
diff -rupN rr62x-linux-src-v1.1/inc/linux/Makefile.def rr62x-linux-src-v1.1-modificado//inc/linux/Makefile.def
--- rr62x-linux-src-v1.1/inc/linux/Makefile.def	2009-12-21 05:01:21.000000000 -0200
+++ rr62x-linux-src-v1.1-modificado//inc/linux/Makefile.def	2012-07-17 10:54:24.000000000 -0300
@@ -74,19 +74,21 @@ ifndef KERNELDIR
 KERNELDIR := /lib/modules/$(shell uname -r)/build
 endif
 
-KERNEL_VER := 2.$(shell expr `grep LINUX_VERSION_CODE $(KERNELDIR)/include/linux/version.h | cut -d\  -f3` / 256 % 256)
-
+KERNEL_VER := $(shell uname -r | cut -f1-2 -d.)
 ifeq ($(KERNEL_VER),)
 $(error Cannot find kernel version. Check $(KERNELDIR)/include/linux/version.h.)
 endif
-
+ifneq ($(KERNEL_VER), 3.2)
+ifneq ($(KERNEL_VER), 3.0)
 ifneq ($(KERNEL_VER), 2.6)
 ifneq ($(KERNEL_VER), 2.4)
-$(error Only kernel 2.4/2.6 is supported but you use $(KERNEL_VER))
+$(error Only kernel 2.4/2.6/3.0/3.2 is supported but you use $(KERNEL_VER))
+endif
+endif
 endif
 endif
 
-ifeq ($(KERNEL_VER), 2.6)
+ifeq ($(KERNEL_VER), $(filter $(KERNEL_VER),3.2 3.0 2.6))
 
 TARGET := $(TARGETNAME).ko
 
diff -rupN rr62x-linux-src-v1.1/osm/linux/install.sh rr62x-linux-src-v1.1-modificado//osm/linux/install.sh
--- rr62x-linux-src-v1.1/osm/linux/install.sh	2009-12-21 05:01:22.000000000 -0200
+++ rr62x-linux-src-v1.1-modificado//osm/linux/install.sh	2012-07-17 10:58:22.000000000 -0300
@@ -14,6 +14,14 @@ case ${KERNEL_VER} in
 	OBJ=ko
 	MODVER=`modinfo -F vermagic ${PWD}/${TARGETNAME}.${OBJ} | cut -d' ' -f1`
 	;;
+       3.0 )
+       OBJ=ko
+       MODVER=`modinfo -F vermagic ${PWD}/${TARGETNAME}.${OBJ} | cut -d' ' -f1`
+       ;;
+       3.2 )
+       OBJ=ko
+       MODVER=`modinfo -F vermagic ${PWD}/${TARGETNAME}.${OBJ} | cut -d' ' -f1`
+       ;;
 esac
 
 if test "${MODVER}" = "" ; then
diff -rupN rr62x-linux-src-v1.1/osm/linux/osm_linux.c rr62x-linux-src-v1.1-modificado//osm/linux/osm_linux.c
--- rr62x-linux-src-v1.1/osm/linux/osm_linux.c	2009-12-21 05:01:22.000000000 -0200
+++ rr62x-linux-src-v1.1-modificado//osm/linux/osm_linux.c	2012-07-17 10:57:42.000000000 -0300
@@ -922,7 +922,7 @@ static void hpt_scsi_start_stop_done(PCO
 	}
 }
 
-static int hpt_queuecommand (Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
+static int hpt_queuecommand_lck (Scsi_Cmnd * SCpnt, void (*done) (Scsi_Cmnd *))
 {
 	struct Scsi_Host *phost = sc_host(SCpnt);
 	PVBUS_EXT vbus_ext = get_vbus_ext(phost);
@@ -1456,6 +1456,12 @@ cmd_done:
 	return 0;
 }
 
+
+#ifdef DEF_SCSI_QCMD
+DEF_SCSI_QCMD(hpt_queuecommand)
+#else
+#define hpt_queuecommand hpt_queuecommand_lck
+#endif
 static int hpt_reset (Scsi_Cmnd *SCpnt)
 {
 	PVBUS_EXT vbus_ext = get_vbus_ext(sc_host(SCpnt));
diff -rupN rr62x-linux-src-v1.1/osm/linux/osm_linux.h rr62x-linux-src-v1.1-modificado//osm/linux/osm_linux.h
--- rr62x-linux-src-v1.1/osm/linux/osm_linux.h	2009-12-21 05:01:22.000000000 -0200
+++ rr62x-linux-src-v1.1-modificado//osm/linux/osm_linux.h	2012-07-17 10:55:06.000000000 -0300
@@ -7,10 +7,7 @@
 #define _OSM_LINUX_H
 
 /* system headers */
-
-#ifndef AUTOCONF_INCLUDED
-#include <linux/config.h>
-#endif
+#include <generated/autoconf.h>
 
 #include <linux/version.h>
 
diff -rupN rr62x-linux-src-v1.1/osm/linux/patch.sh rr62x-linux-src-v1.1-modificado//osm/linux/patch.sh
--- rr62x-linux-src-v1.1/osm/linux/patch.sh	2009-12-21 05:01:22.000000000 -0200
+++ rr62x-linux-src-v1.1-modificado//osm/linux/patch.sh	2012-07-17 10:58:51.000000000 -0300
@@ -143,7 +143,7 @@ CONFIG_SCSI_${UTARGETNAME}=y
 		fi
 	fi
 	;;
-	2.6 )
+	2.6 | 3.0 | 3.2 )
 	cd ${HPT_ROOT}/lib/linux/free-${ARCH}-regparm0
 	ld -r -o ${ARCH}-${TARGETNAME}.obj ${TARGETMODS}
 	mv ${ARCH}-${TARGETNAME}.obj $KERNELDIR/drivers/scsi/${TARGETNAME}/	

Caso prefira, realize o download do patch criado por Raphael Bastos no link a seguir:

wget http://wiki.hackstore.com.br/downloads/rr62x-patched/Rocket-RAID600-modulo-rr62x/raphael.patch


Faça o download do código fonte do módulo rr62x no link abaixo:

wget http://wiki.hackstore.com.br/downloads/rr62x-patched/Rocket-RAID600-modulo-rr62x/rr62x-linux-src-v1.1-091221-1456.tar.gz


Extraia o fonte e aplique o patch:

tar xzvf rr62x-linux-src-v1.1-091221-1456.tar.gz
mv raphael.patch rr62x-linux-src-v1.1-091221-1456
patch -p1 < raphael.patch


Compile o módulo e seja feliz! Caso prefira, utilize o source do módulo com o patch aplicado:

http://wiki.hackstore.com.br/downloads/rr62x-patched/Rocket-RAID600-modulo-rr62x/rr62x-linux-src-v1.1-modificado.tar.gz