Latest LQ Deal: Linux Power User Bundle
Go Back > Forums > Linux Forums > Linux - Hardware
User Name
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?


  Search this Thread
Old 08-31-2005, 10:55 PM   #1
Registered: Apr 2005
Location: San Francisco, CA
Distribution: Ubuntu, Debian
Posts: 83

Rep: Reputation: 15
PCI ATA RAID on Debian 3.1 [Building Driver's into the Kernel]

GOAL: Dedicated File Server with Hardware RAID 1 Mirror array

I am running Debian Sarge 3.1 with a Kernel-2.6.8-2-686.
I have a Pentium 4, 1.5 GHZ processor with an Intel Desktop Mother Board D850MV.
I have an I/0 PCI ATA 133 RAID Controller with a Silicon Image chipset.
I have two identical Maxtor Drives of 160GB.
Both drives are connected to the RAID Controller.

In my BIOS RAID utility I have created a mirrored set:

Drive Number: 0 Maxtor 6Y160p0 156334 MB
Drive Number: 2 Maxtor 6Y160p0 156334 MB

Set: 1 <0> <2> SiI Mirrored Set <PM> 153333 MB
I tried to do a new install here, but the mirrored set was not 'true' as the second drive remained unwritten (what i could tell from multiple installations of Debian)

I then found instructions that led me to believe that I had to boot a linux kernel that I previously compiled with my RAID. And then mount the RAID, and then install Debian. This was after instensive searching, and became my only resource for finding an answer!



On the workstation PC, you need to build a kernel for the RAID PC.

The kernel source package supplied with Debian puts a zipped kernel source in /usr/src. You must decompress this with bzip2

cd /usr/src
bzip2 -cd kernel-source-2.4.21.tar.bz2 | tar xf -
cd kernel-source-2.4.21
make menuconfig

Select the kernel options required for your new RAID server. Typically, you must include the following into the kernel (but not as modules!):

* Choice of CPU
* Driver for RAID controller
* If the RAID controller uses a SCSI driver (some, like Compaq SMART2, use SCSI disks but do not require the Linux SCSI drivers!), you must inc
lude the sd SCSI disk driver
* Driver for network card
* Networking and TCP/IP support

Now you must save the kernel configuration, exit the menuconfig utility and compile your kernel with the following command:

make-kpkg binary-arch

After a few minutes, a kernel will be ready. Put the package file somewhere safe as you will need it again later. Now, you must make a standalone zImage file:

make zImage
You will use the zImage file shortly
This information is deprecated, or I am interpreting it wrong. Since I have a newer kernel, I used the newer kernel in place of the older one. I immediately found that the article left out dependencies needed to use the commands. i discovered them by trial and error and research.

Upon reaching the point where I must include the RAID drivers, I found that I had to research building drivers into the debian kernel. The best resource I could find was the following. However, it is deprecated information yet again; Sep 26, 2002.

An installation script that applies appropriate patches

The most common of all these is the patch against a specific kernel version. These patches can in most cases be applied with the following procedure:2

# cd /usr/src/linux ; patch -p1 < patch_file

Diffs made against a different minor version of the kernel may fail, but the driver should still work. Here, we cover how to manually add a network "snarf" driver to the kernel. It's a very complicated and tedious process, especially when compared to other operating systems we've seen.

By convention, Linux kernel source resides in /usr/src/linux. Within the drivers subdirectory, you'll need to find the subdirectory that corresponds to the type of device you have. A directory listing of drivers looks like this:

% ls -F /usr/src/linux/drivers
Makefile cdrom/ i2o/ nubus/ sbus/ telephony/
acorn/ char/ isdn/ parport/ scsi/ usb/
ap1000/ dio/ macintosh/ pci/ sgi/ video/
atm/ fc4/ misc/ pcmcia/ sound/ zorro/
block/ i2c/ net/ pnp/ tc/

The most common directories to which drivers are added are block, char, net, usb, sound, and scsi. These directories contain drivers for block devices (such as IDE disk drives), character devices (such as serial ports), network devices, USB devices, sound cards, and SCSI cards, respectively. Some of the other directories contain drivers for the buses themselves (e.g., pci, nubus, and zorro); it's unlikely that you will need to add drivers to these directories. Some directories contain platform-specific drivers, such as macintosh, acorn, and ap1000. Some directories contain specialty devices such as atm, isdn, and telephony.

Since our example device is a network-related device, we will add the driver to the directory drivers/net. We'll need to modify the following files:


drivers/net/Makefile, so that our driver will be compiled

drivers/net/, so that our device will appear in the config options

drivers/net/Space.c, so that the device will be probed on startup

After putting the .c and .h files for the driver in drivers/net, we'll add the driver to drivers/net/Makefile. The lines we'd add (near the end of the file) follow.

ifeq ($(CONFIG_SNARF),y)
L_OBJS += snarf.o
ifeq ($(CONFIG_SNARF),m)
M_OBJS += snarf.o

This configuration adds the snarf driver so that it can be either configured as a module or built into the kernel.

After adding the device to the Makefile, we have to make sure we can configure the device when we configure the kernel. All network devices need to be listed in the file drivers/net/ To add the device so that it can be built either as a module or as part of the kernel (consistent with what we claimed in the Makefile), we add the following line:

tristate 'Snarf device support' CONFIG_SNARF
he tristate keyword means you can build the device as a module. If the device cannot be built as a module, use the keyword bool instead of tristate. The next token is the string to display on the configuration screen. It can be any arbitrary text, but it should identify the device that is being configured. The final token is the configuration macro. This token needs to be the same as that tested for with the ifeq clause in the Makefile.

The last file we need to edit to add our device to the system is drivers/net/Space.c. Space.c contains references to the probe routines for the device driver, and it also controls the device probe order. Here, we'll have to edit the file in two different places. First we'll add a reference to the probe function, then we'll add the device to the list of devices to probe for.

At the top of the Space.c file are a bunch of references to other probe functions. We'll add the following line to that list:

extern int snarf_probe(struct device *);
I followed these instructions and copied the two files supplied by I/O for my silicon image chipset: "siimage.c" and "siimage.h". I moved them under the PCI Folder. (Since its a PCI card, and no RAID section was available) I edited my makefile in that directory with the script that they reccomended. Each time remembering to make snarf=siimage and the appropriate changes. When I get to the step where I am to edit the file, I realize that it doesn't exist. There is, however, a kconfig file in the place where one would assume the file should exist. Therefore, I simply input the text into that file as an experiment. The next step requires that I edit the Space.c file. The description this article gives to describe it is to vague for me to figure out what the new Space.c file is. Just like the file, it no longer exists, and must have been replaced by a new file. Running make menuconfig again only offered me an error, therefore the kconfig file did not correlate! I ran make clean and gave up!

After this headache I decided to use the options on my menuconfig to load support for RAID. My RAID chip wasn't listed, but a general option was listed:
[*] Multiple devices driver support (RAID and LVM)

I checked this baby for support! And not just with an M for module!

<*> RAID-1 (mirroring) mode

I checked this baby for support! And not just with an M for module!

Okay. Maybe, the newer kernels will somehow support my device.. Maybe.

So then I go back to my very first resource to continue with the instructions and run:

make-kpkg binary-arch

This takes two hours (don't ask me why). Somthing must be wrong. I then try and make an image with the next command:

make zImage

It gives me an error stating that my kernel is too big!

I then pull my hair out and post this. HELP!!! What am I doing wrong? Anyone have a resource? ACK!

Last edited by elliotfuller; 09-01-2005 at 12:26 AM.
Old 09-02-2005, 11:00 AM   #2
Registered: Aug 2003
Location: Edinburgh
Distribution: Server: Gentoo2004; Desktop: Ubuntu
Posts: 720

Rep: Reputation: 30

I'm pretty sure I have the same card. My lspci is:
01:0d.0 RAID bus controller: Silicon Image, Inc. (formerly CMD Technology Inc) PCI0680 Ultra ATA-133 Host Controller (rev 02)

Two things I know about it:
1. it isn't real HW raid (iirc) I think it is just a cheap (mine certainly was) card which says HW RAID, but really does most of the work with software.

2. It was impossible to get the drive installed. I tried, and gave up.

I now just use software raid on it, and it works really well.



Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
PCI ATA 133 RAID on Debian Sarge, Where do I go from here? elliotfuller Debian 6 08-31-2005 11:11 AM
Adaptec Raid 1200A 2 Port ATA 100 PCI Card - under SUSE 9.0 rwtreke SUSE / openSUSE 4 01-12-2005 09:48 PM
Sata Raid & Ata Raid Marinmo Linux - Hardware 6 08-13-2004 03:19 AM
Move from ATA RAID to native RAID Nalfeshnee Linux - Hardware 1 02-16-2004 08:46 AM
Kernel 2.4.23 compile causes kernel panics on ATA RAID-1 (mirror) array Raptor Ramjet Slackware 3 12-18-2003 02:40 PM > Forums > Linux Forums > Linux - Hardware

All times are GMT -5. The time now is 05:05 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration