[CentOS] CentOS4 and older megaraid - SOLVED

Mon Jan 22 20:56:32 UTC 2007
David Booth <md at goulburn.net.au>

Here is my recipe, tried and true, to compile and load megaraid.ko for 
HP Netserver LP 1000r using kernel-devel-2.6.9-42.EL and 
kernel-smp-devel-2.6.9-42.EL which matches my install disk, 
Centos4.4Final i386 Disk 1 of 4.

If you update the kernel after this you have to do it all again!

Sources:
http://www.tuxyturvy.com/blog/index.php?/archives/4-Installing-RHEL4-on-Systems-with-Legacy-Megaraid-Drivers.html
http://lists.centos.org/pipermail/centos/2005-August/010021.html

# START
# Install Centos4.4 on an old system with floppy, net and PCI HD
#
mkdir /usr/src/software
cd /usr/src/software
wget http://www.tuxyturvy.com/files/megaraid2.tar.bz2
mkdir /usr/src/megaraid
cd /usr/src/megaraid
tar jxvfp /usr/src/sofware/megaraid2.tar.bz2
#
yum install kernel-devel-2.6.9-42.EL.i686
yum install kernel-smp-devel-2.6.9-42.EL.i686
#
cd /usr/src
mkdir megaraid
cd megaraid
tar jxvfp /usr/src/sofware/megaraid2.tar.bz2
make -C /lib/modules/2.6.9-42.EL/build SUBDIRS=/usr/src/megaraid modules
cd /usr/src
mv megaraid megaraid-686
mkdir megaraid
cd megaraid
tar jxvfp /usr/src/sofware/megaraid2.tar.bz2
make -C /lib/modules/2.6.9-42.ELsmp/build SUBDIRS=/usr/src/megaraid modules
mv megaraid megaraid-smp-686
#
# copy megaraid.ko to a floppies and label
# insert new disk
mformat a:
mount /media/floppy
cp /usr/src/megaraid-686/megaraid.ko /media/floppy
umount /media/floppy
# Label it megaraidUP686
# insert new disk
mformat a:
mount /media/floppy
cp /usr/src/megaraid-smp-686/megaraid.ko /media/floppy
umount /media/floppy
# Label it megaraidSMP686
#
# Now have 2 disks with megaraid.ko
#
# On the SCSI system, start the install with
linux
# and get to 'no suitable disk'
#
Alt-F2
rmmod megaraid_mbox
rmmod megaraid_mm
# insert the labelled megaraidUP686
mkdir /mnt/floppy
mount /dev/fd0 /mnt/floppy
insmod /mnt/floppy/megaraid.ko
# Verify that the module loaded
lsmod
# see if megaraid is listed
# Verify that your RAID array was found
Alt-F4
# look for 'megaraid' in the output from the module load
# switch back to the normal install screen
Alt-F1
# Since you've manually loaded the driver from the command prompt
# ignore the instructions to pick a driver. Continue the install.
# After all packages are installed and the system prompts you to reboot:
! DON"T DO IT!
# Because the megaraid driver was installed manually the installer will
# not build a proper initrd.
# Fix this before the reboot right now with the following steps:
#
# switch from the GUI to a bash prompt
Alt-F2
# megaraidUP686 floppy is`still in the floppy drive
cp /mnt/floppy/megaraid.ko 
/mnt/sysimage/lib/modules/2.6.9-42.EL/kernel/drivers/scsi
umount /mnt/floppy
# Insert floppy labelled megaraidSMP686
mount /dev/fd0 /media/floppy
# Copy the smp megaraid.ko module
cp /media/floppy/megaraid.ko 
/mnt/sysimage/lib/modules/2.6.9-42.ELsmp/kernel/drivers/scsi
# set root to your newly installed system image
chroot /mnt/sysimage
vi /etc/modprobe.conf
# make the line with 'alias scsi_hostadapter' say
alias scsi_hostadapter megaraid
# Save the file.
:wq
#Switch to the /boot directory
cd /boot
#Create new initrd files
/sbin/mkinitrd initrd-2.6.9-42.EL.img.megaraid 2.6.9-42.EL
/sbin/mkinitrd initrd-2.6.9-42.ELsmp.img.megaraid 2.6.9-42.ELsmp
#
#Copy the new initrd over old initrd
cp initrd-2.6.9-42.EL.img.megaraid initrd-2.6.42-EL.img
cp initrd-2.6.9-42.EL.img.megaraid initrd-2.6.42-ELsmp.img
# Exit chroot environment
exit
# Switch back to the GUI installer
Alt-F1
reboot
# FINISH
___________
David Booth