[home]

OpenBSD and the iPod nano

Don Stewart


Contents

Introduction

This page describes how to use an Apple iPod nano with OpenBSD. In summary: it all works :)

Preparation

To use the nano you need a 3.8-current kernel from cvs some time after late October. I'm using:

    OpenBSD 3.8-current (GENERIC) #3: Thu Nov  3 23:26:41 EST 2005
        root@paprika.cse.unsw.edu.au:/usr/src/sys/arch/i386/compile/GENERIC

When you attach the nano to via usb, it should be detected something like this:

    umass0 at uhub3 port 4 configuration 1 interface 0
    umass0: Apple iPod, rev 2.00/0.01, addr 2
    umass0: using SCSI over Bulk-Only
    scsibus0 at umass0: 2 targets
    sd0 at scsibus0 targ 1 lun 0:  SCSI0 0/direct removable
    sd0: 1953MB, 1953 cyl, 64 head, 32 sec, 512 bytes/sec, 3999744 sec total

You can mount the ipod as a normal disk. First create a mount point:

    $ mkdir /ipod

Then add an entry to /etc/fstab (to save typing later):

    $ cat /etc/fstab | grep ipod
    /dev/sd0j /ipod msdos rw,noauto 0 0

Now mount the device (using sudo, or as root perhaps):

    $ sudo mount /ipod

You may need to edit your sudoers file. Now we're ready to actually use this thing.

Initialising

If you've never used the ipod before (since you only use OpenBSD, right?), you'll first need to initialise it. This can be done with the GNUpod tools. GNUpod depends on some perl libraries, all of which are available in the ports tree. Install gnupod.

Then to initialise the ipod, mount it and run the gnupod_INIT.pl script. For further information, check the GNUpod documentation.

    $ gnupod_INIT.pl -m /ipod

Use

Once the ipod is initialised, you can begin using it. Install gtkpod from the ports collection. It provides a convenient gui for syncing mp3s between the computer and the ipod, as well as editing and organising all the mp3 files. (An alternative would be to use the command line scripts provided by gnupod, though they can be a bit tedious).

gtkpod is straight forward. Adjust the settings so that the default mount point is "/ipod". Mount the ipod, click `read' to get the iTunes database off the ipod, `add' new mp3s, then `sync' the ipod again, before unmounting. A useful trick is to call eject(1) on the device, so that the ipod can be used while charging.

I wrote the following little script so my girlfriend can use her ipod without worrying too much:

    #!/bin/sh
    if sudo /sbin/mount /ipod ; then
            gtkpod
            sudo /sbin/umount /ipod
            sudo /bin/eject /dev/rsd0c
    else 
            echo "Unable to find the ipod. Maybe you have not plugged it in?"
            exit 1
    fi

That's all there is to it. The ipod is practically an open platform :)

Changelog