handyfloss

Because FLOSS is handy, isn’t it?

SATA HD plus IDE CD under 2.6 kernel

Posted by isilanes on July 14, 2006

You can read in my troubleshooting page what problems I had with my CD unit in a computer with a SATA hard disk (under Linux kernel 2.6, not 2.4).

Basically it boils down to: if / is mounted on a SATA HD, the libata kernel module must be loaded at boot time. When libata is loaded, it “hijacks” not only the SATA interfaces, but also the IDE interfaces. When, later on, ide-generic and other IDE kernel modules are loaded, they don’t see the IDE ports, so the CDs/DVDs or other IDE HDs, are not found! Moreover, they can’t ever be found.

This can be overcome by loading some IDE modules before libata is loaded, as I outline in my “Troubleshooting” page. However, I recently discovered (with kernel 2.6.15), that an IDE module (precisely ide-generic would, conversely, hijack the SATA ports, making libata not find any SATA interface, and generating a kernel panic at boot time, because / could not be mounted.

Now, it seemed like I had no way to fix it, because if I loaded ide-generic first, I would get a kernel panic, whereas if I loaded libata first, I would have to make do without access to the CD. Luckily, I tried to find out how to load one of the modules without having it hijack the interface that it shouldn’t hijack. To do so, I used the modinfo utility:

Bart:~# modinfo libata
filename: /lib/modules/2.6.15-1-686-smp/kernel/drivers/scsi/libata.ko
author: Jeff Garzik
description: Library module for ATA devices
license: GPL
version: 1.20
vermagic: 2.6.15-1-686-smp SMP 686 gcc-4.0
depends: scsi_mod
srcversion: 54ECB7B28C0FB6028983484
parm: atapi_enabled:Enable discovery of ATAPI devices (0=off, 1=on) (int)

Then I tried to load libata (“load” means to put it in /etc/mkinitrd/modules), then running mkinitrd -o /boot/initrd.img-2.6.15-1-686-smp.custom 2.6.15-1-686-smp, then rebooting) with the atapi_enabled=0 parameter, so that it wouldn’t hijack the IDE, and it failed again :^(

They say that if you can’t beat an enemy you should join her, and that I did: I tried libata atapi_enabled=1 with the intention of having libata handle the IDE device properly (if I couldn’t make it ignore it), and it worked! The CD is emulated as a SCSI device (a /dev/sga0 device was generated), but it works.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

 
%d bloggers like this: