0. Firewire and Fedora Core 2 Fedora Core 2 ships with a kernel that's quite close to 2.6.6 and that, as such, has seriously broken Firewire modules, so they were disabled to avoid the problems described in section 0.1. In this text, you'll find information on how to install Fedora Core on a machine that uses Firewire CD drives, and/or to Firewire HDs (section 1); install Firewire modules for use by the system after the installation is complete (section 2); build Firewire modules for other 2.6.6ish kernels you might choose to install (section 3); and add modified Firewire modules (or any other modules, for that matter) to the Fedora Core 2 install CD (section 4). All of the information is provided in the hope that it is useful. No guarantees, implied or otherwise. If it breaks, you get to keep all the pieces. If your Firewire devices burst in flames, I'm sorry; mine didn't. This text is Copyright (C) 2004 Alexandre Oliva I hereby grant permission for anyone to distribute this file verbatim, if accompanied by the other files in this directory. Also, feel free to convert it to other formats, as long as the content is preserved and a URL to the original location is provided. You may also make changes to it, as long as they're clearly marked. Translations are permitted as well. Constructive feedback is welcome :-) Updated versions of this document may be found at http://www.ic.unicamp.br/~oliva/snapshots/FC2-firewire/ http://people.redhat.com/aoliva/snapshots/FC2-firewire/ 0.1. Problems in Firewire modules included in the FC2 kernel. The most serious problem, that caused the modules to not be enabled in the kernel that Fedora Core 2 ships, was that, when the Firewire controller module is loaded and then unloaded very quickly, the kernel hangs. It turns out that this is exactly what kudzu does, and kudzu is the component responsible for the `checking for new hardware' line in the boot messages. As a result, if you had any Firewire controller installed on your system, you were very likely to run into this problem, being unable to boot your machine after installation and, worse, having no clue what the problem was. Another problem was a race condition in the firewire controller code that caused the module to turn belly up at random, particularly while under heavy access to external disks. This made it quite unreliable. The other problem in the Firewire modules in the pre-release of kernel 2.6.6 that ships with FC2 was that a patch to enable the Firewire modules to shut down properly was missing. I *think* this patch made it to 2.6.6 final, but 2.6.6 was released a bit too late for it to be included in FC2. The plan is to issue a kernel update for FC2 at some point, containing fixes for the problems described above. 1. Installation The trick here is to add the Firewire modules to the install CD. I tried to build a driver disk, but for some reason I still don't understand, it failed miserably, so I'm afraid you'll have to burn an additional bootable CD (or create a modified disc1 with the script described in section 4.2). Download boot-firewire.iso from this directory, burn it into a CD just like you'd have burnt FC2-i386-disc1.iso, and you'll have a CD you can boot from in order to start the installation. If you eject it after it starts the loader program and load disc1 in its stead, or start a network install, everything should work just fine. If you have Firewire CD drives or hard disks, they should be visible to the installer. If you intend to install to a Firewire HD, you have to add the `expert' option to the boot command line, as maybe `firewire' as well. I haven't verified whether the latter is still needed for FC2; it used to be with FC1. If you intend to have filesystems mounted from Firewire HDs on the first boot, make sure you read section 2 before your installation is complete, especially if such filesystems are essential for the machine to boot (e.g., the root filesystem). Note I don't have any Firewire CD drives myself; all I've been able to verify is that the Firewire modules are loaded within the installer, and that I can access my Firewire disks from in both install and rescue modes. 2. Post-install issues So you want to be able to use Firewire devices after the install is complete, eh? Well, you have three different ways to accomplish this. The first is the simplest, if it works for you. From the others, one is simpler, but it won't work if you actually need the Firewire modules in order to mount filesystems required at boot time; in this case, you'll need the trickier one. 2.0. Install an updated kernel containing the fixes An updated kernel for FC2 is going to be issued containing the fixes for the Firewire problems. Meanwhile, test kernels already containing the fixes are already available in the Fedora development tree (rawhide), as well as at http://people.redhat.com/arjanv/2.6/ (compatible with yum and apt). IIRC kernels starting with 2.6.6-1.378 already contain the essential Firewire fixes, but I haven't personally tested them. I know Arjan has, with his new Firewire enclosure. Firewire is probably going to work very well from now on :-) 2.1. Installing Firewire modules after the first boot This is the simpler procedure, as long as you're not running an SMP kernel (i.e., you're on a single-processor box). Run `uname -r'. If there's `smp' anywhere in the string, you'll need to go to section 3 to find out how to build modules for your system, or boot into the uniprocessor kernel after installing the modules as described below. Download firewire-dd.tar.bz2 into /tmp, then run, as root: tar --use=bzip2 -xf firewire-dd.tar.bz2 cd firewire-dd zcat modules.cgz | cpio -i --make-directories mkdir -p /lib/modules/2.6.5-1.358/unsupported/drivers/ieee1394 cp 2.6.5-1.358/`arch`/*.ko \ /lib/modules/2.6.5-1.358/unsupported/drivers/ieee1394 depmod -a `uname -r` After you've done this, reboot (into a non-SMP kernel). kudzu will probably tell you it found this new Firewire controller and maybe Firewire devices such as CDs, HDs, etc. Or maybe it won't. The important bit is that the modules will be available. You can tell for sure by looking at /etc/modprobe.conf. If it worked, the file will contain lines such as: alias ieee1394-controller ohci1394 If you have any Firewire CDs or HDs connected to the system, you may also see: alias scsi_hostadapter sbp2 If you see this, you're probably good to go, but you might have to reboot one more time for these lines, added by Kudzu, to take effect and get the Firewire modules loaded early enough. Or just run, as root, `modprobe ohci1394'. 2.2. Installing Firewire modules during the installation If 2.1 is good enough for you, feel free to skip this section entirely. It's the trickier procedure I mentioned above, so only use it if you really need. If you need Firewire modules installed into initrd.img for the first boot, you'll have to extract them from the install image into the root filesystem, after the installer creates and mounts it. You'll probably want to prepare for that before starting the installation (not the installer, but rather that point of the installer in which it says it will start formatting filesystems, installing pakcages, etc), and then quickly follow some additional steps right before the installation of packages begins. 2.2.1. Preparation After you boot from boot-firewire.iso and anaconda starts (when the installer switches to graphical mode), switch to VT2 (that's Ctrl-Alt-F2) and run the following commands: cd /tmp zcat /modules/modules.cgz | cpio -i --make-directories --verbose cd 2.6.5-1.358/i686 list=`ls *` cd ../`arch` dir=/mnt/sysimage/lib/modules/2.6.5-1.358/unsupported/drivers/ieee1394 The commands above will have created a directory named 2.6.5-1.358, and, inside it, directories named i586 and i686. This is where the firewire modules are. In the i586 case, there are going to be modules for all other stuff, so we collect the list of Firewire modules from the i686 dir, even if we're installing on an i586 box. At last, we CD to the directory containing the modules appropriate for the architecture on which we're installing, and set a variable to the directory where we'll want to install the modules later, such that we don't have to type this long directory name later, when we won't have much time. Now switch back to the graphical installer (Ctrl-Alt-F7) and proceed to the installation. Actually, before you switch back, you may want to type the command from section 2.2.2., but don't hit ENTER, do that at the point suggested below. 2.2.2. During installation When the actual install begins, Anaconda will format some filesystems, if you told it to do so, and then mount all of the filesystems you've configured inside /mnt/sysimage. As soon as it begins to prepare to install packages, switch back to VT2 and run: mkdir -p $dir && cp -p $list $dir Now switch back to VT7 and make sure installation of packages hasn't begun yet. If it has, it's unlikely that the kernel has already installed, so you're probably fine unless you went out for a cup of coffee and returned on the next morning :-) Just to be sure, at the end of the install, before you let the installer reboot, verify that /mnt/sysimage/etc/modprobe.conf contains both `alias' lines mentioned at the end of section 2.1 (if it doesn't, add them), and then run: chroot /mnt/sysimage mkinitrd -v -f /boot/initrd-2.6.5-1.358.img 2.6.5-1.358 The -v flag will let you know which modules mkinitrd adds to the initrd img. Make sure ohci1394 and sbp2 are in there. If not, make sure you did all of the above correctly, repeat mkinitrd above after correcting any mistakes, and, if it fails again, well... I guess it's time to panic :-) 3. Building Firewire modules So you have a multi-processor or hyper-threaded box, and now you'd like to build Firewire modules for the SMP kernel you've installed? Or maybe you built a custom kernel but didn't enable Firewire modules? This is what you can do to get working Firewire modules for the kernel you're running. Make sure you have the kernel-source package installed. The Firewire kernel modules use some internal SCSI headers that aren't installed in /lib/modules/`uname -r`/build :-( Download ieee1394.tar.bz2, then run: # Change this dir to use a different kernel source tree kernel_src_drivers_scsi=/usr/src/linux-2.6.5-1.358/drivers/scsi # Change this variable to build for a different kernel variant # (e.g., SMP while running the uni-processor kenrel) kernel_variant=`uname -r` moddir=/lib/modules/$kernel_variant/unsupported/drivers/ieee1394 # Adjust this if your kernel module building machinery isn't there kernel_build_root=/lib/modules/$kernel_variant/build # Don't change anything below. # The line below computes a relative pathname from $kernel_build_root # to the root directory, because some commands in the ieee1394 dir # assume $(src) is a relative pathname from $(srctree). root_from_kernel_build_root=`echo $kernel_build_root | sed 's,//*[^/][^/]*,../,g'` mkdir ieee1394-build cd ieee1394-build tar --use=bzip2 -xf ../ieee1394.tar.bz2 ln -s $kernel_src_drivers_scsi . cd ieee1394 make -C $kernel_build_root SUBDIRS=$root_from_kernel_build_root`pwd` modules \ CONFIG_IEEE1394{,_{{OHCI,VIDEO,DV,ETH}1394,PCILYNX,RAWIO,SBP2,AMDTP,CMP}}=m You may ignore the obnoxious warnings printed by the make command, especially the ones about `no CRC'. To install the modules, run, as root, the following commands (there's probably a better way to do it, but this is the one I've tested :-) kernel_variant=`uname -r` moddir=/lib/modules/$kernel_variant/unsupported/drivers/ieee1394 mkdir -p $moddir cp *.ko $moddir strip -g $moddir/*.ko depmod -a $kernel_variant After you've done this, you may want to re-run mkinitrd for this kernel, as described at the end of section 2.2.2 (adjust the kernel version name, though!) If you'd prefer to build the firewire modules as part of a custom kernel build, you may want to replace the drivers/ieee1394 subtree in the kernel with the contents of ieee1394.tar.bz2, or at least manually apply the patches in ieee1394-patches.tar.bz2. I've only recently switched to 2.6.6ish Firewire modules. Before that, I was using Firewire modules based on the 2.6.3 tree, and they'd worked very reliably for me. I offer an xdelta file to turn ieee1394.tar into iee1394-2.6.3ish.tar, in case you'd rather use the earlier version. IIRC this is not exactly the drivers/ieee1394 tree in 2.6.3; a one-liner patch was needed to get that to build with 2.6.6, but I haven't kept that patch handy, sorry. 4. Adding modules to the installer CD So, did you find problems in the Firewire modules I posted? Or you want to add smp modules to the installer image as well? Or maybe you want to add other modules to the installer? Section 4.1 explains how to prepare modules for inclusion in a driver disk-like directory, and section 4.2 explains how to add the contents of such a driver disk-like directory to bootable media. At some passages below, I may assume you have downloaded firewire-dd.tar.bz2 and extracted it into the directory firewire-dd, if you want to reuse the content I created instead of re-creating it from scratch. To create it from scratch, just create an empty firewire-dd directory and follow the procedure in the following section. 4.1. Preparing modules for a driver disk This is not necessarily for the faint of heart, but if you really want to do it, let me tell you how I did it. The idea is to create the contents for a what could be driver disk, then use a script I wrote to add the contents of that driver disk to the bootable media. One thing to keep in mind is that the installer boots off an i586 uniprocessor kernel, so, for any changes you might want to make to the Firewire modules, you'll have to build modules for the i586 kernel, and this may be tricky if you don't have the .i586.rpm kernel rpm installed to use the procedure described in section 3. What I did on my i686 box was to build the i686 modules following the procedure in section 3, and then build the i586 modules using a different procedure. I downloaded kernel-2.6.5-1.358.src.rpm, then ran `rpmbuild -bc --target=i586 kernel-2.6.5-1.358.src.rpm'. Just after this started the actual build (you begin to see [CC] lines flying by), I aborted the build, entered the rpm build dir, removed my login name from the version line in the Makefile, edited .config so as to enable firewire modules, patched the drivers/ieee1394 tree, and then ran `make'. Then, I extracted the *.ko files from drivers/ieee1394. Yeah, that sucks. There must be a better way that doesn't involve replacing the .i686 kernel with the .i586 kernel. Suggestions are welcome! Ok, so now I have Firewire modules for i586 and i686. I create a directory named 2.6.5-1.358, inside it I create directories named i586 and i686, and then I copy the modules for each architecture into the corresponding dir. If you didn't make any changes to the Firewire modules, and just want to add SMP (or non-Firewire) modules, you may want to just extract the Firewire modules I built from firewire-dd/modules.cgz: zcat firewire-dd/modules.cgz | cpio -i --make-directories If you want to add SMP modules, it doesn't really matter how you name the directories; the installer won't use them, only the procedure in section 2.2.2 does. If this was an actual driver disk, the story would be a bit different, because I'm told the installer is actually supposed to install drivers it finds in driver disks; I'd try 2.6.5-1.358smp/i[56]86. But since I couldn't get driver disks to work, anything would do. If you managed to get the driver disk to work, please let me know how! So, now you have this directory named 2.6.5-1.358 (and maybe a sibling named 2.6.5-1.358smp), and you want to re-create firewire-dd. Run this: find 2.6.5-1.358 -print | cpio -o -H crc | gzip -9 > firewire-dd/modules.cgz Ok, this might be enough for inclusion in the installer. For actual driver disks, some additional files would be necessary. I describe below where/how I obtained the contents I included in firewire-dd.tar.bz2. modinfo - the `sbp2' definition was manually extracted from FC1 (Yarrow)'s boot initrd.img:/modules/module-info modules.dep - after installing the Firewire modules on my box and running depmod -a, I ran: grep 1394 /lib/modules/`uname -r`/modules.dep | sed '/:$/d;s,/[^ ]*/,,g;s,\.ko,,g' modules.pcimap - grep 1394 /lib/modules/`uname -r`/modules.pcimap pcitable - grep 1394 /usr/share/hwdata/pcitable rhdd - a one-line text file that must be present for a driver disk to be recognized as such, not used otherwise AFAIK 4.2. Adding driver disk contents to bootable media Once you have created a directory containing all of the files above (for example, the files in firewire-dd.tar.bz2), you can merge its contents into FC2 installable media using the add-modules script I wrote. Download the script into the current dir, make it executable, create a soft link to the original boot.iso, rescuecd.iso, disc1.iso and/or initrd.img in the current directory, then run, as root: ./add-modules firewire-dd [disc1.iso] [rescuecd.iso] [boot.iso] [initrd.img] When the script is complete, you'll find disc1.iso.new, rescuecd.iso.new, boot.iso.new and/or initrd.img.new in the current directory. Read a longer explanation of how it works in the comments in the beginning of the script. Warning: this script may use about as much as twice the size of the biggest file you list, half of that in the current directory (where the new images are created), half of that in $TMPDIR (or /tmp, if not set). 5. Revision history May 31, 2004: fixed command to extract firewire-dd.tar.bz2. May 24, 2004: added depmod to section 2.1 as well. Added section 2.0 about kernel updates. May 17, 2004: break up section 4 into separate sections, and point readers of section 1 to 4.2. Revised the whole text fixing typos and rephrasing badly-written paragraphs. Removed bogus `&& cat' from the command in section 2.2.2 (/me wonders what he was thinking of adding when he wrote that...) Added ieee1394-2.6.3ish.tar.xdelta May 15, 2004: first public release.