For kernel versions 2.4.x and higher, RAID support is built into the kernel. You can download the kernel source here:
This probably wasn't very helpful, since I haven't identified which part of the kernel code contains the RAID parts. Sadly, I have no idea. It's a starting point, at least.