# Adding additional modules to initramfs using genkernel

## sinops

So I have taken sometime in figuring this out, so I thought I'd share this info.

I have an opteron machine with an Areca card and 16 750GB HD's

 *Quote:*   

> Mass storage controller: Silicon Image, Inc. SiI 3114 [SATALink/SATARaid] Serial ATA Controller (rev 02)

 

I began reverse engineering initramfs and genkernel using the script on the following link:

https://forums.gentoo.org/viewtopic-t-429263-highlight-usage+initramfs+directory.html

I have also found this:

http://www.gentoo.org/doc/en/genkernel.xml

 *Quote:*   

> --callback="echo Hello": This routine calls the specified arguments after the kernel and the relevant modules have been built; but before the initrd has been built. This is useful where you might want external modules installed to the initrd by emerging the relevant item using the callback and then redefinining a genkernel module group.

 

The problem is the lack of documentation that states how to get a module into the initramfs file using the redefinition of a module group.

As of this posting all the genkenel magic happens in /usr/share/genkernel/

My architecture is x86_64 and thus there is a directory /usr/share/genkernel/x86_64/

In that directory is a file called modules_load. I have placed the name of the areca driver: arcmsr into the modules_load file at the end of the MODULES_SCSI line.

Then I ran genkernel --lvm2 initrd and the module was then copied into the initramfs file.

The benefit is that the Areca storage shows up as sdb and my SATA drive stays sda. Also, there seems to be a bug with the Areca driver and 2.6.17-gentoo-r7. Building the driver into the kernel or as a module prevents the machine from rebooting. 

My workaround: 

 1. Build the driver as a module. 

2. Put the driver into the initramfs to guarantee the Areca storage is sdb.

3. Remove the module before reboot in the /etc/init.d/reboot.sh script.

I am using lvm2 on top of the raw storage device which is a little under 9TB using hardware raid6. I tried to create partitions, but things did not work out well. So raw storage it is!

I hope this helps someone else out.

----------

