User:D3zm0nd/HARDWARE LSI 8208ELP RAID5 Controller

Introduction
The LSI 8208ELP is a SOFTWARE based PCI-Express (x4) RAID Controller; Although the RAID array can be created at the BIOS level (it has its own BIOS) and although it CAN boot from RAID5, the actual RAID operation that is being done during normal operation is done by an Operating System driver, and not a dedicated CPU on the card, for the best of my understanding from conversation with LSI people; This is something I did not know before I bought the card, because I believed that every RAID5 controller must be a Hardware-based one. Not true... I hope this helps someone (I would probably skip this purchase had I known...)

Why writing a HOWTO? What's special about this hardware?
Because this controller does not have any kind of support in the Linux kernel. There are tips on the Internet that includes patching certain files in the kernel, making it think it's a similar controller, which works (I tried...) - but identifies all the disks in the controller as JBOD, and not as a one logical array.

Do they actually sell a RAID5 Controller that doesn't support Linux?
Well, depends on how you look at it. Since (and this is my guess) all the work of the RAID is done at the driver level, they probably don't want anyone to steal it, which is why they don't distribute the source code of the driver, which is also probably the reason why it didn't get integrated into the Linux Kernel... instead, they're providing binary packages only for RHEL and SLES, and, after talking with them (thanks Sreenivas Bagalkote from LSI), I found out that there's a SHIM package to support the controller in other Linuxes as well. A SHIM package is an opensource code which in turn is linked with a binary (the proprietary part), and becomes a module that can be compiled against any kernel (well, in theory. Read on...).

Before you start...
Go into the controller BIOS during boot and set up the arrays that you want.

Get the controller running on an existing system, to install a Gentoo system on in a chroot
This is rather easy. Download the package that contains the SHIM package. Make sure that your running kernel is not above 2.6.19. Why? Because the Kernel source changed, and some stuff that is included with the SHIM package, as of writing this document (December 16th, 2007), will no longer pass compilation with newer sources.

Uncompressing the Shim Package
Create a working directory and uncompress the driver package

Compiling the Shim Package
Compile the Shim Package

Loading the module we just compiled
That's it, if nothing is wrong, a file called megasr.ko would be created in your working directory.

Install Gentoo on your newly recognized Hardware
OK, not really a challenge ;) But now you would do it on the newly generated SCSI drive(s). If you want to see all your drives, you could use:

This guide assumes that you'll be using a kernel not newer than 2.6.19 on your new installation (due to the limitation mentioned above), and that you'll use Genkernel to compile your kernel (adding options to genkernel, like --lvm or --menuconfig is OK; This guide relies on Genkernel because of the excellent initramfs it will make for us, and save us time. So please go the genkernel route if you want to keep reading this guide.

After you completed the install of Gentoo...
Make sure that you installed your bootloader, and that your kernel and initramfs has been placed in /boot. Also, make sure to add "doscsi" to the kernel options in your bootloader (we rely on that in this guide), and other options that are mandatory for your environment (for example, if you use LVM like I did, you need to also add "dolvm").

To the fun part: Embedding the megasr module inside Genkernel's initramfs
First, re-compile the megasr module inside the chroot with the new sources and kernel configuration in your chroot. Follow the exact same steps as above, just don't load the module (don't do "insmod megasr.ko").

So here is what you do:

Embedding a new module into an existing Genkernel initramfs
mkdir myinitramfs && cd myinitramfs cp /boot/initramfs*. mv initramfs* initramfs.gz gunzip initramfs.gz cpio -i < initramfs rm initramfs.gz