Highpoint RocketRaid Driver DKMS Mini-HowTo
This HowTo details how to configure DKMS to build and install your RocketRaid driver. This will allow your driver to automatically migrate between kernel updates without your intervention. DKMS is automatically called by the Ubuntu kernel install scripts.
RocketRaid 62x Driver
Notice
Variations on these instructions will likely work with other RocketRaid (or even other hardware) drivers, but they've at least been tested with the rr62x on Maverick 10.10. In spite of this, this how-to may not be complete and require modifications particular to your setup. Feel free to add modifications in this wiki page. For clarifications on how to use DKMS, the Ubuntu help page and man dkms are always a good place to look.
Prerequisites
- Ubuntu 10.10 (other versions may work as well)
RocketRaid 622 RAID Card
- Kernel Tools and Headers
Aside from the RAID Card, the standard Ubuntu installation should have everything you need, but just in case, the following should pull in anything you're missing:
# sudo apt-get install dkms
Introduction
To use a module with DKMS, one places the module installation files (could be source code or binary) in /usr/src/<modulename>-<version>, along with a configuration file dkms.conf that tells DKMS how to build/configure the module and what its name is. Under more advanced scenarios, conditional build instructions and patching can be done by the dkms system, but in our case this is not necessary.
Setup
Fire up your favorite terminal and download the driver package you want to use. I use the "legacy" non-RAID driver that forces all disks to be recognized as pass-thru devices for direct disk access, but the RAID driver works in exactly the same way. The following links may not be up-to-date, but they work well as of kernel 2.6.35.
# wget http://dl.sansdigital.com/images/downloads/TR8M-BP_TR8MP/Non_RAID_Driver_Linux-SourceCode-v1.0-100421-1320.tar.zip
or for RAID
# wget http://www.support-highpoint-tech.com/Main/RR622/Linux/opensrc/rr62x-linux-src-v1.1-091221-1456.tar.gz
Now untar/unzip the files and enter the installation directory. Non-RAID:
# unzip Non_RAID_Driver_Linux-SourceCode-v1.0-100421-1320.tar.zip # tar -xzf rr62x-linuxla-src-v1.0-100421-1320.tar.gz # cd rr62x-linuxla-src-v1.0/
RAID:
# tar -xzf rr62x-linux-src-v1.1-091221-1456.tar.gz # cd rr62x-linux-src-v1.1/
From this point on, install instructions will be the same for the RAID and non-RAID drivers, except for the version difference (1.0 for non-RAID, 1.1 for RAID), and the "la" suffix is in various places for the non-RAID driver. I'll continue as if we're working with the non-RAID driver, though if you drop the "la" and change the version to 1.1 you have the instructions for the RAID driver.
Installation ''Without'' DKMS
First, let's see what we're looking at:
# ls inc lib osm product README
Take a look at the README. Following its instructions we do the following:
# cd product/rr62x/linuxla/ # ls config.c Makefile # make stuff happens... look for errors # ls config.c Makefile rr62x.ko # sudo make install rr62x.ko is copied to kernel tree, initrd is rebuilt
With DKMS, we tell DKMS how to do all that for you by creating a dkms.conf file with the appropriate entries.
Configure dkms.conf
Back in the "root" rr62x-linuxla-src-v1.0/, we create dkms.conf and open it in our favorite text editor:
# ls inc lib osm product README # touch dkms.conf #create dkms.conf file # texteditorofyourchoice dkms.conf
Inside dkms.conf, we add the lines:
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
All directories are with respect to the location of the dkms.conf file. This tells DKMS
The command to build the module (run make in the directory product/rr62x/linuxla/).
The command to clean the source tree (run make clean in the directory product/rr62x/linuxla/).
The name of the module without the .o or .ko extension.
That DKMS can find the built module in product/rr62x/linuxla/.
- The name and version DKMS should associate with the module.
- To automatically install the module into a new kernel on boot if the capability exists (this isn't necessary if you use Ubuntu's prebuilt packages to update your kernels, but it doesn't hurt).
- To remake the initrd image after installing the module.
Save the file.
Tell DKMS about the module
Next, we install the module into DKMS by copying the module installation files into the kernel source tree /usr/src/<modulename>-<version> and tell DKMS about the new module. In our case, this is:
# ls dkms.conf inc lib osm product README # sudo cp -R . /usr/src/rr62xla-1.0 # sudo dkms add -m rr62xla -v 1.0 dkms does its thing...
Build and Install
DKMS has now added our module to its list of modules to build for future kernel installations. To make sure it works and to install the module into our current kernel, we can instruct dkms to build and install the module:
# sudo dkms build -m rr62xla -v 1.0 dkms does its thing.... watch for build errors... you may need to tweak dkms.conf # sudo dkms install -m rr62xla -v 1.0 dkms does its thing.... module is copied into current kernel module tree
Your module will be installed and reinstalled into future kernel updates.
RocketRaid 26xx Driver
Notice
This is wiki page is in its infancy. Please feel free to modify or offer suggestions if possible. Currently a lot of this was done from memory and notes, and should therefore be tested again. These instructions are a bit dated, and some success may be had using a variation or combination of these with the RocketRaid 62x instructions above.
Purpose
This mini-howto is intended to help others avoid the frustration I went through when updating kernels and having my root partition on a RocketRaid mirrored drive. While not complete, this mini-howto should get most users the ability to have the driver automatically compile and install on a kernel update using DKMS.
Prerequisites
- Ubuntu 9.04 / 9.10
RocketRaid 26xx RAID Card
- Kernel Tools and Headers
- Internet Access
- Root/sudo Permission
Setup
First, install the build tools:
sudo apt-get install build-essential
"Note: Need to make sure kernel headers are installed"
Download the driver source from Highpoint: "I recommend verifying this link is the most recent before downloading"
lwp-download http://www.support-highpoint-tech.com/Main/rr26xx/264x/Linux/opensrc/rr2640-linux-src-v1.2-090925-0932.tar.gz
Extract the tar:
tar zxvf rr2640-linux-src-v1.2-090925-0932.tar.gz
cd rr2640-linux-src-v1.2
Make sure DKMS is installed:
sudo aptitude install dkms
Create the DKMS configuration file:
cat >dkms.conf
Cut and Paste the following text:
BUILT_MODULE_NAME=rr26xx DEST_MODULE_LOCATION=/kernel/drivers/scsi PACKAGE_NAME=rr26xx PACKAGE_VERSION=1.2 AUTOINSTALL=yes POST_BUILD="do_Module.symvers rr26xx save $dkms_tree/$module/$module_version/build/Module.symvers"
Hit "Control-D" (as in Dog) to close the file.
Copy the Makefile and Config files up to the top directory:
cp product/rr2640/linux/* . mv Makefile Makefile_orig
Modify the HPT_ROOT in the Makefile:
sed 's/HPT_ROOT := ..\/..\/../HPT_ROOT := \/var\/lib\/dkms\/rr26xx\/1.2\/build/' Makefile_orig >Makefile
Move the source into /usr/src for DKMS:
cd .. mv rr2640-linux-src-v1.2 /usr/src/rr26xx-1.2
"Todo: Should probably verify permissions here..."
"Note: For some reason dkms will not copy object files (.o) when doing builds, so we need to fool it below."
Trick dkms into looking in the /usr/src directory for the precompiled RocketRaid object code:
mv /usr/src/rr26xx-1.2/lib /usr/src/rr26xx-1.2/real_lib ln -s /usr/src/rr26xx-1.2/real_lib /usr/src/rr26xx-1.2/lib
"Note: Above symbolic link must be complete (absolute) path!"
Add the source to DKMS:
sudo dkms add -m rr26xx -v 1.2
Build the module:
sudo dkms build -k 2.6.31-14-generic -m rr26xx -v 1.2
This should hopefully compile correctly. If not send an email to "rocketraid at mark.org" with the output from the file "/var/lib/dkms/rr26xx/1.2/build/make.log"
Next install the module:
sudo dkms install -k 2.6.31-14-generic -m rr26xx -v 1.2
Finally, create the boot image:
sudo mkinitramfs -o /boot/initrd.img-2.6.31-14-generic 2.6.31-14-generic
This should install it into the named kernel listed above (2.6.31-14 in this example). It will also use DKMS to compile the module for future kernel update automatically. Please see note below.
=== Running mkinitramfs ==-
The directions above seem to automatically recompile and install the module whenever a new kernel update comes out (at least for 9.04 and 9.10). However, so far it does not automatically add it to the boot image.
If after a kernel upgrade you reboot and it can't find the rr26xx module, then reboot in an old working kernel and run this:
sudo mkinitramfs -o /boot/initrd.img-2.6.31-14-generic 2.6.31-14-generic
Obviously, replace "2.6.31-14-generic" with the kernel that was just updated.
I'm looking for a way to do this post DKMS (maybe POST_BUILD???). If anyone has any suggestions, please let me know!
I'm currently experimenting with adding the file /etc/kernel/postinst.d/rr26xx with the following contents:
vi /etc/kernel/postinst.d/rr26xx
# We're passed the version of the kernel being installed inst_kern=$1 echo "Trying mkinitramfs -o /boot/initrd.img-${inst_kern} ${inst_kern}..." mkinitramfs -o /boot/initrd.img-$inst_kern $inst_kern exit 0
in theory this should work, but I haven't tested it yet (will with next kernel upgrade)