January 14, 2003

Using an iPod with FreeBSD

There's not much to this trick.

  1. It must be a Windows iPod. HFS formatted filesystems are not yet supported on FreeBSD. I originally got a Mac iPod and ran the Windows updater to turn it into a WinniPod. You can freely go back and forth as much as you want, although you wipe the filesystem and music library every time you change your mind. Note that although it isn't supported, a WinniPod will work just fine on a Mac, both as a hard disk and with iTunes.
  2. 4.7-STABLE or 5.0 are required for firewire support. You must add the sbp and firewire devices to your kernel.
  3. Having done that, you should see a SCSI device show up when you attach your iPod.
  4. Here's your fstab entry:

    /dev/da0s2 /ipod msdos rw,noauto 0 0

    Change da0 to whatever device shows up. mount /ipod and you should see your iPod's filesystem.


  5. After unmounting, you'll note that your iPod still has the big "don't" sign on it. To get that to change to the "OK to remove" state, do this: camcontrol eject 1:0:0. The 1:0:0 part is the CAM device identifier. That's what mine happens to be. You can find yours by doing a camcontrol devlist with the iPod attached. camcontrol eject will send a SCSI device unload, which is what will get the iPod to spin down.

  6. At this point, you can stop if all you wanted to do was mount the disk. If you also want to fiddle with the music part, you can install WINE and EphPod in the normal way (more about this to come later). Watch out, though. I've found that if I manage my iPod with iTunes, and then touch it with EphPod, it usually winds up screwed up (although the next iTunes sync fixes it).

Posted by nsayer at January 14, 2003 11:45 AM
Comments

Some additional notes to bring this story up-to-date:

1. You can now do this with Macintosh iPods as well. You will need to load the geom_apple module so that the kernel can understand the apple partition table, and you'll need to get the HFS+ filesystem module from http://people.freebsd.org/~yar/hfs/ . Once you have hfs.ko, mount_hfs and fsck_hfs in place and geom_apple loaded, attach your ipod to the system. You should see a new SCSI disk show up. The HFS filesystem is on /dev/daXs3. If the iPod was not cleanly unmounted, you will need to fsck -p it before it will mount. Once mounted, the actual contents are identical to Windows iPods.

2. If you have a dock style iPod, it will work with USB 1.1 and 2.0 under FreeBSD. If you have USB 2.0 hardware, make sure you have the ehci module (along with ohci and uhci) compiled either into your kernel or usb.ko module. Note that USB 2.0 support is a bit unstable with some chipsets and agregation of low speed bandwidth with USB 2.0 hubs doesn't yet work. All in all, I recommend sticking with firewire if at all possible.

Posted by: Nick at June 22, 2004 09:17 AM

One more note... As noted in the original story, camcontrol eject will spin down your iPod. If you have a dock style iPod, when it is spun down, you will be able to use it as a player while still leaving it attached. This will also spin down the hard drive, lengthening its lifespan. If you want to put the iPod back into disk mode, use 'camcontrol load '. This will stop any playback in progress and bring back the "Don't" sign. You can go back and forth this way as much as you like. MAKE SURE that the filesystem is unmounted if you attempt to spin it down! The normal protections that are in place to disallow unmounting of busy filesystems will not prevent camcontrol from unloading a disk. Kernel panics and/or file system corruption may occur!

If you have an older "firewire" style iPod, you can still use eject and load commands with camcontrol to spin the drive up and down, but when spun down the display will simply display the big check mark and "ok to disconnect" message. Still, if you are simply trying to charge the battery from your system, this is the best way to go.

Posted by: Nick at June 22, 2004 09:23 AM

If you don't want to use WINE, there is gtkpod:
http://gtkpod.sourceforge.net/screenshots.html

(I am installing it right now from /usr/ports/audio/gtkpod)

Posted by: Rudy at September 6, 2004 08:58 PM

The first comment was kind of funny. So if I understand correctly, FreeBSD with linux emulation can run WINE to achieve Windows emulation so that you can load EphPod to achieve iTunes emulation, yet somehow this slightly corrupts the filesystem of the iPod so that only using real iTunes on real Windows/OS X fixes it? I am shocked. It should work so flawlessly, and faster.

Posted by: Tom at March 10, 2005 07:31 AM

This works fine with USB. However, Beware of 'device atapicam' in your kernel.

Posted by: Jared Kuolt at May 4, 2005 12:53 PM

just wondering hoe to get BSD running on the ipod :)

Posted by: Michiel at August 16, 2006 01:45 PM

I have an iPod 5th and I use FreeBSD 6.0-RELEASE. But when I attach my iPod, I can't see any scsi device was added in the /dev dir. Does your iPod the newest one?

Posted by: Feng Liu at October 1, 2006 11:33 PM