Marvell's SATA hardware doesn't work out of the box on Linux. Their driver module must be downloaded and built against the current kernel. It's sort of a catch 22, must have Linux to build the driver, must have the driver to install Linux. The procedures below document an installation of Gentoo 2005.1 on a SuperMicro P4SCT+ which has this controller.

Installation Goals

In order to use four drives in the system (wanted RAID5 w/hotspare) the Marvell controller must be used. The internal Intel SATA only supports two. The primary install drive was connected to the Intel SATA controller, port 0. The BIOS was configured as follows

Actually, it varies - pick Legacy or not PATA

The installation of Gentoo was done normally and the specifics of the Marvell driver were as follows. This should be done as the root user.

mkdir -p ~/mvsata
cd ~/mvsata/
emerge app-arch/unzip
wget ftp://ftp.abit.com.tw/pub/download/drivers/linux/marvell/mvsata340.zip
unzip mvsata340.zip
ln -s /usr/src/linux-2.6.12-gentoo-r9/ /usr/src/linux-2.6
cd LinuxIAL

The supplied code doesn't work on kernels >=2.6.12, because serial_number_at_timeout doesn't exist. Some searches on the internet determined we should do this to patch it, use with caution!

--- mvLinuxIalHt.c.orig 2005-08-21 08:12:17.000000000 -0700
+++ mvLinuxIalHt.c      2005-08-21 08:13:18.000000000 -0700
@@ -1390,6 +1390,9 @@
     channel = pHost->channelIndex;
     pAdapter = MV_IAL_ADAPTER(SCpnt->device->host);
     pMvSataAdapter = &pAdapter->mvSataAdapter;
+
+// note: edoceo patch here, found on internet
+#ifdef serial_number_at_timeout
     if (SCpnt->serial_number != SCpnt->serial_number_at_timeout)
     {
         mvLogMsg(MV_IAL_LOG_ID, MV_DEBUG_ERROR, "[%d %d %d]: abort failed, "
@@ -1397,6 +1400,8 @@
                  channel, SCpnt->device->id);
         return FAILED;
     }
+#endif
+
 #if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,0)
     spin_unlock_irq (&io_request_lock);
 #else

When that patch is in place then the driver builds OK.

bash ./build.sh
insmod ./mv_sata.ko
dmesg

There should be messages in the dmesg output similar to: mv_sata: module license 'Marvell' taints kernel.. The SCSI modules will have some of their messages following the mv_sata one, ensure they look proper.

Booting with mv_sata

To boot from a drive that requires mv_sata to access it an initrd must be used. The steps below will create an initrd for the kernel, configure the GRUB bootloader and test it. Perform the following steps as root, ensure /boot is mounted.

cd
REL=`uname -r`
grep /boot /proc/mounts || mount /boot
emerge sys-apps/mkinitrd
cp mvsata/LinuxIAL/mv_sata.ko /lib/modules/$REL/kernel/drivers/scsi/
echo "alias scsi_hostadapter mv_sata" >> /etc/modules.d/aliases
modules-update
depmod -ae -F /boot/System.map-$REL
mkinitrd -v -f /boot/initrd-$REL $REL

Now grub must be configured to boot using this initrd as follows

timeout 3
default 0

title=GNU/Linux+SATA
  root (hd0,0)
  kernel /bzImage-2.6.12-gentoo-r9-edoceo root=/dev/sda3
  initrd /initrd-2.6.12-gentoo-r9-edoceo

The next step is to make the machine boot from this controller with RAID0 and RAID5 devices.

Known Vendors/Mainboards

See Also

ChangeLog