Configuring MEGARAID driver in CentOS4 kernel to support Dell PERC2/SC and PERC2/DC

This article describes how I successfully installed CentOS4 on a Dell PowerEdge with a PERC2/SC (or PERC2/DC) hardware SCSI RAID controller. The Kernel bundled with CentOS4 uses a newer megaraid_mbox module that no longer includes support for these older Dell PERC-2 (ie: LSI Megaraid 467) controllers. First, you begin by building a “megaraid.ko” module for each kernel you will use (ie: UP/uniprocessor, SMP/multiprocessor). Then you install CentOS4 using the UP module. After installation, you configure CentOS4 to use the MP module.

Building the MEGARAID.ko Kernel Module

You may be able to skip this section by using the files I built. If these files do not work, you will need to build your own kernel modules. You will need to extract each file with bunzip2. [megaraid.ko] [megaraid.ko.smp]

Temporarily setup CentOS4 on another computer. You should only use RPMs from the CD, so that the module you build is compatible with the installation Kernel provided on the CD. In addition to the bare bones installation, you will need the following RPMs:

gcc-3.4.4-2.i386.rpm
cpp-3.4.4-2.i386.rpm
glibc-devel-2.3.4-2.13.i386.rpm
glibc-headers-2.3.4-2.13.i386.rpm
glibc-kernheaders-2.4-9.1.98.EL.i386.rpm

kernel-devel-2.6.9-22.EL.i686.rpm

kernel-smp-2.6.9-22.EL.i686.rpm
kernel-smp-devel-2.6.9-22.EL.i686.rpm

Compile the UP (uniprocessor) “megaraid.ko” module first. You will download and extract the source for this module (local copy of megaraid.tar.bz2). Then you will compile the module for use with the 2.6.9-11.EL kernel. Afterwards, you must format a floppy disk and copy the new file to floppy (for use later).

cd /opt
wget http://www.tuxyturvy.com/files/megaraid2.tar.bz2

mkdir /usr/src/megaraid
cd /usr/src/megaraid
tar jxvfp /opt/megaraid2.tar.bz2

make -C /lib/modules/2.6.9-11.EL/build SUBDIRS=/usr/src/megaraid modules

fdformat /dev/floppy
mkdosfs /dev/floppy

mkdir /mnt/floppy
mount /dev/floppy /mnt/floppy 

cp megaraid.ko /mnt/floppy/
umount /mnt/floppy

Compile the SMP (multiprocessor) “megaraid.ko” module next. You will compile the module for use with the 2.6.9-11.ELsmp kernel. You should also copy this module to floppy (as a separate file name).

mkdir /usr/src/megaraid-smp
cd /usr/src/megaraid-smp
tar jxvfp /opt/megaraid2.tar.bz2

make -C /lib/modules/2.6.9-11.ELsmp/build SUBDIRS=/usr/src/megaraid-smp modules

cp megaraid.ko megaraid.ko.smp

fdformat /dev/floppy
mkdosfs /dev/floppy

mkdir /mnt/floppy
mount /dev/floppy /mnt/floppy 

cp megaraid.ko.smp /mnt/floppy
umount /mnt/floppy

Manually Loading the MEGARAID.ko Kernel Module

Now you are ready to begin installation of CentOS4 on your Dell PowerEdge system with the unsupported PERC2/SC or PERC2/DC raid controller. When you first boot the CD, type “linux noprobe” to avoid automatic hardware detection. Otherwise, the system will automatically load the (wrong) “megaraid_mbox” module.

linux noprobe

When you choose CDROM install, you may receive an error telling you “no cdrom found”. You will need to load the module for the CDROM’s SCSI (or IDE) controller. In our case, we loaded driver “aic7xxx” for our SCSI controller. You should also load your network driver while you can. In our case, we loaded the “3c59x” driver.

Now we will manually load the “megaraid.ko” driver from our floppy disk. Follow the instructions below, starting with CTRL-ALT-F2 to change to a shell prompt.

CTRL-ALT-F2
mkdir /mnt/floppy
mount /dev/fd0 /mnt/floppy
insmod /mnt/floppy/megaraid.ko
CTRL-ALT-F1

You can now continue with your installation. The OS will be able to see and partition the volume(s) configured on your PERC2 SCSI raid controller. You must manually install the module BEFORE you press the reboot button at the end of the installation!

Manually Installing the MEGARAID.ko Module

First we will install the UP (uniprocessor) module for use with the 2.6.9-22.EL kernel. We start by switching to a shell console, then copy the “megaraid.ko” module from our floppy to the hard disk. Afterwards, we update modprobe.conf and build a new initial ramdisk image for this kernel.

CTRL-ALT-F2
cp /mnt/floppy/megaraid.ko /mnt/sysimage/lib/modules/2.6.9-22.EL/kernel/drivers/scsi/megaraid.ko
chroot /mnt/sysimage
cp /etc/modprobe.conf /etc/modprobe.conf.orig
vi /etc/modprobe.conf
diff /etc/modprobe.conf /etc/modprobe.conf.orig
4c4
< alias scsi_hostadapter1 megaraid
---
> alias scsi_hostadapter1 megaraid_mbox

cd /boot
/sbin/mkinitrd initrd-2.6.9-22.EL.img.megaraid 2.6.9-22.EL
cp initrd-2.6.9-EL.img initrd-2.6.9-EL.img.orig
cp initrd-2.6.9-22.EL.img.megaraid initrd-2.6.9-EL.img
exit
CTRL-ALT-F1

Then we will install the MP (multiprocessor) module for use with the 2.6.9-22.ELsmp kernel using a similar method.

CTRL-ALT-F2
cp /mnt/floppy/megaraid.ko.smp /mnt/sysimage/lib/modules/2.6.9-22.ELsmp/kernel/drivers/scsi/megaraid.ko
chroot /mnt/sysimage
cp /etc/modprobe.conf /etc/modprobe.conf.orig
vi /etc/modprobe.conf
diff /etc/modprobe.conf /etc/modprobe.conf.orig
4c4
< alias scsi_hostadapter1 megaraid
---
> alias scsi_hostadapter1 megaraid_mbox

cd /boot
/sbin/mkinitrd initrd-2.6.9-22.ELsmp.img.megaraid 2.6.9-22.ELsmp
cp initrd-2.6.9-ELsmp.img initrd-2.6.9-ELsmp.img.orig
cp initrd-2.6.9-22.ELsmp.img.megaraid initrd-2.6.9-ELsmp.img
exit
CTRL-ALT-F1

Now the UP and SMP kernels have been configured with the new (old) “megaraid.ko” module! You should be able to boot from both of these modules with support for your PERC2/SC or PERC2/DC controller!

2006/05/18 – Jason Klein

Leave a Reply

Your email address will not be published. Required fields are marked *