Tuesday, April 14, 2009

Ipod Nano on Gentoo

I recently bought a new 4th generation Ipod Nano from an Apple store and after some fiddling about, managed to get it to work successfully on Gentoo and gtkpod. :) The Ipod is formatted as HFS (Mac partition) AND with journalling enabled. In order for Gentoo to be able read and write into the Ipod, first of all the kernel must be compiled to include support for HFS and journalling must be disabled using a Mac OS.

1. Compile the kernel to include HFS
File systems --->
Miscellaneous filesystems --->
<*> Apple Macintosh file system support (EXPERIMENTAL)
<*> Apple Extended HFS file system support

File systems --->
Partition Types --->
[*] Macintosh partition map support

2. Connect the Ipod to a Mac OS. Go to Disk Utilities. Click on the Ipod Volume. Press 'Option' on the keyboard. Hold it. Go right to the top of the screen. Click on File --> Disable Journalling.

3. Some settings to mount the Ipod.

My udev rule for Ipod in /etc/udev/rules.d/10-local.rules


BUS=="usb", ATTRS{serial}=="00FD29001F03C45A" KERNEL=="sd?2", NAME="%k", SYMLINK="nano", RUN+="/sbin/fsck.hfsplus -r /dev/nano"

a. The serial number in ATTRS{serial}=="00FD29001F03C45A" can be obtained by running udevinfo -a -p 'udevinfo -q path -n /dev/sd?'

NB: udevinfo is already obsolete. Replace with udevadm. 

udevadm info -a -p $(udevadm info -q path -n /dev/sd?)

Replace the question mark with whatever alphabet that the Ipod is mounted on. That can be seen by running dmesg. Leave the question mark as it is though in the udev rules file!

b. RUN+="/sbin/fsck.hfsplus -r /dev/nano" is placed in udev rules in order to prevent this error from popping up in dmesg: hfs: Filesystem was not cleanly unmounted, running fsck.hfsplus is recommended. mounting read-only.

My /etc/fstab entry for Ipod
/dev/nano /mnt/nano hfsplus noauto,rw,user 0 0

3. Now Ipod Nano can be mounted using the command mount /mnt/nano.

4. Next is to configure gtkpod. For the recent Ipods, gtkpod needs to be configure to include the "Firewire ID" or else it won't be able to write into the Ipod database. Use the 16 character serial that was obtained using udevinfo.

Create the file SysInfo in /mnt/ipod/iPod_Control/Device. That means: mkdir /mnt/ipod/iPod_Control/Device/SysInfo. Or if the file already exists, edit it to include the following line in the file:

FirewireGuid: 00FD29001F03C45A (Replace the 16 character with your own Ipod's serial)

After that, we're good to go. :)

No comments: